]> git.saurik.com Git - apt.git/commitdiff
hide implicit deps in apt-cache again by default
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 16 Jul 2015 09:15:25 +0000 (11:15 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Mon, 10 Aug 2015 15:27:58 +0000 (17:27 +0200)
Before MultiArch implicits weren't a thing, so they were hidden by
default by definition. Adding them for MultiArch solved many problems,
but having no reliable way of detecting which dependency (and provides)
is implicit or not causes problems everytime we want to output
dependencies without confusing our observers with unneeded
implementation details.

The really notworthy point here is actually that we keep now a better
record of how a dependency came to be so that we can later reason about
it more easily, but that is hidden so deep down in the library internals
that change is more the problems it solves than the change itself.

12 files changed:
apt-pkg/cacheiterators.h
apt-pkg/deb/deblistparser.cc
apt-pkg/edsp.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcache.h
apt-pkg/pkgcachegen.cc
apt-pkg/pkgcachegen.h
apt-private/private-cmndline.cc
cmdline/apt-cache.cc
doc/apt-cache.8.xml
test/integration/test-apt-cache
test/integration/test-ordering-ignore-not-matching-breaks [deleted file]

index 7e6adb92f473c6bbd65d042b3cccb700fa085588..1063d6f9e38920cfd04b60327f64f381c35cd98f 100644 (file)
@@ -295,7 +295,16 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
        bool IsNegative() const APT_PURE;
        bool IsIgnorable(PrvIterator const &Prv) const APT_PURE;
        bool IsIgnorable(PkgIterator const &Pkg) const APT_PURE;
-       bool IsMultiArchImplicit() const APT_PURE;
+       /* MultiArch can be translated to SingleArch for an resolver and we did so,
+          by adding dependencies to help the resolver understand the problem, but
+          sometimes it is needed to identify these to ignore them… */
+       inline bool IsMultiArchImplicit() const APT_PURE {
+               return (S2->CompareOp & pkgCache::Dep::MultiArchImplicit) == pkgCache::Dep::MultiArchImplicit;
+       }
+       /* This covers additionally negative dependencies, which aren't arch-specific,
+          but change architecture nontheless as a Conflicts: foo does applies for all archs */
+       bool IsImplicit() const APT_PURE;
+
        bool IsSatisfied(VerIterator const &Ver) const APT_PURE;
        bool IsSatisfied(PrvIterator const &Prv) const APT_PURE;
        void GlobOr(DepIterator &Start,DepIterator &End);
@@ -367,7 +376,12 @@ class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
        inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}
        inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}
 
-       bool IsMultiArchImplicit() const APT_PURE;
+       /* MultiArch can be translated to SingleArch for an resolver and we did so,
+          by adding provides to help the resolver understand the problem, but
+          sometimes it is needed to identify these to ignore them… */
+       bool IsMultiArchImplicit() const APT_PURE
+       { return (S->Flags & pkgCache::Flag::MultiArchImplicit) == pkgCache::Flag::MultiArchImplicit; }
+
 
        inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {}
        inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
index e57a3524fd0aa168a706e159f5925478b466106e..df087964102e2d1cdc24966f62885d8686be0a60 100644 (file)
@@ -812,7 +812,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
         // … but this is probably the best thing to do.
         if (Arch == "native")
            Arch = _config->Find("APT::Architecture");
-        if (NewDepends(Ver,Package,Arch,Version,Op,Type) == false)
+        if (NewDepends(Ver,Package,Arch,Version,Op | pkgCache::Dep::ArchSpecific,Type) == false)
            return false;
       }
       else
@@ -858,13 +858,13 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
         } else if (archfound != string::npos) {
            string OtherArch = Package.substr(archfound+1, string::npos);
            Package = Package.substr(0, archfound);
-           if (NewProvides(Ver, Package, OtherArch, Version) == false)
+           if (NewProvides(Ver, Package, OtherArch, Version, pkgCache::Flag::ArchSpecific) == false)
               return false;
         } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) {
            if (NewProvidesAllArch(Ver, Package, Version) == false)
               return false;
         } else {
-           if (NewProvides(Ver, Package, Arch, Version) == false)
+           if (NewProvides(Ver, Package, Arch, Version, 0) == false)
               return false;
         }
 
