1 #!/bin/sh -- # no runable script, just for vi
6 if [ "$1" = "-q" ]; then
8 elif [ "$1" = "-v" ]; then
10 elif [ "$1" = '--color=no' ]; then
13 echo >&2 "WARNING: Unknown parameter »$1« will be ignored"
17 export MSGLEVEL
="${MSGLEVEL:-3}"
19 # we all like colorful messages
20 if [ "$MSGCOLOR" != 'NO' ] && [ "$MSGCOLOR" != 'ALWAYS' ]; then
21 if [ ! -t 1 ]; then # but check that we output to a terminal
27 if [ "$MSGCOLOR" != 'NO' ]; then
28 CERROR
="\033[1;31m" # red
29 CWARNING
="\033[1;33m" # yellow
30 CMSG
="\033[1;32m" # green
31 CINFO
="\033[1;96m" # light blue
32 CDEBUG
="\033[1;94m" # blue
33 CNORMAL
="\033[0;39m" # default system console color
34 CDONE
="\033[1;32m" # green
35 CPASS
="\033[1;32m" # green
36 CFAIL
="\033[1;31m" # red
37 CCMD
="\033[1;35m" # pink
49 printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghs]\)#apt-\1#')"
55 msgdie
() { msgprintf
"${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; }
56 msgwarn
() { msgprintf
"${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; }
57 msgmsg
() { msgprintf
"${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; }
58 msginfo
() { msgprintf
"${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; }
59 msgdebug
() { msgprintf
"${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; }
60 msgdone
() { msgprintf
"${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; }
61 msgnwarn
() { msgprintf
"${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; }
62 msgnmsg
() { msgprintf
"${CMSG}%s" '%s' "${CNORMAL}" "$@"; }
63 msgninfo
() { msgprintf
"${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; }
64 msgndebug
() { msgprintf
"${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; }
65 msgtest
() { msgprintf
"${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; }
66 msgpass
() { printf "${CPASS}PASS${CNORMAL}\n"; }
68 if [ -n "$MSGTEST_MSG" ]; then
69 echo -n "$MSGTEST_MSG"
72 if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2;
73 else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi
76 if [ -n "$MSGTEST_MSG" ]; then
77 echo -n "$MSGTEST_MSG"
80 if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
81 else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
82 if [ -n "$APT_DEBUG_TESTS" ]; then
85 EXIT_CODE
=$((EXIT_CODE+1));
88 # enable / disable Debugging
89 if [ $MSGLEVEL -le 0 ]; then
92 if [ $MSGLEVEL -le 1 ]; then
96 if [ $MSGLEVEL -le 2 ]; then
99 msgtest
() { MSGTEST_MSG
="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")"; }
100 msgpass
() { printf " ${CPASS}P${CNORMAL}"; }
102 if [ $MSGLEVEL -le 3 ]; then
106 if [ $MSGLEVEL -le 4 ]; then
108 msgndebug
() { true
; }
111 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
112 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
113 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
114 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
115 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
118 printf "${CDONE}DONE${CNORMAL}\n";
122 if [ -f .
/aptconfig.conf
]; then
123 echo "$(readlink -f ./aptconfig.conf)"
124 elif [ -f ..
/aptconfig.conf
]; then
125 echo "$(readlink -f ../aptconfig.conf)"
126 elif [ -f ..
/..
/aptconfig.conf
]; then
127 echo "$(readlink -f ../../aptconfig.conf)"
128 elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then
129 echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")"
133 msgdebug
"Executing: ${CCMD}$*${CDEBUG} "
137 sh
|aptitude
|*/*|command) ;;
138 *) CMD
="${BUILDDIRECTORY}/$CMD";;
140 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${LIBRARYPATH} $CMD "$@"
142 aptconfig
() { runapt apt
-config "$@"; }
143 aptcache
() { runapt apt
-cache "$@"; }
144 aptcdrom
() { runapt apt
-cdrom "$@"; }
145 aptget
() { runapt apt
-get "$@"; }
146 aptftparchive
() { runapt apt
-ftparchive "$@"; }
147 aptkey
() { runapt apt
-key "$@"; }
148 aptmark
() { runapt apt
-mark "$@"; }
149 aptsortpkgs
() { runapt apt
-sortpkgs "$@"; }
150 apt
() { runapt apt
"$@"; }
151 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
152 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
153 aptitude
() { runapt aptitude
"$@"; }
154 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
155 aptinternalsolver
() { runapt
"${APTINTERNALSOLVER}" "$@"; }
156 aptdumpsolver
() { runapt
"${APTDUMPSOLVER}" "$@"; }
159 "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
161 dpkgcheckbuilddeps
() {
162 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
167 aptget
) CMD
="apt-get";;
168 aptcache
) CMD
="apt-cache";;
169 aptcdrom
) CMD
="apt-cdrom";;
170 aptconfig
) CMD
="apt-config";;
171 aptmark
) CMD
="apt-mark";;
172 apthelper
) CMD
="apt-helper";;
173 aptftparchive
) CMD
="apt-ftparchive";;
177 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
181 # error if we about to overflow, but ...
182 # "255 failures ought to be enough for everybody"
183 if [ $EXIT_CODE -gt 255 ]; then
184 msgdie
"Total failure count $EXIT_CODE too big"
186 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
189 shellsetedetector
() {
191 if [ "$exit_status" != '0' ]; then
192 printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n"
193 if [ "$EXIT_CODE" = '0' ]; then
194 EXIT_CODE
="$exit_status"
200 if [ "$1" = 'prefix' ]; then
201 CURRENTTRAP
="$2 $CURRENTTRAP"
203 CURRENTTRAP
="$CURRENTTRAP $1"
205 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
209 # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir)
210 if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then
213 TMPWORKINGDIRECTORY
=$(mktemp -d)
214 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
215 msgninfo
"Preparing environment for $(basename $0) in ${TMPWORKINGDIRECTORY}…"
217 mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded"
218 if [ "$(id -u)" = '0' ]; then
219 # relax permissions so that running as root with user switching works
221 chmod 711 "$TMPWORKINGDIRECTORY"
222 chown _apt
:root
"${TMPWORKINGDIRECTORY}/downloaded"
225 TESTDIRECTORY
=$(readlink -f $(dirname $0))
226 # allow overriding the default BUILDDIR location
227 SOURCEDIRECTORY
=${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}
228 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
229 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
230 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
231 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
232 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
233 APTINTERNALSOLVER
=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
234 APTDUMPSOLVER
=${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}
235 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
238 cd $TMPWORKINGDIRECTORY
239 mkdir rootdir aptarchive keys
241 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
242 mkdir -p usr
/bin var
/cache var
/lib var
/log tmp
243 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
244 touch var
/lib
/dpkg
/available
246 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
247 if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
248 mkdir -p usr
/lib
/apt
/solvers
249 ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr
/lib
/apt
/solvers
/dump
250 ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr
/lib
/apt
/solvers
/apt
251 echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc
/apt
/apt.conf.d
/externalsolver.conf
253 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
255 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
256 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
258 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
261 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
262 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
263 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
265 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
266 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
267 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
269 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
270 chmod 644 $(find keys -name '*.pub' -o -name '*.sec')
271 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
273 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
274 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
275 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
276 echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf
277 # store apt-key were we can access it, even if we run it as a different user
278 # destroys coverage reporting though, so just do it for root for now
279 if [ "$(id -u)" = '0' ]; then
280 cp "${BUILDDIRECTORY}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
281 chmod o
+rx
"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key"
282 echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf
284 echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
287 cat << EOF > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
290 if [ -r "${TMPWORKINGDIRECTORY}/noopchroot.so" ]; then
291 if [ -n "\$LD_PRELOAD" ]; then
292 export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}"
294 export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so"
297 exec fakeroot dpkg --root="${TMPWORKINGDIRECTORY}/rootdir" \\
298 --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log \\
299 --force-not-root --force-bad-path "\$@"
301 chmod +x
"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
302 echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir
/etc
/apt
/apt.conf.d
/99dpkg
305 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
306 echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it…
308 echo 'quiet::NoUpdate "true";'
309 echo 'quiet::NoStatistic "true";'
310 # too distracting for users, but helpful to detect changes
311 echo 'Acquire::Progress::Ignore::ShowErrorText "true";'
312 echo 'Acquire::Progress::Diffpercent "true";'
313 # in testcases, it can appear as if localhost has a rotation setup,
314 # hide this as we can't really deal with it properly
315 echo 'Acquire::Failure::ShowIP "false";'
318 cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem"
319 if [ "$(id -u)" = '0' ]; then
320 chown _apt
:root
"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem"
322 echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
323 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
324 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
326 # create some files in /tmp and look at user/group to get what this means
327 TEST_DEFAULT_USER
="$USER"
328 if [ "$(uname)" = 'GNU/kFreeBSD' ]; then
329 TEST_DEFAULT_GROUP
='root'
331 TEST_DEFAULT_GROUP
="$USER"
334 # Acquire::AllowInsecureRepositories=false is not yet the default
335 # but we want it to be the default soon
336 configallowinsecurerepositories
"false";
338 # cleanup the environment a bit
339 # prefer our apt binaries over the system apt binaries
340 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
341 export LC_ALL
=C.UTF
-8
342 unset LANGUAGE APT_CONFIG
343 unset GREP_OPTIONS DEB_BUILD_PROFILES
348 if [ "$1" = "native" -o -z "$1" ]; then
349 eval `aptconfig shell ARCH APT::Architecture`
350 if [ -n "$ARCH" ]; then
353 dpkg
--print-architecture
361 aptconfig dump
--no-empty --format '%v%n' APT
::Architecture APT
::Architectures
| sort -u | tr '\n' ' '
364 getarchitecturesfromcommalist
() {
365 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
368 configarchitecture
() {
370 echo "APT::Architecture \"$(getarchitecture $1)\";"
371 while [ -n "$1" ]; do
372 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
375 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
380 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
381 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
382 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
383 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
385 echo -n > rootdir/var/lib/dpkg/status
388 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
389 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
390 local ARCHS="$(getarchitectures)"
391 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
392 DPKGARCH="$(dpkg --print-architecture)"
393 for ARCH in ${ARCHS}; do
394 if [ "${ARCH}" != "${DPKGARCH}" ]; then
395 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
396 # old-style used e.g. in Ubuntu-P – and as it seems travis
397 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
398 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
402 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
403 # dpkg doesn't really check the version as long as it is fully installed,
404 # but just to be sure we choose one above the required version
405 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
411 configdpkgnoopchroot() {
412 # create a library to noop chroot() and rewrite maintainer script executions
413 # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
414 # chroot directory dpkg could chroot into to execute the maintainer scripts
415 msgtest 'Building library to preload to make maintainerscript work in' 'dpkg'
416 cat << EOF > noopchroot.c
423 static char * chrootdir = NULL;
425 int chroot(const char *path) {
426 printf("WARNING
: CHROOTing to
%s was ignored
!\n", path);
428 chrootdir = strdup(path);
431 int execvp(const char *file, char *const argv[]) {
432 static int (*func_execvp) (const char *, char * const []) = NULL;
433 if (func_execvp == NULL)
434 func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp
");
435 if (chrootdir == NULL || strncmp(file, "/var
/lib
/dpkg
/", strlen("/var
/lib
/dpkg
/")) != 0)
436 return func_execvp(file, argv);
437 printf("REWRITE execvp call
%s into
%s
\n", file, chrootdir);
438 char newfile[strlen(chrootdir) + strlen(file)];
439 strcpy(newfile, chrootdir);
440 strcat(newfile, file);
441 char const * const baseadmindir = "/var
/lib
/dpkg
";
442 char admindir[strlen(chrootdir) + strlen(baseadmindir)];
443 strcpy(admindir, chrootdir);
444 strcat(admindir, baseadmindir);
445 setenv("DPKG_ADMINDIR
", admindir, 1);
446 return func_execvp(newfile, argv);
449 testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
452 configallowinsecurerepositories() {
453 echo "Acquire
::AllowInsecureRepositories
\"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf
457 configcompression() {
458 while [ -n "$1" ]; do
460 '.') printf ".
\t.
\tcat
\n";;
461 'gz') printf "gzip\tgz
\tgzip
\n";;
462 'bz2') printf "bzip2\tbz
2\tbzip
2\n";;
463 'lzma') printf "lzma
\tlzma
\txz
--format=lzma
\n";;
464 'xz') printf "xz
\txz
\txz
\n";;
465 *) printf "$1\t$1\t$1\n";;
468 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
475 gzip) COMPRESS='gz';;
476 bzip2) COMPRESS='bz2';;
477 lzma) COMPRESS='lzma';;
479 *) msgdie "Compressor
$COMPRESSOR is unknown to framework
, so can
't be forced by forcecompressor!";;
481 local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor"
482 echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; };
483 Dir::Bin::uncompressed \"/does/not/exist\";
484 Dir::Bin::gzip \"/does/not/exist\";
485 Dir::Bin::bzip2 \"/does/not/exist\";
486 Dir::Bin::lzma \"/does/not/exist\";
487 Dir::Bin::xz \"/does/not/exist\";" > "$CONFFILE"
488 if [ -e "/bin/${COMPRESSOR}" ]; then
489 echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE"
490 elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
491 echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> "$CONFFILE"
492 elif [ "${COMPRESSOR}" = 'lzma
' ]; then
493 echo 'Dir
::Bin
::xz
"/usr/bin/xz";' >> "$CONFFILE"
494 COMPRESSOR_CMD='xz
--format=lzma
'
496 msgtest 'Test
for availability of compressor
' "${COMPRESSOR}"
497 msgfail "${COMPRESSOR} not available"
501 setupsimplenativepackage() {
505 local RELEASE="${4:-unstable}"
506 local DEPENDENCIES="$5"
507 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
508 If you find such a package installed on your system,
509 something went horribly wrong! They are autogenerated
510 und used only by testcases and surf no other propose…"}"
512 local SECTION="${7:-others}"
514 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
517 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
519 local BUILDDIR=incoming/${NAME}-${VERSION}
520 mkdir -p ${BUILDDIR}/debian/source
522 echo "* most suckless software product ever" > FEATURES
523 test -e debian/copyright || echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright
524 test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low
528 -- Joe Sixpack <joe@example.org> $(date -R)" > debian/changelog
529 test -e debian/control || echo "Source: $NAME
532 Maintainer: Joe Sixpack <joe@example.org>
533 Build-Depends: debhelper (>= 7)
534 Standards-Version: 3.9.1
536 Package: $NAME" > debian/control
537 if [ "$ARCH" = 'all
' ]; then
538 echo "Architecture: all" >> debian/control
540 echo "Architecture: any" >> debian/control
542 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
543 echo "Description: $DESCRIPTION" >> debian/control
545 test -e debian/compat || echo "7" > debian/compat
546 test -e debian/source/format || echo "3.0 (native)" > debian/source/format
547 test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
551 buildsimplenativepackage() {
554 if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib
' ]; then
555 NM="$(echo "$NAME" | cut -c 1-4)"
557 NM="$(echo "$NAME" | cut -c 1)"
561 local RELEASE="${4:-unstable}"
562 local DEPENDENCIES="$5"
563 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
564 If you find such a package installed on your system,
565 something went horribly wrong! They are autogenerated
566 und used only by testcases and surf no other propose…"}"
568 local SECTION="${7:-others}"
569 local PRIORITY="${8:-optional}"
571 local COMPRESS_TYPE="${10:-gzip}"
573 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
576 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
578 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
580 msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME"
581 mkdir -p $BUILDDIR/debian/source
582 echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES
584 echo '$NAME says
\"Hello
!\"'" > ${BUILDDIR}/${NAME}
586 echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright
587 echo "$NAME ($VERSION) $RELEASE; urgency=low
591 -- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog
594 Maintainer: Joe Sixpack <joe@example.org>
595 Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
596 if [ "$SECTION" != '<none
>' ]; then
597 echo "Section: $SECTION" >> ${BUILDDIR}/debian/control
599 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
600 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
602 Package: $NAME" >> ${BUILDDIR}/debian/control
604 if [ "$ARCH" = 'all
' ]; then
605 echo "Architecture: all" >> ${BUILDDIR}/debian/control
607 echo "Architecture: any" >> ${BUILDDIR}/debian/control
609 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
610 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
611 echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
613 echo '3.0 (native
)' > ${BUILDDIR}/debian/source/format
615 testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION}
617 sed -n 's
#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \
619 echo "pool/${SRC}" >> ${BUILDDIR}/..
/${RELEASE}.
${DISTSECTION}.srclist
620 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
621 # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \
622 # adv --yes --default-key 'Joe Sixpack' \
623 # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
624 # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
628 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
629 msgtest
"Build binary package for ${RELEASE} in ${SECTION}" "$NAME"
630 rm -rf ${BUILDDIR}/debian
/tmp
631 mkdir -p ${BUILDDIR}/debian
/tmp
/DEBIAN
${BUILDDIR}/debian
/tmp
/usr
/share
/doc
/${NAME} ${BUILDDIR}/debian
/tmp
/usr
/bin
632 cp ${BUILDDIR}/debian
/copyright
${BUILDDIR}/debian
/changelog
${BUILDDIR}/FEATURES
${BUILDDIR}/debian
/tmp
/usr
/share
/doc
/${NAME}
633 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian
/tmp
/usr
/bin
/${NAME}-${arch}
634 if [ -n "$FILE_TREE" ]; then
635 cp -ar "$FILE_TREE" ${BUILDDIR}/debian
/tmp
638 (cd ${BUILDDIR}; dpkg
-gencontrol -DArchitecture=$arch)
639 (cd ${BUILDDIR}/debian
/tmp
; md5sum $(find usr/ -type f) > DEBIAN
/md5sums
)
640 local LOG
="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
641 # ensure the right permissions as dpkg-deb insists
642 chmod 755 ${BUILDDIR}/debian
/tmp
/DEBIAN
643 testsuccess
--nomsg dpkg
-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian
/tmp
${BUILDDIR}/..
644 echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/..
/${RELEASE}.
${DISTSECTION}.pkglist
647 local CHANGEPATH
="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}"
649 cp ${BUILDDIR}/debian
/changelog
$CHANGEPATH
658 local ARCH
=$(getarchitecture $4)
659 local PKGNAME
="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
660 local BUILDLOG
="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
661 msgtest
"Build package for ${RELEASE} in ${SECTION}" "$PKGNAME"
663 if [ "$ARCH" = "all" ]; then
664 ARCH
="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
666 testsuccess
--nomsg dpkg
-buildpackage -uc -us -a$ARCH
667 cp ${TMPWORKINGDIRECTORY}/rootdir
/tmp
/testsuccess.output
$BUILDLOG
668 local PKGS
="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
669 local SRCS
="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
672 echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming
/${RELEASE}.
${SECTION}.pkglist
675 echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming
/${RELEASE}.
${SECTION}.srclist
680 if [ -d incoming
]; then
681 buildaptarchivefromincoming
"$@"
683 buildaptarchivefromfiles
"$@"
687 createaptftparchiveconfig
() {
688 local COMPRESSORS
="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
689 local COMPRESSORS
="${COMPRESSORS%* }"
690 local ARCHS
="$(getarchitectures)"
692 ArchiveDir "' >> ftparchive.conf
693 echo -n $(readlink -f .) >> ftparchive.conf
695 CacheDir "' >> ftparchive.conf
696 echo -n $(readlink -f ..) >> ftparchive.conf
698 FileListDir "' >> ftparchive.conf
699 echo -n $(readlink -f pool/) >> ftparchive.conf
703 Packages::Compress "'"$COMPRESSORS"'";
704 Sources::Compress "'"$COMPRESSORS"'";
705 Contents::Compress "'"$COMPRESSORS"'";
706 Translation::Compress "'"$COMPRESSORS"'";
707 LongDescription "false";
711 SrcDirectory "pool/";
717 Label "apttestcases";
719 Description "repository with dummy packages";
720 Architectures "' >> ftparchive.conf
721 echo -n "$ARCHS" >> ftparchive.conf
725 };' >> ftparchive.conf
726 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
727 echo -n 'tree "dists/' >> ftparchive.conf
728 echo -n "$DIST" >> ftparchive.conf
730 Architectures "' >> ftparchive.conf
731 echo -n "$ARCHS" >> ftparchive.conf
733 FileList "' >> ftparchive.conf
734 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
736 SourceFileList "' >> ftparchive.conf
737 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
739 Sections "' >> ftparchive.conf
740 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
742 };' >> ftparchive.conf
746 buildaptftparchivedirectorystructure
() {
747 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
748 for DIST
in $DISTS; do
749 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
750 for SECTION
in $SECTIONS; do
751 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
752 for ARCH
in $ARCHS; do
753 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
755 mkdir -p dists
/${DIST}/${SECTION}/source
756 mkdir -p dists
/${DIST}/${SECTION}/i18n
766 local DEPENDENCIES
="$5"
767 local PRIORITY
="${6:-optional}"
768 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASES}
769 If you find such a package installed on your system,
770 something went horribly wrong! They are autogenerated
771 und used only by testcases and surf no other propose…"}"
773 for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do
774 if [ "$RELEASE" = 'installed' ]; then
775 insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7"
778 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
779 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
780 ARCHS="$(getarchitectures)"
784 for BUILDARCH in $ARCHS; do
785 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
787 local FILE="${PPATH}/Packages
"
792 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
793 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
794 echo "Version
: $VERSION
795 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
796 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
797 echo "Description
: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE
798 echo "Description
-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE
802 mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n
803 touch aptarchive/dists/${RELEASE}/main/source/Sources
805 Description
-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)
806 Description
-en: $DESCRIPTION
807 " >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en
816 local DEPENDENCIES="$5"
817 local BINARY="${6:-$NAME}"
819 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
821 local FILE="${SPATH}/Sources
"
822 local DSCFILE="${NAME}_
${VERSION}.dsc
"
823 local TARFILE="${NAME}_
${VERSION}.
tar.gz
"
827 Maintainer
: Joe Sixpack
<joe@example.org
>
828 Architecture
: $ARCH" >> $FILE
829 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
831 $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) $DSCFILE
832 $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) $TARFILE
836 insertinstalledpackage() {
840 local DEPENDENCIES="$4"
841 local PRIORITY="${5:-optional}"
842 local STATUS="${6:-install ok installed}"
843 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
844 If you
find such a package installed on your system
,
845 something went horribly wrong
! They are autogenerated
846 und used only by testcases and surf no other propose…
"}"
848 local FILE
='rootdir/var/lib/dpkg/status'
849 local INFO
='rootdir/var/lib/dpkg/info'
850 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
856 Maintainer: Joe Sixpack <joe@example.org>
857 Version: $VERSION" >> $FILE
858 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
859 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
860 echo "Description: $DESCRIPTION" >> $FILE
862 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
863 echo -n > ${INFO}/${NAME}:${arch}.list
865 echo -n > ${INFO}/${NAME}.list
871 buildaptarchivefromincoming
() {
872 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
874 [ -e pool
] || ln -s ..
/incoming pool
875 [ -e ftparchive.conf
] || createaptftparchiveconfig
876 [ -e dists
] || buildaptftparchivedirectorystructure
877 msgninfo
"\tGenerate Packages, Sources and Contents files… "
878 testsuccess aptftparchive generate ftparchive.conf
881 generatereleasefiles
"$@"
884 buildaptarchivefromfiles
() {
885 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
886 local DIR
='aptarchive'
887 if [ -d "${DIR}/dists" ]; then DIR
="${DIR}/dists"; fi
888 find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line
; do
889 msgninfo
"\t${line} file… "
890 compressfile
"$line" "$1"
893 generatereleasefiles
"$@"
897 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
898 if [ "$compressor" = '.' ]; then
904 cat "$1" | $command > "${1}.${extension}"
906 touch -d "$2" "${1}.${extension}"
911 # can be overridden by testcases for their pleasure
912 getcodenamefromsuite
() {
914 unstable
) echo 'sid';;
918 getreleaseversionfromsuite
() { true
; }
919 getlabelfromsuite
() { true
; }
920 getoriginfromsuite
() { true
; }
922 generatereleasefiles
() {
923 # $1 is the Date header and $2 is the ValidUntil header to be set
924 # both should be given in notation date/touch can understand
925 msgninfo
"\tGenerate Release files… "
926 if [ -e aptarchive
/dists
]; then
927 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
928 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
929 local CODENAME
="$(getcodenamefromsuite $SUITE)"
930 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
931 local LABEL
="$(getlabelfromsuite $SUITE)"
932 local ORIGIN
="$(getoriginfromsuite $SUITE)"
933 if [ -n "$VERSION" ]; then
934 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
936 if [ -n "$LABEL" ]; then
937 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
939 if [ -n "$ORIGIN" ]; then
940 ORIGIN
="-o APT::FTPArchive::Release::Origin=${ORIGIN}"
942 aptftparchive
-qq release
$dir \
943 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
944 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
948 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
949 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
951 NotAutomatic: yes' $dir/Release
953 if [ -n "$1" -a "$1" != "now" ]; then
954 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
958 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
962 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
964 if [ -n "$1" -a "$1" != "now" ]; then
965 for release
in $(find ./aptarchive -name 'Release'); do
966 touch -d "$1" $release
972 setupdistsaptarchive
() {
973 local APTARCHIVE
=$(readlink -f ./aptarchive)
974 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
975 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
976 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
977 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
978 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
979 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
980 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
985 setupflataptarchive
() {
986 local APTARCHIVE
=$(readlink -f ./aptarchive)
987 if [ -f ${APTARCHIVE}/Packages
]; then
988 msgninfo
"\tadd deb sources.list line… "
989 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
992 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
994 if [ -f ${APTARCHIVE}/Sources
]; then
995 msgninfo
"\tadd deb-src sources.list line… "
996 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
999 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
1005 if [ "$1" = '--no-update' ]; then
1009 buildaptarchive
"$@"
1010 if [ -e aptarchive
/dists
]; then
1011 setupdistsaptarchive
1015 signreleasefiles
'Joe Sixpack'
1016 if [ "1" != "$NOUPDATE" ]; then
1017 testsuccess aptget update
-o Debug
::pkgAcquire
::Worker
=true
-o Debug
::Acquire
::gpgv
=true
1021 signreleasefiles
() {
1022 local SIGNER
="${1:-Joe Sixpack}"
1023 local REPODIR
="${2:-aptarchive}"
1024 local KEY
="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')"
1025 local GPG
="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly adv --batch --yes"
1026 msgninfo
"\tSign archive with $SIGNER key $KEY… "
1027 local REXKEY
='keys/rexexpired'
1028 local SECEXPIREBAK
="${REXKEY}.sec.bak"
1029 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
1030 if [ "${SIGNER}" = 'Rex Expired' ]; then
1031 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
1032 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
1033 # therefore we 'temporary' make the key not expired and restore a backup after signing
1034 cp ${REXKEY}.sec
$SECEXPIREBAK
1035 cp ${REXKEY}.pub
$PUBEXPIREBAK
1036 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
1037 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
1038 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
1039 cp $SECUNEXPIRED ${REXKEY}.sec
1040 cp $PUBUNEXPIRED ${REXKEY}.pub
1042 if ! printf "expire\n1w\nsave\n" | $GPG --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg
2>&1; then
1046 cp ${REXKEY}.sec
$SECUNEXPIRED
1047 cp ${REXKEY}.pub
$PUBUNEXPIRED
1050 for RELEASE
in $(find ${REPODIR}/ -name Release); do
1051 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
1052 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
1053 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
1054 # we might have set a specific date for the Release file, so copy it
1055 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
1057 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
1058 mv -f $SECEXPIREBAK ${REXKEY}.sec
1059 mv -f $PUBEXPIREBAK ${REXKEY}.pub
1064 redatereleasefiles
() {
1065 local DATE
="$(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')"
1066 for release
in $(find aptarchive/ -name 'Release'); do
1067 sed -i "s/^Date: .*$/Date: ${DATE}/" $release
1068 touch -d "$DATE" $release
1070 signreleasefiles
"${2:-Joe Sixpack}"
1074 local WEBSERVER
="${3:-http://localhost:8080}"
1076 if [ "$1" = '--no-check' ]; then
1080 local DOWNLOG
='rootdir/tmp/download-testfile.log'
1081 local STATUS
='downloaded/webserverconfig.status'
1082 rm -f "$STATUS" "$DOWNLOG"
1084 if [ -n "$2" ]; then
1085 msgtest
"Set webserver config option '${1}' to" "$2"
1086 URI
="${WEBSERVER}/_config/set/${1}/${2}"
1088 msgtest
'Clear webserver config option' "${1}"
1089 URI
="${WEBSERVER}/_config/clear/${1}"
1091 if downloadfile
"$URI" "$STATUS" > "$DOWNLOG"; then
1094 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output"
1095 cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true
1096 msgfailoutput
'' "$OUTPUT"
1098 $NOCHECK || testwebserverlaststatuscode
'200'
1101 rewritesourceslist
() {
1102 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
1103 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
1104 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#https://localhost:4433/#${1}#"
1108 # wait for up to 10s for a pid file to appear to avoid possible race
1109 # when a helper is started and dosn't write the PID quick enough
1112 for i
in $(seq 10); do
1113 if test -s "$PIDFILE"; then
1118 msgdie
"waiting for $PIDFILE failed"
1122 changetowebserver
() {
1123 if [ "$1" != '--no-rewrite' ]; then
1124 rewritesourceslist
'http://localhost:8080/'
1128 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
1130 local LOG
="webserver.log"
1131 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
1135 waitforpidfile aptwebserver.pid
1136 local PID
="$(cat aptwebserver.pid)"
1137 if [ -z "$PID" ]; then
1138 msgdie
'Could not fork aptwebserver successfully'
1140 addtrap
"kill $PID;"
1143 msgdie
'You have to build aptwerbserver or install a webserver'
1147 changetohttpswebserver
() {
1148 if ! which stunnel4
>/dev
/null
; then
1149 msgdie
'You need to install stunnel4 for https testcases'
1151 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
1152 changetowebserver
--no-rewrite "$@"
1154 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
1155 cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem
1161 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
1162 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
1163 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
1164 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
1165 if [ -z "$PID" ]; then
1166 msgdie
'Could not fork stunnel4 successfully'
1168 addtrap
'prefix' "kill ${PID};"
1169 rewritesourceslist
'https://localhost:4433/'
1173 mkdir -p rootdir
/media
/cdrom
/.disk
1174 local CD
="$(readlink -f rootdir/media/cdrom)"
1175 echo "acquire::cdrom::mount \"${CD}\";
1176 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
1177 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
1178 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
1179 echo -n "$1" > ${CD}/.disk
/info
1180 if [ ! -d aptarchive
/dists
]; then
1181 msgdie
'Flat file archive cdroms can not be created currently'
1184 mv aptarchive
/dists
"$CD"
1185 ln -s "$(readlink -f ./incoming)" $CD/pool
1186 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
1187 # start with an unmounted disk
1188 mv "${CD}" "${CD}-unmounted"
1189 # we don't want the disk to be modifiable
1190 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
1191 chmod -R 555 rootdir
/media
/cdrom
-unmounted/dists
1195 local PROTO
="${1%%:*}"
1196 if ! apthelper
-o Debug
::Acquire
::${PROTO}=1 -o Debug
::pkgAcquire
::Worker
=1 \
1197 download
-file "$1" "$2" "$3" 2>&1 ; then
1200 # only if the file exists the download was successful
1201 if [ -r "$2" ]; then
1209 local DIFFTEXT
="$(command diff -u "$@" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
1210 if [ -n "$DIFFTEXT" ]; then
1212 echo >&2 "$DIFFTEXT"
1220 local MSG
='Test for correctness of file'
1221 if [ "$1" = '--nomsg' ]; then
1227 if [ -n "$MSG" ]; then
1228 msgtest
"$MSG" "$FILE"
1230 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output"
1231 if [ -z "$*" ]; then
1232 if echo -n "" | checkdiff
- $FILE >"$OUTPUT" 2>&1; then
1235 msgfailoutput
'' "$OUTPUT"
1238 if echo "$*" | checkdiff
- $FILE >"$OUTPUT" 2>&1; then
1241 msgfailoutput
'' "$OUTPUT"
1247 msgtest
"Test for no output of" "$*"
1248 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
1249 if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
1252 msgfailoutput
'' "$COMPAREFILE"
1254 aptautotest
'testempty' "$@"
1258 local MSG
='Test of equality of'
1259 if [ "$1" = '--nomsg' ]; then
1264 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1265 echo "$1" > $COMPAREFILE
1268 if [ -n "$MSG" ]; then
1271 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output"
1272 if "$@" 2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1275 msgfailoutput
'' "$OUTPUT"
1277 aptautotest
'testequal' "$@"
1281 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1282 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1283 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1284 echo "$1" > $COMPAREFILE1
1285 echo "$2" > $COMPAREFILE2
1287 msgtest
"Test for equality OR of" "$*"
1288 "$@" >$COMPAREAGAINST 2>&1 || true
1289 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1290 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1294 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output"
1295 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1
1296 checkdiff
"$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true
1297 echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1
1298 checkdiff
"$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true
1299 msgfailoutput
'' "$OUTPUT"
1301 aptautotest
'testequalor2' "$@"
1305 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1308 while [ -n "$1" ]; do
1310 N: Can't select versions from package '$1' as it is purely virtual"
1311 PACKAGE
="${PACKAGE} $1"
1314 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1316 N: No packages found"
1317 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1318 local ARCH
="$(getarchitecture 'native')"
1319 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE"
1320 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output"
1321 if aptcache show
-q=0 "$PACKAGE" 2>&1 | checkdiff
"$COMPAREFILE" - >"$OUTPUT" 2>&1; then
1324 msgfailoutput
'' "$OUTPUT"
1329 msgtest
"Test for non-existent packages" "apt-cache show $*"
1330 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1331 if [ -n "$SHOWPKG" ]; then
1332 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output"
1333 echo "$SHOWPKG" >"$OUTPUT"
1334 msgfailoutput
'' "$OUTPUT"
1344 msgtest
"Test that $NR package(s) are in state $STATE with" "dpkg -l $*"
1345 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)"
1346 if [ "$PKGS" != $NR ]; then
1347 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output"
1348 echo "$PKGS" >"$OUTPUT"
1349 dpkg
-l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true
1350 msgfailoutput
'' "$OUTPUT"
1356 testdpkginstalled
() {
1357 testdpkgstatus
'ii' "$#" "$@"
1360 testdpkgnotinstalled
() {
1361 testdpkgstatus
'ii' '0' "$@"
1365 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1366 if [ -n "$1" ]; then
1367 msgtest
'Test for correctly marked as auto-installed' "$*"
1368 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1370 msgtest
'Test for correctly marked as auto-installed' 'no package'
1371 echo -n > $COMPAREFILE
1373 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.output"
1374 if aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1377 msgfailoutput
'' "$OUTPUT"
1380 testmarkedmanual
() {
1381 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile"
1382 if [ -n "$1" ]; then
1383 msgtest
'Test for correctly marked as manually installed' "$*"
1384 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1386 msgtest
'Test for correctly marked as manually installed' 'no package'
1387 echo -n > $COMPAREFILE
1389 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.output"
1390 if aptmark showmanual
2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1393 msgfailoutput
'' "$OUTPUT"
1398 if [ -n "$MSGTEST_MSG" ]; then
1400 echo -n "$MSGTEST_MSG"
1406 if [ "$1" = 'grep' ]; then
1408 while [ -n "$2" ]; do shift; done
1409 echo "#### Complete file: $1 ####"
1410 cat >&2 "$1" || true
1411 echo '#### grep output ####'
1412 elif [ "$1" = 'test' ]; then
1414 # doesn't support ! or non-file flags
1415 msgfailoutputstatfile
() {
1416 local FILEFLAGS
='^-[bcdefgGhkLOprsStuwx]$'
1417 if expr match
"$1" "$FILEFLAGS" >/dev
/null
; then
1418 echo "#### stat(2) of file: $2 ####"
1422 msgfailoutputstatfile
"$2" "$3"
1423 while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do
1425 msgfailoutputstatfile
"$2" "$3"
1427 echo '#### test output ####'
1434 if [ "$1" = '--nomsg' ]; then
1437 msgtest
'Test for successful execution of' "$*"
1439 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1440 if "$@" >${OUTPUT} 2>&1; then
1441 if expr match
"$1" '^apt.*' >/dev
/null
; then
1442 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1443 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1444 elif grep -E '^[WE]: ' "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then
1445 if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then
1446 if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \
1447 | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev
/null
2>&1; then
1450 msgfailoutput
'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
1453 msgfailoutput
'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
1463 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1465 aptautotest
'testsuccess' "$@"
1468 if [ "$1" = '--nomsg' ]; then
1471 msgtest
'Test for successful execution with warnings of' "$*"
1473 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output"
1474 if "$@" >${OUTPUT} 2>&1; then
1475 if expr match
"$1" '^apt.*' >/dev
/null
; then
1476 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1477 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1478 elif grep -q -E '^E: ' "$OUTPUT"; then
1479 msgfailoutput
'successful run, but output contains errors' "$OUTPUT" "$@"
1480 elif ! grep -q -E '^W: ' "$OUTPUT"; then
1481 msgfailoutput
'successful run, but output contains no warnings' "$OUTPUT" "$@"
1490 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1492 aptautotest
'testwarning' "$@"
1495 if [ "$1" = '--nomsg' ]; then
1498 msgtest
'Test for failure in execution of' "$*"
1500 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1501 if "$@" >${OUTPUT} 2>&1; then
1503 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1506 if expr match
"$1" '^apt.*' >/dev
/null
; then
1507 if [ "$1" = 'aptkey' ]; then
1508 if grep -q -E " Can't check signature: " "$OUTPUT" || \
1509 grep -q -E " BAD signature from " "$OUTPUT"; then
1512 msgfailoutput
"run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@"
1515 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1516 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1517 elif grep -q -E '==ERROR' "$OUTPUT"; then
1518 msgfailoutput
'compiler sanitizers reported errors' "$OUTPUT" "$@"
1519 elif ! grep -q -E '^E: ' "$OUTPUT"; then
1520 msgfailoutput
"run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@"
1529 aptautotest
'testfailure' "$@"
1532 testsuccessequal
() {
1536 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
1538 testwarningequal
() {
1542 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
1544 testfailureequal
() {
1548 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
1555 msgtest
'Check that the output of the previous failed command has expected' 'failures and warnings'
1556 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile"
1557 grep '^\(W\|E\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true
1558 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.output"
1559 if echo "$CMP" | checkdiff
- "${COMPAREFILE}" >"$OUTPUT" 2>&1; then
1562 echo '### Complete output ###' >"$OUTPUT"
1563 cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" >"$OUTPUT"
1564 msgfailoutput
'' "$OUTPUT"
1569 msgtest
"Test that file $1 has $2 $3" "$4"
1570 if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
1573 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output"
1576 echo -n "stat(1) reports for $2: "
1577 stat
--format "$2" "$1" || true
1579 msgfailoutput
'' "$OUTPUT"
1582 testaccessrights
() {
1583 testfilestats
"$1" '%a' '=' "$2"
1586 testwebserverlaststatuscode
() {
1587 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1588 local STATUS
='downloaded/webserverstatus-statusfile.log'
1589 rm -f "$DOWNLOG" "$STATUS"
1590 msgtest
'Test last status code from the webserver was' "$1"
1591 if downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then
1594 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output"
1596 if [ -n "$2" ]; then
1598 echo >&2 '#### Additionally provided output files contain:'
1601 echo >&2 '#### Download log of the status code:'
1604 msgfailoutput
"Status was $(cat "$STATUS")" "$OUTPUT"
1609 echo "STOPPED execution. Press enter to continue"
1614 listcurrentlistsdirectory
() {
1616 find rootdir
/var
/lib
/apt
/lists
-maxdepth 1 -type d
| while read line
; do
1617 stat
--format '%U:%G:%a:%n' "$line"
1619 find rootdir
/var
/lib
/apt
/lists
-maxdepth 1 \
! -type d
| while read line
; do
1620 stat
--format '%U:%G:%a:%s:%y:%n' "$line"
1625 ### convenience hacks ###
1627 # creating some directories by hand is a tedious task, so make it look simple
1628 if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
1629 [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
1630 # only the last directory created by mkdir is effected by the -m !
1631 command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
1632 command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"
1633 command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
1634 touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock"
1635 if [ "$(id -u)" = '0' ]; then
1636 chown _apt
:root
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
1643 ### The following tests are run by most test methods automatically to check
1644 ### general things about commands executed without writing the test every time.
1650 local AUTOTEST
="aptautotest_$(basename "$CMD" | tr -d '-')_$(echo "$FIRSTOPT" | tr -d '-')"
1651 if command -v $AUTOTEST >/dev
/null
; then
1653 # save and restore the *.output files from other tests
1654 # as we might otherwise override them in these automatic tests
1655 rm -rf ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before
1656 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before
1657 mkdir ${TMPWORKINGDIRECTORY}/rootdir
/tmp
1658 $AUTOTEST "$TESTCALL" "$@"
1659 rm -rf ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-aptautotest
1660 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
${TMPWORKINGDIRECTORY}/rootdir
/tmp
-aptautotest
1661 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before ${TMPWORKINGDIRECTORY}/rootdir
/tmp
1665 aptautotest_aptget_update
() {
1667 while [ -n "$2" ]; do
1668 if [ "$2" = '--print-uris' ]; then return; fi # simulation mode
1671 if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
1672 testfilestats
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
1673 testfilestats
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
1674 # all copied files are properly chmodded
1675 for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do
1676 testfilestats
"$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
1678 if [ "$TESTCALL" = 'testsuccess' ]; then
1679 # failure cases can retain partial files and such
1680 testempty
find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \
( -name 'lock' -o -name '*.FAILED' \
)
1683 aptautotest_apt_update
() { aptautotest_aptget_update
"$@"; }
1684 aptautotest_aptcdrom_add
() { aptautotest_aptget_update
"$@"; }
1686 testaptautotestnodpkgwarning
() {
1688 while [ -n "$2" ]; do
1689 if expr match
"$2" '^-[a-z]*s' >/dev
/null
2>&1; then return; fi # simulation mode
1690 if expr match
"$2" '^-dy\?' >/dev
/null
2>&1; then return; fi # download-only mode
1693 testfailure
grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output"
1696 aptautotest_aptget_install
() { testaptautotestnodpkgwarning
"$@"; }
1697 aptautotest_aptget_remove
() { testaptautotestnodpkgwarning
"$@"; }
1698 aptautotest_aptget_purge
() { testaptautotestnodpkgwarning
"$@"; }
1699 aptautotest_apt_install
() { testaptautotestnodpkgwarning
"$@"; }
1700 aptautotest_apt_remove
() { testaptautotestnodpkgwarning
"$@"; }
1701 aptautotest_apt_purge
() { testaptautotestnodpkgwarning
"$@"; }