Enable arm64 and MacOS Docker build
This commit is contained in:
parent
309f05c166
commit
819596cb1f
@ -7,7 +7,7 @@ Build-Depends: debhelper, wget, tar, gzip, make, dh-exec
|
||||
Standards-Version: 3.9.5
|
||||
|
||||
Package: {{.Backend.PackageName}}
|
||||
Architecture: amd64
|
||||
Architecture: {{.Env.Architecture}}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate
|
||||
Description: Satoshilabs packaged {{.Coin.Name}} server
|
||||
{{end}}
|
||||
|
||||
@ -7,7 +7,7 @@ Build-Depends: debhelper, dh-exec
|
||||
Standards-Version: 3.9.5
|
||||
|
||||
Package: {{.Blockbook.PackageName}}
|
||||
Architecture: amd64
|
||||
Architecture: {{.Env.Architecture}}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, {{.Backend.PackageName}}
|
||||
Description: Satoshilabs blockbook server ({{.Coin.Name}})
|
||||
{{end}}
|
||||
|
||||
@ -16,10 +16,10 @@ if [ -z "$IMG_CREATED_TIME" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
IMG_CREATED_TS=$(date -d $IMG_CREATED_TIME +%s)
|
||||
GIT_COMMIT_TS=$(date -d $(git log --pretty="format:%cI" -1 $DIR) +%s)
|
||||
IMG_CREATED_TS=$IMG_CREATED_TIME
|
||||
GIT_COMMIT_TS=$(git log --pretty="format:%cI" -1 $DIR)
|
||||
|
||||
if [ $IMG_CREATED_TS -lt $GIT_COMMIT_TS ]; then
|
||||
if [[ "$IMG_CREATED_TS" < "$GIT_COMMIT_TS" ]]; then
|
||||
echo "out-of-time"
|
||||
else
|
||||
echo "ok"
|
||||
|
||||
@ -8,10 +8,36 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Backend contains backend specific fields
|
||||
type Backend struct {
|
||||
PackageName string `json:"package_name"`
|
||||
PackageRevision string `json:"package_revision"`
|
||||
SystemUser string `json:"system_user"`
|
||||
Version string `json:"version"`
|
||||
BinaryURL string `json:"binary_url"`
|
||||
VerificationType string `json:"verification_type"`
|
||||
VerificationSource string `json:"verification_source"`
|
||||
ExtractCommand string `json:"extract_command"`
|
||||
ExcludeFiles []string `json:"exclude_files"`
|
||||
ExecCommandTemplate string `json:"exec_command_template"`
|
||||
LogrotateFilesTemplate string `json:"logrotate_files_template"`
|
||||
PostinstScriptTemplate string `json:"postinst_script_template"`
|
||||
ServiceType string `json:"service_type"`
|
||||
ServiceAdditionalParamsTemplate string `json:"service_additional_params_template"`
|
||||
ProtectMemory bool `json:"protect_memory"`
|
||||
Mainnet bool `json:"mainnet"`
|
||||
ServerConfigFile string `json:"server_config_file"`
|
||||
ClientConfigFile string `json:"client_config_file"`
|
||||
AdditionalParams interface{} `json:"additional_params,omitempty"`
|
||||
Platforms map[string]Backend `json:"platforms,omitempty"`
|
||||
}
|
||||
|
||||
// Config contains the structure of the config
|
||||
type Config struct {
|
||||
Coin struct {
|
||||
@ -33,27 +59,7 @@ type Config struct {
|
||||
RPCTimeout int `json:"rpc_timeout"`
|
||||
MessageQueueBindingTemplate string `json:"message_queue_binding_template"`
|
||||
} `json:"ipc"`
|
||||
Backend struct {
|
||||
PackageName string `json:"package_name"`
|
||||
PackageRevision string `json:"package_revision"`
|
||||
SystemUser string `json:"system_user"`
|
||||
Version string `json:"version"`
|
||||
BinaryURL string `json:"binary_url"`
|
||||
VerificationType string `json:"verification_type"`
|
||||
VerificationSource string `json:"verification_source"`
|
||||
ExtractCommand string `json:"extract_command"`
|
||||
ExcludeFiles []string `json:"exclude_files"`
|
||||
ExecCommandTemplate string `json:"exec_command_template"`
|
||||
LogrotateFilesTemplate string `json:"logrotate_files_template"`
|
||||
PostinstScriptTemplate string `json:"postinst_script_template"`
|
||||
ServiceType string `json:"service_type"`
|
||||
ServiceAdditionalParamsTemplate string `json:"service_additional_params_template"`
|
||||
ProtectMemory bool `json:"protect_memory"`
|
||||
Mainnet bool `json:"mainnet"`
|
||||
ServerConfigFile string `json:"server_config_file"`
|
||||
ClientConfigFile string `json:"client_config_file"`
|
||||
AdditionalParams interface{} `json:"additional_params,omitempty"`
|
||||
} `json:"backend"`
|
||||
Backend Backend `json:"backend"`
|
||||
Blockbook struct {
|
||||
PackageName string `json:"package_name"`
|
||||
SystemUser string `json:"system_user"`
|
||||
@ -87,6 +93,7 @@ type Config struct {
|
||||
BackendDataPath string `json:"backend_data_path"`
|
||||
BlockbookInstallPath string `json:"blockbook_install_path"`
|
||||
BlockbookDataPath string `json:"blockbook_data_path"`
|
||||
Architecture string `json:"architecture"`
|
||||
} `json:"-"`
|
||||
}
|
||||
|
||||
@ -136,6 +143,16 @@ func (c *Config) ParseTemplate() *template.Template {
|
||||
return t
|
||||
}
|
||||
|
||||
func copyNonZeroBackendFields(toValue *Backend, fromValue *Backend) {
|
||||
from := reflect.ValueOf(*fromValue)
|
||||
to := reflect.ValueOf(toValue).Elem()
|
||||
for i := 0; i < from.NumField(); i++ {
|
||||
if from.Field(i).IsValid() && !from.Field(i).IsZero() {
|
||||
to.Field(i).Set(from.Field(i))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LoadConfig loads the config files
|
||||
func LoadConfig(configsDir, coin string) (*Config, error) {
|
||||
config := new(Config)
|
||||
@ -161,8 +178,15 @@ func LoadConfig(configsDir, coin string) (*Config, error) {
|
||||
}
|
||||
|
||||
config.Meta.BuildDatetime = time.Now().Format("Mon, 02 Jan 2006 15:04:05 -0700")
|
||||
config.Env.Architecture = runtime.GOARCH
|
||||
|
||||
if !isEmpty(config, "backend") {
|
||||
// set platform specific fields to config
|
||||
platform, found := config.Backend.Platforms[runtime.GOARCH]
|
||||
if found {
|
||||
copyNonZeroBackendFields(&config.Backend, &platform)
|
||||
}
|
||||
|
||||
switch config.Backend.ServiceType {
|
||||
case "forking":
|
||||
case "simple":
|
||||
|
||||
@ -41,6 +41,12 @@
|
||||
"client_config_file": "bitcoin_client.conf",
|
||||
"additional_params": {
|
||||
"deprecatedrpc": "estimatefee"
|
||||
},
|
||||
"platforms": {
|
||||
"arm64": {
|
||||
"binary_url": "https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-aarch64-linux-gnu.tar.gz",
|
||||
"verification_source": "06f4c78271a77752ba5990d60d81b1751507f77efda1e5981b4e92fd4d9969fb"
|
||||
}
|
||||
}
|
||||
},
|
||||
"blockbook": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user