Either backend or blockbook config sections are optional
This commit is contained in:
parent
53f8c042cf
commit
dbe71185bb
@ -17,12 +17,12 @@ cp -r /src/configs .
|
|||||||
go run build/templates/generate.go $coin
|
go run build/templates/generate.go $coin
|
||||||
|
|
||||||
# backend
|
# backend
|
||||||
if [ $package = "backend" ] || [ $package = "all" ]; then
|
if ([ $package = "backend" ] || [ $package = "all" ]) && [ -d build/pkg-defs/backend ]; then
|
||||||
(cd build/pkg-defs/backend && dpkg-buildpackage -us -uc $@)
|
(cd build/pkg-defs/backend && dpkg-buildpackage -us -uc $@)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# blockbook
|
# blockbook
|
||||||
if [ $package = "blockbook" ] || [ $package = "all" ]; then
|
if ([ $package = "blockbook" ] || [ $package = "all" ]) && [ -d build/pkg-defs/blockbook ]; then
|
||||||
export VERSION=$(cd build/pkg-defs/blockbook && dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)([-+~].+)?$/\1/p')
|
export VERSION=$(cd build/pkg-defs/blockbook && dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)([-+~].+)?$/\1/p')
|
||||||
|
|
||||||
cp Makefile ldb sst_dump build/pkg-defs/blockbook
|
cp Makefile ldb sst_dump build/pkg-defs/blockbook
|
||||||
|
|||||||
@ -166,31 +166,48 @@ func loadConfig(coin string) *Config {
|
|||||||
|
|
||||||
config.Meta.BuildDatetime = time.Now().Format("Mon, 02 Jan 2006 15:04:05 -0700")
|
config.Meta.BuildDatetime = time.Now().Format("Mon, 02 Jan 2006 15:04:05 -0700")
|
||||||
|
|
||||||
switch config.Backend.ServiceType {
|
if !isEmpty(config, "backend") {
|
||||||
case "forking":
|
switch config.Backend.ServiceType {
|
||||||
case "simple":
|
case "forking":
|
||||||
default:
|
case "simple":
|
||||||
panic("Invalid service type: " + config.Backend.ServiceType)
|
default:
|
||||||
}
|
panic("Invalid service type: " + config.Backend.ServiceType)
|
||||||
|
}
|
||||||
|
|
||||||
switch config.Backend.VerificationType {
|
switch config.Backend.VerificationType {
|
||||||
case "":
|
case "":
|
||||||
case "gpg":
|
case "gpg":
|
||||||
case "sha256":
|
case "sha256":
|
||||||
case "gpg-sha256":
|
case "gpg-sha256":
|
||||||
default:
|
default:
|
||||||
panic("Invalid verification type: " + config.Backend.VerificationType)
|
panic("Invalid verification type: " + config.Backend.VerificationType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isEmpty(config *Config, target string) bool {
|
||||||
|
switch target {
|
||||||
|
case "backend":
|
||||||
|
return config.Backend.PackageName == ""
|
||||||
|
case "blockbook":
|
||||||
|
return config.Blockbook.PackageName == ""
|
||||||
|
default:
|
||||||
|
panic("Invalid target name: " + target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func generatePackageDefinitions(config *Config) {
|
func generatePackageDefinitions(config *Config) {
|
||||||
templ := config.ParseTemplate()
|
templ := config.ParseTemplate()
|
||||||
|
|
||||||
makeOutputDir(outputDir)
|
makeOutputDir(outputDir)
|
||||||
|
|
||||||
for _, subdir := range []string{"backend", "blockbook"} {
|
for _, subdir := range []string{"backend", "blockbook"} {
|
||||||
|
if isEmpty(config, subdir) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
root := filepath.Join(inputDir, subdir)
|
root := filepath.Join(inputDir, subdir)
|
||||||
|
|
||||||
err := os.Mkdir(filepath.Join(outputDir, subdir), 0755)
|
err := os.Mkdir(filepath.Join(outputDir, subdir), 0755)
|
||||||
@ -235,7 +252,9 @@ func generatePackageDefinitions(config *Config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeBackendConfigFile(config)
|
if !isEmpty(config, "backend") {
|
||||||
|
writeBackendConfigFile(config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeOutputDir(path string) {
|
func makeOutputDir(path string) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user