[DRE-commits] [pkg-ruby-extras] 01/02: build-and-upload: offer to test reverse build dependencies

Antonio Terceiro terceiro at moszumanska.debian.org
Thu Jul 21 12:07:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository pkg-ruby-extras.

commit 5e16a9dad2a0da24789a7629740fe5179f478c5f
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Wed Jul 20 13:35:06 2016 -0300

    build-and-upload: offer to test reverse build dependencies
---
 build-and-upload | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 68 insertions(+), 5 deletions(-)

diff --git a/build-and-upload b/build-and-upload
index d4bae44..3955046 100755
--- a/build-and-upload
+++ b/build-and-upload
@@ -89,13 +89,13 @@ check_package() {
   if [ "$distribution" = unstable ] || \
     [ "$distribution" = experimental ] || \
     [ "$distribution" = UNRELEASED ]; then
+    update_chdist
     test_reverse_dependencies
+    test_reverse_build_dependencies
   fi
 }
 
-test_reverse_dependencies() {
-  local binaries="$(dh_listpackages)"
-  local debs="$(dcmd --deb "$changes")"
+update_chdist() {
   if [ ! -d "${HOME}/.chdist/unstable" ]; then
     chdist create unstable
   fi
@@ -104,7 +104,12 @@ deb http://deb.debian.org/debian/ unstable main
 deb-src http://deb.debian.org/debian/ unstable main
 EOF
   chdist apt unstable update
-  local rdeps="$(chdist apt-cache unstable rdepends $binaries | grep '^\s' | xargs -n 1 chdist bin2src unstable | sort | uniq)"
+}
+
+test_reverse_dependencies() {
+  local binaries="$(dh_listpackages)"
+  local debs="$(dcmd --deb "$changes")"
+  local rdeps="$(chdist apt-cache unstable rdepends $binaries | grep '^\s' | xargs -n 1 chdist bin2src unstable | sort -u)"
   local failed_rdeps=""
   if [ -n "$rdeps" ]; then
     echo "I: found reverse dependencies:"
@@ -126,10 +131,68 @@ EOF
       warning "Tests for $pkg failed! Please verify before uploading"
     done
   else
-    echo "I: no reverse dependencies found, skipping"
+    echo "I: no reverse dependencies found"
   fi
 }
 
+test_reverse_build_dependencies() {
+  # turn list of binaries into a pattern for grep-dctrl
+  local pattern='\('
+  local binary
+  local patsep=''
+  for binary in $(dh_listpackages); do
+    pattern="$pattern""$patsep""$binary"
+    patsep='\|'
+  done
+  pattern="$pattern"'\)\([, ]\|$\)'
+
+
+  local rbdeps="$(chdist grep-dctrl-sources unstable -F Build-Depends -r "$pattern" -n -s Package | sort -u)"
+
+  if [ -n "$rbdeps" ]; then
+    echo "I: found reverse build dependencies:"
+    echo "$rbdeps"
+
+    local pkg
+
+    # list of locally built binaries to pass to sbuild
+    local extra_packages=''
+    for deb in $(dcmd --deb "$changes"); do
+      extra_packages="$extra_packages --extra-package=$(readlink -f $deb)"
+    done
+    echo "$extra_packages"
+
+    local failed_rbdeps=""
+
+    for pkg in $rbdeps; do
+      if confirm "Test rebuilding $pkg? [Y/n]" y; then
+        if ! test_rebuild "$pkg" $extra_packages; then
+          failed_rbdeps="$failed_rbdeps $pkg"
+        fi
+      fi
+    done
+    for pkg in $failed_rbdeps; do
+      warning "Tests for $pkg failed! Please verify before uploading"
+    done
+  else
+    echo "I: no reverse build dependencies found"
+  fi
+}
+
+test_rebuild() {
+  local pkg="$1"
+  shift
+
+  local tmpdir="$(mktemp -d)"
+  cd "$tmpdir"
+  chdist apt-get unstable source "$pkg"
+  rc=0
+  sbuild --dist=unstable $@ *.dsc || rc=$?
+  cd -
+  rm -rf "$tmpdir"
+  return "$rc"
+}
+
 confirm() {
   prompt="$1"
   default="${2:-n}"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/pkg-ruby-extras.git



More information about the Pkg-ruby-extras-commits mailing list