summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-09-12 16:09:53 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-09-12 16:09:53 +0200
commit7adf8bb88faba98793998bed1e6c60f4b5483531 (patch)
tree4002c43084de6db6eb4f6128baa241cb6c757ba7
parent178dd062eeaa1d7e56770455e005dc27aa71f026 (diff)
parent02679bb36369dce76f3a2159dbb829ba221c1e67 (diff)
merged from lp:~donkult/apt/sid
-rw-r--r--apt-pkg/acquire-item.cc47
-rw-r--r--apt-pkg/acquire.cc4
-rw-r--r--apt-pkg/cachefile.cc14
-rw-r--r--apt-pkg/cachefile.h1
-rw-r--r--apt-pkg/indexrecords.cc21
-rw-r--r--apt-pkg/orderlist.cc70
-rw-r--r--apt-pkg/orderlist.h4
-rw-r--r--apt-pkg/packagemanager.cc31
-rw-r--r--cmdline/apt-get.cc20
-rwxr-xr-xcmdline/apt-key2
-rw-r--r--debian/changelog32
-rw-r--r--doc/apt.conf.5.xml25
-rw-r--r--test/integration/framework36
-rwxr-xr-xtest/integration/test-bug-254770-segfault-if-cache-not-buildable1
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order2
-rwxr-xr-xtest/integration/test-bug-595691-empty-and-broken-archive-files2
-rwxr-xr-xtest/integration/test-bug-601016-description-translation2
-rwxr-xr-xtest/integration/test-bug-618288-multiarch-same-lockstep4
-rwxr-xr-xtest/integration/test-bug-632221-cross-dependency-satisfaction16
-rwxr-xr-xtest/integration/test-bug-633350-do-not-kill-last-char-in-Release2
-rwxr-xr-xtest/integration/test-compressed-indexes17
-rwxr-xr-xtest/integration/test-disappearing-packages8
-rwxr-xr-xtest/integration/test-hashsum-verification2
-rwxr-xr-xtest/integration/test-policy-pinning7
-rwxr-xr-xtest/integration/test-releasefile-valid-until95
-rwxr-xr-xtest/integration/test-releasefile-verification3
-rwxr-xr-xtest/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first31
27 files changed, 375 insertions, 124 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 566f51606..39ce90dda 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1258,9 +1258,9 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, /*{{{*
if (SigFile == "")
{
// There was no signature file, so we are finished. Download
- // the indexes and do only hashsum verification
+ // the indexes and do only hashsum verification if possible
MetaIndexParser->Load(DestFile);
- QueueIndexes(true);
+ QueueIndexes(false);
}
else
{
@@ -1378,33 +1378,30 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
++Target)
{
HashString ExpectedIndexHash;
- if (verify)
+ const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey);
+ if (Record == NULL)
{
- const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey);
- if (Record == NULL)
+ if (verify == true && (*Target)->IsOptional() == false)
{
- if ((*Target)->IsOptional() == false)
- {
- Status = StatAuthError;
- strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str());
- return;
- }
+ Status = StatAuthError;
+ strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str());
+ return;
}
- else
+ }
+ else
+ {
+ ExpectedIndexHash = Record->Hash;
+ if (_config->FindB("Debug::pkgAcquire::Auth", false))
{
- ExpectedIndexHash = Record->Hash;
- if (_config->FindB("Debug::pkgAcquire::Auth", false))
- {
- std::cerr << "Queueing: " << (*Target)->URI << std::endl;
- std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
- std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
- }
- if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
- {
- Status = StatAuthError;
- strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str());
- return;
- }
+ std::cerr << "Queueing: " << (*Target)->URI << std::endl;
+ std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
+ std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
+ }
+ if (verify == true && ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
+ {
+ Status = StatAuthError;
+ strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str());
+ return;
}
}
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index a2da196be..ef120d8e9 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -445,6 +445,10 @@ pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I)
if it is part of the download set. */
bool pkgAcquire::Clean(string Dir)
{
+ // non-existing directories are by definition clean…
+ if (DirectoryExists(Dir) == false)
+ return true;
+
DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc
index 964c5bd8b..a76cfc08e 100644
--- a/apt-pkg/cachefile.cc
+++ b/apt-pkg/cachefile.cc
@@ -163,6 +163,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
return true;
}
/*}}}*/
+// CacheFile::RemoveCaches - remove all cache files from disk /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgCacheFile::RemoveCaches()
+{
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
+ if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+ unlink(pkgcache.c_str());
+ if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+ unlink(srcpkgcache.c_str());
+}
+ /*}}}*/
// CacheFile::Close - close the cache files /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h
index 09d3ec267..b4f41c6f4 100644
--- a/apt-pkg/cachefile.h
+++ b/apt-pkg/cachefile.h
@@ -57,6 +57,7 @@ class pkgCacheFile
bool Open(OpProgress *Progress = NULL, bool WithLock = true);
inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); };
__deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); };
+ static void RemoveCaches();
void Close();
inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; };
diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc
index 10e154ad2..ba5b7c846 100644
--- a/apt-pkg/indexrecords.cc
+++ b/apt-pkg/indexrecords.cc
@@ -113,10 +113,14 @@ bool indexRecords::Load(const string Filename) /*{{{*/
}
// get the user settings for this archive and use what expires earlier
int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0);
- if (Label.empty() == true)
+ if (Label.empty() == false)
MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
+ int MinAge = _config->FindI("Acquire::Min-ValidTime", 0);
+ if (Label.empty() == false)
+ MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
- if(MaxAge == 0) // No user settings, use the one from the Release file
+ if(MaxAge == 0 &&
+ (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file
return true;
time_t date;
@@ -125,10 +129,17 @@ bool indexRecords::Load(const string Filename) /*{{{*/
strprintf(ErrorText, _("Invalid 'Date' entry in Release file %s"), Filename.c_str());
return false;
}
- date += 24*60*60*MaxAge;
- if (ValidUntil == 0 || ValidUntil > date)
- ValidUntil = date;
+ if (MinAge != 0 && ValidUntil != 0) {
+ time_t const min_date = date + MinAge;
+ if (ValidUntil < min_date)
+ ValidUntil = min_date;
+ }
+ if (MaxAge != 0) {
+ time_t const max_date = date + MaxAge;
+ if (ValidUntil == 0 || ValidUntil > max_date)
+ ValidUntil = max_date;
+ }
return true;
}
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index a58efa987..cae5b0a48 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -152,7 +152,7 @@ bool pkgOrderList::DoRun()
iterator OldEnd = End;
End = NList;
for (iterator I = List; I != OldEnd; ++I)
- if (VisitNode(PkgIterator(Cache,*I)) == false)
+ if (VisitNode(PkgIterator(Cache,*I), "DoRun") == false)
{
End = OldEnd;
return false;
@@ -495,33 +495,69 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver)
/*}}}*/
// OrderList::VisitProvides - Visit all of the providing packages /*{{{*/
// ---------------------------------------------------------------------
-/* This routine calls visit on all providing packages. */
+/* This routine calls visit on all providing packages.
+
+ If the dependency is negative it first visits packages which are
+ intended to be removed and after that all other packages.
+ It does so to avoid situations in which this package is used to
+ satisfy a (or-group/provides) dependency of another package which
+ could have been satisfied also by upgrading another package -
+ otherwise we have more broken packages dpkg needs to auto-
+ deconfigure and in very complicated situations it even decides
+ against it! */
bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
-{
+{
SPtrArray<Version *> List = D.AllTargets();
- for (Version **I = List; *I != 0; I++)
+ for (Version **I = List; *I != 0; ++I)
{
VerIterator Ver(Cache,*I);
PkgIterator Pkg = Ver.ParentPkg();
+ if (D.IsNegative() == true && Cache[Pkg].Delete() == false)
+ continue;
+
if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
continue;
-
+
if (D.IsNegative() == false &&
Cache[Pkg].InstallVer != *I)
continue;
-
+
if (D.IsNegative() == true &&
(Version *)Pkg.CurrentVer() != *I)
continue;
-
+
+ // Skip over missing files
+ if (Critical == false && IsMissing(D.ParentPkg()) == true)
+ continue;
+
+ if (VisitNode(Pkg, "Provides-1") == false)
+ return false;
+ }
+ if (D.IsNegative() == false)
+ return true;
+ for (Version **I = List; *I != 0; ++I)
+ {
+ VerIterator Ver(Cache,*I);
+ PkgIterator Pkg = Ver.ParentPkg();
+
+ if (Cache[Pkg].Delete() == true)
+ continue;
+
+ if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
+ continue;
+
+ if ((Version *)Pkg.CurrentVer() != *I)
+ continue;
+
// Skip over missing files
if (Critical == false && IsMissing(D.ParentPkg()) == true)
continue;
- if (VisitNode(Pkg) == false)
+ if (VisitNode(Pkg, "Provides-2") == false)
return false;
}
+
return true;
}
/*}}}*/
@@ -530,7 +566,7 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
/* This is the core ordering routine. It calls the set dependency
consideration functions which then potentialy call this again. Finite
depth is achived through the colouring mechinism. */
-bool pkgOrderList::VisitNode(PkgIterator Pkg)
+bool pkgOrderList::VisitNode(PkgIterator Pkg, char const* from)
{
// Looping or irrelevent.
// This should probably trancend not installed packages
@@ -541,7 +577,7 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg)
if (Debug == true)
{
for (int j = 0; j != Depth; j++) clog << ' ';
- clog << "Visit " << Pkg.FullName() << endl;
+ clog << "Visit " << Pkg.FullName() << " from " << from << endl;
}
Depth++;
@@ -636,7 +672,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
if (CheckDep(D) == true)
continue;
- if (VisitNode(D.ParentPkg()) == false)
+ if (VisitNode(D.ParentPkg(), "UnPackCrit") == false)
return false;
}
else
@@ -811,7 +847,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D)
if (IsMissing(D.ParentPkg()) == true)
continue;
- if (VisitNode(D.ParentPkg()) == false)
+ if (VisitNode(D.ParentPkg(), "UnPackDep-Parent") == false)
return false;
}
else
@@ -825,7 +861,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D)
if (CheckDep(D) == true)
continue;
- if (VisitNode(D.TargetPkg()) == false)
+ if (VisitNode(D.TargetPkg(), "UnPackDep-Target") == false)
return false;
}
}
@@ -924,7 +960,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
if (IsFlag(P, InList) == true &&
IsFlag(P, AddPending) == false &&
Cache[P].InstallVer != 0 &&
- VisitNode(P) == true)
+ VisitNode(P, "Remove-P") == true)
{
Flag(P, Immediate);
tryFixDeps = false;
@@ -960,7 +996,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
if (IsFlag(F.TargetPkg(), InList) == true &&
IsFlag(F.TargetPkg(), AddPending) == false &&
Cache[F.TargetPkg()].InstallVer != 0 &&
- VisitNode(F.TargetPkg()) == true)
+ VisitNode(F.TargetPkg(), "Remove-Target") == true)
{
Flag(F.TargetPkg(), Immediate);
tryFixDeps = false;
@@ -974,7 +1010,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
if (IsFlag(Prv.OwnerPkg(), InList) == true &&
IsFlag(Prv.OwnerPkg(), AddPending) == false &&
Cache[Prv.OwnerPkg()].InstallVer != 0 &&
- VisitNode(Prv.OwnerPkg()) == true)
+ VisitNode(Prv.OwnerPkg(), "Remove-Owner") == true)
{
Flag(Prv.OwnerPkg(), Immediate);
tryFixDeps = false;
@@ -994,7 +1030,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
if (IsMissing(D.ParentPkg()) == true)
continue;
- if (VisitNode(D.ParentPkg()) == false)
+ if (VisitNode(D.ParentPkg(), "Remove-Parent") == false)
return false;
}
diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h
index bbceb3879..264f7ba03 100644
--- a/apt-pkg/orderlist.h
+++ b/apt-pkg/orderlist.h
@@ -18,6 +18,7 @@
#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/macros.h>
class pkgDepCache;
class pkgOrderList : protected pkgCache::Namespace
@@ -45,7 +46,8 @@ class pkgOrderList : protected pkgCache::Namespace
bool Debug;
// Main visit function
- bool VisitNode(PkgIterator Pkg);
+ __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); };
+ bool VisitNode(PkgIterator Pkg, char const* from);
bool VisitDeps(DepFunc F,PkgIterator Pkg);
bool VisitRDeps(DepFunc F,PkgIterator Pkg);
bool VisitRProvides(DepFunc F,VerIterator Ver);
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 6601d9f6b..8b73b9980 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -603,18 +603,39 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
- if (instVer->MultiArch == pkgCache::Version::Same)
+ if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same)
+ {
+ /* Do lockstep M-A:same unpacking in two phases:
+ First unpack all installed architectures, then the not installed.
+ This way we avoid that M-A: enabled packages are installed before
+ their older non-M-A enabled packages are replaced by newer versions */
+ bool const installed = Pkg->CurrentVer != 0;
+ if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false)
+ return false;
for (PkgIterator P = Pkg.Group().PackageList();
P.end() == false; P = Pkg.Group().NextPkg(P))
{
- if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+ if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
(Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
continue;
- SmartUnPack(P, false);
+ if (SmartUnPack(P, false) == false)
+ return false;
}
-
- if(Install(Pkg,FileNames[Pkg->ID]) == false)
+ if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false)
+ return false;
+ for (PkgIterator P = Pkg.Group().PackageList();
+ P.end() == false; P = Pkg.Group().NextPkg(P))
+ {
+ if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+ Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
+ (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
+ continue;
+ if (SmartUnPack(P, false) == false)
+ return false;
+ }
+ }
+ else if (Install(Pkg,FileNames[Pkg->ID]) == false)
return false;
// Perform immedate configuration of the package.
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 1849f1335..69b9dcda9 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1625,7 +1625,8 @@ bool DoUpdate(CommandLine &CmdL)
if (_config->FindB("APT::Get::Download",true) == true)
ListUpdate(Stat, *List);
- // Rebuild the cache.
+ // Rebuild the cache.
+ pkgCacheFile::RemoveCaches();
if (Cache.BuildCaches() == false)
return false;
@@ -2203,10 +2204,14 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
/* */
bool DoClean(CommandLine &CmdL)
{
+ std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+ std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
if (_config->FindB("APT::Get::Simulate") == true)
{
- cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " <<
- _config->FindDir("Dir::Cache::archives") << "partial/*" << endl;
+ cout << "Del " << archivedir << "* " << archivedir << "partial/*"<< endl
+ << "Del " << pkgcache << " " << srcpkgcache << endl;
return true;
}
@@ -2214,14 +2219,17 @@ bool DoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ Lock.Fd(GetLock(archivedir + "lock"));
if (_error->PendingError() == true)
return _error->Error(_("Unable to lock the download directory"));
}
pkgAcquire Fetcher;
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
- Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
+ Fetcher.Clean(archivedir);
+ Fetcher.Clean(archivedir + "partial/");
+
+ pkgCacheFile::RemoveCaches();
+
return true;
}
/*}}}*/
diff --git a/cmdline/apt-key b/cmdline/apt-key
index e632be706..97d6e0323 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -152,7 +152,7 @@ if [ "$1" = "--keyring" ]; then
#echo "keyfile given"
shift
TRUSTEDFILE="$1"
- if [ -r "$TRUSTEDFILE" ]; then
+ if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
else
echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
diff --git a/debian/changelog b/debian/changelog
index 56d4c7e0e..7d005475d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,16 +3,42 @@ apt (0.8.15.7) UNRELEASED; urgency=low
[ David Kalnischkies ]
* apt-pkg/packagemanager.cc, apt-pkg/pkgcache.cc:
- ignore "self"-conflicts for all architectures of a package
- instead of just for the architecture of the package locked at
- in the ordering of installations too (Closes: #802901)
+ instead of just for the architecture of the package look at
+ in the ordering of installations, too (LP: #802901)
+ - M-A:same lockstep unpack should operate on installed
+ packages first (LP: #835625)
* test/*
- reorganize the various testcases and helper we have and
integrate them better into the buildsystem
- run the test/libapt testcases at package build-time
* debian/apt.symbols:
- add the newly added symbols since 0.8.15.3
+ * cmdline/apt-get.cc:
+ - remove the binary caches in 'apt-get clean' as it is the first
+ thing recommend by many supporters in case of APT segfaults
+ - remove the caches in 'apt-get update', too, as they will be
+ invalid in most cases anyway
+ * apt-pkg/acquire-item.cc:
+ - if no Release.gpg file is found try to verify with hashes,
+ but do not fail if a hash can't be found
+ * apt-pkg/acquire.cc:
+ - non-existing directories are by definition clean
+ * cmdline/apt-key:
+ - if command is 'add' do not error out if the specified
+ keyring doesn't exist, it will be created by gpg
+ * apt-pkg/orderlist.cc:
+ - prefer visiting packages marked for deletion in VisitProvides
+ if we are operating on a negative dependency so that we can
+ deal early with the fallout of this remove
+ * apt-pkg/indexrecords.cc:
+ - fix Acquire::Max-ValidTime option by interpreting it really
+ as seconds as specified in the manpage and not as days
+ - add an Acquire::Min-ValidTime option (Closes: #640122)
+ * doc/apt.conf.5.xml:
+ - reword Acquire::Max-ValidTime documentation to make clear
+ that it doesn't provide the new Min-ValidTime functionality
- -- David Kalnischkies <kalnischkies@gmail.com> Wed, 17 Aug 2011 15:09:16 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Fri, 09 Sep 2011 12:49:24 +0200
apt (0.8.15.6) unstable; urgency=low
diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml
index 2634c47a9..1adc868e0 100644
--- a/doc/apt.conf.5.xml
+++ b/doc/apt.conf.5.xml
@@ -267,14 +267,23 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
<varlistentry><term>Max-ValidTime</term>
<listitem><para>Seconds the Release file should be considered valid after
- it was created. The default is "for ever" (0) if the Release file of the
- archive doesn't include a <literal>Valid-Until</literal> header.
- If it does then this date is the default. The date from the Release file or
- the date specified by the creation time of the Release file
- (<literal>Date</literal> header) plus the seconds specified with this
- options are used to check if the validation of a file has expired by using
- the earlier date of the two. Archive specific settings can be made by
- appending the label of the archive to the option name.
+ it was created (indicated by the <literal>Date</literal> header).
+ If the Release file itself includes a <literal>Valid-Until</literal> header
+ the earlier date of the two is used as the expiration date.
+ The default value is <literal>0</literal> which stands for "for ever".
+ Archive specific settings can be made by appending the label of the archive
+ to the option name.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry><term>Min-ValidTime</term>
+ <listitem><para>Minimum of seconds the Release file should be considered
+ valid after it was created (indicated by the <literal>Date</literal> header).
+ Use this if you need to use a seldomly updated (local) mirror of a more
+ regular updated archive with a <literal>Valid-Until</literal> header
+ instead of competely disabling the expiration date checking.
+ Archive specific settings can and should be used by appending the label of
+ the archive to the option name.
</para></listitem>
</varlistentry>
diff --git a/test/integration/framework b/test/integration/framework
index 45c1f156a..a2e71760e 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -513,10 +513,12 @@ buildaptarchivefromfiles() {
# can be overridden by testcases for their pleasure
getcodenamefromsuite() { echo -n "$1"; }
getreleaseversionfromsuite() { true; }
+getlabelfromsuite() { 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 +527,35 @@ 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
+ local LABEL="$(getlabelfromsuite $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
+ aptftparchive -qq release $dir \
+ -o APT::FTPArchive::Release::Suite="${SUITE}" \
+ -o APT::FTPArchive::Release::Codename="${CODENAME}" \
+ ${LABEL} \
+ ${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
diff --git a/test/integration/test-bug-254770-segfault-if-cache-not-buildable b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
index b9f45b131..8fa337ccc 100755
--- a/test/integration/test-bug-254770-segfault-if-cache-not-buildable
+++ b/test/integration/test-bug-254770-segfault-if-cache-not-buildable
@@ -12,7 +12,6 @@ trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
chmod a-x rootdir/var/lib/dpkg
testsegfault() {
- rm -f rootdir/var/cache/apt/*.bin
msgtest "No segfault in" "$*"
local TEST="$($* 2>&1 | grep -v 'E:')"
if [ -z "$TEST" ]; then
diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
index 0f6493948..645e86d7d 100755
--- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
+++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
@@ -25,7 +25,6 @@ MD5sum: 8489687ce10e656babd467c9ee389349
Description-de: Verschiedene Dateien für das Basis-System von Debian"
predependsgawk() {
- rm rootdir/var/cache/apt/*.bin
cp $TESTDIR/$(echo "$(basename $0)" | sed 's/test-/status-/') rootdir/var/lib/dpkg/status
echo "$pkgbasefile
Pre-Depends: $1
@@ -57,7 +56,6 @@ predependsgawk "awk | aawk"
predependsgawk "awk"
predependsgawk2() {
- rm rootdir/var/cache/apt/*.bin
cp $TESTDIR/$(echo "$(basename $0)" | sed 's/test-/status-/') rootdir/var/lib/dpkg/status
echo "$pkgbasefile
Pre-Depends: $1
diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files
index 11dee0628..5c103da6f 100755
--- a/test/integration/test-bug-595691-empty-and-broken-archive-files
+++ b/test/integration/test-bug-595691-empty-and-broken-archive-files
@@ -11,7 +11,7 @@ touch aptarchive/Packages
setupflataptarchive
testaptgetupdate() {
- rm -rf rootdir/var/lib/apt rootdir/var/cache/apt
+ rm -rf rootdir/var/lib/apt
aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
GIVEN="$1"
diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/test-bug-601016-description-translation
index 2a323a201..44ab91900 100755
--- a/test/integration/test-bug-601016-description-translation
+++ b/test/integration/test-bug-601016-description-translation
@@ -57,7 +57,7 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg
testrun() {
echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
export LC_ALL=""
- rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/
+ rm -rf rootdir/var/lib/apt/lists
setupaptarchive
testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep
index 7e384e428..a05f03df4 100755
--- a/test/integration/test-bug-618288-multiarch-same-lockstep
+++ b/test/integration/test-bug-618288-multiarch-same-lockstep
@@ -22,8 +22,8 @@ Building dependency tree...
The following packages will be upgraded:
apt:i386 apt2 libsame libsame:i386
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Inst libsame [1] (2 unstable [amd64]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:i386 apt2:amd64 ]
-Inst libsame:i386 [1] (2 unstable [i386]) [apt2:amd64 apt:i386 ]
+Inst libsame:i386 [1] (2 unstable [i386]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:amd64 apt:i386 ]
+Inst libsame [1] (2 unstable [amd64]) [apt2:amd64 apt:i386 ]
Conf libsame:i386 (2 unstable [i386]) [apt2:amd64 apt:i386 ]
Conf libsame (2 unstable [amd64]) [apt2:amd64 apt:i386 ]
Inst apt2 [1] (2 unstable [amd64]) [apt:i386 ]
diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction
index 58de44843..4299f052f 100755
--- a/test/integration/test-bug-632221-cross-dependency-satisfaction
+++ b/test/integration/test-bug-632221-cross-dependency-satisfaction
@@ -47,10 +47,10 @@ Inst amdboot (1.0 unstable [amd64])
Inst cool (1.0 unstable [amd64])
Inst doxygen (1.0 unstable [amd64])
Inst foreigner (1.0 unstable [amd64])
-Inst libc6:armel (1.0 unstable [armel])
Inst libc6 (1.0 unstable [amd64])
-Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libc6:armel (1.0 unstable [armel])
Inst libc6-dev (1.0 unstable [amd64])
+Inst libc6-dev:armel (1.0 unstable [armel])
Conf amdboot (1.0 unstable [amd64])
Conf cool (1.0 unstable [amd64])
Conf doxygen (1.0 unstable [amd64])
@@ -90,10 +90,10 @@ Inst amdboot:amd64 (1.0 unstable [amd64])
Inst cool (1.0 unstable [armel])
Inst doxygen (1.0 unstable [armel])
Inst foreigner (1.0 unstable [armel])
-Inst libc6 (1.0 unstable [armel])
Inst libc6:amd64 (1.0 unstable [amd64])
-Inst libc6-dev (1.0 unstable [armel])
+Inst libc6 (1.0 unstable [armel])
Inst libc6-dev:amd64 (1.0 unstable [amd64])
+Inst libc6-dev (1.0 unstable [armel])
Conf amdboot:amd64 (1.0 unstable [amd64])
Conf cool (1.0 unstable [armel])
Conf doxygen (1.0 unstable [armel])
@@ -129,10 +129,10 @@ The following NEW packages will be installed:
0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
Inst amdboot (1.0 unstable [amd64])
Inst doxygen (1.0 unstable [amd64])
-Inst libc6:armel (1.0 unstable [armel])
Inst libc6 (1.0 unstable [amd64])
-Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libc6:armel (1.0 unstable [armel])
Inst libc6-dev (1.0 unstable [amd64])
+Inst libc6-dev:armel (1.0 unstable [armel])
Conf amdboot (1.0 unstable [amd64])
Conf doxygen (1.0 unstable [amd64])
Conf libc6 (1.0 unstable [amd64])
@@ -169,10 +169,10 @@ The following NEW packages will be installed:
0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
Inst amdboot:amd64 (1.0 unstable [amd64])
Inst doxygen (1.0 unstable [armel])
-Inst libc6 (1.0 unstable [armel])
Inst libc6:amd64 (1.0 unstable [amd64])
-Inst libc6-dev (1.0 unstable [armel])
+Inst libc6 (1.0 unstable [armel])
Inst libc6-dev:amd64 (1.0 unstable [amd64])
+Inst libc6-dev (1.0 unstable [armel])
Conf amdboot:amd64 (1.0 unstable [amd64])
Conf doxygen (1.0 unstable [armel])
Conf libc6:amd64 (1.0 unstable [amd64])
diff --git a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
index 3d3835507..2aae7cfcc 100755
--- a/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
+++ b/test/integration/test-bug-633350-do-not-kill-last-char-in-Release
@@ -15,7 +15,7 @@ echo 'NotAutomatic: yes' >> aptarchive/dists/unstable/Release
signreleasefiles
find aptarchive/dists -name 'InRelease' -delete
-rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt
+rm -rf rootdir/var/lib/apt/lists
OUTPUT="$(aptget update 2>&1)"
msgtest 'Check that parsing happens without warnings' 'with missing newline'
diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes
index 99943574e..a5e885745 100755
--- a/test/integration/test-compressed-indexes
+++ b/test/integration/test-compressed-indexes
@@ -10,10 +10,10 @@ configarchitecture "i386"
buildsimplenativepackage "testpkg" "i386" "1.0"
setupaptarchive
-local GOODSHOW="$(aptcache show testpkg)
+GOODSHOW="$(aptcache show testpkg)
"
-local GOODPOLICY="$(aptcache policy testpkg)"
-local GOODSHOWSRC="$(aptcache showsrc testpkg)
+GOODPOLICY="$(aptcache policy testpkg)"
+GOODSHOWSRC="$(aptcache showsrc testpkg)
"
test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
@@ -51,17 +51,16 @@ testrun() {
aptget clean
msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
fi
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODSHOW" aptcache show testpkg
testequal "$GOODSHOW" aptcache show testpkg
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODPOLICY" aptcache policy testpkg
testequal "$GOODPOLICY" aptcache policy testpkg
- rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
+ rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
testequal "$GOODSHOWSRC" aptcache showsrc testpkg
testequal "$GOODSHOWSRC" aptcache showsrc testpkg
- rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
- rm -rf rootdir/var/cache/apt/archives
+ aptget clean
msgtest "Check if the source is aptgetable"
aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
@@ -100,7 +99,7 @@ testrun "compressed"
rm rootdir/etc/apt/apt.conf.d/02compressindex
changetowebserver
aptget update -qq
-local GOODPOLICY="$(aptcache policy testpkg)"
+GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4
testequal "$GOODPOLICY" aptcache policy testpkg
diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages
index b5d565c2f..82ba9e592 100755
--- a/test/integration/test-disappearing-packages
+++ b/test/integration/test-disappearing-packages
@@ -12,13 +12,13 @@ buildsimplenativepackage "unrelated" "all" "0.5" "unstable"
setupsimplenativepackage "new-pkg" "i386" "2.0" "unstable" "Provides: old-pkg
Replaces: old-pkg
Conflicts: old-pkg (<< 2.0)"
-local BUILDDIR="incoming/new-pkg-2.0"
+BUILDDIR="incoming/new-pkg-2.0"
echo "/usr/share/doc/new-pkg /usr/share/doc/old-pkg" > ${BUILDDIR}/debian/new-pkg.links
buildpackage "$BUILDDIR" "unstable" "main"
rm -rf "$BUILDDIR"
setupsimplenativepackage "old-pkg" "all" "2.0" "unstable" "Depends: new-pkg"
-local BUILDDIR="incoming/old-pkg-2.0"
+BUILDDIR="incoming/old-pkg-2.0"
echo "/usr/share/doc/new-pkg /usr/share/doc/old-pkg" > ${BUILDDIR}/debian/old-pkg.links
echo "
override_dh_link:
@@ -33,9 +33,9 @@ aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null
testmarkedauto # old-pkg is manual installed
-local CMD="aptget dist-upgrade -y -q=0"
+CMD="aptget dist-upgrade -y -q=0"
msgtest "Test for equality of" "$CMD"
-local COMPAREFILE=$(mktemp)
+COMPAREFILE=$(mktemp)
echo "The following package disappeared from your system as
all files have been overwritten by other packages:
old-pkg
diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification
index 033096ee8..3ac9eccfb 100755
--- a/test/integration/test-hashsum-verification
+++ b/test/integration/test-hashsum-verification
@@ -19,8 +19,6 @@ prepare() {
for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
touch -d 'now - 6 hours' $release
done
- rm -rf rootdir/var/cache/apt/archives
- rm -f rootdir/var/cache/apt/*.bin
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
cat aptarchive/Packages | gzip > aptarchive/Packages.gz
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index fa356ed54..6b1473564 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -30,21 +30,18 @@ testequalpolicy 100 500
testequalpolicy 990 500 -t now
sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 1 -o Test=NotAutomatic
testequalpolicy 990 1 -o Test=NotAutomatic -t now
sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicy 100 500 -o Test=Automatic
@@ -135,7 +132,6 @@ Pin-Priority: -1" > rootdir/etc/apt/preferences
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic
@@ -164,7 +160,6 @@ testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t s
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
@@ -211,7 +206,6 @@ setupaptarchive
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic
@@ -220,7 +214,6 @@ testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=N
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin
aptget update -qq
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades
diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until
new file mode 100755
index 000000000..680a370cb
--- /dev/null
+++ b/test/integration/test-releasefile-valid-until
@@ -0,0 +1,95 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'wheezy' 'apt' 'all' '0.8.15'
+
+getlabelfromsuite() {
+ echo -n 'Testcases'
+}
+
+
+setupaptarchive
+
+setupreleasefile() {
+ rm -rf rootdir/var/lib/apt/lists
+ aptget clean
+ generatereleasefiles "$1" "$2"
+ signreleasefiles
+}
+
+aptgetupdate() {
+ if aptget update $* 2>&1 | grep -q 'is expired'; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+setupreleasefile
+msgtest 'Release file is accepted as it has' 'no Until'
+aptgetupdate && msgpass || msgfail
+
+setupreleasefile
+msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail
+
+setupreleasefile 'now - 2 days'
+msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass
+
+setupreleasefile 'now - 3 days' 'now + 1 day'
+msgtest 'Release file is accepted as it has' 'good Until'
+aptgetupdate && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Until'
+aptgetupdate && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)'
+aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)'
+aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)'
+aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is accepted as it has' 'good labeled Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now + 4 days'
+msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid'
+aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now + 1 days'
+msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)'
+aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now - 4 days'
+msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)'
+aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now - 2 days'
+msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <'
+aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail
+
+setupreleasefile 'now - 7 days' 'now - 2 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >'
+aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 2 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <'
+aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass
+
+setupreleasefile 'now - 7 days' 'now - 2 days'
+msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >'
+aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index 961c49895..8bf02a78f 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -19,8 +19,7 @@ prepare() {
for release in $(find rootdir/var/lib/apt/lists 2> /dev/null); do
touch -d 'now - 6 hours' $release
done
- rm -rf rootdir/var/cache/apt/archives
- rm -f rootdir/var/cache/apt/*.bin
+ aptget clean
cp $1 aptarchive/Packages
find aptarchive -name 'Release' -delete
cat aptarchive/Packages | gzip > aptarchive/Packages.gz
diff --git a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first
new file mode 100755
index 000000000..a9a4069cf
--- /dev/null
+++ b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'libsame' 'i386' '1'
+insertinstalledpackage 'apt' 'i386' '1' 'Depends: libsame (= 1)'
+
+insertpackage 'unstable' 'libsame' 'i386,amd64' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'apt' 'i386' '2' 'Depends: libsame (= 2)'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ apt:i386 libsame:i386
+The following NEW packages will be installed:
+ libsame
+The following packages will be upgraded:
+ apt:i386 libsame:i386
+2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame:i386 [1] (2 unstable [i386]) [apt:i386 ]
+Inst libsame (2 unstable [amd64]) [apt:i386 ]
+Conf libsame:i386 (2 unstable [i386]) [apt:i386 ]
+Conf libsame (2 unstable [amd64]) [apt:i386 ]
+Inst apt:i386 [1] (2 unstable [i386])
+Conf apt:i386 (2 unstable [i386])' aptget install libsame:amd64 -s