]> git.proxmox.com Git - debcargo-conf.git/commitdiff
sync scripts with upstream
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 29 Nov 2021 11:25:31 +0000 (12:25 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 29 Nov 2021 11:27:48 +0000 (12:27 +0100)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 files changed:
build.sh
dev/filter-not-NEW.sh [new file with mode: 0755]
dev/filter-semver.sh
dev/grant-dm-perms.sh
dev/link-patches.sh
dev/list-binpkgs.sh
dev/list-pending-needs-reupload.sh [new file with mode: 0755]
dev/list-pending-not-NEW.sh [deleted file]
dev/list-pending.sh [new file with mode: 0755]
dev/list-rdeps.sh
dev/list-remaining-deps.sh
dev/list-rfs.sh
dev/merge-accepted.sh
dev/sync-pending-branches.sh
repackage.sh
update.sh
vars.sh.frag

index 5775e44ce08fae8c1d0db5826dcbb7b221a158ce..1b59014b5ed2658f3fa7d9cbf6def78debaaf6ad 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -14,6 +14,8 @@
 #     Release to something other than unstable, e.g. experimental
 # CHROOT=$chroot
 #     Build using another schroot than debcargo-unstable-amd64-sbuild
+# SBUILD_OPTS=
+#     will pass to sbuild; for example SBUILD_OPTS=--arch=i386
 set -e
 
 SCRIPTDIR="$(dirname $(readlink -f "$0"))"
@@ -27,8 +29,8 @@ fi
 
 if [ -n "$DEBCARGO" ]; then
        true
-elif which debcargo >/dev/null; then
-       DEBCARGO=$(which debcargo)
+elif type -p debcargo >/dev/null 2>&1; then
+       DEBCARGO=$(type -p debcargo)
 elif [ -f "$HOME/.cargo/bin/debcargo" ]; then
        DEBCARGO="$HOME/.cargo/bin/debcargo"
 else
@@ -93,11 +95,15 @@ if shouldbuild "$SRCNAME.dsc" "$PKGNAME/debian/changelog" ]; then
        ( cd "$PKGNAME" && dpkg-buildpackage -d -S --no-sign )
        # sign if not UNRELEASED
        if echo "$DEBDIST" | grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
-               debsign "${SRCNAME}_source.changes"
+               debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID} "${SRCNAME}_source.changes"
        fi
 fi
 
 EXTRA_DEBS=( "$@" )
+if [ -n "$*" -a -z "$IGNORE_MISSING_BUILD_DEPS" ]; then
+       IGNORE_MISSING_BUILD_DEPS=1
+       echo >&2 "Given non-empty extra debs; defaulting IGNORE_MISSING_BUILD_DEPS=1"
+fi
 
 check_build_deps() {
        mkdir -p dpkg-dummy
@@ -154,6 +160,7 @@ SBUILD_CONFIG="$SCRIPTDIR/dev/sbuildrc" sbuild --no-source --arch-any --arch-all
   "${EXTRA_DEBS_AUTOPKGTEST_OPTS[@]}" \
   "${AUTOPKGTEST_OPTS[@]}" \
   "${LINTIAN_OPTS[@]}" \
+   ${SBUILD_OPTS} \
   "$SRCNAME.dsc"
 if [ "$SKIP_AUTOPKGTEST" != 1 ]; then
        report "analyzing autopkgtest log: $BUILDNAME.test.log"
@@ -167,5 +174,5 @@ report "build complete: $BUILDNAME.changes"
 
 # sign if not UNRELEASED
 if echo "$DEBDIST" | grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
-       debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID }--no-re-sign "$BUILDNAME.changes"
+       debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID--no-re-sign "$BUILDNAME.changes"
 fi
diff --git a/dev/filter-not-NEW.sh b/dev/filter-not-NEW.sh
new file mode 100755 (executable)
index 0000000..69ffa0d
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+# Filter package-versions of our rust packages, that are not in NEW.
+
+comm -13 \
+  <(curl -s https://ftp-master.debian.org/new.html \
+    | sed -nre 's,.*<a href="new/rust-([a-zA-Z0-9-]*)_([.a-zA-Z0-9-]*)\.html">.*,\1 \2,gp' \
+    | sort) \
+  -
index b623018ab6d1a1b397ce8f5e9932263b133ec4c6..e0841eb15062401d3d96bdf37a58d76a51e8bd01 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Given a full version string, output just the part that is significant for
 # semver. i.e.. 0.x.* becomes 0.x and x.* becomes x for x != 0.
 sed -r \
index c7151071d9f6923129cb962f8f5597e1f9e5e6c9..b12ebb4aab91bdb924bc6269eb22d884e163f55b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Grant DM upload permissions on all crates maintained by a DM.
 
 if [ "$#" -ne 1 ]; then
