diff --git a/Earthfile b/Earthfile index 0eb7846c..a67bfcce 100644 --- a/Earthfile +++ b/Earthfile @@ -75,14 +75,17 @@ go-base: LET version = $(git tag --points-at) IF [ "${version}" = "" ] - SET version = $(git describe --tags --abbrev=0 || echo "dev_build") + SET version = "$(git describe --tags --abbrev=0)_dev_build" + END + IF [ "${version}" = "" ] + SET version = "dev_build" END ENV VERSION="${version}" - LET source = $( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown_source" ) + LET source = $( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown" ) ENV SOURCE="${source}" - LET build_time = $(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown_build_time") + LET build_time = $(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown") ENV BUILD_TIME = "${build_time}" # Explicitly cache here. diff --git a/cmds/portmaster-core/build b/cmds/portmaster-core/build index 36ca5a23..6caafe4a 100755 --- a/cmds/portmaster-core/build +++ b/cmds/portmaster-core/build @@ -1,14 +1,11 @@ #!/bin/bash # Gather build metadata. -VERSION=$(git tag --points-at) -if [[ -z "$VERSION" ]]; then - VERSION=$(git describe --tags --abbrev=0 || echo "dev_build") -fi -SOURCE=$( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown_source" ) -BUILD_TIME=$(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown_build_time") +VERSION="$(git tag --points-at)"; test -z "$VERSION" && VERSION="$(git describe --tags --abbrev=0)_dev_build"; test -z "$VERSION" && VERSION="dev_build" +SOURCE=$( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown" ) +BUILD_TIME=$(date -u "+%Y-%m-%dT%H:%M:%SZ" || echo "unknown") # Build -CGO_ENABLED=0 +export CGO_ENABLED=0 BUILD_PATH="github.com/safing/portbase/info" go build -ldflags "-X github.com/safing/portbase/info.version=${VERSION} -X github.com/safing/portbase/info.buildSource=${SOURCE} -X github.com/safing/portbase/info.buildTime=${BUILD_TIME}" "$@" diff --git a/go.mod b/go.mod index def44cb9..6585c62b 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/r3labs/diff/v3 v3.0.1 github.com/rot256/pblind v0.0.0-20231024115251-cd3f239f28c1 github.com/safing/jess v0.3.3 - github.com/safing/portbase v0.19.1 + github.com/safing/portbase v0.19.3 github.com/safing/portmaster-android/go v0.0.0-20230830120134-3226ceac3bec github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 6eb1853d..28b0fab5 100644 --- a/go.sum +++ b/go.sum @@ -245,6 +245,10 @@ github.com/safing/portbase v0.19.0 h1:2T6f/w90IdIsSgUfyXoveqZM7tVwW+IFrtLbPVXtY3 github.com/safing/portbase v0.19.0/go.mod h1:Qrh3ck+7VZloFmnozCs9Hj8godhJAi55cmiDiC7BwTc= github.com/safing/portbase v0.19.1 h1:Uk/WyP9HsIJrCn0pE4a7AWIrfUSHyCOObQyRmXsGQ9A= github.com/safing/portbase v0.19.1/go.mod h1:Qrh3ck+7VZloFmnozCs9Hj8godhJAi55cmiDiC7BwTc= +github.com/safing/portbase v0.19.2 h1:qGF5Jv9eEE33d2aIxeBQdnitnBoF44BGVFtboqfE+1A= +github.com/safing/portbase v0.19.2/go.mod h1:Qrh3ck+7VZloFmnozCs9Hj8godhJAi55cmiDiC7BwTc= +github.com/safing/portbase v0.19.3 h1:fzb4d2nzhmRq4Lt6sgn9R20iykireAkBNyf9pfGqQjk= +github.com/safing/portbase v0.19.3/go.mod h1:Qrh3ck+7VZloFmnozCs9Hj8godhJAi55cmiDiC7BwTc= github.com/safing/portmaster-android/go v0.0.0-20230830120134-3226ceac3bec h1:oSJY1seobofPwpMoJRkCgXnTwfiQWNfGMCPDfqgAEfg= github.com/safing/portmaster-android/go v0.0.0-20230830120134-3226ceac3bec/go.mod h1:abwyAQrZGemWbSh/aCD9nnkp0SvFFf/mGWkAbOwPnFE= github.com/safing/spn v0.7.5 h1:WfkMs2omLrwxBWccGGG9Akx0AvsvJLG+W7rjWQpQhl4=