1 #!/bin/sh -- # no runable script, just for vi
5 # we all like colorful messages
6 if [ "$MSGCOLOR" != 'NO' ]; then
7 if [ ! -t 1 ]; then # but check that we output to a terminal
13 if [ "$MSGCOLOR" != 'NO' ]; then
14 CERROR
="\033[1;31m" # red
15 CWARNING
="\033[1;33m" # yellow
16 CMSG
="\033[1;32m" # green
17 CINFO
="\033[1;96m" # light blue
18 CDEBUG
="\033[1;94m" # blue
19 CNORMAL
="\033[0;39m" # default system console color
20 CDONE
="\033[1;32m" # green
21 CPASS
="\033[1;32m" # green
22 CFAIL
="\033[1;31m" # red
23 CCMD
="\033[1;35m" # pink
26 msgdie
() { printf "${CERROR}E: $1${CNORMAL}\n" >&2; exit 1; }
27 msgwarn
() { printf "${CWARNING}W: $1${CNORMAL}\n" >&2; }
28 msgmsg
() { printf "${CMSG}$1${CNORMAL}\n"; }
29 msginfo
() { printf "${CINFO}I: $1${CNORMAL}\n"; }
30 msgdebug
() { printf "${CDEBUG}D: $1${CNORMAL}\n"; }
31 msgdone
() { printf "${CDONE}DONE${CNORMAL}\n"; }
32 msgnwarn
() { printf "${CWARNING}W: $1${CNORMAL}" >&2; }
33 msgnmsg
() { printf "${CMSG}$1${CNORMAL}"; }
34 msgninfo
() { printf "${CINFO}I: $1${CNORMAL}"; }
35 msgndebug
() { printf "${CDEBUG}D: $1${CNORMAL}"; }
38 printf "${CINFO}$1${CCMD} "
39 printf -- "$(echo "$2" | sed -e 's#^apt\([cgfs]\)#apt-\1#')${CINFO} "
41 if [ -n "$1" ]; then shift; else break; fi
45 msgpass
() { printf "${CPASS}PASS${CNORMAL}\n"; }
46 msgskip
() { printf "${CWARNING}SKIP${CNORMAL}\n" >&2; }
48 if [ $# -gt 0 ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
49 else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
50 EXIT_CODE
=$((EXIT_CODE+1));
53 # enable / disable Debugging
54 MSGLEVEL
=${MSGLEVEL:-3}
55 if [ $MSGLEVEL -le 0 ]; then
58 if [ $MSGLEVEL -le 1 ]; then
62 if [ $MSGLEVEL -le 2 ]; then
66 msgpass
() { printf " ${CPASS}P${CNORMAL}"; }
67 msgskip
() { printf " ${CWARNING}S${CNORMAL}" >&2; }
68 if [ -n "$CFAIL" ]; then
69 msgfail
() { printf " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
71 msgfail
() { printf " ###FAILED###" >&2; EXIT_CODE
=$((EXIT_CODE+1)); }
74 if [ $MSGLEVEL -le 3 ]; then
78 if [ $MSGLEVEL -le 4 ]; then
83 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
84 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
85 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
86 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
87 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
90 printf "${CDONE}DONE${CNORMAL}\n";
94 if [ -f .
/aptconfig.conf
]; then
95 echo "./aptconfig.conf"
96 elif [ -f ..
/aptconfig.conf
]; then
97 echo "../aptconfig.conf"
101 msgdebug
"Executing: ${CCMD}$*${CDEBUG} "
105 sh
|aptitude
|*/*|command) ;;
106 *) CMD
="${BUILDDIRECTORY}/$CMD";;
108 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${LIBRARYPATH} $CMD "$@"
110 aptconfig
() { runapt apt
-config "$@"; }
111 aptcache
() { runapt apt
-cache "$@"; }
112 aptcdrom
() { runapt apt
-cdrom "$@"; }
113 aptget
() { runapt apt
-get "$@"; }
114 aptftparchive
() { runapt apt
-ftparchive "$@"; }
115 aptkey
() { runapt apt
-key "$@"; }
116 aptmark
() { runapt apt
-mark "$@"; }
117 aptsortpkgs
() { runapt apt
-sortpkgs "$@"; }
118 apt
() { runapt apt
"$@"; }
119 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
120 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
121 aptitude
() { runapt aptitude
"$@"; }
122 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
123 aptinternalsolver
() { runapt
"${APTINTERNALSOLVER}" "$@"; }
126 command dpkg
--root=${TMPWORKINGDIRECTORY}/rootdir
--force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/dpkg.log
"$@"
128 dpkgcheckbuilddeps
() {
129 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
134 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
137 # see apt-key for the whole trickery. Setup is done in setupenvironment
138 command gpg
--ignore-time-conflict --no-options --no-default-keyring \
139 --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \
140 --no-auto-check-trustdb --trust-model always \
145 # error if we about to overflow, but ...
146 # "255 failures ought to be enough for everybody"
147 if [ $EXIT_CODE -gt 255 ]; then
148 msgdie
"Total failure count $EXIT_CODE too big"
150 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
153 shellsetedetector
() {
155 if [ "$exit_status" != '0' ]; then
156 printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n"
157 if [ "$EXIT_CODE" = '0' ]; then
158 EXIT_CODE
="$exit_status"
164 if [ "$1" = 'prefix' ]; then
165 CURRENTTRAP
="$2 $CURRENTTRAP"
167 CURRENTTRAP
="$CURRENTTRAP $1"
169 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
173 TMPWORKINGDIRECTORY
=$(mktemp -d)
174 TESTDIRECTORY
=$(readlink -f $(dirname $0))
175 msgninfo
"Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "
177 # allow overriding the default BUILDDIR location
178 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
179 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
180 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
181 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
182 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
183 APTINTERNALSOLVER
=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
184 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
187 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
188 cd $TMPWORKINGDIRECTORY
189 mkdir rootdir aptarchive keys
191 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
192 mkdir -p var
/cache var
/lib
/apt var
/log tmp
193 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
194 touch var
/lib
/dpkg
/available
196 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
197 if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
198 mkdir -p usr
/lib
/apt
/solvers
199 ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr
/lib
/apt
/solvers
/dump
200 ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr
/lib
/apt
/solvers
/apt
201 echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc
/apt
/apt.conf.d
/externalsolver.conf
203 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
205 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
206 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
208 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
211 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
212 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
213 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
215 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
216 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
217 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
219 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
220 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
221 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
222 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
223 echo "Debug::NoLocking \"true\";" >> aptconfig.conf
224 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
225 echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf
226 echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
227 echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
228 echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
229 echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
230 echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
231 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
232 echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf
# Added to test multiarch before dpkg is ready for it…
234 echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
235 echo 'quiet::NoUpdate "true";' >> aptconfig.conf
236 echo 'quiet::NoStatistic "true";' >> aptconfig.conf
237 echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
238 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
239 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
241 # gpg needs a trustdb to function, but it can't be invalid (not even empty)
242 # see also apt-key where this trickery comes from:
243 local TRUSTDBDIR
="${TMPWORKINGDIRECTORY}/gnupghome"
245 chmod 700 "$TRUSTDBDIR"
246 # We also don't use a secret keyring, of course, but gpg panics and
247 # implodes if there isn't one available - and writeable for imports
248 local SECRETKEYRING
="${TRUSTDBDIR}/secring.gpg"
250 # now create the trustdb with an (empty) dummy keyring
251 # newer gpg versions are fine without it, but play it safe for now
252 gpg
--quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev
/null
2>&1
254 # cleanup the environment a bit
255 # prefer our apt binaries over the system apt binaries
256 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
257 export LC_ALL
=C.UTF
-8
258 unset LANGUAGE APT_CONFIG
259 unset GREP_OPTIONS DEB_BUILD_PROFILES
265 if [ "$1" = "native" -o -z "$1" ]; then
266 eval `aptconfig shell ARCH APT::Architecture`
267 if [ -n "$ARCH" ]; then
270 dpkg
--print-architecture
278 echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
281 getarchitecturesfromcommalist
() {
282 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
285 configarchitecture
() {
287 echo "APT::Architecture \"$(getarchitecture $1)\";"
288 while [ -n "$1" ]; do
289 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
292 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
297 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
298 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
299 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
300 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
302 echo -n > rootdir/var/lib/dpkg/status
305 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
306 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
307 local ARCHS="$(getarchitectures)"
308 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
309 DPKGARCH="$(dpkg --print-architecture)"
310 for ARCH in ${ARCHS}; do
311 if [ "${ARCH}" != "${DPKGARCH}" ]; then
312 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
313 # old-style used e.g. in Ubuntu-P – and as it seems travis
314 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
315 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
319 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
320 # dpkg doesn't really check the version as long as it is fully installed,
321 # but just to be sure we choose one above the required version
322 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
328 configcompression() {
329 while [ -n "$1" ]; do
331 '.') printf ".
\t.
\tcat
\n";;
332 'gz') printf "gzip\tgz
\tgzip
\n";;
333 'bz2') printf "bzip2\tbz
2\tbzip
2\n";;
334 'lzma') printf "lzma
\tlzma
\txz
--format=lzma
\n";;
335 'xz') printf "xz
\txz
\txz
\n";;
336 *) printf "$1\t$1\t$1\n";;
339 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
342 setupsimplenativepackage() {
346 local RELEASE="${4:-unstable}"
347 local DEPENDENCIES="$5"
348 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
349 If you
find such a package installed on your system
,
350 something went horribly wrong
! They are autogenerated
351 und used only by testcases and surf no other propose…
"}"
353 local SECTION
="${7:-others}"
355 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
358 DISTSECTION
="$(echo "$SECTION" | cut -d'/' -f 1)"
360 local BUILDDIR
=incoming
/${NAME}-${VERSION}
361 mkdir -p ${BUILDDIR}/debian
/source
363 echo "* most suckless software product ever" > FEATURES
364 test -e debian
/copyright
|| echo "Copyleft by Joe Sixpack $(date +%Y)" > debian
/copyright
365 test -e debian
/changelog
|| echo "$NAME ($VERSION) $RELEASE; urgency=low
369 -- Joe Sixpack <joe@example.org> $(date -R)" > debian
/changelog
370 test -e debian
/control
|| echo "Source: $NAME
373 Maintainer: Joe Sixpack <joe@example.org>
374 Build-Depends: debhelper (>= 7)
375 Standards-Version: 3.9.1
377 Package: $NAME" > debian
/control
378 if [ "$ARCH" = 'all' ]; then
379 echo "Architecture: all" >> debian
/control
381 echo "Architecture: any" >> debian
/control
383 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian
/control
384 echo "Description: $DESCRIPTION" >> debian
/control
386 test -e debian
/compat
|| echo "7" > debian
/compat
387 test -e debian
/source
/format
|| echo "3.0 (native)" > debian
/source
/format
388 test -e debian
/rules
|| cp /usr
/share
/doc
/debhelper
/examples
/rules.tiny debian
/rules
392 buildsimplenativepackage
() {
396 local RELEASE
="${4:-unstable}"
397 local DEPENDENCIES
="$5"
398 local DESCRIPTION
="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
399 If you find such a package installed on your system,
400 something went horribly wrong! They are autogenerated
401 und used only by testcases and surf no other propose…"}"
403 local SECTION="${7:-others}"
404 local PRIORITY="${8:-optional}"
406 local COMPRESS_TYPE="${10:-gzip}"
408 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
411 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
413 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
415 msgninfo "Build package
${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}…
"
416 mkdir -p $BUILDDIR/debian/source
417 echo "* most suckless software product ever
" > ${BUILDDIR}/FEATURES
419 echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
421 echo "Copyleft by Joe Sixpack
$(date +%Y)" > ${BUILDDIR}/debian/copyright
422 echo "$NAME ($VERSION) $RELEASE; urgency
=low
426 -- Joe Sixpack
<joe@example.org
> $(date -R)" > ${BUILDDIR}/debian/changelog
430 Maintainer
: Joe Sixpack
<joe@example.org
>
431 Standards
-Version: 3.9.3" > ${BUILDDIR}/debian/control
432 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
433 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
435 Package
: $NAME" >> ${BUILDDIR}/debian/control
437 if [ "$ARCH" = 'all' ]; then
438 echo "Architecture
: all
" >> ${BUILDDIR}/debian/control
440 echo "Architecture
: any
" >> ${BUILDDIR}/debian/control
442 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
443 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
444 echo "Description
: $DESCRIPTION" >> ${BUILDDIR}/debian/control
446 echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
447 (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
449 echo "pool
/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
450 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
451 # gpg --yes --secret-keyring ./keys/joesixpack.sec \
452 # --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \
453 # --clearsign -o "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
454 # mv "${BUILDDIR}/..
/${SRC}.sign
" "${BUILDDIR}/..
/$SRC"
458 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
459 rm -rf ${BUILDDIR}/debian/tmp
460 mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
461 cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
462 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}
463 if [ -n "$FILE_TREE" ]; then
464 cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp
467 (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
468 (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
469 local LOG="${BUILDDIR}/..
/${NAME}_
${VERSION}_
${arch}.dpkg
-deb.log
"
470 # ensure the right permissions as dpkg-deb ensists
471 chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
472 if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
477 echo "pool
/${NAME}_
${VERSION}_
${arch}.deb
" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
480 mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
481 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
482 cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
491 local ARCH=$(getarchitecture $4)
492 local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
493 local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
494 msgninfo "Build package
${PKGNAME} for ${RELEASE} in ${SECTION}…
"
496 if [ "$ARCH" = "all
" ]; then
497 ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
499 if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
503 local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
504 local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
507 echo "pool
/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist
510 echo "pool
/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
516 if [ -d incoming ]; then
517 buildaptarchivefromincoming "$@
"
519 buildaptarchivefromfiles "$@
"
523 createaptftparchiveconfig() {
524 local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
525 COMPRESSORS="${COMPRESSORS%* }"
526 local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb
$#\
1#' | tr '\n' ' ')"
527 if [ -z "$ARCHS" ]; then
528 # the pool is empty, so we will operate on faked packages - let us use the configured archs
529 ARCHS
="$(getarchitectures)"
532 ArchiveDir "' >> ftparchive.conf
533 echo -n $(readlink -f .) >> ftparchive.conf
535 CacheDir "' >> ftparchive.conf
536 echo -n $(readlink -f ..) >> ftparchive.conf
538 FileListDir "' >> ftparchive.conf
539 echo -n $(readlink -f pool/) >> ftparchive.conf
543 Packages::Compress "'"$COMPRESSORS"'";
544 Sources::Compress "'"$COMPRESSORS"'";
545 Contents::Compress "'"$COMPRESSORS"'";
546 Translation::Compress "'"$COMPRESSORS"'";
547 LongDescription "false";
551 SrcDirectory "pool/";
557 Label "apttestcases";
559 Description "repository with dummy packages";
560 Architectures "' >> ftparchive.conf
561 echo -n "$ARCHS" >> ftparchive.conf
565 };' >> ftparchive.conf
566 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
567 echo -n 'tree "dists/' >> ftparchive.conf
568 echo -n "$DIST" >> ftparchive.conf
570 Architectures "' >> ftparchive.conf
571 echo -n "$ARCHS" >> ftparchive.conf
573 FileList "' >> ftparchive.conf
574 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
576 SourceFileList "' >> ftparchive.conf
577 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
579 Sections "' >> ftparchive.conf
580 echo -n "$(find ./pool/ -maxdepth 1 -name "${DIST}.*.pkglist" -type f | cut -d'/' -f 3 | cut -d'.' -f 2 | sort | uniq | tr '\n' ' ')" >> ftparchive.conf
582 };' >> ftparchive.conf
586 buildaptftparchivedirectorystructure
() {
587 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
588 for DIST
in $DISTS; do
589 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
590 for SECTION
in $SECTIONS; do
591 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
592 for ARCH
in $ARCHS; do
593 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
595 mkdir -p dists
/${DIST}/${SECTION}/source
596 mkdir -p dists
/${DIST}/${SECTION}/i18n
606 local DEPENDENCIES
="$5"
607 local PRIORITY
="${6:-optional}"
608 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
609 If you find such a package installed on your system,
610 something went horribly wrong! They are autogenerated
611 und used only by testcases and surf no other propose…"}"
613 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
614 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
615 ARCHS="$(getarchitectures)"
619 for BUILDARCH in $ARCHS; do
620 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
621 mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source
622 touch aptarchive/dists/${RELEASE}/main/source/Sources
623 local FILE="${PPATH}/Packages
"
628 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
629 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
630 echo "Version
: $VERSION
631 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
632 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
633 echo "Description
: $DESCRIPTION" >> $FILE
644 local DEPENDENCIES="$5"
646 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
648 local FILE="${SPATH}/Sources
"
652 Maintainer
: Joe Sixpack
<joe@example.org
>
653 Architecture
: $ARCH" >> $FILE
654 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
656 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.dsc
657 d41d8cd98f00b204e9800998ecf8427e
0 ${NAME}_
${VERSION}.
tar.gz
661 insertinstalledpackage() {
665 local DEPENDENCIES="$4"
666 local PRIORITY="${5:-optional}"
667 local STATUS="${6:-install ok installed}"
668 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
669 If you
find such a package installed on your system
,
670 something went horribly wrong
! They are autogenerated
671 und used only by testcases and surf no other propose…
"}"
673 local FILE
='rootdir/var/lib/dpkg/status'
674 local INFO
='rootdir/var/lib/dpkg/info'
675 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
681 Maintainer: Joe Sixpack <joe@example.org>
682 Version: $VERSION" >> $FILE
683 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
684 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
685 echo "Description: $DESCRIPTION" >> $FILE
687 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
688 echo -n > ${INFO}/${NAME}:${arch}.list
690 echo -n > ${INFO}/${NAME}.list
696 buildaptarchivefromincoming
() {
697 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
699 [ -e pool
] || ln -s ..
/incoming pool
700 [ -e ftparchive.conf
] || createaptftparchiveconfig
701 [ -e dists
] || buildaptftparchivedirectorystructure
702 msgninfo
"\tGenerate Packages, Sources and Contents files… "
703 aptftparchive
-qq generate ftparchive.conf
709 buildaptarchivefromfiles
() {
710 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
711 find aptarchive
-name 'Packages' -o -name 'Sources' | while read line
; do
712 msgninfo
"\t${line} file… "
713 compressfile
"$line" "$1"
716 generatereleasefiles
"$@"
720 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
721 if [ "$compressor" = '.' ]; then
727 cat "$1" | $command > "${1}.${extension}"
729 touch -d "$2" "${1}.${extension}"
734 # can be overridden by testcases for their pleasure
735 getcodenamefromsuite
() {
737 unstable
) echo 'sid';;
741 getreleaseversionfromsuite
() { true
; }
742 getlabelfromsuite
() { true
; }
744 generatereleasefiles
() {
745 # $1 is the Date header and $2 is the ValidUntil header to be set
746 # both should be given in notation date/touch can understand
747 msgninfo
"\tGenerate Release files… "
748 if [ -e aptarchive
/dists
]; then
749 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
750 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
751 local CODENAME
="$(getcodenamefromsuite $SUITE)"
752 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
753 local LABEL
="$(getlabelfromsuite $SUITE)"
754 if [ -n "$VERSION" ]; then
755 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
757 if [ -n "$LABEL" ]; then
758 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
760 aptftparchive
-qq release
$dir \
761 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
762 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
765 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
766 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
768 NotAutomatic: yes' $dir/Release
770 if [ -n "$1" -a "$1" != "now" ]; then
771 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
775 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
779 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
781 if [ -n "$1" -a "$1" != "now" ]; then
782 for release
in $(find ./aptarchive -name 'Release'); do
783 touch -d "$1" $release
789 setupdistsaptarchive
() {
790 local APTARCHIVE
=$(readlink -f ./aptarchive)
791 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
792 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
793 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
794 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
795 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
796 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
797 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
802 setupflataptarchive
() {
803 local APTARCHIVE
=$(readlink -f ./aptarchive)
804 if [ -f ${APTARCHIVE}/Packages
]; then
805 msgninfo
"\tadd deb sources.list line… "
806 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
809 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
811 if [ -f ${APTARCHIVE}/Sources
]; then
812 msgninfo
"\tadd deb-src sources.list line… "
813 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
816 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
822 if [ -e aptarchive
/dists
]; then
828 if [ "$1" != '--no-update' ]; then
829 msgninfo
"\tSync APT's cache with the archive… "
836 local SIGNER
="${1:-Joe Sixpack}"
837 local GPG
="gpg --batch --yes"
838 msgninfo
"\tSign archive with $SIGNER key… "
839 local REXKEY
='keys/rexexpired'
840 local SECEXPIREBAK
="${REXKEY}.sec.bak"
841 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
842 if [ "${SIGNER}" = 'Rex Expired' ]; then
843 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
844 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
845 # therefore we 'temporary' make the key not expired and restore a backup after signing
846 cp ${REXKEY}.sec
$SECEXPIREBAK
847 cp ${REXKEY}.pub
$PUBEXPIREBAK
848 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
849 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
850 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
851 cp $SECUNEXPIRED ${REXKEY}.sec
852 cp $PUBUNEXPIRED ${REXKEY}.pub
854 printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub
--secret-keyring ${REXKEY}.sec
--command-fd 0 --edit-key "${SIGNER}" >/dev
/null
2>&1 || true
855 cp ${REXKEY}.sec
$SECUNEXPIRED
856 cp ${REXKEY}.pub
$PUBUNEXPIRED
859 for KEY
in $(find keys/ -name '*.sec'); do
860 GPG
="$GPG --secret-keyring $KEY"
862 for KEY
in $(find keys/ -name '*.pub'); do
863 GPG
="$GPG --keyring $KEY"
865 for RELEASE
in $(find aptarchive/ -name Release); do
866 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
867 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
868 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
869 # we might have set a specific date for the Release file, so copy it
870 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
872 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
873 mv -f $SECEXPIREBAK ${REXKEY}.sec
874 mv -f $PUBEXPIREBAK ${REXKEY}.pub
880 msgtest
"Set webserver config option '${1}' to" "$2"
881 local DOWNLOG
='rootdir/tmp/download-testfile.log'
882 local STATUS
='rootdir/tmp/webserverconfig.status'
883 rm -f "$STATUS" "$DOWNLOG"
884 if downloadfile
"http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then
887 cat "$DOWNLOG" "$STATUS"
890 testwebserverlaststatuscode
'200'
893 rewritesourceslist
() {
894 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
895 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
896 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#"
900 # wait for up to 10s for a pid file to appear to avoid possible race
901 # when a helper is started and dosn't write the PID quick enough
904 for i
in $(seq 10); do
905 if test -s "$PIDFILE"; then
910 msgdie
"waiting for $PIDFILE failed"
914 changetowebserver
() {
915 if [ "$1" != '--no-rewrite' ]; then
916 rewritesourceslist
'http://localhost:8080/'
920 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
922 local LOG
="webserver.log"
923 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
927 waitforpidfile aptwebserver.pid
928 local PID
="$(cat aptwebserver.pid)"
929 if [ -z "$PID" ]; then
930 msgdie
'Could not fork aptwebserver successfully'
935 msgdie
'You have to build aptwerbserver or install a webserver'
939 changetohttpswebserver
() {
940 if ! which stunnel4
>/dev
/null
; then
941 msgdie
'You need to install stunnel4 for https testcases'
943 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
944 changetowebserver
--no-rewrite "$@"
946 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
947 cert = ${TESTDIRECTORY}/apt.pem
953 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
954 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
955 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
956 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
957 if [ -z "$PID" ]; then
958 msgdie
'Could not fork stunnel4 successfully'
960 addtrap
'prefix' "kill ${PID};"
961 rewritesourceslist
'https://localhost:4433/'
965 mkdir -p rootdir
/media
/cdrom
/.disk
966 local CD
="$(readlink -f rootdir/media/cdrom)"
967 echo "acquire::cdrom::mount \"${CD}\";
968 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
969 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
970 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
971 echo -n "$1" > ${CD}/.disk
/info
972 if [ ! -d aptarchive
/dists
]; then
973 msgdie
'Flat file archive cdroms can not be created currently'
976 mv aptarchive
/dists
"$CD"
977 ln -s "$(readlink -f ./incoming)" $CD/pool
978 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
979 # start with an unmounted disk
980 mv "${CD}" "${CD}-unmounted"
981 # we don't want the disk to be modifiable
982 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
983 chmod -R -w rootdir
/media
/cdrom
-unmounted/dists
987 local PROTO
="$(echo "$1" | cut -d':' -f 1 )"
988 apthelper
-o Debug
::Acquire
::${PROTO}=1 \
989 download
-file "$1" "$2" 2>&1 || true
990 # only if the file exists the download was successful
999 local DIFFTEXT
="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
1000 if [ -n "$DIFFTEXT" ]; then
1002 echo >&2 "$DIFFTEXT"
1012 msgtest
"Test for correctness of file" "$FILE"
1013 if [ -z "$*" ]; then
1014 echo -n "" | checkdiff
$FILE - && msgpass
|| msgfail
1016 echo "$*" | checkdiff
$FILE - && msgpass
|| msgfail
1021 msgtest
"Test for no output of" "$*"
1022 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
1023 if $
* >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
1032 local MSG
='Test of equality of'
1033 if [ "$1" = '--nomsg' ]; then
1038 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1039 echo "$1" > $COMPAREFILE
1042 if [ -n "$MSG" ]; then
1045 $
* 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1049 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1050 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1051 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1052 echo "$1" > $COMPAREFILE1
1053 echo "$2" > $COMPAREFILE2
1055 msgtest
"Test for equality OR of" "$*"
1056 $
* >$COMPAREAGAINST 2>&1 || true
1057 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1058 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1062 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}"
1063 checkdiff
$COMPAREFILE1 $COMPAREAGAINST || true
1064 echo -n "${CINFO}Diff against OR 2${CNORMAL}"
1065 checkdiff
$COMPAREFILE2 $COMPAREAGAINST || true
1071 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1074 while [ -n "$1" ]; do
1076 N: Can't select versions from package '$1' as it is purely virtual"
1077 PACKAGE
="${PACKAGE} $1"
1080 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1082 N: No packages found"
1083 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1084 local ARCH
="$(getarchitecture 'native')"
1085 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
1086 aptcache show
-q=0 $PACKAGE 2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1090 msgtest
"Test for non-existent packages" "apt-cache show $*"
1091 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1092 if [ -n "$SHOWPKG" ]; then
1101 testdpkginstalled
() {
1102 msgtest
"Test for correctly installed package(s) with" "dpkg -l $*"
1103 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
1104 if [ "$PKGS" != $# ]; then
1106 dpkg
-l "$@" | grep '^[a-z]' >&2
1113 testdpkgnotinstalled
() {
1114 msgtest
"Test for correctly not-installed package(s) with" "dpkg -l $*"
1115 local PKGS
="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
1116 if [ "$PKGS" != 0 ]; then
1118 dpkg
-l "$@" | grep '^[a-z]' >&2
1126 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1127 if [ -n "$1" ]; then
1128 msgtest
'Test for correctly marked as auto-installed' "$*"
1129 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1131 msgtest
'Test for correctly marked as auto-installed' 'no package'
1132 echo -n > $COMPAREFILE
1134 aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - && msgpass
|| msgfail
1138 if [ "$1" = '--nomsg' ]; then
1141 msgtest
'Test for successful execution of' "$*"
1143 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1144 if $@
>${OUTPUT} 2>&1; then
1154 if [ "$1" = '--nomsg' ]; then
1157 msgtest
'Test for failure in execution of' "$*"
1159 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1160 if $@
>${OUTPUT} 2>&1; then
1169 testwebserverlaststatuscode
() {
1170 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1171 local STATUS
='rootdir/tmp/webserverstatus-statusfile.log'
1172 rm -f "$DOWNLOG" "$STATUS"
1173 msgtest
'Test last status code from the webserver was' "$1"
1174 downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG"
1175 if [ "$(cat "$STATUS")" = "$1" ]; then
1179 if [ -n "$2" ]; then
1181 echo >&2 '#### Additionally provided output files contain:'
1184 echo >&2 '#### Download log of the status code:'
1186 msgfail
"Status was $(cat "$STATUS")"
1191 echo "STOPPED execution. Press enter to continue"