index 11d358cc02c3c2096137edbbba04101567a72e7a..5d70e2fdcf1f6a57aeec57d966685b5888c10981 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Symlink {build => src}/$pkg/debian/patches for easier editing.
 #
 # If you give a second argument $2, will create this patch, add Cargo.toml to
index b74019cd5bfe080710234747285ffd1bb6c057cb..1418e5277a169641401ddd3853a342224eea3f66 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # List all packages that produce rust binaries, from this repo.
 grep -l "\[packages.bin\]" src/*/debian/debcargo.toml \
   | cut -d/ -f2 \
diff --git a/dev/list-pending-needs-reupload.sh b/dev/list-pending-needs-reupload.sh
new file mode 100755 (executable)
index 0000000..734b7db
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+dev/list-pending.sh | dev/filter-not-NEW.sh | dev/filter-package-in-debian.sh
diff --git a/dev/list-pending-not-NEW.sh b/dev/list-pending-not-NEW.sh
deleted file mode 100755 (executable)
index 9251816..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# List pending branches that we have, but that are not in NEW.
-# You might find it also useful to pipe the output of this into filter-package-in-debian.sh
-set -e
-
-git fetch origin --prune
-comm -13 \
- <(curl -s https://ftp-master.debian.org/new.html | \
-   grep '<td class="package">rust-' | \
-   sed -nre 's/.*\brust-([-A-Za-z0-9.]+)\b.*/\1/gp' | \
-   sort) \
- <(git branch --list -r 'origin/pending-*' --format='%(refname)' | \
-   sed -e 's,refs/remotes/origin/pending-,,g' | \
-   sort) | \
-while read x; do
-       echo $x $(git show "origin/pending-$x:src/$x/debian/changelog" | dpkg-parsechangelog -l- -SVersion)
-done
diff --git a/dev/list-pending.sh b/dev/list-pending.sh
new file mode 100755 (executable)
index 0000000..84510d6
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# List pending branches that we have.
+# You may want to run dev/sync-pending-branches.sh first.
+# You may find it useful to pipe the output of this into filter-package-in-debian.sh
+#
+set -e
+
+git fetch origin --prune
+
+if [ "${PENDING_LOCAL}" = 1 ]; then
+git branch --list 'pending-*' --format='%(refname)' \
+  | sed -e 's,refs/heads/pending-,,g' \
+  | sort \
+  | while read x; do
+       echo $x $(git show "pending-$x:src/$x/debian/changelog" | dpkg-parsechangelog -l- -SVersion)
+  done
+else
+git branch --list -r 'origin/pending-*' --format='%(refname)' \
+  | sed -e 's,refs/remotes/origin/pending-,,g' \
+  | sort \
+  | while read x; do
+       echo $x $(git show "origin/pending-$x:src/$x/debian/changelog" | dpkg-parsechangelog -l- -SVersion)
+  done
+fi
index 83dd9bb7763ab2895bca2c21fa7b91461135566f..204a486cf46c5c8af702f883f63005d4f3056abe 100755 (executable)
@@ -11,8 +11,9 @@ shopt -s lastpipe # important for populating associative arrays via pipes
 
 abort() { local x=$1; shift; for i in "$@"; do echo >&2 "$0: abort: $i"; done; exit "$x"; }
 
-which grep-dctrl >/dev/null || abort 1 "grep-dctrl not found, install dctrl-tools"
-which aptitude >/dev/null || abort 1 "aptitude not found, install it"
+type grep-dctrl >/dev/null || abort 1 "grep-dctrl not found, install dctrl-tools"
+type aptitude >/dev/null || abort 1 "aptitude not found, install it"
+type gawk >/dev/null || abort 1 "gawk not found, install gawk"
 
 ARCHIVE="${ARCHIVE:-unstable}"
 ARCHIVT="${ARCHIVT:-testing}"
index 070ba7d816205542434cb190eecb7610493bbb48..cd25455cb79c2c90becb8f165a715c5f9a7e5d86 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 abort() { local x=$1; shift; for i in "$@"; do echo >&2 "$0: abort: $i"; done; exit "$x"; }
 
@@ -7,8 +7,8 @@ echo >&2 "e.g. dependencies of crates that we already patched away in Debian."
 
 if [ -n "$DEBCARGO" ]; then
        true
-elif which debcargo >/dev/null; then
-       DEBCARGO=$(which debcargo)
+elif type -p debcargo >/dev/null 2>&1; then
+       DEBCARGO=$(type -p debcargo)
 elif [ -f "$HOME/.cargo/bin/debcargo" ]; then
        DEBCARGO="$HOME/.cargo/bin/debcargo"
 else
