]> git.saurik.com Git - apt.git/commitdiff
merged from donkult
authorMichael Vogt <egon@debian-devbox>
Tue, 19 Jun 2012 11:56:39 +0000 (13:56 +0200)
committerMichael Vogt <egon@debian-devbox>
Tue, 19 Jun 2012 11:56:39 +0000 (13:56 +0200)
20 files changed:
apt-pkg/cachefilter.cc
apt-pkg/cachefilter.h
apt-pkg/cacheset.cc
apt-pkg/cacheset.h
apt-pkg/deb/debindexfile.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/edsp/edspindexfile.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcachegen.cc
buildlib/configure.mak
cmdline/apt-get.cc
debian/changelog
test/integration/framework
test/integration/test-673536-pre-depends-breaks-loop [deleted file]
test/integration/test-apt-get-download
test/integration/test-architecture-specification-parsing [new file with mode: 0755]
test/integration/test-bug-673536-pre-depends-breaks-loop [new file with mode: 0755]
test/integration/test-bug-675449-essential-are-protected [new file with mode: 0755]
test/integration/test-cachecontainer-architecture-specification [new file with mode: 0755]
test/libapt/parsedepends_test.cc

index fb444208c21b6f1cebd2d9ae2fbd6cbbcbe381e6..35f95fe22fcc4d558530ed9099bfcb0277c343ea 100644 (file)
@@ -9,10 +9,12 @@
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/strutl.h>
 
 #include <string>
 
 #include <regex.h>
+#include <fnmatch.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
@@ -52,5 +54,54 @@ PackageNameMatchesRegEx::~PackageNameMatchesRegEx() {                        /*{{{*/
        delete pattern;
 }
                                                                        /*}}}*/
+
+// CompleteArch to <kernel>-<cpu> tuple                                        /*{{{*/
+//----------------------------------------------------------------------
+/* The complete architecture, consisting of <kernel>-<cpu>. */
+static std::string CompleteArch(std::string const &arch) {
+       if (arch.find('-') != std::string::npos) {
+               // ensure that only -any- is replaced and not something like company-
+               std::string complete = std::string("-").append(arch).append("-");
+               complete = SubstVar(complete, "-any-", "-*-");
+               complete = complete.substr(1, complete.size()-2);
+               return complete;
+       }
+       else if (arch == "armel")               return "linux-arm";
+       else if (arch == "armhf")               return "linux-arm";
+       else if (arch == "lpia")                return "linux-i386";
+       else if (arch == "powerpcspe")          return "linux-powerpc";
+       else if (arch == "uclibc-linux-armel")  return "linux-arm";
+       else if (arch == "uclinux-armel")       return "uclinux-arm";
+       else if (arch == "any")                 return "*-*";
+       else                                    return "linux-" + arch;
+}
+                                                                       /*}}}*/
+PackageArchitectureMatchesSpecification::PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern) :/*{{{*/
+                                       literal(pattern), isPattern(isPattern), d(NULL) {
+       complete = CompleteArch(pattern);
+}
+                                                                       /*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (char const * const &arch) {/*{{{*/
+       if (strcmp(literal.c_str(), arch) == 0 ||
+           strcmp(complete.c_str(), arch) == 0)
+               return true;
+       std::string const pkgarch = CompleteArch(arch);
+       if (isPattern == true)
+               return fnmatch(complete.c_str(), pkgarch.c_str(), 0) == 0;
+       return fnmatch(pkgarch.c_str(), complete.c_str(), 0) == 0;
+}
+                                                                       /*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (pkgCache::PkgIterator const &Pkg) {/*{{{*/
+       return (*this)(Pkg.Arch());
+}
+                                                                       /*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (pkgCache::VerIterator const &Ver) {/*{{{*/
+       return (*this)(Ver.ParentPkg());
+}
+                                                                       /*}}}*/
+PackageArchitectureMatchesSpecification::~PackageArchitectureMatchesSpecification() {  /*{{{*/
+}
+                                                                       /*}}}*/
+
 }
 }
index 5d426008b26288abb9f83a2f1d671fedfe8ead51..25cd43f476136dd7fd95418055e29e0b8c128031 100644 (file)
@@ -26,6 +26,36 @@ public:
        ~PackageNameMatchesRegEx();
 };
                                                                        /*}}}*/