@@ -890,7 +890,7 @@ bool debListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const
    for (std::vector<string>::const_iterator a = Architectures.begin();
        a != Architectures.end(); ++a)
    {
-      if (NewProvides(Ver, Package, *a, Version) == false)
+      if (NewProvides(Ver, Package, *a, Version, pkgCache::Flag::MultiArchImplicit) == false)
         return false;
    }
    return true;
index 5c53581fef2f27617cf21bb8489963f7f441ae3a..34b0b0cc7fdc9c72fe9131a1999b69587d25c2d8 100644 (file)
@@ -102,11 +102,11 @@ static void WriteScenarioDependency( FILE* output, pkgCache::VerIterator const &
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      if (Dep.IsMultiArchImplicit() == true)
+      if (Dep.IsImplicit() == true)
         continue;
       if (orGroup == false)
         dependencies[Dep->Type].append(", ");
-      dependencies[Dep->Type].append(Dep.TargetPkg().Name());
+      dependencies[Dep->Type].append(Dep.TargetPkg().FullName((Dep->CompareOp & pkgCache::Dep::ArchSpecific) != pkgCache::Dep::ArchSpecific));
       if (Dep->Version != 0)
         dependencies[Dep->Type].append(" (").append(pkgCache::CompTypeDeb(Dep->CompareOp)).append(" ").append(Dep.TargetVer()).append(")");
       if ((Dep->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or)
@@ -140,7 +140,7 @@ static void WriteScenarioLimitedDependency(FILE* output,
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      if (Dep.IsMultiArchImplicit() == true)
+      if (Dep.IsImplicit() == true)
         continue;
       if (orGroup == false)
       {
@@ -156,7 +156,7 @@ static void WriteScenarioLimitedDependency(FILE* output,
         orGroup = false;
         continue;
       }
-      dependencies[Dep->Type].append(Dep.TargetPkg().Name());
+      dependencies[Dep->Type].append(Dep.TargetPkg().FullName((Dep->CompareOp & pkgCache::Dep::ArchSpecific) != pkgCache::Dep::ArchSpecific));
       if (Dep->Version != 0)
         dependencies[Dep->Type].append(" (").append(pkgCache::CompTypeDeb(Dep->CompareOp)).append(" ").append(Dep.TargetVer()).append(")");
       if ((Dep->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or)
index 5034ee38ae8aa0c27c152198887af864271bdc75..e8c95738e9673848ce6d27c932449a9195234bea 100644 (file)
@@ -727,21 +727,7 @@ bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &PT) const
    // ignore group-conflict on a M-A:same package - but not our implicit dependencies
    // so that we can have M-A:same packages conflicting with their own real name
    if ((PV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
-   {
-      // Replaces: ${self}:other ( << ${binary:Version})
-      if (S2->Type == pkgCache::Dep::Replaces)
-      {
-        if (S2->CompareOp == pkgCache::Dep::Less && strcmp(PV.VerStr(), TargetVer()) == 0)
-           return false;
-      }
-      // Breaks: ${self}:other (!= ${binary:Version})
-      else if (S2->Type == pkgCache::Dep::DpkgBreaks)
-      {
-        if (S2->CompareOp == pkgCache::Dep::NotEquals && strcmp(PV.VerStr(), TargetVer()) == 0)
-           return false;
-      }
-      return true;
-   }
+      return IsMultiArchImplicit() == false;
 
    return false;
 }
@@ -756,27 +742,12 @@ bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
    if (Prv.OwnerPkg()->Group == Pkg->Group)
       return true;
    // Implicit group-conflicts should not be applied on providers of other groups
-   if (Pkg->Group == TargetPkg()->Group && Prv.OwnerPkg()->Group != Pkg->Group)
+   if (IsMultiArchImplicit() && Prv.OwnerPkg()->Group != Pkg->Group)
       return true;
 
    return false;
 }
                                                                        /*}}}*/
-// DepIterator::IsMultiArchImplicit - added by the cache generation    /*{{{*/
-// ---------------------------------------------------------------------
-/* MultiArch can be translated to SingleArch for an resolver and we did so,
-   by adding dependencies to help the resolver understand the problem, but
-   sometimes it is needed to identify these to ignore them… */
-bool pkgCache::DepIterator::IsMultiArchImplicit() const
-{
-   if (ParentPkg()->Arch != TargetPkg()->Arch &&
-       (S2->Type == pkgCache::Dep::Replaces ||
-       S2->Type == pkgCache::Dep::DpkgBreaks ||
-       S2->Type == pkgCache::Dep::Conflicts))
-      return true;
-   return false;
-}
-                                                                       /*}}}*/
 // DepIterator::IsSatisfied - check if a version satisfied the dependency /*{{{*/
 bool pkgCache::DepIterator::IsSatisfied(VerIterator const &Ver) const
 {
@@ -787,6 +758,20 @@ bool pkgCache::DepIterator::IsSatisfied(PrvIterator const &Prv) const
    return Owner->VS->CheckDep(Prv.ProvideVersion(),S2->CompareOp,TargetVer());
 }
                                                                        /*}}}*/
+// DepIterator::IsImplicit - added by the cache generation             /*{{{*/
+bool pkgCache::DepIterator::IsImplicit() const
+{
+   if (IsMultiArchImplicit() == true)
+      return true;
+   if (IsNegative() || S2->Type == pkgCache::Dep::Replaces)
+   {
+      if ((S2->CompareOp & pkgCache::Dep::ArchSpecific) != pkgCache::Dep::ArchSpecific &&
+           strcmp(ParentPkg().Arch(), TargetPkg().Arch()) != 0)
+        return true;
+   }
+   return false;
+}
+                                                                       /*}}}*/
 // ostream operator to handle string representation of a dependecy     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -1067,19 +1052,5 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
 }
 
                                                                        /*}}}*/
-// PrvIterator::IsMultiArchImplicit - added by the cache generation    /*{{{*/
-// ---------------------------------------------------------------------
-/* MultiArch can be translated to SingleArch for an resolver and we did so,
-   by adding provides to help the resolver understand the problem, but
-   sometimes it is needed to identify these to ignore them… */
-bool pkgCache::PrvIterator::IsMultiArchImplicit() const
-{
-   pkgCache::PkgIterator const Owner = OwnerPkg();
-   pkgCache::PkgIterator const Parent = ParentPkg();
-   if (strcmp(Owner.Arch(), Parent.Arch()) != 0 || Owner.Group()->Name == Parent.Group()->Name)
-      return true;
-   return false;
-}
-                                                                       /*}}}*/
 
 pkgCache::~pkgCache() {}
index fba6929826c1e21897ee1468509fa0be8e3b5304..8a726085eb14f8e2eb7340acb1bc1e825a8f6061 100644 (file)
@@ -149,8 +149,12 @@ class pkgCache                                                             /*{{{*/
           The lower 4 bits are used to indicate what operator is being specified and
           the upper 4 bits are flags. OR indicates that the next package is
           or'd with the current package. */
-      enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
-        Greater=0x4,Equals=0x5,NotEquals=0x6};
+      enum DepCompareOp {NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
+        Greater=0x4,Equals=0x5,NotEquals=0x6,
+        Or=0x10, /*!< or'ed with the next dependency */
+        MultiArchImplicit=0x20, /*!< generated internally, not spelled out in the index */
+        ArchSpecific=0x40 /*!< was decorated with an explicit architecture in index */
+      };
    };
    
    struct State
@@ -178,6 +182,10 @@ class pkgCache                                                             /*{{{*/
         NotAutomatic=(1<<0), /*!< archive has a default pin of 1 */
         ButAutomaticUpgrades=(1<<1), /*!< (together with the previous) archive has a default pin of 100 */
       };
