]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
merged from debian-sid
[apt.git] / test / integration / framework
index cc5af798c9b38448bba008ec9f85ac47ee1a1b84..fa451cf4f3c2c7cfa988efb43688090254ae3f3f 100644 (file)
@@ -151,6 +151,7 @@ setupenvironment() {
 
 configarchitecture() {
        local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
+       rm -f $CONFFILE
        echo "APT::Architecture \"$1\";" > $CONFFILE
        shift
        while [ -n "$1" ]; do
@@ -429,6 +430,27 @@ Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
        done
 }
 
+insertsource() {
+       local RELEASE="$1"
+       local NAME="$2"
+       local ARCH="$3"
+       local VERSION="$4"
+       local DEPENDENCIES="$5"
+       local ARCHS=""
+       local SPATH="aptarchive/dists/${RELEASE}/main/source"
+       mkdir -p $SPATH
+       local FILE="${SPATH}/Sources"
+       echo "Package: $NAME
+Binary: $NAME
+Version: $VERSION
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: $ARCH" >> $FILE
+       test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
+       echo "Files:
+ d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz" >> $FILE
+}
+
 insertinstalledpackage() {
        local NAME="$1"
        local ARCH="$2"
@@ -481,6 +503,10 @@ buildaptarchivefromfiles() {
        generatereleasefiles
 }
 
+# can be overridden by testcases for their pleasure
+getcodenamefromsuite() { echo -n "$1"; }
+getreleaseversionfromsuite() { true; }
+
 generatereleasefiles() {
        msgninfo "\tGenerate Release files… "
        local DATE="${1:-now}"
@@ -489,9 +515,22 @@ generatereleasefiles() {
                        aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index
                done
                for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
-                       local CODENAME="$(echo "$dir" | cut -d'/' -f 4)"
-                       aptftparchive -qq release $dir -o APT::FTPArchive::Release::Suite="${CODENAME}" -o APT::FTPArchive::Release::Codename="${CODENAME}" | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
-                       if [ "$CODENAME" = "experimental" -o "$CODENAME" = "experimental2" ]; then
+                       local SUITE="$(echo "$dir" | cut -d'/' -f 4)"
+                       local CODENAME="$(getcodenamefromsuite $SUITE)"
+                       local VERSION="$(getreleaseversionfromsuite $SUITE)"
+                       if [ -z "$VERSION" ]; then
+                               aptftparchive -qq release $dir \
+                                       -o APT::FTPArchive::Release::Suite="${SUITE}" \
+                                       -o APT::FTPArchive::Release::Codename="${CODENAME}" \
+                                               | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
+                       else
+                               aptftparchive -qq release $dir \
+                                       -o APT::FTPArchive::Release::Suite="${SUITE}" \
+                                       -o APT::FTPArchive::Release::Codename="${CODENAME}" \
+                                       -o APT::FTPArchive::Release::Version="${VERSION}" \
+                                               | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
+                       fi
+                       if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
                                sed -i '/^Date: / a\
 NotAutomatic: yes' $dir/Release
                        fi
@@ -708,3 +747,9 @@ testmarkedauto() {
        fi
        aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
+
+pause() {
+       echo "STOPPED execution. Press enter to continue"
+       local IGNORE
+       read IGNORE
+}