diff --git a/Makefile.common b/Makefile.common index 76b2d2a..b915fbb 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,88 +1,88 @@ SHELL = /bin/bash TOPLVL = "../." SPECFILE = $(shell if [ -f package.yml ]; then echo "package.yml"; else echo "pspec.xml"; fi; ) SPECFILE2 = $(shell if [ -f pspec_x86_64.xml ]; then echo "pspec_x86_64.xml"; else echo "pspec.xml"; fi; ) TAG=$(shell $(TOPLVL)/common/Scripts/gettag.py $(SPECFILE)) SOURCE=$(shell basename $(shell dirname $(abspath $(SPECFILE)))) SIGNTAG=$(shell if [ "$(git config commit.gpgsign)" == "true" ]; then echo "-s"; else echo " "; fi; ) complete: make build abireport: $(TOPLVL)/common/Go/yabi/yabi *.eopkg build-stable: sudo solbuild build $(SPECFILE) -p main-x86_64; @echo "==========================================================================" @echo "WARNING: This package was built against -stable and is for local use only." @echo " " @echo " Do NOT publish packages or Differentials built against -stable!!!" @echo "==========================================================================" build: sudo solbuild build $(SPECFILE) -p unstable-x86_64; tram: sudo solbuild --transit-manifest unstable build $(SPECFILE) -p unstable-x86_64; local: sudo solbuild build $(SPECFILE) -p local-unstable-x86_64; cvecheck: cve-check-tool $(SPECFILE2) -M $(TOPLVL)/common/mapping -o report.html; \ bump: if [[ -e package.yml ]]; then \ python /usr/share/ypkg/ybump.py package.yml; \ else \ $(TOPLVL)/common/Scripts/pbump.py pspec.xml; \ fi; convert: $(TOPLVL)/common/Scripts/yconvert.py pspec.xml; clean: if [[ `ls *.eopkg` ]]; then \ rm *.eopkg -fv; \ fi; pull: git pull --rebase publish: - sh $(TOPLVL)/common/Scripts/system-base-devel-safety-catch.sh + sh $(TOPLVL)/common/Scripts/package-publish-safety-catches.sh @if [[ `git symbolic-ref HEAD 2>/dev/null` = "refs/heads/master" && `git tag` != *$(TAG)* ]]; then \ git tag $(SIGNTAG) -a -m "Publish $(TAG)" $(TAG); \ git push --follow-tags; \ ssh -4 -p 798 build@getsol.us build "$(SOURCE)" "$(TAG)"; \ else \ echo "Error: Cannot publish, either not on the master branch or the tag already exists."; \ fi; republish: ssh -4 -p 798 build@getsol.us build "$(SOURCE)" "$(TAG)" switch-domains: go run $(TOPLVL)/common/Go/switch_repo_domains.go notify-complete: sh $(TOPLVL)/common/Scripts/buildserver-notification.sh help: @echo "build - Build the current package against the unstable repo" @echo "build-stable - Build the current package against the stable repo (do NOT use for official submissions!)" @echo "tram - Build the current package against the unstable-x86-64 profile and generate a solbuild transit manifest" @echo "bump - Bump current release" @echo "convert - Convert pspec to package.yml" @echo "cvecheck - Check package for CVEs" @echo "clean - Clean current tree" @echo "republish - Rebuild existing tag" @echo "publish - Tag and publish a release" @echo "pull - Pull/rebase latest changes" @echo "notify-complete - Get a notification when the build has finished on the buildserver" @echo "switch-domains - Update local repositories to use correct hostname" .PHONY: complete diff --git a/Scripts/system-base-devel-safety-catch.sh b/Scripts/package-publish-safety-catches.sh similarity index 50% rename from Scripts/system-base-devel-safety-catch.sh rename to Scripts/package-publish-safety-catches.sh index cf66695..e4054f2 100755 --- a/Scripts/system-base-devel-safety-catch.sh +++ b/Scripts/package-publish-safety-catches.sh @@ -1,32 +1,49 @@ #!/usr/bin/env bash -# Safety catch to prevent system.base/system.devel pkgs where there are additions to abi_used_libs from being published accidently. -# Otherwise, if a system.base/system.devel pkg depends on another pkg that isn't in system.base/system.devel the solbuild image -# will refuse to update. +# Safety catches when publishing packages. Not foolproof and there are edge cases where we don't want it which allows for force-pushing. +# Currently: + # - Checks that the release has been bumped. + # - Warns if there are additions to abi_used_libs for system.{base,devel} packages. -# FIXME: Check for rundeps changes as well +# FIXME: Check for rundeps changes as well for system.{base,devel} packages. +# FIXME: For the initial inclusion check that the release == 1 LAST_COMMIT_DIFF=`git diff @~ @` +PKG_BUMP=`git diff @~ @ package.yml | grep -w +release` + +# Check the release has been bumped +if [[ $PKG_BUMP == "" ]]; then + echo "Warning: Cannot determine that the release has been bumped" + read -p "Press y to force-through. If unsure press any other key to abort." prompt + if [[ $prompt = "y" ]]; then + exit 0 + else + exit 1 + fi +fi + +# Checks for additions to abi_used_libs for system.{base,devel} packages. + if [[ `git grep -E 'system.base|system.devel' pspec_x86_64.xml` ]]; then SYSTEM_BASE_DEVEL_PKG=1 fi if [[ `grep -E abi_used_libs <<< $LAST_COMMIT_DIFF` ]]; then # Only if the change is an addition ABI_ADDITION=`git diff @~ @ -U0 --word-diff abi_used_libs | grep {+` if [[ $ABI_ADDITION != "" ]]; then CHANGED_ABI_USED_LIBS=1 fi fi if [[ ! -z "${SYSTEM_BASE_DEVEL_PKG}" && ! -z "${CHANGED_ABI_USED_LIBS}" ]]; then echo "Found a system.base/system.devel pkg where" $ABI_ADDITION "has been added to abi_used_libs." echo "Please ensure that the package containing" $ABI_ADDITION "is in system.base/system.devel BEFORE continuing." read -p "Press y to continue. If unsure press any other key to abort." prompt if [[ $prompt = "y" ]]; then exit 0 else exit 1 fi fi