+      enum ProvidesFlags {
+        MultiArchImplicit=pkgCache::Dep::MultiArchImplicit, /*!< generated internally, not spelled out in the index */
+        ArchSpecific=pkgCache::Dep::ArchSpecific /*!< was decorated with an explicit architecture in index */
+      };
    };
    
    protected:
@@ -725,9 +733,9 @@ struct pkgCache::Provides
    /** \brief version in the provides line (if any)
 
        This version allows dependencies to depend on specific versions of a
-       Provides, as well as allowing Provides to override existing packages.
-       This is experimental. Note that Debian doesn't allow versioned provides */
+       Provides, as well as allowing Provides to override existing packages. */
    map_stringitem_t ProvideVersion;
+   map_flags_t Flags;
    /** \brief next provides (based of package) */
    map_pointer_t NextProvides;     // Provides
    /** \brief next provides (based of version) */
index a82483d15c84b5e0be7640587883c861fa0661e8..9acb2563a4159d083b28397f8664e6d9b9708e8e 100644 (file)
@@ -709,16 +709,16 @@ bool pkgCacheGenerator::AddImplicitDepends(pkgCache::GrpIterator &G,
       {
         // Replaces: ${self}:other ( << ${binary:Version})
         NewDepends(D, V, VerStrIdx,
-                   pkgCache::Dep::Less, pkgCache::Dep::Replaces,
+                   pkgCache::Dep::Less | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::Replaces,
                    OldDepLast);
         // Breaks: ${self}:other (!= ${binary:Version})
         NewDepends(D, V, VerStrIdx,
-                   pkgCache::Dep::NotEquals, pkgCache::Dep::DpkgBreaks,
+                   pkgCache::Dep::NotEquals | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::DpkgBreaks,
                    OldDepLast);
       } else {
         // Conflicts: ${self}:other
         NewDepends(D, V, 0,
-                   pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+                   pkgCache::Dep::NoOp | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::Conflicts,
                    OldDepLast);
       }
    }
