if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then
echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it…
fi
+ echo 'quiet "0";'
echo 'quiet::NoUpdate "true";'
echo 'quiet::NoStatistic "true";'
# too distracting for users, but helpful to detect changes
# both should be given in notation date/touch can understand
local DATE="$1"
local VALIDUNTIL="$2"
- msgninfo "\tGenerate Release files… "
if [ -e aptarchive/dists ]; then
+ msgninfo "\tGenerate Release files for dists… "
for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")"
local SUITE="$(echo "$dir" | cut -d'/' -f 4)"
local VERSION="$(getreleaseversionfromsuite $SUITE)"
local LABEL="$(getlabelfromsuite $SUITE)"
local ORIGIN="$(getoriginfromsuite $SUITE)"
- if [ -n "$VERSION" ]; then
- VERSION="-o APT::FTPArchive::Release::Version=${VERSION}"
- fi
- if [ -n "$LABEL" ]; then
- LABEL="-o APT::FTPArchive::Release::Label=${LABEL}"
- fi
- if [ -n "$ORIGIN" ]; then
- ORIGIN="-o APT::FTPArchive::Release::Origin=${ORIGIN}"
- fi
- if [ -n "$ARCHITECTURES" ]; then
- ARCHITECTURES="-o APT::FTPArchive::Release::Architectures=${ARCHITECTURES}"
- fi
aptftparchiverelease "$dir" \
-o APT::FTPArchive::Release::Suite="${SUITE}" \
-o APT::FTPArchive::Release::Codename="${CODENAME}" \
- ${ARCHITECTURES} \
- ${LABEL} \
- ${ORIGIN} \
- ${VERSION} \
+ -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \
+ -o APT::FTPArchive::Release::Label="${LABEL}" \
+ -o APT::FTPArchive::Release::Origin="${ORIGIN}" \
+ -o APT::FTPArchive::Release::Version="${VERSION}" \
> "$dir/Release"
if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
sed -i '/^Date: / a\
fi
done
else
+ msgninfo "\tGenerate Release files for flat… "
aptftparchiverelease ./aptarchive > aptarchive/Release
fi
if [ -n "$DATE" -a "$DATE" != "now" ]; then
local ARCH="$(getarchitecture 'native')"
echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE"
local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output"
- testoutputequal "$COMPAREFILE" aptcache show -q=0 "$PACKAGE"
+ testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE"
msggroup
}
msgfail "$MSG"
}
-testsuccess() {
- msggroup 'testsuccess'
+testsuccesswithglobalerror() {
+ local TYPE="$1"
+ local ERRORS="$2"
+ shift 2
+ msggroup "$TYPE"
if [ "$1" = '--nomsg' ]; then
shift
else
msgtest 'Test for successful execution of' "$*"
fi
- local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output"
if "$@" >"${OUTPUT}" 2>&1; then
if expr match "$1" '^apt.*' >/dev/null; then
if grep -q -E ' runtime error: ' "$OUTPUT"; then
msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@"
- elif grep -E '^[WE]: ' "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then
+ elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then
if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then
if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \
| cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then
else
msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@"
fi
+ elif [ "$TYPE" = 'testsuccesswithnotice' ]; then
+ if grep -q -E "^N: " "$OUTPUT"; then
+ msgpass
+ else
+ msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@"
+ fi
else
msgpass
fi
local EXITCODE=$?
msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@"
fi
- aptautotest 'testsuccess' "$@"
+ aptautotest "$TYPE" "$@"
msggroup
}
+testsuccesswithnotice() {
+ testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@"
+}
+testsuccess() {
+ testsuccesswithglobalerror 'testsuccess' 'NWE' "$@"
+}
testwarning() {
msggroup 'testwarning'
if [ "$1" = '--nomsg' ]; then
testreturnstateequal() {
local STATE="$1"
- msggroup "${STATE}equal"
- if [ "$2" != '--nomsg' ]; then
- local CMP="$2"
- shift 2
- "$STATE" "$@"
- testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
- else
- local CMP="$3"
+ if [ "$STATE" = 'testsuccesswithglobalerror' ]; then
+ local STATE="$2"
+ local TYPE="$3"
shift 3
- "$STATE" --nomsg "$@"
- testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ msggroup "${STATE}equal"
+ if [ "$1" != '--nomsg' ]; then
+ local CMP="$1"
+ shift
+ testsuccesswithglobalerror "$STATE" "$TYPE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ else
+ local CMP="$2"
+ shift 2
+ testsuccesswithglobalerror "$STATE" "$TYPE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ fi
+ else
+ msggroup "${STATE}equal"
+ if [ "$2" != '--nomsg' ]; then
+ local CMP="$2"
+ shift 2
+ "$STATE" "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ else
+ local CMP="$3"
+ shift 3
+ "$STATE" --nomsg "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP"
+ fi
fi
msggroup
}
testsuccessequal() {
- testreturnstateequal 'testsuccess' "$@"
+ # we compare output, so we know perfectly well about N:
+ testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@"
}
testwarningequal() {
testreturnstateequal 'testwarning' "$@"
### convenience hacks ###
mkdir() {
# creating some directories by hand is a tedious task, so make it look simple
- if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
- [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
+ local PARAMS="$*"
+ if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then
# only the last directory created by mkdir is effected by the -m !
command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"