Skip to content

Commit f4db944

Browse files
committed
Merge branch 'master' of git://github.com/go-gitea/gitea
Conflicts because of updated Lato fonts, which I ripped out.
2 parents 9767090 + 5748755 commit f4db944

File tree

497 files changed

+131234
-18130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

497 files changed

+131234
-18130
lines changed

.drone.yml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,12 @@ steps:
388388
commands:
389389
- git fetch --tags --force
390390

391-
- name: build
392-
pull: always
393-
image: node:10 # this step is kept at the lowest version of node that we support
394-
commands:
395-
- make css
396-
- make js
397-
398391
- name: static
399392
pull: always
400393
image: techknowlogick/xgo:latest
401394
commands:
395+
- apt update && apt -y install curl
396+
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
402397
- export PATH=$PATH:$GOPATH/bin
403398
- make release
404399
environment:
@@ -419,8 +414,6 @@ steps:
419414
from_secret: gpgsign_key
420415
GPGSIGN_PASSPHRASE:
421416
from_secret: gpgsign_passphrase
422-
depends_on:
423-
- static
424417

425418
- name: release-branch-release
426419
pull: always
@@ -438,8 +431,6 @@ steps:
438431
from_secret: aws_access_key_id
439432
AWS_SECRET_ACCESS_KEY:
440433
from_secret: aws_secret_access_key
441-
depends_on:
442-
- gpg-sign
443434
when:
444435
branch:
445436
- "release/*"
@@ -462,8 +453,6 @@ steps:
462453
from_secret: aws_access_key_id
463454
AWS_SECRET_ACCESS_KEY:
464455
from_secret: aws_secret_access_key
465-
depends_on:
466-
- gpg-sign
467456
when:
468457
branch:
469458
- master
@@ -496,17 +485,12 @@ steps:
496485
commands:
497486
- git fetch --tags --force
498487

499-
- name: build
500-
pull: always
501-
image: node:10 # this step is kept at the lowest version of node that we support
502-
commands:
503-
- make css
504-
- make js
505-
506488
- name: static
507489
pull: always
508490
image: techknowlogick/xgo:latest
509491
commands:
492+
- apt update && apt -y install curl
493+
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
510494
- export PATH=$PATH:$GOPATH/bin
511495
- make release
512496
environment:
@@ -527,8 +511,6 @@ steps:
527511
from_secret: gpgsign_key
528512
GPGSIGN_PASSPHRASE:
529513
from_secret: gpgsign_passphrase
530-
depends_on:
531-
- static
532514

533515
- name: release
534516
pull: always
@@ -546,8 +528,6 @@ steps:
546528
from_secret: aws_access_key_id
547529
AWS_SECRET_ACCESS_KEY:
548530
from_secret: aws_secret_access_key
549-
depends_on:
550-
- gpg-sign
551531

552532
- name: github
553533
pull: always
@@ -558,8 +538,6 @@ steps:
558538
environment:
559539
GITHUB_TOKEN:
560540
from_secret: github_token
561-
depends_on:
562-
- gpg-sign
563541

564542
---
565543
kind: pipeline

.ignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
/public/vendor
3+
/modules/options/bindata.go
4+
/modules/public/bindata.go
5+
/modules/templates/bindata.go

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ included in the next released version.
114114
## Building Gitea
115115

116116
Generally, the go build tools are installed as-needed in the `Makefile`.
117-
An exception are the tools to build the CSS and images.
117+
An exception are the tools to build the CSS, JS and images.
118118