@@ -737,16 +737,16 @@ bool pkgCacheGenerator::AddImplicitDepends(pkgCache::VerIterator &V,
       map_stringitem_t const VerStrIdx = V->VerStr;
       // Replaces: ${self}:other ( << ${binary:Version})
       NewDepends(D, V, VerStrIdx,
-                pkgCache::Dep::Less, pkgCache::Dep::Replaces,
+                pkgCache::Dep::Less | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::Replaces,
                 OldDepLast);
       // Breaks: ${self}:other (!= ${binary:Version})
       NewDepends(D, V, VerStrIdx,
-                pkgCache::Dep::NotEquals, pkgCache::Dep::DpkgBreaks,
+                pkgCache::Dep::NotEquals | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::DpkgBreaks,
                 OldDepLast);
    } else {
       // Conflicts: ${self}:other
       NewDepends(D, V, 0,
-                pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+                pkgCache::Dep::NoOp | pkgCache::Dep::MultiArchImplicit, pkgCache::Dep::Conflicts,
                 OldDepLast);
    }
    return true;
@@ -913,8 +913,8 @@ map_pointer_t pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
 bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
                                   pkgCache::VerIterator &Ver,
                                   string const &Version,
-                                  unsigned int const &Op,
-                                  unsigned int const &Type,
+                                  uint8_t const Op,
+                                  uint8_t const Type,
                                   map_stringitem_t* &OldDepLast)
 {
    map_stringitem_t index = 0;
@@ -940,8 +940,8 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
 bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
                                   pkgCache::VerIterator &Ver,
                                   map_pointer_t const Version,
-                                  unsigned int const &Op,
-                                  unsigned int const &Type,
+                                  uint8_t const Op,
+                                  uint8_t const Type,
                                   map_pointer_t* &OldDepLast)
 {
    void const * const oldMap = Map.Data();
@@ -1040,8 +1040,8 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver,
                                               const string &PackageName,
                                               const string &Arch,
                                               const string &Version,
-                                              unsigned int Op,
-                                              unsigned int Type)
+                                              uint8_t const Op,
+                                              uint8_t const Type)
 {
    pkgCache::GrpIterator Grp;
    Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
@@ -1073,12 +1073,11 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver,
 }
                                                                        /*}}}*/
 // ListParser::NewProvides - Create a Provides element                 /*{{{*/
-// ---------------------------------------------------------------------
-/* */
 bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
-                                               const string &PkgName,
+                                               const string &PkgName,
                                                const string &PkgArch,
-                                               const string &Version)
+                                               const string &Version,
+                                               uint8_t const Flags)
 {
    pkgCache &Cache = Owner->Cache;
 
@@ -1097,6 +1096,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
    pkgCache::PrvIterator Prv(Cache,Cache.ProvideP + Provides,Cache.PkgP);
    Dynamic<pkgCache::PrvIterator> DynPrv(Prv);
    Prv->Version = Ver.Index();
+   Prv->Flags = Flags;
    Prv->NextPkgProv = Ver->ProvidesList;
    Ver->ProvidesList = Prv.Index();
    if (Version.empty() == false) {
index c56b5abae6e5dd804175ea8b01ccbfc84b9ba31b..c5527ff309f9f9f2b833fd58844ae8c8369214eb 100644 (file)
@@ -82,11 +82,11 @@ class APT_HIDDEN pkgCacheGenerator                                  /*{{{*/
    bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
    bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
    bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
-                  std::string const &Version, unsigned int const &Op,
-                  unsigned int const &Type, map_pointer_t* &OldDepLast);
+                  std::string const &Version, uint8_t const Op,
+                  uint8_t const Type, map_pointer_t* &OldDepLast);
    bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
