Codebase list rust-bzip2 / 9cc53ba
automatically run autopkgtest by default, and analyze the log Ximin Luo 4 years ago
3 changed file(s) with 24 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
00 #!/bin/bash
11 set -e
22
3 SCRIPTDIR="$(dirname $(readlink -f "$0"))"
4
35 abort() { local x=$1; shift; for i in "$@"; do echo >&2 "$0: abort: $i"; done; exit "$x"; }
6 report() { for i in "$@"; do echo >&2 "debcargo-conf builder: $i"; done; }
47
58 if [ "$(basename "$PWD")" != "build" ]; then
69 abort 1 "This script is only meant to be run from the build/ directory."
3134 DEBSRC=$(dpkg-parsechangelog -l $PKGNAME/debian/changelog -SSource)
3235 DEBDIST=$(dpkg-parsechangelog -l $PKGNAME/debian/changelog -SDistribution)
3336 DEB_HOST_ARCH=$(dpkg-architecture -q DEB_HOST_ARCH)
37 SRCNAME="${DEBSRC}_${DEBVER}"
38 BUILDNAME="${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}"
3439 if [ -z "$CHROOT" ] && schroot -i -c "debcargo-unstable-${DEB_HOST_ARCH}-sbuild" >/dev/null 2>&1; then
3540 CHROOT="debcargo-unstable-${DEB_HOST_ARCH}-sbuild"
3641 fi
4146 test ! -e "$dst" -o "$src" -nt "$dst"
4247 }
4348
44 if shouldbuild ${DEBSRC}_${DEBVER}.dsc "$PKGNAME/debian/changelog" ]; then
49 if shouldbuild "$SRCNAME.dsc" "$PKGNAME/debian/changelog" ]; then
4550 if [ "$REUSE_EXISTING_ORIG_TARBALL" = 1 ]; then
4651 UPSVER="${DEBVER%-*}"
4752 mv "${DEBSRC}_${UPSVER}.orig.tar.gz" "${DEBSRC}_${UPSVER}.orig.tar.gz.new"
6166 ( cd "$PKGNAME" && dpkg-buildpackage -d -S --no-sign )
6267 # sign if not UNRELEASED
6368 if echo "$DEBDIST" | grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
64 debsign ${DEBSRC}_${DEBVER}_source.changes
69 debsign "${SRCNAME}_source.changes"
6570 fi
6671 fi
6772
7378 apt-cache dumpavail -o APT::Default-Release=unstable | \
7479 sed -e 's/Package: .*/\0\nStatus: install ok installed/g' > dpkg-dummy/status
7580 if ! test -s dpkg-dummy/status; then
76 echo >&2 "couldn't generate dpkg-dummy/status, is Debian unstable in your APT sources?"
77 exit 1
81 abort 1 "couldn't generate dpkg-dummy/status, is Debian unstable in your APT sources?"
7882 fi
7983 fi
8084 ( cd "$PKGNAME" && dpkg-checkbuilddeps --admindir=../dpkg-dummy )
9094 exit
9195 fi
9296
93 AUTOPKGTEST_OPTS=()
94 if [ "$RUN_AUTOPKGTEST" = 1 ]; then
95 AUTOPKGTEST_OPTS=(--run-autopkgtest --autopkgtest-root-arg= --autopkgtest-opts="-- schroot ${CHROOT}")
97 AUTOPKGTEST_OPTS=(--run-autopkgtest --autopkgtest-root-arg= --autopkgtest-opts="-- schroot ${CHROOT}")
98 if [ "$SKIP_AUTOPKGTEST" = 1 ]; then
99 AUTOPKGTEST_OPTS=()
96100 fi
97101
98102 sbuild --no-source --arch-any --arch-all \
100104 ${DISTRIBUTION:+-d $DISTRIBUTION} \
101105 ${@/#/--extra-package=} \
102106 "${AUTOPKGTEST_OPTS[@]}" \
103 ${DEBSRC}_${DEBVER}.dsc
104 changestool ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes adddsc ${DEBSRC}_${DEBVER}.dsc
107 "$SRCNAME.dsc"
108 if [ "$SKIP_AUTOPKGTEST" != 1 ]; then
109 report "analyzing autopkgtest log: $BUILDNAME.test.log"
110 # this is a bit of a hack but works OK for now, until sbuild supports %SBUILD_BUILD_DIR in --autopkgtest-opt
111 sed -ne '/autopkgtest .*: testing package .* version .*/,$p' "$BUILDNAME.build" > "$BUILDNAME.test.log"
112 "$SCRIPTDIR/dev/rust-regressions.sh" "$BUILDNAME.test.log"
113 fi
114 changestool "$BUILDNAME.changes" adddsc "$SRCNAME.dsc"
115 report "build complete: $BUILDNAME.changes"
105116
106117 # sign if not UNRELEASED
107118 if echo "$DEBDIST" | grep -qv UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
108 debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID }--no-re-sign ${DEBSRC}_${DEBVER}_${DEB_HOST_ARCH}.changes
119 debsign ${DEBSIGN_KEYID:+-k $DEBSIGN_KEYID }--no-re-sign "$BUILDNAME.changes"
109120 fi
1515 local c=0
1616 local url="$1"
1717 local name="$(zegrep -o 'autopkgtest \[[0-9:]+\]: testing package [^[:space:]]+' "$url" | cut '-d ' -f5)"
18 if zegrep -q '^error\[E0554\]' "$url"; then
18 if zegrep -q '^error\[E0554\]' "$url" && \
19 ! zegrep -q "^cargo-auto-test: re-running test with RUSTC_BOOTSTRAP due to E0554" "$url"; then
1920 results["falsepositive_unstable"]+="$name"$'\n'
2021 c=$((c+1))
2122 fi
5757 PKGCFG="$PKGDIR/debian/debcargo.toml"
5858
5959 mkdir -p "$(dirname $BUILDDIR)"
60 cp "$PWD/build.sh" "$PWD/build/build.sh"
60 ln -srf "$PWD/build.sh" "$PWD/build/build.sh"
6161 chmod +x "$PWD/build/build.sh"
6262
6363 if [ -z "$CRATE" ]; then