+// PackageArchitectureMatchesSpecification                             /*{{{*/
+/** \class PackageArchitectureMatchesSpecification
+   \brief matching against architecture specification strings
+
+   The strings are of the format <kernel>-<cpu> where either component,
+   or the whole string, can be the wildcard "any" as defined in
+   debian-policy §11.1 "Architecture specification strings".
+
+   Examples: i386, mipsel, linux-any, any-amd64, any */
+class PackageArchitectureMatchesSpecification {
+       std::string literal;
+       std::string complete;
+       bool isPattern;
+       /** \brief dpointer placeholder (for later in case we need it) */
+       void *d;
+public:
+       /** \brief matching against architecture specification strings
+        *
+        * @param pattern is the architecture specification string
+        * @param isPattern defines if the given \b pattern is a
+        *        architecture specification pattern to match others against
+        *        or if it is the fixed string and matched against patterns
+        */
+       PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
+       bool operator() (char const * const &arch);
+       bool operator() (pkgCache::PkgIterator const &Pkg);
+       bool operator() (pkgCache::VerIterator const &Ver);
+       ~PackageArchitectureMatchesSpecification();
+};
+                                                                       /*}}}*/
 }
 }
 #endif
index e2dbe0e5776e28259c006d3fc893c566cba36acc..784d1f0bf1338dade40f4b835d7c93b33d118b8e 100644 (file)
@@ -182,15 +182,61 @@ pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
        return Pkg;
 }
                                                                        /*}}}*/
+// FromGroup - Returns the package defined  by this string             /*{{{*/
+bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache,
+                       std::string pkg, CacheSetHelper &helper) {
+       if (unlikely(Cache.GetPkgCache() == 0))
+               return false;
+
+       size_t const archfound = pkg.find_last_of(':');
+       std::string arch;
+       if (archfound != std::string::npos) {
+               arch = pkg.substr(archfound+1);
+               pkg.erase(archfound);
+       }
+
+       pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
+       if (Grp.end() == false) {
+               if (arch.empty() == true) {
+                       pkgCache::PkgIterator Pkg = Grp.FindPreferredPkg();
+                       if (Pkg.end() == false)
+                       {
+                          pci->insert(Pkg);
+                          return true;
+                       }
+               } else {
+                       bool found = false;
+                       // for 'linux-any' return the first package matching, for 'linux-*' return all matches
+                       bool const isGlobal = arch.find('*') != std::string::npos;
+                       APT::CacheFilter::PackageArchitectureMatchesSpecification pams(arch);
+                       for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg)) {
+                               if (pams(Pkg) == false)
+                                       continue;
+                               pci->insert(Pkg);
+                               found = true;
+                               if (isGlobal == false)
+                                       break;
+                       }
+                       if (found == true)
+                               return true;
+               }
+       }
+
+       pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
+       if (Pkg.end() == true)
+          return false;
+
+       pci->insert(Pkg);
+       return true;
+}
+                                                                       /*}}}*/
 // FromString - Return all packages matching a specific string         /*{{{*/
 bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
        bool found = true;
        _error->PushToStack();
 
-       pkgCache::PkgIterator Pkg = FromName(Cache, str, helper);
-       if (Pkg.end() == false)
-               pci->insert(Pkg);
-       else if (FromTask(pci, Cache, str, helper) == false &&
+       if (FromGroup(pci, Cache, str, helper) == false &&
+                FromTask(pci, Cache, str, helper) == false &&
                 FromRegEx(pci, Cache, str, helper) == false)
        {
                helper.canNotFindPackage(pci, Cache, str);
index 5b9900603986c758231c469f5857c3b76a6655c1..2a45910bad3994a480514725a7a47bec6a2b914a 100644 (file)
@@ -139,6 +139,7 @@ public:
        static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
        static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
        static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
+       static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
        static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
        static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
 
index 76c74034148dd55539f8656ea319b20b1d03c6d4..de645bb6e331c1189bd9924f68838f39472adcf8 100644 (file)
@@ -602,7 +602,8 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("now");
+   map_ptrloc const storage = Gen.WriteUniqString("now");
+   CFile->Archive = storage;
    
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());   
index 4948c9be4939b8a6389427e5f815ad112e8e82d5..e93e51af30dbb5c6ba1b84f6a1887a880e85dd9c 100644 (file)
@@ -15,6 +15,7 @@
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/cachefilter.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
@@ -22,7 +23,6 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/macros.h>
 
-#include <fnmatch.h>
 #include <ctype.h>
                                                                        /*}}}*/
 
@@ -464,22 +464,6 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
    }
    return I;
 }