-                  map_pointer_t const Version, unsigned int const &Op,
-                  unsigned int const &Type, map_pointer_t* &OldDepLast);
+                  map_pointer_t const Version, uint8_t const Op,
+                  uint8_t const Type, map_pointer_t* &OldDepLast);
    map_pointer_t NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,map_pointer_t const Next) APT_DEPRECATED
    { return NewVersion(Ver, VerStr, 0, 0, Next); }
    map_pointer_t NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,
@@ -162,10 +162,11 @@ class APT_HIDDEN pkgCacheGenerator::ListParser
    inline map_stringitem_t WriteString(const std::string &S) {return Owner->WriteStringInMap(S);};
    inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};
    bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, const std::string &Arch,
-                  const std::string &Version,unsigned int Op,
-                  unsigned int Type);
+                  const std::string &Version,uint8_t const Op,
+                  uint8_t const Type);
    bool NewProvides(pkgCache::VerIterator &Ver,const std::string &PkgName,
-                   const std::string &PkgArch, const std::string &Version);
+                   const std::string &PkgArch, const std::string &Version,
+                   uint8_t const Flags);
    
    public:
    
index 71dceb55917360452b8666bca3a21fe9c74824ba..cfdc13259837c92b03f4a301d3e1a79e9eb50819 100644 (file)
@@ -51,6 +51,7 @@ static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char cons
       addArg(0, "conflicts", "APT::Cache::ShowConflicts", 0);
       addArg(0, "enhances", "APT::Cache::ShowEnhances", 0);
       addArg(0, "recurse", "APT::Cache::RecurseDepends", 0);
