From 1a22e16a1ebf08243c1836e1c593cb966cae4850 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 3 Dec 2013 21:49:02 +0100 Subject: proof-of-concept for fixing debian #731102 --- apt-pkg/indexrecords.cc | 5 ++++ apt-pkg/indexrecords.h | 1 + apt-pkg/metaindex.h | 3 ++- cmdline/apt-get.cc | 66 +++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 61 insertions(+), 14 deletions(-) diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 8a72ca151..f8097c3c6 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -27,6 +27,11 @@ string indexRecords::GetDist() const return this->Dist; } +string indexRecords::GetSuite() const +{ + return this->Suite; +} + bool indexRecords::CheckDist(const string MaybeDist) const { return (this->Dist == MaybeDist diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index a98b939bc..d003ec0fa 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -46,6 +46,7 @@ class indexRecords virtual bool Load(std::string Filename); std::string GetDist() const; + std::string GetSuite() const; time_t GetValidUntil() const; virtual bool CheckDist(const std::string MaybeDist) const; std::string GetExpectedDist() const; diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 5783735ff..0c2600c3a 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -48,7 +48,8 @@ class metaIndex virtual ~metaIndex() { if (Indexes == 0) return; - for (std::vector::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I) + for (std::vector::iterator I = (*Indexes).begin(); + I != (*Indexes).end(); ++I) delete *I; delete Indexes; } diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 912b2d609..2370318e8 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include #include @@ -135,11 +137,12 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, /* */ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords &SrcRecs,string &Src, - pkgDepCache &Cache) + CacheFile &CacheFile) { string VerTag; string DefRel = _config->Find("APT::Default-Release"); string TmpSrc = Name; + pkgDepCache *Cache = CacheFile.GetDepCache(); // extract the version/release from the pkgname const size_t found = TmpSrc.find_last_of("/="); @@ -155,7 +158,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, install a version and determine the source package name, then look in the archive for a source package of the same name. */ bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source"); - const pkgCache::PkgIterator Pkg = Cache.FindPkg(TmpSrc); + const pkgCache::PkgIterator Pkg = Cache->FindPkg(TmpSrc); if (MatchSrcOnly == false && Pkg.end() == false) { if(VerTag.empty() == false || DefRel.empty() == false) @@ -180,7 +183,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, } // We match against a concrete version (or a part of this version) if (VerTag.empty() == false && - (fuzzy == true || Cache.VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match + (fuzzy == true || Cache->VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match (fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match continue; @@ -217,22 +220,24 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, if (Src.empty() == false) break; } +#if 0 if (Src.empty() == true) { // Sources files have no codename information if (VerTag.empty() == true && DefRel.empty() == false) { - _error->Error(_("Ignore unavailable target release '%s' of package '%s'"), DefRel.c_str(), TmpSrc.c_str()); - return 0; + _error->Warning(_("Ignore unavailable target release '%s' of package '%s'"), DefRel.c_str(), TmpSrc.c_str()); + return 0; } } +#endif } if (Src.empty() == true) { // if we don't have found a fitting package yet so we will // choose a good candidate and proceed with that. // Maybe we will find a source later on with the right VerTag - pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg); + pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg); if (Ver.end() == false) { pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList()); @@ -262,6 +267,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords::Parser *Last = 0; unsigned long Offset = 0; string Version; + string FoundRel; /* Iterate over all of the hits, which includes the resulting binary packages in the search */ @@ -273,26 +279,60 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { const string Ver = Parse->Version(); + + // find release + const pkgIndexFile& SI = Parse->Index(); + pkgSourceList *SrcList = CacheFile.GetSourceList(); + for (pkgSourceList::const_iterator S = SrcList->begin(); + S != SrcList->end(); ++S) + { + vector *Indexes = (*S)->GetIndexFiles(); + for (vector::const_iterator IF = Indexes->begin(); + IF != Indexes->end(); ++IF) + { + if (&SI == (*IF)) + { + std::string dirname = _config->FindDir("Dir::State::lists"); + std::string path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release"; + indexRecords records; + records.Load(path); + if (records.GetSuite() == DefRel) + { + ioprintf(clog, "Selectied version '%s' (%s) for %s\n", + Ver.c_str(), DefRel.c_str(), Src.c_str()); + Last = Parse; + Offset = Parse->Offset(); + Version = Ver; + FoundRel = DefRel; + break; + } + } + } + } + if (DefRel.empty() == false && (DefRel == FoundRel)) + break; + // Ignore all versions which doesn't fit if (VerTag.empty() == false && - Cache.VS().CmpVersion(VerTag, Ver) != 0) // exact match + Cache->VS().CmpVersion(VerTag, Ver) != 0) // exact match continue; // Newer version or an exact match? Save the hit - if (Last == 0 || Cache.VS().CmpVersion(Version,Ver) < 0) { + if (Last == 0 || Cache->VS().CmpVersion(Version,Ver) < 0) { Last = Parse; Offset = Parse->Offset(); Version = Ver; } // was the version check above an exact match? If so, we don't need to look further - if (VerTag.empty() == false && VerTag.size() == Ver.size()) + if (VerTag.empty() == false && (VerTag == Ver)) + { + std::cerr << "meep" << std::endl; break; + } } if (Last != 0 || VerTag.empty() == true) break; - //if (VerTag.empty() == false && Last == 0) - _error->Error(_("Ignore unavailable version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str()); return 0; } @@ -628,7 +668,7 @@ bool DoSource(CommandLine &CmdL) for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++) { string Src; - pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache); + pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache); if (Last == 0) { delete[] Dsc; @@ -925,7 +965,7 @@ bool DoBuildDep(CommandLine &CmdL) for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++) { string Src; - pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,*Cache); + pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache); if (Last == 0) return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); -- cgit v1.2.3 From 019dfaedcc169837f88cc0b971fd8897828d93bf Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 07:58:37 +0100 Subject: add test, deal with InRelease --- cmdline/apt-get.cc | 6 +++-- test/integration/test-apt-get-source | 45 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 test/integration/test-apt-get-source diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 2370318e8..3003c1971 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -293,7 +293,10 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, if (&SI == (*IF)) { std::string dirname = _config->FindDir("Dir::State::lists"); - std::string path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release"; + std::string path; + path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release"; + if (!FileExists(path)) + path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_InRelease"; indexRecords records; records.Load(path); if (records.GetSuite() == DefRel) @@ -327,7 +330,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, // was the version check above an exact match? If so, we don't need to look further if (VerTag.empty() == false && (VerTag == Ver)) { - std::cerr << "meep" << std::endl; break; } } diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source new file mode 100755 index 000000000..d2b8deafd --- /dev/null +++ b/test/integration/test-apt-get-source @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# we need to insert a package into "unstable" so that a Release file is +# create for the test +insertpackage 'wheezy' 'unreleated-package' 'all' '1.0' + +# a "normal" package with source and binary +insertpackage 'unstable' 'foo' 'all' '2.0' +insertsource 'unstable' 'foo' 'all' '2.0' + +insertpackage 'stable' 'foo' 'all' '1.0' +insertsource 'stable' 'foo' 'all' '1.0' + +# this package exists only as source +insertsource 'wheezy' 'foo' 'all' '0.1' + +setupaptarchive + +APTARCHIVE=$(readlink -f ./aptarchive) + +# normal operation gets highest version number +testequal "'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo + +# select by release +testequal "Selectied version '1.0' (stable) for foo +'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/stable + +# select by version +testequal "'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo=1.0 + +# select by release with no binary package (Bug#731102) +testequal "Selectied version '0.1' (wheezy) for foo +'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/wheezy + -- cgit v1.2.3 From 7b33ae1070f3ecff0f20745db7edeead8dfc3a05 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 08:18:58 +0100 Subject: refactor and move generation of the MetaIndex FileName out of the FindSrc() --- cmdline/apt-get.cc | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 3003c1971..3205fd90a 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -63,6 +63,8 @@ #include #include +#include + #include #include @@ -132,6 +134,26 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, return true; } /*}}}*/ + +// FIXME: move into more generic code (metaindex ?) +std::string MetaIndexFileName(metaIndex *metaindex) +{ + // FIXME: this cast is the horror, the horror + debReleaseIndex *r = (debReleaseIndex*)metaindex; + + // see if we have a InRelease file + std::string PathInRelease = _config->FindDir("Dir::State::lists") + + URItoFileName(r->MetaIndexURI("InRelease")); + if (FileExists(PathInRelease)) + return PathInRelease; + + // and if not return the normal one + return _config->FindDir("Dir::State::lists") + + URItoFileName(r->MetaIndexURI("Release")); +} + + + // FindSrc - Find a source record /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -268,6 +290,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, unsigned long Offset = 0; string Version; string FoundRel; + pkgSourceList *SrcList = CacheFile.GetSourceList(); /* Iterate over all of the hits, which includes the resulting binary packages in the search */ @@ -279,10 +302,9 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { const string Ver = Parse->Version(); - - // find release + // try to find release const pkgIndexFile& SI = Parse->Index(); - pkgSourceList *SrcList = CacheFile.GetSourceList(); + for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); ++S) { @@ -292,11 +314,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { if (&SI == (*IF)) { - std::string dirname = _config->FindDir("Dir::State::lists"); - std::string path; - path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release"; - if (!FileExists(path)) - path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_InRelease"; + std::string path = MetaIndexFileName(*S); indexRecords records; records.Load(path); if (records.GetSuite() == DefRel) -- cgit v1.2.3 From 4652a9eee39df1cefa49ab177c0cfc50b9aad567 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 08:41:23 +0100 Subject: further refactor, extract GetReleaseForSourceRecord() out of FindSrc(), write out the selection notice to c1out to be consistent with the rest of the source --- cmdline/apt-get.cc | 85 ++++++++++++++++++------------------ test/integration/test-apt-get-source | 26 +++++++---- 2 files changed, 60 insertions(+), 51 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 3205fd90a..15742c8e5 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -152,6 +152,29 @@ std::string MetaIndexFileName(metaIndex *metaindex) URItoFileName(r->MetaIndexURI("Release")); } +std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, + pkgSrcRecords::Parser *Parse) +{ + // try to find release + const pkgIndexFile& SI = Parse->Index(); + for (pkgSourceList::const_iterator S = SrcList->begin(); + S != SrcList->end(); ++S) + { + vector *Indexes = (*S)->GetIndexFiles(); + for (vector::const_iterator IF = Indexes->begin(); + IF != Indexes->end(); ++IF) + { + if (&SI == (*IF)) + { + std::string path = MetaIndexFileName(*S); + indexRecords records; + records.Load(path); + return records.GetSuite(); + } + } + } + return ""; +} // FindSrc - Find a source record /*{{{*/ @@ -162,7 +185,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, CacheFile &CacheFile) { string VerTag; - string DefRel = _config->Find("APT::Default-Release"); + string RelTag = _config->Find("APT::Default-Release"); string TmpSrc = Name; pkgDepCache *Cache = CacheFile.GetDepCache(); @@ -170,7 +193,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, const size_t found = TmpSrc.find_last_of("/="); if (found != string::npos) { if (TmpSrc[found] == '/') - DefRel = TmpSrc.substr(found+1); + RelTag = TmpSrc.substr(found+1); else VerTag = TmpSrc.substr(found+1); TmpSrc = TmpSrc.substr(0,found); @@ -183,7 +206,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, const pkgCache::PkgIterator Pkg = Cache->FindPkg(TmpSrc); if (MatchSrcOnly == false && Pkg.end() == false) { - if(VerTag.empty() == false || DefRel.empty() == false) + if(VerTag.empty() == false || RelTag.empty() == false) { bool fuzzy = false; // we have a default release, try to locate the pkg. we do it like @@ -223,8 +246,8 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, // or we match against a release if(VerTag.empty() == false || - (VF.File().Archive() != 0 && VF.File().Archive() == DefRel) || - (VF.File().Codename() != 0 && VF.File().Codename() == DefRel)) + (VF.File().Archive() != 0 && VF.File().Archive() == RelTag) || + (VF.File().Codename() != 0 && VF.File().Codename() == RelTag)) { pkgRecords::Parser &Parse = Recs.Lookup(VF); Src = Parse.SourcePkg(); @@ -242,23 +265,13 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, if (Src.empty() == false) break; } -#if 0 - if (Src.empty() == true) - { - // Sources files have no codename information - if (VerTag.empty() == true && DefRel.empty() == false) - { - _error->Warning(_("Ignore unavailable target release '%s' of package '%s'"), DefRel.c_str(), TmpSrc.c_str()); - return 0; - } - } -#endif } if (Src.empty() == true) { // if we don't have found a fitting package yet so we will // choose a good candidate and proceed with that. // Maybe we will find a source later on with the right VerTag + // or RelTag pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg); if (Ver.end() == false) { @@ -271,7 +284,9 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, } if (Src.empty() == true) + { Src = TmpSrc; + } else { /* if we have a source pkg name, make sure to only search @@ -301,36 +316,20 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) { const string Ver = Parse->Version(); + const string Rel = GetReleaseForSourceRecord(SrcList, Parse); - // try to find release - const pkgIndexFile& SI = Parse->Index(); - - for (pkgSourceList::const_iterator S = SrcList->begin(); - S != SrcList->end(); ++S) + if (RelTag != "" && Rel == RelTag) { - vector *Indexes = (*S)->GetIndexFiles(); - for (vector::const_iterator IF = Indexes->begin(); - IF != Indexes->end(); ++IF) - { - if (&SI == (*IF)) - { - std::string path = MetaIndexFileName(*S); - indexRecords records; - records.Load(path); - if (records.GetSuite() == DefRel) - { - ioprintf(clog, "Selectied version '%s' (%s) for %s\n", - Ver.c_str(), DefRel.c_str(), Src.c_str()); - Last = Parse; - Offset = Parse->Offset(); - Version = Ver; - FoundRel = DefRel; - break; - } - } - } + ioprintf(c1out, "Selectied version '%s' (%s) for %s\n", + Ver.c_str(), RelTag.c_str(), Src.c_str()); + Last = Parse; + Offset = Parse->Offset(); + Version = Ver; + FoundRel = RelTag; + break; } - if (DefRel.empty() == false && (DefRel == FoundRel)) + + if (RelTag.empty() == false && (RelTag == FoundRel)) break; // Ignore all versions which doesn't fit diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index d2b8deafd..0f9e29c80 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -26,20 +26,30 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) # normal operation gets highest version number -testequal "'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo +HEADER="Reading package lists... +Building dependency tree..." +testequal "$HEADER +Need to get 0 B of source archives. +'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo # select by release -testequal "Selectied version '1.0' (stable) for foo +testequal "$HEADER +Selectied version '1.0' (stable) for foo +Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/stable +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/stable # select by version -testequal "'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo=1.0 +testequal "$HEADER +Need to get 0 B of source archives. +'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e +'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo=1.0 # select by release with no binary package (Bug#731102) -testequal "Selectied version '0.1' (wheezy) for foo +testequal "$HEADER +Selectied version '0.1' (wheezy) for foo +Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e -'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/wheezy +'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/wheezy -- cgit v1.2.3 From c6b83f9c68aafa3f2bd1b695a6beb724d7520bc5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 16:26:57 +0100 Subject: add test for aptget source for unavailable package --- test/integration/test-apt-get-source | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source index 0f9e29c80..5bef781f1 100755 --- a/test/integration/test-apt-get-source +++ b/test/integration/test-apt-get-source @@ -53,3 +53,8 @@ Need to get 0 B of source archives. 'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e 'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/wheezy +# unavailable one +testequal "$HEADER +E: Ignore unavailable version '9.9-not-there' of package 'foo' +E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there + -- cgit v1.2.3 From 42517437947654de48102c1f9e32353c8a043af2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 16:27:05 +0100 Subject: refactor FindSrc() --- cmdline/apt-get.cc | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 15742c8e5..79e9d7fcb 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -304,7 +304,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords::Parser *Last = 0; unsigned long Offset = 0; string Version; - string FoundRel; pkgSourceList *SrcList = CacheFile.GetSourceList(); /* Iterate over all of the hits, which includes the resulting @@ -316,21 +315,21 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) { const string Ver = Parse->Version(); - const string Rel = GetReleaseForSourceRecord(SrcList, Parse); - if (RelTag != "" && Rel == RelTag) + // See if we need to look for a specific release tag + if (RelTag != "") { - ioprintf(c1out, "Selectied version '%s' (%s) for %s\n", - Ver.c_str(), RelTag.c_str(), Src.c_str()); - Last = Parse; - Offset = Parse->Offset(); - Version = Ver; - FoundRel = RelTag; - break; - } + const string Rel = GetReleaseForSourceRecord(SrcList, Parse); - if (RelTag.empty() == false && (RelTag == FoundRel)) - break; + if (Rel == RelTag) + { + ioprintf(c1out, "Selectied version '%s' (%s) for %s\n", + Ver.c_str(), RelTag.c_str(), Src.c_str()); + Last = Parse; + Offset = Parse->Offset(); + break; + } + } // Ignore all versions which doesn't fit if (VerTag.empty() == false && @@ -344,14 +343,14 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, Version = Ver; } - // was the version check above an exact match? If so, we don't need to look further + // was the version check above an exact match? + // If so, we don't need to look further if (VerTag.empty() == false && (VerTag == Ver)) - { break; - } } if (Last != 0 || VerTag.empty() == true) break; + _error->Error(_("Ignore unavailable version '%s' of package '%s'"), VerTag.c_str(), TmpSrc.c_str()); return 0; } -- cgit v1.2.3 From d85d0c09cee3aa5b84e45f46595f6dd617ce64b6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 16:38:20 +0100 Subject: use MetaIndexFile() instead of MetaIndexURI() --- cmdline/apt-get.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 79e9d7fcb..f0405e75c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -142,14 +142,12 @@ std::string MetaIndexFileName(metaIndex *metaindex) debReleaseIndex *r = (debReleaseIndex*)metaindex; // see if we have a InRelease file - std::string PathInRelease = _config->FindDir("Dir::State::lists") + - URItoFileName(r->MetaIndexURI("InRelease")); + std::string PathInRelease = r->MetaIndexFile("InRelease"); if (FileExists(PathInRelease)) return PathInRelease; // and if not return the normal one - return _config->FindDir("Dir::State::lists") + - URItoFileName(r->MetaIndexURI("Release")); + return r->MetaIndexFile("Release"); } std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, -- cgit v1.2.3 From 916e5cb41edfa015fd8ec42ba140eb7c0c4cb511 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 17:58:36 +0100 Subject: add #ifdefed ABI break & cleaner solution once the abi break is in place --- apt-pkg/deb/debmetaindex.cc | 3 ++- apt-pkg/deb/debmetaindex.h | 5 +++++ apt-pkg/makefile | 2 +- apt-pkg/metaindex.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ apt-pkg/metaindex.h | 21 +++++++++++++++------ cmdline/apt-get.cc | 5 +++++ 6 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 apt-pkg/metaindex.cc diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index b597b6f3c..345b1ec11 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1,4 +1,3 @@ -// ijones, walters #include #include @@ -36,6 +35,7 @@ string debReleaseIndex::Info(const char *Type, string const &Section, string con return Info; } +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) string debReleaseIndex::MetaIndexInfo(const char *Type) const { string Info = ::URI::SiteOnly(URI) + ' '; @@ -71,6 +71,7 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const Res += Type; return Res; } +#endif string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const { diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index b9ecab97c..fc0b7f948 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -3,6 +3,7 @@ #define PKGLIB_DEBMETAINDEX_H #include +#include #include #include @@ -39,9 +40,13 @@ class debReleaseIndex : public metaIndex { virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const; std::vector * ComputeIndexTargets() const; std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const; + +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) std::string MetaIndexInfo(const char *Type) const; std::string MetaIndexFile(const char *Types) const; std::string MetaIndexURI(const char *Type) const; +#endif + std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const; std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const; std::string SourceIndexURI(const char *Type, const std::string &Section) const; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index a90131f80..108632695 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -41,7 +41,7 @@ SOURCE+= pkgcache.cc version.cc depcache.cc \ pkgrecords.cc algorithms.cc acquire.cc\ acquire-worker.cc acquire-method.cc init.cc clean.cc \ srcrecords.cc cachefile.cc versionmatch.cc policy.cc \ - pkgsystem.cc indexfile.cc pkgcachegen.cc acquire-item.cc \ + pkgsystem.cc indexfile.cc metaindex.cc pkgcachegen.cc acquire-item.cc \ indexrecords.cc vendor.cc vendorlist.cc cdrom.cc indexcopy.cc \ aptconfiguration.cc cachefilter.cc cacheset.cc edsp.cc \ install-progress.cc upgrade.cc update.cc diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc new file mode 100644 index 000000000..2292ac388 --- /dev/null +++ b/apt-pkg/metaindex.cc @@ -0,0 +1,44 @@ + +#include + +#include "init.h" +#include "metaindex.h" + + +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +string metaIndex::MetaIndexInfo(const char *Type) const +{ + string Info = ::URI::SiteOnly(URI) + ' '; + if (Dist[Dist.size() - 1] == '/') + { + if (Dist != "/") + Info += Dist; + } + else + Info += Dist; + Info += " "; + Info += Type; + return Info; +} + +string metaIndex::MetaIndexFile(const char *Type) const +{ + return _config->FindDir("Dir::State::lists") + + URItoFileName(MetaIndexURI(Type)); +} + +string metaIndex::MetaIndexURI(const char *Type) const +{ + string Res; + + if (Dist == "/") + Res = URI; + else if (Dist[Dist.size()-1] == '/') + Res = URI + Dist; + else + Res = URI + "dists/" + Dist + "/"; + + Res += Type; + return Res; +} +#endif diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 0c2600c3a..6503f7dc8 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -5,6 +5,7 @@ #include #include #include +#include #ifndef APT_8_CLEANER_HEADERS #include @@ -28,24 +29,32 @@ class metaIndex public: - // Various accessors virtual std::string GetURI() const {return URI;} virtual std::string GetDist() const {return Dist;} virtual const char* GetType() const {return Type;} // Interface for acquire - virtual std::string ArchiveURI(std::string const& /*File*/) const = 0; + virtual std::string ArchiveURI(std::string const& File) const = 0; virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0; - virtual std::vector *GetIndexFiles() = 0; virtual bool IsTrusted() const = 0; - metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) : - Indexes(NULL), Type(Type), URI(URI), Dist(Dist) { +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + virtual std::string MetaIndexInfo(const char *Type) const; + virtual std::string MetaIndexFile(const char *Types) const; + virtual std::string MetaIndexURI(const char *Type) const; +#endif + + metaIndex(std::string const &URI, std::string const &Dist, + char const * const Type) + : Indexes(NULL), Type(Type), URI(URI), Dist(Dist) + { + /* nothing */ } - virtual ~metaIndex() { + virtual ~metaIndex() + { if (Indexes == 0) return; for (std::vector::iterator I = (*Indexes).begin(); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index f0405e75c..5f04135d2 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -136,10 +136,15 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, /*}}}*/ // FIXME: move into more generic code (metaindex ?) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) std::string MetaIndexFileName(metaIndex *metaindex) { // FIXME: this cast is the horror, the horror debReleaseIndex *r = (debReleaseIndex*)metaindex; +#else +std::string MetaIndexFileName(metaIndex *r) +{ +#endif // see if we have a InRelease file std::string PathInRelease = r->MetaIndexFile("InRelease"); -- cgit v1.2.3 From 86e3c55052737d57f9d0123f8aaacd044774c698 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Dec 2013 22:39:04 +0100 Subject: refactor --- cmdline/apt-get.cc | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5f04135d2..c38fd2d31 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -135,14 +135,15 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, } /*}}}*/ + // FIXME: move into more generic code (metaindex ?) #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) -std::string MetaIndexFileName(metaIndex *metaindex) +std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) { // FIXME: this cast is the horror, the horror debReleaseIndex *r = (debReleaseIndex*)metaindex; #else -std::string MetaIndexFileName(metaIndex *r) +std::string MetaIndexFileNameOnDisk(metaIndex *r) { #endif @@ -152,14 +153,22 @@ std::string MetaIndexFileName(metaIndex *r) return PathInRelease; // and if not return the normal one - return r->MetaIndexFile("Release"); + if (FileExists(PathInRelease)) + return r->MetaIndexFile("Release"); + + return ""; } + +// GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/ +// --------------------------------------------------------------------- +/* */ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, pkgSrcRecords::Parser *Parse) { // try to find release - const pkgIndexFile& SI = Parse->Index(); + const pkgIndexFile& CurrentIndexFile = Parse->Index(); + for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); ++S) { @@ -167,19 +176,21 @@ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, for (vector::const_iterator IF = Indexes->begin(); IF != Indexes->end(); ++IF) { - if (&SI == (*IF)) + if (&CurrentIndexFile == (*IF)) { - std::string path = MetaIndexFileName(*S); - indexRecords records; - records.Load(path); - return records.GetSuite(); + std::string path = MetaIndexFileNameOnDisk(*S); + if (path != "") + { + indexRecords records; + records.Load(path); + return records.GetSuite(); + } } } } return ""; } - - + /*}}}*/ // FindSrc - Find a source record /*{{{*/ // --------------------------------------------------------------------- /* */ -- cgit v1.2.3 From d958636fdf39d8b1f08239f9981c8b6520bde7a6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Dec 2013 07:53:53 +0100 Subject: add new LocalFileName() method to metaindex --- apt-pkg/deb/debmetaindex.cc | 16 +++++++++++++++- apt-pkg/deb/debmetaindex.h | 6 ++++++ apt-pkg/indexfile.h | 4 ++-- apt-pkg/makefile | 2 +- apt-pkg/metaindex.cc | 44 -------------------------------------------- apt-pkg/metaindex.h | 16 ++++++++++------ cmdline/apt-get.cc | 12 ++++++------ 7 files changed, 40 insertions(+), 60 deletions(-) delete mode 100644 apt-pkg/metaindex.cc diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 345b1ec11..504877558 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -35,7 +35,6 @@ string debReleaseIndex::Info(const char *Type, string const &Section, string con return Info; } -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) string debReleaseIndex::MetaIndexInfo(const char *Type) const { string Info = ::URI::SiteOnly(URI) + ' '; @@ -71,6 +70,21 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const Res += Type; return Res; } + +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +std::string debReleaseIndex::LocalFileName() const +{ + // see if we have a InRelease file + std::string PathInRelease = MetaIndexFile("InRelease"); + if (FileExists(PathInRelease)) + return PathInRelease; + + // and if not return the normal one + if (FileExists(PathInRelease)) + return MetaIndexFile("Release"); + + return ""; +} #endif string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index fc0b7f948..9f488898d 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -45,6 +45,12 @@ class debReleaseIndex : public metaIndex { std::string MetaIndexInfo(const char *Type) const; std::string MetaIndexFile(const char *Types) const; std::string MetaIndexURI(const char *Type) const; +#else + virtual std::string MetaIndexInfo(const char *Type) const; + virtual std::string MetaIndexFile(const char *Types) const; + virtual std::string MetaIndexURI(const char *Type) const; + + virtual std::string LocalFileName() const; #endif std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const; diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 1d34dc773..2d433b60a 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -78,10 +78,10 @@ class pkgIndexFile virtual bool Exists() const = 0; virtual bool HasPackages() const = 0; virtual unsigned long Size() const = 0; - virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; }; + virtual bool Merge(pkgCacheGenerator &Gen, OpProgress* Prog) const { return false; }; __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const { return Merge(Gen, &Prog); }; - virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;}; + virtual bool MergeFileProvides(pkgCacheGenerator &Gen,OpProgress* Prog) const {return true;}; __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const {return MergeFileProvides(Gen, &Prog);}; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 108632695..a90131f80 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -41,7 +41,7 @@ SOURCE+= pkgcache.cc version.cc depcache.cc \ pkgrecords.cc algorithms.cc acquire.cc\ acquire-worker.cc acquire-method.cc init.cc clean.cc \ srcrecords.cc cachefile.cc versionmatch.cc policy.cc \ - pkgsystem.cc indexfile.cc metaindex.cc pkgcachegen.cc acquire-item.cc \ + pkgsystem.cc indexfile.cc pkgcachegen.cc acquire-item.cc \ indexrecords.cc vendor.cc vendorlist.cc cdrom.cc indexcopy.cc \ aptconfiguration.cc cachefilter.cc cacheset.cc edsp.cc \ install-progress.cc upgrade.cc update.cc diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc deleted file mode 100644 index 2292ac388..000000000 --- a/apt-pkg/metaindex.cc +++ /dev/null @@ -1,44 +0,0 @@ - -#include - -#include "init.h" -#include "metaindex.h" - - -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) -string metaIndex::MetaIndexInfo(const char *Type) const -{ - string Info = ::URI::SiteOnly(URI) + ' '; - if (Dist[Dist.size() - 1] == '/') - { - if (Dist != "/") - Info += Dist; - } - else - Info += Dist; - Info += " "; - Info += Type; - return Info; -} - -string metaIndex::MetaIndexFile(const char *Type) const -{ - return _config->FindDir("Dir::State::lists") + - URItoFileName(MetaIndexURI(Type)); -} - -string metaIndex::MetaIndexURI(const char *Type) const -{ - string Res; - - if (Dist == "/") - Res = URI; - else if (Dist[Dist.size()-1] == '/') - Res = URI + Dist; - else - Res = URI + "dists/" + Dist + "/"; - - Res += Type; - return Res; -} -#endif diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 6503f7dc8..147154227 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -34,18 +34,22 @@ class metaIndex virtual std::string GetDist() const {return Dist;} virtual const char* GetType() const {return Type;} + // interface to to query it +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) + virtual std::string MetaIndexInfo(const char *Type) const {return "";}; + virtual std::string MetaIndexFile(const char *Types) const {return "";}; + virtual std::string MetaIndexURI(const char *Type) const {return "";}; + + // returns the path of the local file (or "" if its not available) + virtual std::string LocalFileName() const {return "";}; +#endif + // Interface for acquire virtual std::string ArchiveURI(std::string const& File) const = 0; virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0; virtual std::vector *GetIndexFiles() = 0; virtual bool IsTrusted() const = 0; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) - virtual std::string MetaIndexInfo(const char *Type) const; - virtual std::string MetaIndexFile(const char *Types) const; - virtual std::string MetaIndexURI(const char *Type) const; -#endif - metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) : Indexes(NULL), Type(Type), URI(URI), Dist(Dist) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index c38fd2d31..7e59f3d67 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -136,16 +136,12 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, /*}}}*/ -// FIXME: move into more generic code (metaindex ?) +// helper that can go wit hthe next ABI break #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) { // FIXME: this cast is the horror, the horror debReleaseIndex *r = (debReleaseIndex*)metaindex; -#else -std::string MetaIndexFileNameOnDisk(metaIndex *r) -{ -#endif // see if we have a InRelease file std::string PathInRelease = r->MetaIndexFile("InRelease"); @@ -158,7 +154,7 @@ std::string MetaIndexFileNameOnDisk(metaIndex *r) return ""; } - +#endif // GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/ // --------------------------------------------------------------------- @@ -178,7 +174,11 @@ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, { if (&CurrentIndexFile == (*IF)) { +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) std::string path = MetaIndexFileNameOnDisk(*S); +#else + std::string path = (*S)->LocalFileName(); +#endif if (path != "") { indexRecords records; -- cgit v1.2.3 From 55e3b9e3ddc2a59df06e22be4efff7f72406d4ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Dec 2013 08:06:06 +0100 Subject: remove exposing {MetaIndexInfo,MetaIndexFile,MetaIndexURI} again as this is package system specific --- apt-pkg/deb/debmetaindex.h | 6 +----- apt-pkg/metaindex.h | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 9f488898d..cef8d68f7 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -41,15 +41,11 @@ class debReleaseIndex : public metaIndex { std::vector * ComputeIndexTargets() const; std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) std::string MetaIndexInfo(const char *Type) const; std::string MetaIndexFile(const char *Types) const; std::string MetaIndexURI(const char *Type) const; -#else - virtual std::string MetaIndexInfo(const char *Type) const; - virtual std::string MetaIndexFile(const char *Types) const; - virtual std::string MetaIndexURI(const char *Type) const; +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) virtual std::string LocalFileName() const; #endif diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 147154227..18a90a29d 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -36,10 +36,6 @@ class metaIndex // interface to to query it #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) - virtual std::string MetaIndexInfo(const char *Type) const {return "";}; - virtual std::string MetaIndexFile(const char *Types) const {return "";}; - virtual std::string MetaIndexURI(const char *Type) const {return "";}; - // returns the path of the local file (or "" if its not available) virtual std::string LocalFileName() const {return "";}; #endif -- cgit v1.2.3