-
-/*
- * CompleteArch:
- *
- * The complete architecture, consisting of <kernel>-<cpu>.
- */
-static string CompleteArch(std::string const &arch) {
-    if (arch == "armel")              return "linux-arm";
-    if (arch == "armhf")              return "linux-arm";
-    if (arch == "lpia")               return "linux-i386";
-    if (arch == "powerpcspe")         return "linux-powerpc";
-    if (arch == "uclibc-linux-armel") return "linux-arm";
-    if (arch == "uclinux-armel")      return "uclinux-arm";
-
-    return (arch.find("-") != string::npos) ? arch : "linux-" + arch;
-}
                                                                        /*}}}*/
 // ListParser::ParseDepends - Parse a dependency element               /*{{{*/
 // ---------------------------------------------------------------------
@@ -556,58 +540,59 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
 
    if (ParseArchFlags == true)
    {
-      string completeArch = CompleteArch(arch);
+      APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
 
       // Parse an architecture
       if (I != Stop && *I == '[')
       {
+        ++I;
         // malformed
-         I++;
-         if (I == Stop)
-           return 0; 
-        
-         const char *End = I;
-         bool Found = false;
-        bool NegArch = false;
-         while (I != Stop) 
+        if (unlikely(I == Stop))
+           return 0;
+
+        const char *End = I;
+        bool Found = false;
+        bool NegArch = false;
+        while (I != Stop)
         {
-            // look for whitespace or ending ']'
-           while (End != Stop && !isspace(*End) && *End != ']') 
-              End++;
-        
-           if (End == Stop) 
+           // look for whitespace or ending ']'
+           for (;End != Stop && !isspace(*End) && *End != ']'; ++End);
+
+           if (unlikely(End == Stop))
               return 0;
 
            if (*I == '!')
-            {
+           {
               NegArch = true;
-              I++;
-            }
+              ++I;
+           }
 
-           if (stringcmp(arch,I,End) == 0) {
+           std::string arch(I, End);
+           if (arch.empty() == false && matchesArch(arch.c_str()) == true)
+           {
               Found = true;
-           } else {
-              std::string wildcard = SubstVar(string(I, End), "any", "*");
-              if (fnmatch(wildcard.c_str(), completeArch.c_str(), 0) == 0)
-                 Found = true;
+              if (I[-1] != '!')
+                 NegArch = false;
+              // we found a match, so fast-forward to the end of the wildcards
+              for (; End != Stop && *End != ']'; ++End);
            }
-           
+
            if (*End++ == ']') {
               I = End;
               break;
            }
-           
+
            I = End;
            for (;I != Stop && isspace(*I) != 0; I++);
-         }
+        }
 
-        if (NegArch)
+        if (NegArch == true)
            Found = !Found;
-        
-         if (Found == false)
+
+        if (Found == false)
            Package = ""; /* not for this arch */
       }
-      
+
       // Skip whitespace
       for (;I != Stop && isspace(*I) != 0; I++);
    }
@@ -797,7 +782,8 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 {
    // apt-secure does no longer download individual (per-section) Release
    // file. to provide Component pinning we use the section name now
-   FileI->Component = WriteUniqString(component);
+   map_ptrloc const storage = WriteUniqString(component);
+   FileI->Component = storage;
 
    // FIXME: Code depends on the fact that Release files aren't compressed
    FILE* release = fdopen(dup(File.Fd()), "r");
@@ -884,13 +870,14 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
               break;
            *s = '\0';
         }