+      addArg(0, "implicit", "APT::Cache::ShowImplicit", 0);
    }
    else if (CmdMatches("search"))
    {
index 2fc721f693b58970b9c0d6d7f5b548af75905669..1eb891e8e95496d6929f63e1233fd92ed5b3c0e6 100644 (file)
@@ -689,6 +689,7 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
    bool const ShowBreaks = _config->FindB("APT::Cache::ShowBreaks", Important == false);
    bool const ShowEnhances = _config->FindB("APT::Cache::ShowEnhances", Important == false);
    bool const ShowOnlyFirstOr = _config->FindB("APT::Cache::ShowOnlyFirstOr", false);
+   bool const ShowImplicit = _config->FindB("APT::Cache::ShowImplicit", false);
 
    while (verset.empty() != true)
    {
@@ -709,12 +710,16 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
            case pkgCache::Dep::Depends: if (!ShowDepends) continue; break;
            case pkgCache::Dep::Recommends: if (!ShowRecommends) continue; break;
            case pkgCache::Dep::Suggests: if (!ShowSuggests) continue; break;
-           case pkgCache::Dep::Replaces: if (!ShowReplaces) continue; break;       case pkgCache::Dep::Conflicts: if (!ShowConflicts) continue; break;
+           case pkgCache::Dep::Replaces: if (!ShowReplaces) continue; break;
+           case pkgCache::Dep::Conflicts: if (!ShowConflicts) continue; break;
            case pkgCache::Dep::DpkgBreaks: if (!ShowBreaks) continue; break;
            case pkgCache::Dep::Enhances: if (!ShowEnhances) continue; break;
            }
+           if (ShowImplicit == false && D.IsImplicit())
+              continue;
 
            pkgCache::PkgIterator Trg = RevDepends ? D.ParentPkg() : D.TargetPkg();
+           bool const showNoArch = RevDepends || (D->CompareOp & pkgCache::Dep::ArchSpecific) != pkgCache::Dep::ArchSpecific;
 
            if((Installed && Trg->CurrentVer != 0) || !Installed)
              {
@@ -728,9 +733,9 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
                if (ShowDepType == true)
                  cout << D.DepType() << ": ";
                if (Trg->VersionList == 0)
-                 cout << "<" << Trg.FullName(true) << ">";
+                 cout << "<" << Trg.FullName(showNoArch) << ">";
                else
-                 cout << Trg.FullName(true);
+                 cout << Trg.FullName(showNoArch);
                if (ShowVersion == true && D->Version != 0)
                   cout << " (" << pkgCache::CompTypeDeb(D->CompareOp) << ' ' << D.TargetVer() << ')';
                cout << std::endl;
index a9f6c8da2e96e9e8a42953d6a717457abffcbf75..e20f66770caf5677fda03dc8bb728f7c47fc0354 100644 (file)
@@ -281,12 +281,23 @@ Reverse Provides:
                   <term><option>--no-breaks</option></term>
                   <term><option>--no-replaces</option></term>
                   <term><option>--no-enhances</option></term>
-                  <listitem><para>Per default the <literal>depends</literal> and
-     <literal>rdepends</literal> print all dependencies. This can be tweaked with
+                  <listitem><para>Per default the <command>depends</command> and
+     <command>rdepends</command> print all dependencies. This can be tweaked with
      these flags which will omit the specified dependency type.
      Configuration Item: <literal>APT::Cache::Show<replaceable>DependencyType</replaceable></literal>
      e.g. <literal>APT::Cache::ShowRecommends</literal>.</para></listitem>
      </varlistentry>
+
+     <varlistentry><term><option>--implicit</option></term>
+       <listitem><para>Per default <command>depends</command> and <command>rdepends</command>
+             print only dependencies explicitly expressed in the metadata. With this flag
+             it will also show dependencies implicitely added based on the encountered data.
+             A <literal>Conflicts: foo</literal> e.g. expresses implicitely that this package
+             also conflicts with the package foo from any other architecture.
+             Configuration Item: <literal>APT::Cache::ShowImplicit</literal>.
+       </para></listitem>
+     </varlistentry>
+
      <varlistentry><term><option>-f</option></term><term><option>--full</option></term>
      <listitem><para>Print full package records when searching. 
      Configuration Item: <literal>APT::Cache::ShowFull</literal>.</para></listitem>
index a22b08c2038bd474a62d4b170d599fadb38e2eae..a8ddfd88936c87c0190c4d7f855a6650f8362136 100755 (executable)
@@ -16,6 +16,9 @@ Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR"
 insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
 Breaks: foo (<< 1)
 Replaces: foo (<< 1)' "$DESCR"
+insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64
+Breaks: foo:amd64 (<< 1)
+Replaces: foo:i386 (<< 1)' "$DESCR"
 
 setupaptarchive
 
@@ -44,6 +47,7 @@ testsuccess test -s dump.output
 
 testsuccessequal 'dpkg
 bar
+specific
 fancy
 foo' aptcache pkgnames
 testsuccessequal 'bar' aptcache pkgnames bar
@@ -57,29 +61,60 @@ testsuccessequal "       foo |          1 | file:$(readlink -f .)/aptarchive uns
 testsuccessequal 'foo
   Depends: bar
   Conflicts: <foobar>
-  Conflicts: <foobar:i386>
  |Recommends: <cool>
   Recommends: <cooler>' aptcache depends foo
 testsuccessequal 'foo
   Depends: bar
   Conflicts: <foobar>
   Conflicts: <foobar:i386>
+ |Recommends: <cool>
+  Recommends: <cooler>' aptcache depends foo --implicit
+testsuccessequal 'foo
+  Depends: bar
+  Conflicts: <foobar>
   Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
 testsuccessequal 'foo
   Depends: bar
   Conflicts: <foobar>
   Conflicts: <foobar:i386>
+  Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
+testsuccessequal 'foo
+  Depends: bar
+  Conflicts: <foobar>
  |Recommends: <cool> (>= 2)
   Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
 testsuccessequal 'foo
   Depends: bar
   Conflicts: <foobar>
-  Conflicts: <foobar:i386>' aptcache depends foo --no-recommends
+  Conflicts: <foobar:i386>
+ |Recommends: <cool> (>= 2)
+  Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
 testsuccessequal 'foo
-  Depends: bar' aptcache depends foo --important
+  Depends: bar
+  Conflicts: <foobar>' aptcache depends foo --no-recommends
+testsuccessequal 'foo
+  Depends: bar
+  Conflicts: <foobar>
+  Conflicts: <foobar:i386>' aptcache depends foo --no-recommends --implicit
+testsuccessequal 'foo
+  Depends: bar' aptcache depends foo --important --implicit
 testsuccessequal 'foo
+  Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
+testsuccessequal 'foo
+  Conflicts: <foobar>
+  Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts --implicit
+testsuccessequal 'foo
+  Depends: bar
   Conflicts: <foobar>
-  Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts
+ |Recommends: <cool>
+  Recommends: <cooler>
+bar
+  Depends: bar
+  Breaks: foo
+  Replaces: foo
+<foobar>
+<cool>
+<cooler>' aptcache depends foo --recurse
 testsuccessequal 'foo
   Depends: bar
   Conflicts: <foobar>
@@ -96,29 +131,58 @@ bar
 <foobar:i386>
 <cool>
 <cooler>
-<foo:i386>' aptcache depends foo --recurse
+<foo:i386>' aptcache depends foo --recurse --implicit
+testsuccessequal 'foo
+  Depends: bar
+bar
+  Depends: bar
+  Replaces: foo' aptcache depends foo --recurse --important --replaces
 testsuccessequal 'foo
   Depends: bar
 bar
   Depends: bar
   Replaces: foo
   Replaces: <foo:i386>
-<foo:i386>' aptcache depends foo --recurse --important --replaces
+<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
+testsuccessequal 'bar
+  Depends: bar
+  Breaks: foo
+  Replaces: foo' aptcache depends bar
+testsuccessequal 'bar
+  Depends: bar
+  Breaks: foo
+  Breaks: <foo:i386>
+  Replaces: foo
+  Replaces: <foo:i386>' aptcache depends bar --implicit
+testsuccessequal 'specific
+  Depends: <bar:i386>
+  Depends: specific:amd64
+  Breaks: foo:amd64
+  Replaces: <foo:i386>' aptcache depends specific
+testsuccessequal 'specific
+  Depends: <bar:i386>
+  Depends: specific:amd64
+  Breaks: foo:amd64
+  Replaces: <foo:i386>' aptcache depends specific --implicit
 
 ## rdpends
 
 testsuccessequal 'foo
 Reverse Depends:
   bar
+  specific
   bar' aptcache rdepends foo
 testsuccessequal 'foo
 Reverse Depends:
   Breaks: bar
+  Breaks: specific
   Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
 testsuccessequal 'foo
 Reverse Depends:
   Breaks: bar (<< 1)
+  Breaks: specific (<< 1)
   Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
 testsuccessequal 'foo
 Reverse Depends:
-  Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks
+  Breaks: bar (<< 1)
+  Breaks: specific (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks
diff --git a/test/integration/test-ordering-ignore-not-matching-breaks b/test/integration/test-ordering-ignore-not-matching-breaks
deleted file mode 100755 (executable)
index 7c1365b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-setupenvironment
-configarchitecture 'amd64' 'i386'
-
-insertpackage 'unstable-mp' 'crda' 'i386,amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda
-Multi-Arch: foreign'
-insertpackage 'unstable-m' 'crda' 'i386,amd64' '1.1.1-1ubuntu4m' 'Multi-Arch: foreign'
-insertpackage 'unstable-p' 'crda' 'i386,amd64' '1.1.1-1ubuntu4p' 'Provides: wireless-crda'
-insertpackage 'unstable' 'wireless-crda' 'i386,amd64' '1.16'
-
-
-insertinstalledpackage 'wireless-crda' 'amd64' '1.14'
-
-setupaptarchive
-
-testsuccessequal 'Reading package lists...
-Building dependency tree...
-The following NEW packages will be installed:
-  crda
-0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
-Inst crda (1.1.1-1ubuntu4m unstable-m [amd64])
-Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m
-
-testsuccessequal 'Reading package lists...
-Building dependency tree...
-The following NEW packages will be installed:
-  crda
-0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
-Inst crda (1.1.1-1ubuntu4p unstable-p [amd64])
-Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p
-
-testsuccessequal 'Reading package lists...
-Building dependency tree...
-The following NEW packages will be installed:
-  crda
-0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
-Inst crda (1.1.1-1ubuntu4mp unstable-mp [amd64])
-Conf crda (1.1.1-1ubuntu4mp unstable-mp [amd64])' aptget install crda -s -t unstable-mp
-
-rm rootdir/var/lib/dpkg/status
-insertinstalledpackage 'crda' 'amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda
-Conflicts: wireless-crda (<< 1.15)
-Replaces: wireless-crda ( << 1.15)
-Multi-arch: foreign'
-
-testsuccessequal 'Reading package lists...
-Building dependency tree...
-The following NEW packages will be installed:
-  wireless-crda
-0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
-Inst wireless-crda (1.16 unstable [amd64])
-Conf wireless-crda (1.16 unstable [amd64])' aptget install wireless-crda -s -t unstable