* apt-pkg/indexrecords.cc:
[ntk/apt.git] / test / integration / framework
index 45c1f15..322cf28 100644 (file)
@@ -515,8 +515,9 @@ getcodenamefromsuite() { echo -n "$1"; }
 getreleaseversionfromsuite() { true; }
 
 generatereleasefiles() {
+       # $1 is the Date header and $2 is the ValidUntil header to be set
+       # both should be given in notation date/touch can understand
        msgninfo "\tGenerate Release files… "
-       local DATE="${1:-now}"
        if [ -e aptarchive/dists ]; then
                for dir in $(find ./aptarchive/dists -mindepth 3 -maxdepth 3 -type d -name 'i18n'); do
                        aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index
@@ -525,27 +526,31 @@ generatereleasefiles() {
                        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
+                       if [ -n "$VERSION" ]; then
+                               VERSION="-o APT::FTPArchive::Release::Version='${VERSION}'"
                        fi
+                       aptftparchive -qq release $dir \
+                               -o APT::FTPArchive::Release::Suite="${SUITE}" \
+                               -o APT::FTPArchive::Release::Codename="${CODENAME}" \
+                               -o APT::FTPArchive::Release::Label="Testcases" \
+                               ${VERSION} \
+                                       | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
                        if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
                                sed -i '/^Date: / a\
 NotAutomatic: yes' $dir/Release
                        fi
+                       if [ -n "$1" -a "$1" != "now" ]; then
+                               sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release
+                       fi
+                       if [ -n "$2" ]; then
+                               sed -i "/^Date: / a\
+Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release
+                       fi
                done
        else
                aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference
        fi
-       if [ "$DATE" != "now" ]; then
+       if [ -n "$1" -a "$1" != "now" ]; then
                for release in $(find ./aptarchive -name 'Release'); do
                        touch -d "$1" $release
                done