+        map_ptrloc const storage = WriteUniqString(data);
         switch (writeTo) {
-        case Suite: FileI->Archive = WriteUniqString(data); break;
-        case Component: FileI->Component = WriteUniqString(data); break;
-        case Version: FileI->Version = WriteUniqString(data); break;
-        case Origin: FileI->Origin = WriteUniqString(data); break;
-        case Codename: FileI->Codename = WriteUniqString(data); break;
-        case Label: FileI->Label = WriteUniqString(data); break;
+        case Suite: FileI->Archive = storage; break;
+        case Component: FileI->Component = storage; break;
+        case Version: FileI->Version = storage; break;
+        case Origin: FileI->Origin = storage; break;
+        case Codename: FileI->Codename = storage; break;
+        case Label: FileI->Label = storage; break;
         case None: break;
         }
       }
index 482581979f4cc9c87f448287bef538d30fecc577..98ce4497ae62d560c40c6da18a04ca52c055b512 100644 (file)
@@ -51,7 +51,8 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("edsp::scenario");
+   map_ptrloc const storage = Gen.WriteUniqString("edsp::scenario");
+   CFile->Archive = storage;
 
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());
index f694a237e2435c446fef9cd0c413f6868c3b1829..9acb7da72d5ff436fa98a5aeb43913305cfef12f 100644 (file)
@@ -970,7 +970,7 @@ bool pkgCache::PrvIterator::IsMultiArchImplicit() const
 {
    pkgCache::PkgIterator const Owner = OwnerPkg();
    pkgCache::PkgIterator const Parent = ParentPkg();
-   if (Owner->Arch != Parent->Arch || Owner->Name == Parent->Name)
+   if (strcmp(Owner.Arch(), Parent.Arch()) != 0 || Owner->Name == Parent->Name)
       return true;
    return false;
 }
index 538d10b35136616b8563e1710a59f5bd22d59ef5..f70cbd02a67e62b8b4e325c0029d0b3b908dca9c 100644 (file)
@@ -1316,10 +1316,11 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
         }
         _error->RevertToStack();
       }
-      else if (Debug == true)
+      else
       {
         _error->MergeWithStack();
-        std::clog << "Open filebased MMap" << std::endl;
+        if (Debug == true)
+           std::clog << "Open filebased MMap" << std::endl;
       }
    }
    if (Writeable == false || CacheFile.empty() == true)
index c0d8e3c768d17f1ab75c07da43938221b6bbf5e3..68d0535b41ed4947f9ee2d105ee3c254b396cb81 100644 (file)
 # It would be a fairly good idea to run this after a cvs checkout.
 BUILDDIR=build
 
-.PHONY: startup
+.PHONY: startup missing-config-files
 startup: configure $(BUILDDIR)/config.status $(addprefix $(BUILDDIR)/,$(CONVERTED))
 
 # use the files provided from the system instead of carry around
 # and use (most of the time outdated) copycats
+ifeq (file-okay,$(shell test -r buildlib/config.sub && echo 'file-okay'))
+buildlib/config.sub:
+else
+   ifeq (file-okay,$(shell test -r /usr/share/misc/config.sub && echo 'file-okay'))
 buildlib/config.sub:
        ln -sf /usr/share/misc/config.sub buildlib/config.sub
+   else
+buildlib/config.sub: missing-config-files
+   endif
+endif
+
+ifeq (file-okay,$(shell test -r buildlib/config.guess && echo 'file-okay'))
+buildlib/config.guess:
+else
+   ifeq (file-okay,$(shell test -r /usr/share/misc/config.guess && echo 'file-okay'))
 buildlib/config.guess:
        ln -sf /usr/share/misc/config.guess buildlib/config.guess
+   else
+buildlib/config.guess: missing-config-files
+   endif
+endif
+
+missing-config-files:
+       @echo "APT needs 'config.guess' and 'config.sub' in buildlib/ for configuration."
+       @echo "On Debian systems these are available in the 'autotools-dev' package."
+       @echo
+       @echo "The latest versions can be acquired from the upstream git repository:"
+       @echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
+       @echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
+       exit 100
+
 configure: aclocal.m4 configure.in buildlib/config.guess buildlib/config.sub
        autoconf
 
index 870c77280957dd85075844d49194b4dc312f95d2..d4c7f4200a7c723f6ce0c4462ee62f42541dbaa4 100644 (file)
@@ -2362,6 +2362,8 @@ bool DoDownload(CommandLine &CmdL)
 
    pkgRecords Recs(Cache);
    pkgSourceList *SrcList = Cache.GetSourceList();
