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 if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then
78 echo "Part of the test group: $MSGTEST_GRP"
80 echo -n "$MSGTEST_MSG"
83 if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
84 else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
85 if [ -n "$APT_DEBUG_TESTS" ]; then
88 EXIT_CODE
=$((EXIT_CODE+1));
93 if [ $MSGGROUP_LEVEL = 0 ]; then
96 MSGGROUP_LEVEL
=$((MSGGROUP_LEVEL+1));
98 MSGGROUP_LEVEL
=$((MSGGROUP_LEVEL-1));
99 if [ $MSGGROUP_LEVEL = 0 ]; then
105 # enable / disable Debugging
106 if [ $MSGLEVEL -le 0 ]; then
109 if [ $MSGLEVEL -le 1 ]; then
113 if [ $MSGLEVEL -le 2 ]; then
117 MSGTEST_MSG
="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")"
118 if [ "$MSGTEST_GRP" = 'NEXT' ]; then
119 MSGTEST_GRP
="$MSGTEST_MSG"
122 msgpass
() { printf " ${CPASS}P${CNORMAL}"; }
124 if [ $MSGLEVEL -le 3 ]; then
128 if [ $MSGLEVEL -le 4 ]; then
130 msgndebug
() { true
; }
133 if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
134 [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
135 [ "$1" = "msg" -a $MSGLEVEL -le 2 ] ||
136 [ "$1" = "warn" -a $MSGLEVEL -le 1 ] ||
137 [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then
140 printf "${CDONE}DONE${CNORMAL}\n";
144 if [ -f .
/aptconfig.conf
]; then
145 echo "$(readlink -f ./aptconfig.conf)"
146 elif [ -f ..
/aptconfig.conf
]; then
147 echo "$(readlink -f ../aptconfig.conf)"
148 elif [ -f ..
/..
/aptconfig.conf
]; then
149 echo "$(readlink -f ../../aptconfig.conf)"
150 elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then
151 echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")"
155 msgdebug
"Executing: ${CCMD}$*${CDEBUG} "
159 sh
|aptitude
|*/*|command) ;;
160 *) CMD
="${BUILDDIRECTORY}/$CMD";;
162 MALLOC_PERTURB_
=21 MALLOC_CHECK_
=2 APT_CONFIG
="$(getaptconfig)" LD_LIBRARY_PATH
=${LIBRARYPATH} $CMD "$@"
164 aptconfig
() { runapt apt
-config "$@"; }
165 aptcache
() { runapt apt
-cache "$@"; }
166 aptcdrom
() { runapt apt
-cdrom "$@"; }
167 aptget
() { runapt apt
-get "$@"; }
168 aptftparchive
() { runapt apt
-ftparchive "$@"; }
169 aptkey
() { runapt apt
-key "$@"; }
170 aptmark
() { runapt apt
-mark "$@"; }
171 aptsortpkgs
() { runapt apt
-sortpkgs "$@"; }
172 apt
() { runapt apt
"$@"; }
173 apthelper
() { runapt
"${APTHELPERBINDIR}/apt-helper" "$@"; }
174 aptwebserver
() { runapt
"${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
175 aptitude
() { runapt aptitude
"$@"; }
176 aptextracttemplates
() { runapt apt
-extracttemplates "$@"; }
177 aptinternalsolver
() { runapt
"${APTINTERNALSOLVER}" "$@"; }
178 aptdumpsolver
() { runapt
"${APTDUMPSOLVER}" "$@"; }
181 "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
183 dpkgcheckbuilddeps
() {
184 command dpkg
-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir
/var
/lib
/dpkg
"$@"
189 aptget
) CMD
="apt-get";;
190 aptcache
) CMD
="apt-cache";;
191 aptcdrom
) CMD
="apt-cdrom";;
192 aptconfig
) CMD
="apt-config";;
193 aptmark
) CMD
="apt-mark";;
194 apthelper
) CMD
="apt-helper";;
195 aptftparchive
) CMD
="apt-ftparchive";;
199 runapt
command gdb
--quiet -ex run
"${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
203 # error if we about to overflow, but ...
204 # "255 failures ought to be enough for everybody"
205 if [ $EXIT_CODE -gt 255 ]; then
206 msgdie
"Total failure count $EXIT_CODE too big"
208 exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
211 shellsetedetector
() {
213 if [ "$exit_status" != '0' ]; then
214 printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n"
215 if [ "$EXIT_CODE" = '0' ]; then
216 EXIT_CODE
="$exit_status"
222 if [ "$1" = 'prefix' ]; then
223 CURRENTTRAP
="$2 $CURRENTTRAP"
225 CURRENTTRAP
="$CURRENTTRAP $1"
227 trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
231 # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir)
232 if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then
235 TMPWORKINGDIRECTORY
=$(mktemp -d)
236 addtrap
"cd /; rm -rf $TMPWORKINGDIRECTORY;"
237 msgninfo
"Preparing environment for $(basename $0) in ${TMPWORKINGDIRECTORY}…"
239 mkdir -m 700 "${TMPWORKINGDIRECTORY}/downloaded"
240 if [ "$(id -u)" = '0' ]; then
241 # relax permissions so that running as root with user switching works
243 chmod 711 "$TMPWORKINGDIRECTORY"
244 chown _apt
:root
"${TMPWORKINGDIRECTORY}/downloaded"
247 TESTDIRECTORY
=$(readlink -f $(dirname $0))
248 # allow overriding the default BUILDDIR location
249 SOURCEDIRECTORY
=${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}
250 BUILDDIRECTORY
=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
251 LIBRARYPATH
=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
252 METHODSDIR
=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
253 APTHELPERBINDIR
=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
254 APTWEBSERVERBINDIR
=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
255 APTINTERNALSOLVER
=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
256 APTDUMPSOLVER
=${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}
257 test -x "${BUILDDIRECTORY}/apt-get" || msgdie
"You need to build tree first"
260 cd $TMPWORKINGDIRECTORY
261 mkdir rootdir aptarchive keys
263 mkdir -p etc
/apt
/apt.conf.d etc
/apt
/sources.list.d etc
/apt
/trusted.gpg.d etc
/apt
/preferences.d
264 mkdir -p usr
/bin var
/cache var
/lib var
/log tmp
265 mkdir -p var
/lib
/dpkg
/info var
/lib
/dpkg
/updates var
/lib
/dpkg
/triggers
266 touch var
/lib
/dpkg
/available
268 ln -s ${METHODSDIR} usr
/lib
/apt
/methods
269 if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then
270 mkdir -p usr
/lib
/apt
/solvers
271 ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr
/lib
/apt
/solvers
/dump
272 ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr
/lib
/apt
/solvers
/apt
273 echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc
/apt
/apt.conf.d
/externalsolver.conf
275 # use the autoremove from the BUILDDIRECTORY if its there, otherwise
277 if [ -e ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove
]; then
278 ln -s ${BUILDDIRECTORY}/..
/..
/debian
/apt.conf.autoremove etc
/apt
/apt.conf.d
/01autoremove
280 ln -s /etc
/apt
/apt.conf.d
/01autoremove etc
/apt
/apt.conf.d
/01autoremove
283 local PACKAGESFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
284 if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
285 cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages
287 local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/')
288 if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then
289 cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive
/Sources
291 cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys
/
292 chmod 644 $(find keys -name '*.pub' -o -name '*.sec')
293 ln -s ${TMPWORKINGDIRECTORY}/keys
/joesixpack.pub rootdir
/etc
/apt
/trusted.gpg.d
/joesixpack.gpg
295 echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
296 echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf
297 echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf
298 echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf
299 # store apt-key were we can access it, even if we run it as a different user
300 # destroys coverage reporting though, so just do it for root for now
301 if [ "$(id -u)" = '0' ]; then
302 cp "${BUILDDIRECTORY}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
303 chmod o
+rx
"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key"
304 echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf
306 echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
309 cat << EOF > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
312 if [ -r "${TMPWORKINGDIRECTORY}/noopchroot.so" ]; then
313 if [ -n "\$LD_PRELOAD" ]; then
314 export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}"
316 export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so"
319 exec fakeroot dpkg --root="${TMPWORKINGDIRECTORY}/rootdir" \\
320 --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log \\
321 --force-not-root --force-bad-path "\$@"
323 chmod +x
"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
324 echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir
/etc
/apt
/apt.conf.d
/99dpkg
327 if ! command dpkg
--assert-multi-arch >/dev
/null
2>&1; then
328 echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it…
330 echo 'quiet::NoUpdate "true";'
331 echo 'quiet::NoStatistic "true";'
332 # too distracting for users, but helpful to detect changes
333 echo 'Acquire::Progress::Ignore::ShowErrorText "true";'
334 echo 'Acquire::Progress::Diffpercent "true";'
335 # in testcases, it can appear as if localhost has a rotation setup,
336 # hide this as we can't really deal with it properly
337 echo 'Acquire::Failure::ShowIP "false";'
340 cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem"
341 if [ "$(id -u)" = '0' ]; then
342 chown _apt
:root
"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem"
344 echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir
/etc
/apt
/apt.conf.d
/99https
345 echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir
/etc
/apt
/apt.conf.d
/apt
-binary
346 configcompression
'.' 'gz' #'bz2' 'lzma' 'xz'
348 # create some files in /tmp and look at user/group to get what this means
349 TEST_DEFAULT_USER
="$USER"
350 if [ "$(uname)" = 'GNU/kFreeBSD' ]; then
351 TEST_DEFAULT_GROUP
='root'
353 TEST_DEFAULT_GROUP
="$USER"
356 # Acquire::AllowInsecureRepositories=false is not yet the default
357 # but we want it to be the default soon
358 configallowinsecurerepositories
"false";
360 # cleanup the environment a bit
361 # prefer our apt binaries over the system apt binaries
362 export PATH
="${BUILDDIRECTORY}:${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
363 export LC_ALL
=C.UTF
-8
364 unset LANGUAGE APT_CONFIG
365 unset GREP_OPTIONS DEB_BUILD_PROFILES
370 if [ "$1" = "native" -o -z "$1" ]; then
371 eval `aptconfig shell ARCH APT::Architecture`
372 if [ -n "$ARCH" ]; then
375 dpkg
--print-architecture
383 aptconfig dump
--no-empty --format '%v%n' APT
::Architecture APT
::Architectures
| sort -u | tr '\n' ' '
386 getarchitecturesfromcommalist
() {
387 echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/"
390 configarchitecture
() {
392 echo "APT::Architecture \"$(getarchitecture $1)\";"
393 while [ -n "$1" ]; do
394 echo "APT::Architectures:: \"$(getarchitecture $1)\";"
397 } >rootdir
/etc
/apt
/apt.conf.d
/01multiarch.conf
402 if [ ! -e rootdir
/var
/lib
/dpkg
/status
]; then
403 local STATUSFILE
=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/')
404 if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
405 cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
407 echo -n > rootdir/var/lib/dpkg/status
410 rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
411 if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then
412 local ARCHS="$(getarchitectures)"
413 if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
414 DPKGARCH="$(dpkg --print-architecture)"
415 for ARCH in ${ARCHS}; do
416 if [ "${ARCH}" != "${DPKGARCH}" ]; then
417 if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
418 # old-style used e.g. in Ubuntu-P – and as it seems travis
419 echo "DPKG
::options
:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
420 echo "DPKG
::options
:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
424 if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
425 # dpkg doesn't really check the version as long as it is fully installed,
426 # but just to be sure we choose one above the required version
427 insertinstalledpackage 'dpkg' "all
" '1.16.2+fake'
433 configdpkgnoopchroot() {
434 # create a library to noop chroot() and rewrite maintainer script executions
435 # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
436 # chroot directory dpkg could chroot into to execute the maintainer scripts
437 msgtest 'Building library to preload to make maintainerscript work in' 'dpkg'
438 cat << EOF > noopchroot.c
445 static char * chrootdir = NULL;
447 int chroot(const char *path) {
448 printf("WARNING
: CHROOTing to
%s was ignored
!\n", path);
450 chrootdir = strdup(path);
453 int execvp(const char *file, char *const argv[]) {
454 static int (*func_execvp) (const char *, char * const []) = NULL;
455 if (func_execvp == NULL)
456 func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp
");
457 if (chrootdir == NULL || strncmp(file, "/var
/lib
/dpkg
/", strlen("/var
/lib
/dpkg
/")) != 0)
458 return func_execvp(file, argv);
459 printf("REWRITE execvp call
%s into
%s
\n", file, chrootdir);
460 char newfile[strlen(chrootdir) + strlen(file)];
461 strcpy(newfile, chrootdir);
462 strcat(newfile, file);
463 char const * const baseadmindir = "/var
/lib
/dpkg
";
464 char admindir[strlen(chrootdir) + strlen(baseadmindir)];
465 strcpy(admindir, chrootdir);
466 strcat(admindir, baseadmindir);
467 setenv("DPKG_ADMINDIR
", admindir, 1);
468 return func_execvp(newfile, argv);
471 testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
474 configallowinsecurerepositories() {
475 echo "Acquire
::AllowInsecureRepositories
\"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf
479 configcompression() {
480 while [ -n "$1" ]; do
482 '.') printf ".
\t.
\tcat
\n";;
483 'gz') printf "gzip\tgz
\tgzip
\n";;
484 'bz2') printf "bzip2\tbz
2\tbzip
2\n";;
485 'lzma') printf "lzma
\tlzma
\txz
--format=lzma
\n";;
486 'xz') printf "xz
\txz
\txz
\n";;
487 *) printf "$1\t$1\t$1\n";;
490 done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf
497 gzip) COMPRESS='gz';;
498 bzip2) COMPRESS='bz2';;
499 lzma) COMPRESS='lzma';;
501 *) msgdie "Compressor
$COMPRESSOR is unknown to framework
, so can
't be forced by forcecompressor!";;
503 local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor"
504 echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; };
505 Dir::Bin::uncompressed \"/does/not/exist\";
506 Dir::Bin::gzip \"/does/not/exist\";
507 Dir::Bin::bzip2 \"/does/not/exist\";
508 Dir::Bin::lzma \"/does/not/exist\";
509 Dir::Bin::xz \"/does/not/exist\";" > "$CONFFILE"
510 if [ -e "/bin/${COMPRESSOR}" ]; then
511 echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE"
512 elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
513 echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> "$CONFFILE"
514 elif [ "${COMPRESSOR}" = 'lzma
' ]; then
515 echo 'Dir
::Bin
::xz
"/usr/bin/xz";' >> "$CONFFILE"
516 COMPRESSOR_CMD='xz
--format=lzma
'
518 msgtest 'Test
for availability of compressor
' "${COMPRESSOR}"
519 msgfail "${COMPRESSOR} not available"
523 setupsimplenativepackage() {
527 local RELEASE="${4:-unstable}"
528 local DEPENDENCIES="$5"
529 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
530 If you find such a package installed on your system,
531 something went horribly wrong! They are autogenerated
532 und used only by testcases and surf no other propose…"}"
534 local SECTION="${7:-others}"
536 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
539 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
541 local BUILDDIR=incoming/${NAME}-${VERSION}
542 mkdir -p ${BUILDDIR}/debian/source
544 echo "* most suckless software product ever" > FEATURES
545 test -e debian/copyright || echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright
546 test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low
550 -- Joe Sixpack <joe@example.org> $(date -R)" > debian/changelog
551 test -e debian/control || echo "Source: $NAME
554 Maintainer: Joe Sixpack <joe@example.org>
555 Build-Depends: debhelper (>= 7)
556 Standards-Version: 3.9.1
558 Package: $NAME" > debian/control
559 if [ "$ARCH" = 'all
' ]; then
560 echo "Architecture: all" >> debian/control
562 echo "Architecture: any" >> debian/control
564 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
565 echo "Description: $DESCRIPTION" >> debian/control
567 test -e debian/compat || echo "7" > debian/compat
568 test -e debian/source/format || echo "3.0 (native)" > debian/source/format
569 test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
573 buildsimplenativepackage() {
576 if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib
' ]; then
577 NM="$(echo "$NAME" | cut -c 1-4)"
579 NM="$(echo "$NAME" | cut -c 1)"
583 local RELEASE="${4:-unstable}"
584 local DEPENDENCIES="$5"
585 local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
586 If you find such a package installed on your system,
587 something went horribly wrong! They are autogenerated
588 und used only by testcases and surf no other propose…"}"
590 local SECTION="${7:-others}"
591 local PRIORITY="${8:-optional}"
593 local COMPRESS_TYPE="${10:-gzip}"
595 if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
598 DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)"
600 local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
602 msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME"
603 mkdir -p $BUILDDIR/debian/source
604 echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES
606 echo '$NAME says
\"Hello
!\"'" > ${BUILDDIR}/${NAME}
608 echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright
609 echo "$NAME ($VERSION) $RELEASE; urgency=low
613 -- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog
616 Maintainer: Joe Sixpack <joe@example.org>
617 Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
618 if [ "$SECTION" != '<none
>' ]; then
619 echo "Section: $SECTION" >> ${BUILDDIR}/debian/control
621 local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
622 test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
624 Package: $NAME" >> ${BUILDDIR}/debian/control
626 if [ "$ARCH" = 'all
' ]; then
627 echo "Architecture: all" >> ${BUILDDIR}/debian/control
629 echo "Architecture: any" >> ${BUILDDIR}/debian/control
631 local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
632 test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
633 echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
635 echo '3.0 (native
)' > ${BUILDDIR}/debian/source/format
637 testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION}
639 sed -n 's
#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \
641 echo "pool/${SRC}" >> ${BUILDDIR}/..
/${RELEASE}.
${DISTSECTION}.srclist
642 # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
643 # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \
644 # adv --yes --default-key 'Joe Sixpack' \
645 # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
646 # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC"
650 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
651 msgtest
"Build binary package for ${RELEASE} in ${SECTION}" "$NAME"
652 rm -rf ${BUILDDIR}/debian
/tmp
653 mkdir -p ${BUILDDIR}/debian
/tmp
/DEBIAN
${BUILDDIR}/debian
/tmp
/usr
/share
/doc
/${NAME} ${BUILDDIR}/debian
/tmp
/usr
/bin
654 cp ${BUILDDIR}/debian
/copyright
${BUILDDIR}/debian
/changelog
${BUILDDIR}/FEATURES
${BUILDDIR}/debian
/tmp
/usr
/share
/doc
/${NAME}
655 cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian
/tmp
/usr
/bin
/${NAME}-${arch}
656 if [ -n "$FILE_TREE" ]; then
657 cp -ar "$FILE_TREE" ${BUILDDIR}/debian
/tmp
660 (cd ${BUILDDIR}; dpkg
-gencontrol -DArchitecture=$arch)
661 (cd ${BUILDDIR}/debian
/tmp
; md5sum $(find usr/ -type f) > DEBIAN
/md5sums
)
662 local LOG
="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
663 # ensure the right permissions as dpkg-deb insists
664 chmod 755 ${BUILDDIR}/debian
/tmp
/DEBIAN
665 testsuccess
--nomsg dpkg
-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian
/tmp
${BUILDDIR}/..
666 echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/..
/${RELEASE}.
${DISTSECTION}.pkglist
669 local CHANGEPATH
="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}"
671 cp ${BUILDDIR}/debian
/changelog
$CHANGEPATH
680 local ARCH
=$(getarchitecture $4)
681 local PKGNAME
="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
682 local BUILDLOG
="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
683 msgtest
"Build package for ${RELEASE} in ${SECTION}" "$PKGNAME"
685 if [ "$ARCH" = "all" ]; then
686 ARCH
="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
688 testsuccess
--nomsg dpkg
-buildpackage -uc -us -a$ARCH
689 cp ${TMPWORKINGDIRECTORY}/rootdir
/tmp
/testsuccess.output
$BUILDLOG
690 local PKGS
="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
691 local SRCS
="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
694 echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming
/${RELEASE}.
${SECTION}.pkglist
697 echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming
/${RELEASE}.
${SECTION}.srclist
702 if [ -d incoming
]; then
703 buildaptarchivefromincoming
"$@"
705 buildaptarchivefromfiles
"$@"
709 createaptftparchiveconfig
() {
710 local COMPRESSORS
="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
711 local COMPRESSORS
="${COMPRESSORS%* }"
712 local ARCHS
="$(getarchitectures)"
714 ArchiveDir "' >> ftparchive.conf
715 echo -n $(readlink -f .) >> ftparchive.conf
717 CacheDir "' >> ftparchive.conf
718 echo -n $(readlink -f ..) >> ftparchive.conf
720 FileListDir "' >> ftparchive.conf
721 echo -n $(readlink -f pool/) >> ftparchive.conf
725 Packages::Compress "'"$COMPRESSORS"'";
726 Sources::Compress "'"$COMPRESSORS"'";
727 Contents::Compress "'"$COMPRESSORS"'";
728 Translation::Compress "'"$COMPRESSORS"'";
729 LongDescription "false";
733 SrcDirectory "pool/";
739 Label "apttestcases";
741 Description "repository with dummy packages";
742 Architectures "' >> ftparchive.conf
743 echo -n "$ARCHS" >> ftparchive.conf
747 };' >> ftparchive.conf
748 for DIST
in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do
749 echo -n 'tree "dists/' >> ftparchive.conf
750 echo -n "$DIST" >> ftparchive.conf
752 Architectures "' >> ftparchive.conf
753 echo -n "$ARCHS" >> ftparchive.conf
755 FileList "' >> ftparchive.conf
756 echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf
758 SourceFileList "' >> ftparchive.conf
759 echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf
761 Sections "' >> ftparchive.conf
762 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
764 };' >> ftparchive.conf
768 buildaptftparchivedirectorystructure
() {
769 local DISTS
="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')"
770 for DIST
in $DISTS; do
771 local SECTIONS
="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)"
772 for SECTION
in $SECTIONS; do
773 local ARCHS
="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')"
774 for ARCH
in $ARCHS; do
775 mkdir -p dists
/${DIST}/${SECTION}/binary
-${ARCH}
777 mkdir -p dists
/${DIST}/${SECTION}/source
778 mkdir -p dists
/${DIST}/${SECTION}/i18n
788 local DEPENDENCIES
="$5"
789 local PRIORITY
="${6:-optional}"
790 local DESCRIPTION
="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASES}
791 If you find such a package installed on your system,
792 something went horribly wrong! They are autogenerated
793 und used only by testcases and surf no other propose…"}"
795 for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do
796 if [ "$RELEASE" = 'installed' ]; then
797 insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7"
800 for arch in $(getarchitecturesfromcommalist "$ARCH"); do
801 if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
802 ARCHS="$(getarchitectures)"
806 for BUILDARCH in $ARCHS; do
807 local PPATH="aptarchive
/dists
/${RELEASE}/main
/binary
-${BUILDARCH}"
809 local FILE="${PPATH}/Packages
"
814 Maintainer
: Joe Sixpack
<joe@example.org
>" >> $FILE
815 test "$arch" = 'none' || echo "Architecture
: $arch" >> $FILE
816 echo "Version
: $VERSION
817 Filename
: pool
/main
/${NAME}/${NAME}_
${VERSION}_
${arch}.deb
" >> $FILE
818 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
819 echo "Description
: $(printf '%s' "$DESCRIPTION" | head -n 1)" >> $FILE
820 echo "Description
-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" >> $FILE
824 mkdir -p aptarchive/dists/${RELEASE}/main/source aptarchive/dists/${RELEASE}/main/i18n
825 touch aptarchive/dists/${RELEASE}/main/source/Sources
827 Description
-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)
828 Description
-en: $DESCRIPTION
829 " >> aptarchive/dists/${RELEASE}/main/i18n/Translation-en
838 local DEPENDENCIES="$5"
839 local BINARY="${6:-$NAME}"
841 local SPATH="aptarchive
/dists
/${RELEASE}/main
/source"
843 local FILE="${SPATH}/Sources
"
844 local DSCFILE="${NAME}_
${VERSION}.dsc
"
845 local TARFILE="${NAME}_
${VERSION}.
tar.gz
"
849 Maintainer
: Joe Sixpack
<joe@example.org
>
850 Architecture
: $ARCH" >> $FILE
851 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
853 $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) $DSCFILE
854 $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) $TARFILE
858 insertinstalledpackage() {
862 local DEPENDENCIES="$4"
863 local PRIORITY="${5:-optional}"
864 local STATUS="${6:-install ok installed}"
865 local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
866 If you
find such a package installed on your system
,
867 something went horribly wrong
! They are autogenerated
868 und used only by testcases and surf no other propose…
"}"
870 local FILE
='rootdir/var/lib/dpkg/status'
871 local INFO
='rootdir/var/lib/dpkg/info'
872 for arch
in $(getarchitecturesfromcommalist "$ARCH"); do
878 Maintainer: Joe Sixpack <joe@example.org>
879 Version: $VERSION" >> $FILE
880 test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
881 test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
882 echo "Description: $DESCRIPTION" >> $FILE
884 if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
885 echo -n > ${INFO}/${NAME}:${arch}.list
887 echo -n > ${INFO}/${NAME}.list
893 buildaptarchivefromincoming
() {
894 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
896 [ -e pool
] || ln -s ..
/incoming pool
897 [ -e ftparchive.conf
] || createaptftparchiveconfig
898 [ -e dists
] || buildaptftparchivedirectorystructure
899 msgninfo
"\tGenerate Packages, Sources and Contents files… "
900 testsuccess aptftparchive generate ftparchive.conf
903 generatereleasefiles
"$@"
906 buildaptarchivefromfiles
() {
907 msginfo
"Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
908 local DIR
='aptarchive'
909 if [ -d "${DIR}/dists" ]; then DIR
="${DIR}/dists"; fi
910 find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line
; do
911 msgninfo
"\t${line} file… "
912 compressfile
"$line" "$1"
915 generatereleasefiles
"$@"
919 cat ${TMPWORKINGDIRECTORY}/rootdir
/etc
/testcase
-compressor.conf
| while read compressor extension
command; do
920 if [ "$compressor" = '.' ]; then
926 cat "$1" | $command > "${1}.${extension}"
928 touch -d "$2" "${1}.${extension}"
933 # can be overridden by testcases for their pleasure
934 getcodenamefromsuite
() {
936 unstable
) echo 'sid';;
940 getreleaseversionfromsuite
() { true
; }
941 getlabelfromsuite
() { true
; }
942 getoriginfromsuite
() { true
; }
944 generatereleasefiles
() {
945 # $1 is the Date header and $2 is the ValidUntil header to be set
946 # both should be given in notation date/touch can understand
947 msgninfo
"\tGenerate Release files… "
948 if [ -e aptarchive
/dists
]; then
949 for dir
in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
950 local SUITE
="$(echo "$dir" | cut -d'/' -f 4)"
951 local CODENAME
="$(getcodenamefromsuite $SUITE)"
952 local VERSION
="$(getreleaseversionfromsuite $SUITE)"
953 local LABEL
="$(getlabelfromsuite $SUITE)"
954 local ORIGIN
="$(getoriginfromsuite $SUITE)"
955 if [ -n "$VERSION" ]; then
956 VERSION
="-o APT::FTPArchive::Release::Version=${VERSION}"
958 if [ -n "$LABEL" ]; then
959 LABEL
="-o APT::FTPArchive::Release::Label=${LABEL}"
961 if [ -n "$ORIGIN" ]; then
962 ORIGIN
="-o APT::FTPArchive::Release::Origin=${ORIGIN}"
964 aptftparchive
-qq release
$dir \
965 -o APT
::FTPArchive
::Release
::Suite
="${SUITE}" \
966 -o APT
::FTPArchive
::Release
::Codename
="${CODENAME}" \
970 | sed -e '/0 Release$/ d' > $dir/Release
# remove the self reference
971 if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
973 NotAutomatic: yes' $dir/Release
975 if [ -n "$1" -a "$1" != "now" ]; then
976 sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
980 Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
984 aptftparchive
-qq release .
/aptarchive
| sed -e '/0 Release$/ d' > aptarchive
/Release
# remove the self reference
986 if [ -n "$1" -a "$1" != "now" ]; then
987 for release
in $(find ./aptarchive -name 'Release'); do
988 touch -d "$1" $release
994 setupdistsaptarchive
() {
995 local APTARCHIVE
=$(readlink -f ./aptarchive)
996 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb.list
997 rm -f root
/etc
/apt
/sources.list.d
/apt
-test-*-deb-src.list
998 for DISTS
in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do
999 SECTIONS
=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
1000 msgninfo
"\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
1001 echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb.list
1002 echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-${DISTS}-deb-src.list
1007 setupflataptarchive
() {
1008 local APTARCHIVE
=$(readlink -f ./aptarchive)
1009 if [ -f ${APTARCHIVE}/Packages
]; then
1010 msgninfo
"\tadd deb sources.list line… "
1011 echo "deb file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
1014 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb.list
1016 if [ -f ${APTARCHIVE}/Sources
]; then
1017 msgninfo
"\tadd deb-src sources.list line… "
1018 echo "deb-src file://$APTARCHIVE /" > rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
1021 rm -f rootdir
/etc
/apt
/sources.list.d
/apt
-test-archive-deb-src.list
1027 if [ "$1" = '--no-update' ]; then
1031 buildaptarchive
"$@"
1032 if [ -e aptarchive
/dists
]; then
1033 setupdistsaptarchive
1037 signreleasefiles
'Joe Sixpack'
1038 if [ "1" != "$NOUPDATE" ]; then
1039 testsuccess aptget update
-o Debug
::pkgAcquire
::Worker
=true
-o Debug
::Acquire
::gpgv
=true
1043 signreleasefiles
() {
1044 local SIGNER
="${1:-Joe Sixpack}"
1045 local REPODIR
="${2:-aptarchive}"
1046 local KEY
="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | sed 's# ##g')"
1047 local GPG
="aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly adv --batch --yes"
1048 msgninfo
"\tSign archive with $SIGNER key $KEY… "
1049 local REXKEY
='keys/rexexpired'
1050 local SECEXPIREBAK
="${REXKEY}.sec.bak"
1051 local PUBEXPIREBAK
="${REXKEY}.pub.bak"
1052 if [ "${SIGNER}" = 'Rex Expired' ]; then
1053 # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
1054 # option doesn't exist anymore (and using faketime would add a new obscure dependency)
1055 # therefore we 'temporary' make the key not expired and restore a backup after signing
1056 cp ${REXKEY}.sec
$SECEXPIREBAK
1057 cp ${REXKEY}.pub
$PUBEXPIREBAK
1058 local SECUNEXPIRED
="${REXKEY}.sec.unexpired"
1059 local PUBUNEXPIRED
="${REXKEY}.pub.unexpired"
1060 if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
1061 cp $SECUNEXPIRED ${REXKEY}.sec
1062 cp $PUBUNEXPIRED ${REXKEY}.pub
1064 if ! printf "expire\n1w\nsave\n" | $GPG --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg
2>&1; then
1068 cp ${REXKEY}.sec
$SECUNEXPIRED
1069 cp ${REXKEY}.pub
$PUBUNEXPIRED
1072 for RELEASE
in $(find ${REPODIR}/ -name Release); do
1073 $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg
${RELEASE}
1074 local INRELEASE
="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
1075 $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
1076 # we might have set a specific date for the Release file, so copy it
1077 touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg
${INRELEASE}
1079 if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
1080 mv -f $SECEXPIREBAK ${REXKEY}.sec
1081 mv -f $PUBEXPIREBAK ${REXKEY}.pub
1086 redatereleasefiles
() {
1087 local DATE
="$(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')"
1088 for release
in $(find aptarchive/ -name 'Release'); do
1089 sed -i "s/^Date: .*$/Date: ${DATE}/" $release
1090 touch -d "$DATE" $release
1092 signreleasefiles
"${2:-Joe Sixpack}"
1096 local WEBSERVER
="${3:-http://localhost:8080}"
1098 if [ "$1" = '--no-check' ]; then
1102 local DOWNLOG
='rootdir/tmp/download-testfile.log'
1103 local STATUS
='downloaded/webserverconfig.status'
1104 rm -f "$STATUS" "$DOWNLOG"
1106 if [ -n "$2" ]; then
1107 msgtest
"Set webserver config option '${1}' to" "$2"
1108 URI
="${WEBSERVER}/_config/set/${1}/${2}"
1110 msgtest
'Clear webserver config option' "${1}"
1111 URI
="${WEBSERVER}/_config/clear/${1}"
1113 if downloadfile
"$URI" "$STATUS" > "$DOWNLOG"; then
1116 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output"
1117 cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true
1118 msgfailoutput
'' "$OUTPUT"
1120 $NOCHECK || testwebserverlaststatuscode
'200'
1123 rewritesourceslist
() {
1124 local APTARCHIVE
="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")"
1125 for LIST
in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
1126 sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#https://localhost:4433/#${1}#"
1130 # wait for up to 10s for a pid file to appear to avoid possible race
1131 # when a helper is started and dosn't write the PID quick enough
1134 for i
in $(seq 10); do
1135 if test -s "$PIDFILE"; then
1140 msgdie
"waiting for $PIDFILE failed"
1144 changetowebserver
() {
1145 if [ "$1" != '--no-rewrite' ]; then
1146 rewritesourceslist
'http://localhost:8080/'
1150 if test -x ${APTWEBSERVERBINDIR}/aptwebserver
; then
1152 local LOG
="webserver.log"
1153 if ! aptwebserver
-o aptwebserver
::fork
=1 "$@" >$LOG 2>&1 ; then
1157 waitforpidfile aptwebserver.pid
1158 local PID
="$(cat aptwebserver.pid)"
1159 if [ -z "$PID" ]; then
1160 msgdie
'Could not fork aptwebserver successfully'
1162 addtrap
"kill $PID;"
1165 msgdie
'You have to build aptwerbserver or install a webserver'
1169 changetohttpswebserver
() {
1170 if ! which stunnel4
>/dev
/null
; then
1171 msgdie
'You need to install stunnel4 for https testcases'
1173 if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
1174 changetowebserver
--no-rewrite "$@"
1176 echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
1177 cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem
1183 " > ${TMPWORKINGDIRECTORY}/stunnel.conf
1184 stunnel4
"${TMPWORKINGDIRECTORY}/stunnel.conf"
1185 waitforpidfile
"${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid"
1186 local PID
="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)"
1187 if [ -z "$PID" ]; then
1188 msgdie
'Could not fork stunnel4 successfully'
1190 addtrap
'prefix' "kill ${PID};"
1191 rewritesourceslist
'https://localhost:4433/'
1195 mkdir -p rootdir
/media
/cdrom
/.disk
1196 local CD
="$(readlink -f rootdir/media/cdrom)"
1197 echo "acquire::cdrom::mount \"${CD}\";
1198 acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\";
1199 acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\";
1200 acquire::cdrom::autodetect 0;" > rootdir
/etc
/apt
/apt.conf.d
/00cdrom
1201 echo -n "$1" > ${CD}/.disk
/info
1202 if [ ! -d aptarchive
/dists
]; then
1203 msgdie
'Flat file archive cdroms can not be created currently'
1206 mv aptarchive
/dists
"$CD"
1207 ln -s "$(readlink -f ./incoming)" $CD/pool
1208 find rootdir
/etc
/apt
/sources.list.d
/ -name 'apt-test-*.list' -delete
1209 # start with an unmounted disk
1210 mv "${CD}" "${CD}-unmounted"
1211 # we don't want the disk to be modifiable
1212 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;"
1213 chmod -R 555 rootdir
/media
/cdrom
-unmounted/dists
1217 local PROTO
="${1%%:*}"
1218 if ! apthelper
-o Debug
::Acquire
::${PROTO}=1 -o Debug
::pkgAcquire
::Worker
=1 \
1219 download
-file "$1" "$2" "$3" 2>&1 ; then
1222 # only if the file exists the download was successful
1223 if [ -r "$2" ]; then
1231 local DIFFTEXT
="$(command diff -u "$@" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
1232 if [ -n "$DIFFTEXT" ]; then
1234 echo >&2 "$DIFFTEXT"
1243 local MSG
='Test for correctness of file'
1244 if [ "$1" = '--nomsg' ]; then
1250 if [ -n "$MSG" ]; then
1251 msgtest
"$MSG" "$FILE"
1253 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output"
1254 if [ -z "$*" ]; then
1255 if echo -n "" | checkdiff
- $FILE >"$OUTPUT" 2>&1; then
1258 msgfailoutput
'' "$OUTPUT"
1261 if echo "$*" | checkdiff
- $FILE >"$OUTPUT" 2>&1; then
1264 msgfailoutput
'' "$OUTPUT"
1272 msgtest
"Test for no output of" "$*"
1273 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
1274 if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
1277 msgfailoutput
'' "$COMPAREFILE"
1279 aptautotest
'testempty' "$@"
1285 local MSG
='Test of equality of'
1286 if [ "$1" = '--nomsg' ]; then
1291 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
1292 echo "$1" > $COMPAREFILE
1295 if [ -n "$MSG" ]; then
1298 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output"
1299 if "$@" 2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1302 msgfailoutput
'' "$OUTPUT"
1304 aptautotest
'testequal' "$@"
1310 local COMPAREFILE1
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
1311 local COMPAREFILE2
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
1312 local COMPAREAGAINST
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
1313 echo "$1" > $COMPAREFILE1
1314 echo "$2" > $COMPAREFILE2
1316 msgtest
"Test for equality OR of" "$*"
1317 "$@" >$COMPAREAGAINST 2>&1 || true
1318 if checkdiff
$COMPAREFILE1 $COMPAREAGAINST >/dev
/null
2>&1 || \
1319 checkdiff
$COMPAREFILE2 $COMPAREAGAINST >/dev
/null
2>&1
1323 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output"
1324 echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1
1325 checkdiff
"$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true
1326 echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1
1327 checkdiff
"$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true
1328 msgfailoutput
'' "$OUTPUT"
1330 aptautotest
'testequalor2' "$@"
1336 local VIRTUAL
="N: Can't select versions from package '$1' as it is purely virtual"
1339 while [ -n "$1" ]; do
1341 N: Can't select versions from package '$1' as it is purely virtual"
1342 PACKAGE
="${PACKAGE} $1"
1345 msgtest
"Test for virtual packages" "apt-cache show $PACKAGE"
1347 N: No packages found"
1348 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile"
1349 local ARCH
="$(getarchitecture 'native')"
1350 echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE"
1351 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output"
1352 if aptcache show
-q=0 "$PACKAGE" 2>&1 | checkdiff
"$COMPAREFILE" - >"$OUTPUT" 2>&1; then
1355 msgfailoutput
'' "$OUTPUT"
1362 msgtest
"Test for non-existent packages" "apt-cache show $*"
1363 local SHOWPKG
="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
1364 if [ -n "$SHOWPKG" ]; then
1365 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output"
1366 echo "$SHOWPKG" >"$OUTPUT"
1367 msgfailoutput
'' "$OUTPUT"
1379 msgtest
"Test that $NR package(s) are in state $STATE with" "dpkg -l $*"
1380 local PKGS
="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)"
1381 if [ "$PKGS" != $NR ]; then
1382 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output"
1383 echo "$PKGS" >"$OUTPUT"
1384 dpkg
-l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true
1385 msgfailoutput
'' "$OUTPUT"
1392 testdpkginstalled
() {
1394 testdpkgstatus
'ii' "$#" "$@"
1398 testdpkgnotinstalled
() {
1400 testdpkgstatus
'ii' '0' "$@"
1406 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
1407 if [ -n "$1" ]; then
1408 msgtest
'Test for correctly marked as auto-installed' "$*"
1409 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1411 msgtest
'Test for correctly marked as auto-installed' 'no package'
1412 echo -n > $COMPAREFILE
1414 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.output"
1415 if aptmark showauto
2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1418 msgfailoutput
'' "$OUTPUT"
1422 testmarkedmanual
() {
1424 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile"
1425 if [ -n "$1" ]; then
1426 msgtest
'Test for correctly marked as manually installed' "$*"
1427 while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
1429 msgtest
'Test for correctly marked as manually installed' 'no package'
1430 echo -n > $COMPAREFILE
1432 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.output"
1433 if aptmark showmanual
2>&1 | checkdiff
$COMPAREFILE - >"$OUTPUT" 2>&1; then
1436 msgfailoutput
'' "$OUTPUT"
1442 if [ -n "$MSGTEST_MSG" ]; then
1444 if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then
1445 echo "${CFAIL}Part of the test group: $MSGTEST_GRP"
1447 echo -n "$MSGTEST_MSG"
1453 if [ "$1" = 'grep' ]; then
1455 while [ -n "$2" ]; do shift; done
1456 echo "#### Complete file: $1 ####"
1457 cat >&2 "$1" || true
1458 echo '#### grep output ####'
1459 elif [ "$1" = 'test' ]; then
1461 # doesn't support ! or non-file flags
1462 msgfailoutputstatfile
() {
1463 local FILEFLAGS
='^-[bcdefgGhkLOprsStuwx]$'
1464 if expr match
"$1" "$FILEFLAGS" >/dev
/null
; then
1465 echo "#### stat(2) of file: $2 ####"
1469 msgfailoutputstatfile
"$2" "$3"
1470 while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do
1472 msgfailoutputstatfile
"$2" "$3"
1474 echo '#### test output ####'
1482 if [ "$1" = '--nomsg' ]; then
1485 msgtest
'Test for successful execution of' "$*"
1487 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
1488 if "$@" >${OUTPUT} 2>&1; then
1489 if expr match
"$1" '^apt.*' >/dev
/null
; then
1490 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1491 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1492 elif grep -E '^[WE]: ' "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then
1493 if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then
1494 if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \
1495 | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev
/null
2>&1; then
1498 msgfailoutput
'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
1501 msgfailoutput
'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
1511 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1513 aptautotest
'testsuccess' "$@"
1518 if [ "$1" = '--nomsg' ]; then
1521 msgtest
'Test for successful execution with warnings of' "$*"
1523 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output"
1524 if "$@" >${OUTPUT} 2>&1; then
1525 if expr match
"$1" '^apt.*' >/dev
/null
; then
1526 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1527 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1528 elif grep -q -E '^E: ' "$OUTPUT"; then
1529 msgfailoutput
'successful run, but output contains errors' "$OUTPUT" "$@"
1530 elif ! grep -q -E '^W: ' "$OUTPUT"; then
1531 msgfailoutput
'successful run, but output contains no warnings' "$OUTPUT" "$@"
1540 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1542 aptautotest
'testwarning' "$@"
1547 if [ "$1" = '--nomsg' ]; then
1550 msgtest
'Test for failure in execution of' "$*"
1552 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
1553 if "$@" >${OUTPUT} 2>&1; then
1555 msgfailoutput
"exitcode $EXITCODE" "$OUTPUT" "$@"
1558 if expr match
"$1" '^apt.*' >/dev
/null
; then
1559 if [ "$1" = 'aptkey' ]; then
1560 if grep -q -E " Can't check signature: " "$OUTPUT" || \
1561 grep -q -E " BAD signature from " "$OUTPUT"; then
1564 msgfailoutput
"run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@"
1567 if grep -q -E ' runtime error: ' "$OUTPUT"; then
1568 msgfailoutput
'compiler detected undefined behavior' "$OUTPUT" "$@"
1569 elif grep -q -E '==ERROR' "$OUTPUT"; then
1570 msgfailoutput
'compiler sanitizers reported errors' "$OUTPUT" "$@"
1571 elif ! grep -q -E '^E: ' "$OUTPUT"; then
1572 msgfailoutput
"run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@"
1581 aptautotest
'testfailure' "$@"
1585 testsuccessequal
() {
1590 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
1593 testwarningequal
() {
1598 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
1601 testfailureequal
() {
1606 testfileequal
"${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
1615 msgtest
'Check that the output of the previous failed command has expected' 'failures and warnings'
1616 local COMPAREFILE
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile"
1617 grep '^\(W\|E\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true
1618 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.output"
1619 if echo "$CMP" | checkdiff
- "${COMPAREFILE}" >"$OUTPUT" 2>&1; then
1622 echo '### Complete output ###' >"$OUTPUT"
1623 cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" >"$OUTPUT"
1624 msgfailoutput
'' "$OUTPUT"
1631 msgtest
"Test that file $1 has $2 $3" "$4"
1632 if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
1635 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output"
1638 echo -n "stat(1) reports for $2: "
1639 stat
--format "$2" "$1" || true
1641 msgfailoutput
'' "$OUTPUT"
1645 testaccessrights
() {
1647 testfilestats
"$1" '%a' '=' "$2"
1651 testwebserverlaststatuscode
() {
1653 local DOWNLOG
='rootdir/tmp/webserverstatus-testfile.log'
1654 local STATUS
='downloaded/webserverstatus-statusfile.log'
1655 rm -f "$DOWNLOG" "$STATUS"
1656 msgtest
'Test last status code from the webserver was' "$1"
1657 if downloadfile
"http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then
1660 local OUTPUT
="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output"
1662 if [ -n "$2" ]; then
1664 echo >&2 '#### Additionally provided output files contain:'
1667 echo >&2 '#### Download log of the status code:'
1670 msgfailoutput
"Status was $(cat "$STATUS")" "$OUTPUT"
1676 echo "STOPPED execution. Press enter to continue"
1681 listcurrentlistsdirectory
() {
1683 find rootdir
/var
/lib
/apt
/lists
-maxdepth 1 -type d
| while read line
; do
1684 stat
--format '%U:%G:%a:%n' "$line"
1686 find rootdir
/var
/lib
/apt
/lists
-maxdepth 1 \
! -type d
| while read line
; do
1687 stat
--format '%U:%G:%a:%s:%y:%n' "$line"
1692 ### convenience hacks ###
1694 # creating some directories by hand is a tedious task, so make it look simple
1695 if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
1696 [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
1697 # only the last directory created by mkdir is effected by the -m !
1698 command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
1699 command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"
1700 command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
1701 touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock"
1702 if [ "$(id -u)" = '0' ]; then
1703 chown _apt
:root
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
1710 ### The following tests are run by most test methods automatically to check
1711 ### general things about commands executed without writing the test every time.
1717 local AUTOTEST
="aptautotest_$(basename "$CMD" | tr -d '-')_$(echo "$FIRSTOPT" | tr -d '-')"
1718 if command -v $AUTOTEST >/dev
/null
; then
1720 # save and restore the *.output files from other tests
1721 # as we might otherwise override them in these automatic tests
1722 rm -rf ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before
1723 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before
1724 mkdir ${TMPWORKINGDIRECTORY}/rootdir
/tmp
1725 $AUTOTEST "$TESTCALL" "$@"
1726 rm -rf ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-aptautotest
1727 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
${TMPWORKINGDIRECTORY}/rootdir
/tmp
-aptautotest
1728 mv ${TMPWORKINGDIRECTORY}/rootdir
/tmp
-before ${TMPWORKINGDIRECTORY}/rootdir
/tmp
1732 aptautotest_aptget_update
() {
1734 while [ -n "$2" ]; do
1735 if [ "$2" = '--print-uris' ]; then return; fi # simulation mode
1738 if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
1739 testfilestats
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
1740 testfilestats
"${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
1741 # all copied files are properly chmodded
1742 for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do
1743 testfilestats
"$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
1745 if [ "$TESTCALL" = 'testsuccess' ]; then
1746 # failure cases can retain partial files and such
1747 testempty
find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \
( -name 'lock' -o -name '*.FAILED' \
)
1750 aptautotest_apt_update
() { aptautotest_aptget_update
"$@"; }
1751 aptautotest_aptcdrom_add
() { aptautotest_aptget_update
"$@"; }
1753 testaptautotestnodpkgwarning
() {
1755 while [ -n "$2" ]; do
1756 if expr match
"$2" '^-[a-z]*s' >/dev
/null
2>&1; then return; fi # simulation mode
1757 if expr match
"$2" '^-dy\?' >/dev
/null
2>&1; then return; fi # download-only mode
1760 testfailure
grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output"
1763 aptautotest_aptget_install
() { testaptautotestnodpkgwarning
"$@"; }
1764 aptautotest_aptget_remove
() { testaptautotestnodpkgwarning
"$@"; }
1765 aptautotest_aptget_purge
() { testaptautotestnodpkgwarning
"$@"; }
1766 aptautotest_apt_install
() { testaptautotestnodpkgwarning
"$@"; }
1767 aptautotest_apt_remove
() { testaptautotestnodpkgwarning
"$@"; }
1768 aptautotest_apt_purge
() { testaptautotestnodpkgwarning
"$@"; }