119-
- To build CSS: Install [Node.js](https://nodejs.org/en/download/package-manager) at version 8.0 or above
120-
with `npm` and then run `npm install` and `make css`.
119+
- To build CSS and JS: Install [Node.js](https://nodejs.org/en/download/package-manager) at version 10.0 or above
120+
with `npm` and then run `npm install`, `make css` and `make js`.
121121
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
122122
available in your `PATH` to run `make generate-images`.
123123

@@ -166,7 +166,7 @@ import (
166166

167167
To maintain understandable code and avoid circular dependencies it is important to have a good structure of the code. The gitea code is divided into the following parts:
168168

169-
- **integration:** Integrations tests
169+
- **integration:** Integrations tests
170170
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependecies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
171171
- **models/fixtures:** Sample model data used in integration tests.
172172
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ else
1818
ifeq ($(UNAME_S),Darwin)
1919
SED_INPLACE := sed -i ''
2020
endif
21+
ifeq ($(UNAME_S),FreeBSD)
22+
SED_INPLACE := sed -i ''
23+
endif
2124
endif
2225

2326
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
@@ -128,7 +131,7 @@ vet:
128131
GO111MODULE=on $(GO) vet -mod=vendor $(PACKAGES)
129132

130133
.PHONY: generate
131-
generate:
134+
generate: js css
132135
GO111MODULE=on $(GO) generate -mod=vendor $(PACKAGES)
133136

134137
.PHONY: generate-swagger
@@ -384,14 +387,8 @@ check: test
384387
install: $(wildcard *.go)
385388
$(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
386389

387-
.PHONY: go
388-
go: go-check $(EXECUTABLE)
389-
390-
.PHONY: go-all
391-
go-all: go-check generate go
392-
393390
.PHONY: build
394-
build: js css go-all
391+
build: go-check generate $(EXECUTABLE)
395392

396393
$(EXECUTABLE): $(GO_SOURCES)
397394
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@

cmd/dump.go

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ package cmd
88
import (
99
"fmt"
1010
"io/ioutil"
11-
"log"
1211
"os"
1312
"path"
1413
"path/filepath"
1514
"time"
1615

1716
"code.gitea.io/gitea/models"
17+
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
1919

2020
"github.com/unknwon/cae/zip"
@@ -59,6 +59,11 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
5959
},
6060
}
6161

62+
func fatal(format string, args ...interface{}) {
63+
fmt.Fprintf(os.Stderr, format+"\n", args...)
64+
log.Fatal(format, args...)
65+
}
66+
6267
func runDump(ctx *cli.Context) error {
6368
setting.NewContext()
6469
setting.NewServices() // cannot access session settings otherwise
@@ -84,13 +89,13 @@ func runDump(ctx *cli.Context) error {
8489

8590
tmpDir := ctx.String("tempdir")
8691
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
87-
log.Fatalf("Path does not exist: %s", tmpDir)
92+
fatal("Path does not exist: %s", tmpDir)
8893
}
8994
tmpWorkDir, err := ioutil.TempDir(tmpDir, "gitea-dump-")
9095
if err != nil {
91-
log.Fatalf("Failed to create tmp work directory: %v", err)
96+
fatal("Failed to create tmp work directory: %v", err)
9297
}
93-
log.Printf("Creating tmp work dir: %s", tmpWorkDir)
98+
log.Info("Creating tmp work dir: %s", tmpWorkDir)
9499

95100
// work-around #1103
96101
if os.Getenv("TMPDIR") == "" {
@@ -100,88 +105,89 @@ func runDump(ctx *cli.Context) error {
100105
dbDump := path.Join(tmpWorkDir, "gitea-db.sql")
101106

102107
fileName := ctx.String("file")
103-
log.Printf("Packing dump files...")
108+
log.Info("Packing dump files...")
104109
z, err := zip.Create(fileName)
105110
if err != nil {
106-
log.Fatalf("Failed to create %s: %v", fileName, err)
111+
fatal("Failed to create %s: %v", fileName, err)
107112
}
113+
108114
zip.Verbose = ctx.Bool("verbose")
109115

110116
if ctx.IsSet("skip-repository") {
111-
log.Printf("Skip dumping local repositories")
117+
log.Info("Skip dumping local repositories")
112118
} else {
113-
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
119+
log.Info("Dumping local repositories...%s", setting.RepoRootPath)
114120
reposDump := path.Join(tmpWorkDir, "gitea-repo.zip")
115121
if err := zip.PackTo(setting.RepoRootPath, reposDump, true); err != nil {
116-
log.Fatalf("Failed to dump local repositories: %v", err)
122+
fatal("Failed to dump local repositories: %v", err)
117123
}
118124
if err := z.AddFile("gitea-repo.zip", reposDump); err != nil {
119-
log.Fatalf("Failed to include gitea-repo.zip: %v", err)
125+
fatal("Failed to include gitea-repo.zip: %v", err)
120126
}
121127
}
122128

123129
targetDBType := ctx.String("database")
124130
if len(targetDBType) > 0 && targetDBType != setting.Database.Type {
125-
log.Printf("Dumping database %s => %s...", setting.Database.Type, targetDBType)
131+
log.Info("Dumping database %s => %s...", setting.Database.Type, targetDBType)
126132
} else {
127-
log.Printf("Dumping database...")
133+
log.Info("Dumping database...")
128134
}
129135

130136
if err := models.DumpDatabase(dbDump, targetDBType); err != nil {
131-
log.Fatalf("Failed to dump database: %v", err)
137+
fatal("Failed to dump database: %v", err)
132138
}
133139

134140
if err := z.AddFile("gitea-db.sql", dbDump); err != nil {
135-
log.Fatalf("Failed to include gitea-db.sql: %v", err)
141+
fatal("Failed to include gitea-db.sql: %v", err)
136142
}
137143

138144
if len(setting.CustomConf) > 0 {
139-
log.Printf("Adding custom configuration file from %s", setting.CustomConf)
145+
log.Info("Adding custom configuration file from %s", setting.CustomConf)
140146
if err := z.AddFile("app.ini", setting.CustomConf); err != nil {
141-
log.Fatalf("Failed to include specified app.ini: %v", err)
147+
fatal("Failed to include specified app.ini: %v", err)
142148
}
143149
}
144150

145151
customDir, err := os.Stat(setting.CustomPath)
146152
if err == nil && customDir.IsDir() {
147153
if err := z.AddDir("custom", setting.CustomPath); err != nil {
148-
log.Fatalf("Failed to include custom: %v", err)
154+
fatal("Failed to include custom: %v", err)
149155
}
150156
} else {
151-
log.Printf("Custom dir %s doesn't exist, skipped", setting.CustomPath)
157+
log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath)
152158
}
153159

154160
if com.IsExist(setting.AppDataPath) {
155-
log.Printf("Packing data directory...%s", setting.AppDataPath)
161+
log.Info("Packing data directory...%s", setting.AppDataPath)
156162

157163
var sessionAbsPath string
158164
if setting.SessionConfig.Provider == "file" {
159165
sessionAbsPath = setting.SessionConfig.ProviderConfig
160166
}
161167
if err := zipAddDirectoryExclude(z, "data", setting.AppDataPath, sessionAbsPath); err != nil {
162-
log.Fatalf("Failed to include data directory: %v", err)
168+
fatal("Failed to include data directory: %v", err)
163169
}
164170
}
165171

166172
if err := z.AddDir("log", setting.LogRootPath); err != nil {
167-
log.Fatalf("Failed to include log: %v", err)
173+
fatal("Failed to include log: %v", err)
168174
}
169175

170176
if err = z.Close(); err != nil {
171177
_ = os.Remove(fileName)
172-
log.Fatalf("Failed to save %s: %v", fileName, err)
178+
fatal("Failed to save %s: %v", fileName, err)
173179
}
174180

175181
if err := os.Chmod(fileName, 0600); err != nil {
176-
log.Printf("Can't change file access permissions mask to 0600: %v", err)
182+
log.Info("Can't change file access permissions mask to 0600: %v", err)
177183
}
178184

179-
log.Printf("Removing tmp work dir: %s", tmpWorkDir)
185+
log.Info("Removing tmp work dir: %s", tmpWorkDir)
180186

181187
if err := os.RemoveAll(tmpWorkDir); err != nil {
182-
log.Fatalf("Failed to remove %s: %v", tmpWorkDir, err)
188+
fatal("Failed to remove %s: %v", tmpWorkDir, err)
183189
}
184-
log.Printf("Finish dumping in file %s", fileName)
190+
log.Info("Finish dumping in file %s", fileName)
185191

186192
return nil
187193
}

0 commit comments

Comments
 (0)