+   bool gotAll = true;
+
    for (APT::VersionList::const_iterator Ver = verset.begin(); 
         Ver != verset.end(); 
         ++Ver) 
@@ -2372,11 +2374,19 @@ bool DoDownload(CommandLine &CmdL)
       pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList());
       pkgCache::VerFileIterator Vf = Ver.FileList();
       if (Vf.end() == true)
-         return _error->Error("Can not find VerFile");
+      {
+        _error->Error("Can not find VerFile for %s in version %s", Pkg.FullName().c_str(), Ver.VerStr());
+        gotAll = false;
+        continue;
+      }
       pkgCache::PkgFileIterator F = Vf.File();
       pkgIndexFile *index;
       if(SrcList->FindIndex(F, index) == false)
-         return _error->Error("FindIndex failed");
+      {
+        _error->Error(_("Can't find a source to download version '%s' of '%s'"), Ver.VerStr(), Pkg.FullName().c_str());
+        gotAll = false;
+        continue;
+      }
       string uri = index->ArchiveURI(rec.FileName());
       strprintf(descr, _("Downloading %s %s"), Pkg.Name(), Ver.VerStr());
       // get the most appropriate hash
@@ -2392,6 +2402,8 @@ bool DoDownload(CommandLine &CmdL)
       // get the file
       new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), ".");
    }
+   if (gotAll == false)
+      return false;
 
    // Just print out the uris and exit if the --print-uris flag was used
    if (_config->FindB("APT::Get::Print-URIs") == true)
index 1cdfbe61d5d80783dcbc6e1495f635224c4a9951..20dc9d188a2eb4d23733991b36983a99bbe24723 100644 (file)
@@ -8,6 +8,34 @@ apt (0.9.7) UNRELEASED; urgency=low
 
  -- Julian Andres Klode <jak@debian.org>  Sat, 16 Jun 2012 14:28:38 +0200
 