index 4e0989134df9285e14058ad13c1c21dc14cd5db5..84189d9c83dfc2a1adc6a4e51e3dde08eb9a5130 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 for i in src/*/debian/RFS; do
     echo "$(git log -1 --pretty="format:%ct" "$i")" "$i"
 done | sort  | while read t i; do
@@ -11,6 +11,9 @@ done | sort  | while read t i; do
     if ! head -1 $(dirname "$i")/changelog |grep -q UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
         echo -e "\e[31mRFS but the first line of the changelog doesn't contain UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO\e[0m"
     fi
+    if grep -q FIXME $(dirname "$i")/copyright; then
+        echo -e "\e[31mRFS but still contains FIXME in debian/copyright\e[0m"
+    fi
     # trim the content
     content=$(xargs '-d\n' echo -n < "$i")
     if test -n "$content"; then
index 9651a4fcf11ccb6dbebba852fbd2f2b1ba88ac68..cc24e6c98f4dfa0f38fc5c7ef1cfcdde842974bb 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 
-packages=( $(dev/list-pending-not-NEW.sh | dev/filter-package-in-debian.sh | grep -v ' 0$' | cut '-d ' -f1) )
+packages=( $(dev/list-pending.sh | dev/filter-package-in-debian.sh | grep -v ' 0$' | cut '-d ' -f1) )
 
 if [ -z "$packages" ]; then exit 0; fi
 set -x
@@ -11,5 +11,8 @@ git diff --quiet origin/master || \
 { echo >&2 "Please sync with origin/master before running this."; exit 1; }
 
 git merge "${packages[@]/#/pending-}"
-git push origin master "${packages[@]/#/:pending-}"
+git push origin master
+if [ "${PENDING_LOCAL}" != 1 ]; then
+  git push origin "${packages[@]/#/:pending-}"
+fi
 dev/sync-pending-branches.sh
index 7537f6ce685028fd777a2a1bb054bc8c5a634319..1ba3b8dc23924ad8ae9be330c9c3afd9afe35cf0 100755 (executable)
@@ -2,8 +2,27 @@
 # Sync remote pending branches locally, and prune merged branches.
 set -e
 
+git_hash() {
+       git rev-parse -q --verify "$@" || true
+}
+
 git fetch origin --prune
 PREVBRANCH="$(git rev-parse --abbrev-ref HEAD)"
+
+# delete merged
 git branch --merged | tr -d ' ' | grep ^pending- | xargs -trn1 git branch -d
-git branch --list -r 'origin/pending-*' --format='%(refname:lstrip=3)' | xargs -trn1 git checkout
+merged=( $(git branch --list -r 'origin/pending-*' --format='%(refname:lstrip=3)' --merged) )
+git push origin "${merged[@]/#/:}"
+
+# sync local branches
+git branch --list -r 'origin/pending-*' --format='%(refname:lstrip=3)' | while read b; do
+       if [ -z "$(git_hash "$b")" ]; then
+               git checkout "$b"
+       fi
+done
 git checkout "$PREVBRANCH"
+git branch --list 'pending-*'  --format='%(refname:lstrip=2)' | while read b; do
+       if [ "$(git_hash "$b")" != "$(git_hash "origin/$b")" ]; then
+               echo >&2 "WARNING: Local $b ($(git_hash "$b")) differs from remote $b ($(git_hash "origin/$b"))"
+       fi
+done
index d001913fe37b0938884fafadaf64e67c509d8508..6b0b40c57f619b810705a97f0435c49729d1ee66 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Repackage a crate at the exact version that it was packaged at.
 #
 # Usage: ./repackage.sh <CRATE> [<SEMVER>]
index 34a2b4fd77df6231256e4855b4df99f7494a995d..ae4414897a24c8972c6cd7b5bb36ce2581048a8b 100755 (executable)
--- a/update.sh
+++ b/update.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Package or update a new or existing crate.
 #
 # Usage: [REALVER=<EXACTVER>] ./release.sh <CRATE> [<SEMVER>]
index b639d7f5088f4e6e3684c3e48c3fd75558f539c1..761c0b5cc9f6bd1b69b098b250178338c538253d 100644 (file)
@@ -8,13 +8,10 @@ set -e
 
 abort() { local x=$1; shift; for i in "$@"; do echo >&2 "$0: abort: $i"; done; exit "$x"; }
 
-mkdir -p "$(dirname "$0")/.git/hooks"
-HOOK_COMMIT="$(dirname "$0")/.git/hooks/pre-commit"
-
 if [ -n "$DEBCARGO" ]; then
        true
-elif which debcargo >/dev/null; then
-       DEBCARGO=$(which debcargo)
+elif type -p debcargo >/dev/null 2>&1; then
+       DEBCARGO=$(type -p debcargo)
 elif [ -f "$HOME/.cargo/bin/debcargo" ]; then
        DEBCARGO="$HOME/.cargo/bin/debcargo"
 else
@@ -26,6 +23,7 @@ dcver=$($DEBCARGO --version | sed -ne 's/debcargo //p')
 case $dcver in
 2.0.*|2.1.*|2.2.*|2.3.*)       abort 1 "unsupported debcargo version $dcver. try reinstalling with \`cargo install debcargo --force\`";;
 2.4.*) true;;
+2.5.*) true;;
 *)     abort 1 "unsupported debcargo version: $dcver";;
 esac