+apt (0.9.6.1) UNRELEASED; urgency=low
+
+  [ Daniel Hartwig ]
+  * apt-pkg/pkgcachegen.cc:
+    - always reset _error->StackCount in MakeStatusCache (Closes: #677175)
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/deblistparser.cc:
+    - ensure that mixed positive/negative architecture wildcards
+      are handled in the same way as dpkg handles them
+    - use PackageArchitectureMatchesSpecification filter
+  * apt-pkg/cachefilter.cc:
+    - add PackageArchitectureMatchesSpecification (Closes: #672603)
+  * apt-pkg/cacheset.cc:
+    - add PackageContainerInterface::FromGroup to support
+      architecture specifications with wildcards on the commandline
+  * apt-pkg/pkgcache.cc:
+    - do a string comparision for architecture checking in IsMultiArchImplicit
+      as 'unique' strings in the pkgcache aren't unique (Closes: #677454)
+  * buildlib/configure.mak:
+    - print a message detailing how to get config.guess and config.sub
+      in case they are not in /usr/share/misc (Closes: #677312)
+  * cmdline/apt-get.cc:
+    - print a friendly message in 'download' if a package can't be
+      downloaded (Closes: #677887)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 14 Jun 2012 15:45:13 +0200
+
 apt (0.9.6) unstable; urgency=low
 
   [ David Kalnischkies ]
index dba8c016236f542c04820658bfa92b3a94164e5a..2d6ada117c73abae12d28d28090a512e5c529d79 100644 (file)
@@ -304,23 +304,28 @@ echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
 Section: $SECTION
 Priority: $PRIORITY
 Maintainer: Joe Sixpack <joe@example.org>
-Standards-Version: 3.9.1
+Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
+       local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
+       test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
+       echo "
+Package: $NAME" >> ${BUILDDIR}/debian/control
 
-Package: $NAME" > ${BUILDDIR}/debian/control
        if [ "$ARCH" = 'all' ]; then
                echo "Architecture: all" >> ${BUILDDIR}/debian/control
        else
                echo "Architecture: any" >> ${BUILDDIR}/debian/control
        fi
-       test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> ${BUILDDIR}/debian/control
+       local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
+       test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
        if [ -z "$DESCRIPTION" ]; then
                echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
  If you find such a package installed on your system,
  YOU did something horribly wrong! They are autogenerated
  und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
        else
-               echo "Description: $DESCRIPTION" >> ${BUILDIR}/debian/control
+               echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
        fi
+
        echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
        local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
        for SRC in $SRCS; do
diff --git a/test/integration/test-673536-pre-depends-breaks-loop b/test/integration/test-673536-pre-depends-breaks-loop
deleted file mode 100755 (executable)
index e9d3c4d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-setupenvironment
-configarchitecture 'native'
-
-buildsimplenativepackage 'basic' 'native' '1' 'stable'
-buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common'
-buildsimplenativepackage 'common' 'native' '2' 'unstable' 'Breaks: basic (<= 1)'
-
-setupaptarchive
-
-# we check with 'real' packages here as the simulation reports a 'Conf broken'
-# which is technical correct for the simulation, but testing errormsg is ugly
-
-aptget install basic=1 -qq > /dev/null
-testdpkginstalled basic
-testdpkgnotinstalled common
-
-aptget dist-upgrade -qq > /dev/null
-testdpkginstalled basic common
index 4edb7c173f1d8fbf13e0649e95006c2014d4beb2..b164f7dbaa6bb9da6fea477dff5cbfd1beb04b19 100755 (executable)
@@ -9,6 +9,7 @@ configarchitecture "i386"
 
 buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
 buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
+insertinstalledpackage 'vrms' 'all' '1.0'
 
 setupaptarchive
 
@@ -26,3 +27,6 @@ testdownload apt_2.0_all.deb apt
 
 DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
 testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha256:$(sha256sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
+
+# deb:677887
+testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing
new file mode 100755 (executable)
index 0000000..8f365dd
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+buildsimplenativepackage 'pkg-arch-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !amd64]
+Depends: foo [amd64 !amd64]'
+buildsimplenativepackage 'pkg-arch-no-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!amd64 amd64]
+Depends: foo [!amd64 amd64]'
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!kfreebsd-any amd64]
+Depends: foo [!kfreebsd-any amd64]'
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !kfreebsd-any]
+Depends: foo [amd64 !kfreebsd-any]'
+
+buildsimplenativepackage 'foo' 'amd64' '1.0' 'stable'
+
+insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo (1.0 stable [amd64])' aptget install pkg-arch-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  pkg-arch-no-foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst pkg-arch-no-foo (1.0 stable [amd64])
+Conf pkg-arch-no-foo (1.0 stable [amd64])' aptget install pkg-arch-no-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo-unrelated-no
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo-unrelated-no (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo-unrelated-no (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo-unrelated-no2
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no2 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no2 -s
+
+
diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop
new file mode 100755 (executable)
index 0000000..e9d3c4d
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'native'
+
+buildsimplenativepackage 'basic' 'native' '1' 'stable'
+buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common'
+buildsimplenativepackage 'common' 'native' '2' 'unstable' 'Breaks: basic (<= 1)'
+
+setupaptarchive
+
+# we check with 'real' packages here as the simulation reports a 'Conf broken'
+# which is technical correct for the simulation, but testing errormsg is ugly
+
+aptget install basic=1 -qq > /dev/null
+testdpkginstalled basic
+testdpkgnotinstalled common
+
+aptget dist-upgrade -qq > /dev/null
+testdpkginstalled basic common
diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected
new file mode 100755 (executable)
index 0000000..7d8cc34
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'pkg-native' 'amd64' '1' 'Multi-Arch: foreign
+Essential: yes'
+insertinstalledpackage 'pkg-foreign' 'i386' '1' 'Multi-Arch: foreign
+Essential: yes'
+insertinstalledpackage 'pkg-none-native' 'amd64' '1' 'Essential: yes'
+insertinstalledpackage 'pkg-none-foreign' 'i386' '1' 'Essential: yes'
+
+insertpackage 'unstable' 'pkg-native' 'amd64,i386' '2' 'Multi-Arch: foreign
+Essential: yes'
+insertpackage 'unstable' 'pkg-foreign' 'amd64,i386' '2' 'Multi-Arch: foreign
+Depends: pkg-depends-new
+Essential: yes'
+insertpackage 'unstable' 'pkg-none-native' 'amd64,i386' '2' 'Essential: yes'
+insertpackage 'unstable' 'pkg-none-foreign' 'amd64,i386' '2' 'Essential: yes
+Depends: pkg-depends-new'
+
+insertpackage 'unstable' 'pkg-none-new' 'amd64,i386' '2' 'Essential: yes'
+insertpackage 'unstable' 'pkg-depends-new' 'amd64,i386' '2' 'Essential: yes'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  pkg-native*
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+  pkg-native
+0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
+Purg pkg-native [1]' aptget purge pkg-native -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  pkg-foreign:i386*
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+  pkg-foreign:i386
+0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
+Purg pkg-foreign:i386 [1]' aptget purge pkg-foreign:i386 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  pkg-none-native*
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+  pkg-none-native
+0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
+Purg pkg-none-native [1]' aptget purge pkg-none-native -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  pkg-none-foreign:i386*
+WARNING: The following essential packages will be removed.
+This should NOT be done unless you know exactly what you are doing!
+  pkg-none-foreign:i386
+0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
+Purg pkg-none-foreign:i386 [1]' aptget purge pkg-none-foreign:i386 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  pkg-depends-new:i386 pkg-none-new
+The following packages will be upgraded:
+  pkg-foreign:i386 pkg-native pkg-none-foreign:i386 pkg-none-native
+4 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst pkg-depends-new:i386 (2 unstable [i386])
+Conf pkg-depends-new:i386 (2 unstable [i386])
+Inst pkg-foreign:i386 [1] (2 unstable [i386])
+Conf pkg-foreign:i386 (2 unstable [i386])
+Inst pkg-native [1] (2 unstable [amd64])
+Conf pkg-native (2 unstable [amd64])
+Inst pkg-none-foreign:i386 [1] (2 unstable [i386])
+Conf pkg-none-foreign:i386 (2 unstable [i386])
+Inst pkg-none-native [1] (2 unstable [amd64])
+Conf pkg-none-native (2 unstable [amd64])
+Inst pkg-none-new (2 unstable [amd64])
+Conf pkg-none-new (2 unstable [amd64])' aptget dist-upgrade -s
diff --git a/test/integration/test-cachecontainer-architecture-specification b/test/integration/test-cachecontainer-architecture-specification
new file mode 100755 (executable)
index 0000000..174efb0
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'armel'
+
+#insertinstalledpackage 'xserver-xorg-core' 'amd64' '2:1.7.6-2ubuntu7.10'
+insertpackage 'unstable' 'libsame' 'armel,amd64' '1' 'Multi-Arch: same'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame:armel
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame:armel (1 unstable [armel])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:amd64
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel libsame:amd64
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:*
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:any
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:a*
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:linux-any
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:linux-*
+testequal 'Reading package lists...
+Building dependency tree...
+E: Unable to locate package libsame' aptget -s install libsame:windows-any
index b5d92d9d2b85db315ff24b0984a178bdceffec9a..677b1c89263756221358a96fd1169610db0558ed 100644 (file)
@@ -10,7 +10,7 @@ int main(int argc,char *argv[]) {
        unsigned int Null = 0;
        bool StripMultiArch = true;
        bool ParseArchFlags = false;
-       _config->Set("APT::Architecture","dsk");
+       _config->Set("APT::Architecture","amd64");
 
        const char* Depends =
                "debhelper:any (>= 5.0), "
@@ -19,13 +19,13 @@ int main(int argc,char *argv[]) {
                "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
                "debiandoc-sgml, "
                "apt (>= 0.7.25), "
-               "not-for-me [ !dsk ], "
-               "only-for-me [ dsk ], "
+               "not-for-me [ !amd64 ], "
+               "only-for-me [ amd64 ], "
                "any-for-me [ any ], "
                "not-for-darwin [ !darwin-any ], "
-               "cpu-for-me [ any-dsk ], "
+               "cpu-for-me [ any-amd64 ], "
                "os-for-me [ linux-any ], "
-               "cpu-not-for-me [ any-amd64 ], "
+               "cpu-not-for-me [ any-armel ], "
                "os-not-for-me [ kfreebsd-any ], "
                "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
        ;