From 991385872ca4653d3d83c9e13ce471477053d55b Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Fri, 16 May 2014 21:04:20 +0400 Subject: [PATCH] Apply apt-0.5.15cnc5-alt-getsrc.patch Added in commit 3212342: 0.5.5cnc1-alt3 - Introduced APT::Ignore-dpkg support and set this flag by default, to address #0002119. --- apt-0.5.15cnc5-alt-getsrc.patch | 141 ------------------------------- apt/apt-pkg/deb/debsrcrecords.h | 3 + apt/apt-pkg/rpm/rpmrecords.cc | 7 +- apt/apt-pkg/rpm/rpmsrcrecords.cc | 14 +++ apt/apt-pkg/rpm/rpmsrcrecords.h | 2 + apt/apt-pkg/srcrecords.cc | 6 +- apt/apt-pkg/srcrecords.h | 2 + 7 files changed, 31 insertions(+), 144 deletions(-) delete mode 100644 apt-0.5.15cnc5-alt-getsrc.patch diff --git a/apt-0.5.15cnc5-alt-getsrc.patch b/apt-0.5.15cnc5-alt-getsrc.patch deleted file mode 100644 index 0a015e4..0000000 --- a/apt-0.5.15cnc5-alt-getsrc.patch +++ /dev/null @@ -1,141 +0,0 @@ -This patch is the result of work initiated by Anton Denisov's - feedback (and debug-patches). - -There are three problems with apt-get source , this patch fixes two of them: - -- rpmrecords.cc: SourcePackage() returns empty string because of incorrect - rpmlib's return code interpretation (fixed, now it return in most cases - the source package filename); -- srcrecords.cc: Find() called from apt-get's DoSource() doesn't match anything - because it matches against source package name, but gets a filename as an - argument (in the case of the first branch in DoSource() when the return value - of SourcePackage() is used) (fixed: now matching is done for corresponding - fields). - -This makes the first branch in DoSource() work which is almost all one may want. - -9 July 2002 -imz@altlinux.ru - -A bad side of this patch may be that in the first branch (matching against -src.rpm name), it takes the full filename (including version-release) into -account while the second branch does only matching against the name (version -insensitive). - -Ported to apt-0.5.4cnc9. (There is a separate apt-0.5.4cnc9-alt-getsrc-debug.patch -which helps to determine which of the branches is really used.) - -imz@altlinux.ru, 28 Sep 2002. - -Ported to apt-0.5.15cnc4. - -avd@altlinux.org 2003-12-09 - -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/deb/debsrcrecords.h apt-0.5.15cnc5/apt-pkg/deb/debsrcrecords.h ---- apt-0.5.15cnc5.orig/apt-pkg/deb/debsrcrecords.h 2003-12-23 23:19:00 +0300 -+++ apt-0.5.15cnc5/apt-pkg/deb/debsrcrecords.h 2004-01-16 15:18:13 +0300 -@@ -34,6 +34,9 @@ class debSrcRecordParser : public pkgSrc - virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);}; - virtual bool Jump(unsigned long Off) {iOffset = Off; return Tags.Jump(Sect,Off);}; - -+ // These refer to the archive file for the Version -+ virtual string FileName() const {return Sect.FindS("Filename");}; -+ - virtual string Package() const {return Sect.FindS("Package");}; - virtual string Version() const {return Sect.FindS("Version");}; - virtual string Maintainer() const {return Sect.FindS("Maintainer");}; -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmrecords.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmrecords.cc ---- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmrecords.cc 2003-12-23 23:19:50 +0300 -+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmrecords.cc 2004-01-16 15:18:13 +0300 -@@ -178,7 +178,12 @@ string rpmRecordParser::SourcePkg() - { - // This must be the *package* name, not the *file* name. We have no - // current way to extract it safely from the file name. -- return ""; -+ char *str; -+ int_32 count, type; -+ assert(HeaderP != NULL); -+ int rc = headerGetEntry(HeaderP, RPMTAG_SOURCERPM, -+ &type, (void**)&str, &count); -+ return string(rc?str:""); - } - /*}}}*/ - -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsrcrecords.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmsrcrecords.cc ---- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsrcrecords.cc 2003-12-23 23:20:00 +0300 -+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmsrcrecords.cc 2004-01-16 15:18:13 +0300 -@@ -123,6 +123,20 @@ bool rpmSrcRecordParser::Jump(unsigned l - return true; - } - -+// RecordParser::FileName - Return the archive filename on the site /*{{{*/ -+// --------------------------------------------------------------------- -+/* */ -+string rpmSrcRecordParser::FileName() const -+{ -+ char *str; -+ int_32 count, type; -+ assert(HeaderP != NULL); -+ int rc = headerGetEntry(HeaderP, CRPMTAG_FILENAME, -+ &type, (void**)&str, &count); -+ return string(rc?str:""); -+} -+ /*}}}*/ -+ - string rpmSrcRecordParser::Package() const - { - char *str; -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsrcrecords.h apt-0.5.15cnc5/apt-pkg/rpm/rpmsrcrecords.h ---- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsrcrecords.h 2003-12-23 23:20:01 +0300 -+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmsrcrecords.h 2004-01-16 15:18:13 +0300 -@@ -44,6 +44,8 @@ public: - virtual bool Step(); - virtual bool Jump(unsigned long Off); - -+ virtual string FileName() const; -+ - virtual string Package() const; - virtual string Version() const; - virtual string Maintainer() const; -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/srcrecords.cc apt-0.5.15cnc5/apt-pkg/srcrecords.cc ---- apt-0.5.15cnc5.orig/apt-pkg/srcrecords.cc 2003-12-23 23:19:13 +0300 -+++ apt-0.5.15cnc5/apt-pkg/srcrecords.cc 2004-01-16 15:18:13 +0300 -@@ -82,7 +82,7 @@ bool pkgSrcRecords::Restart() - /*}}}*/ - // SrcRecords::Find - Find the first source package with the given name /*{{{*/ - // --------------------------------------------------------------------- --/* This searches on both source package names and output binary names and -+/* This searches on both source package filenames and output binary names and - returns the first found. A 'cursor' like system is used to allow this - function to be called multiple times to get successive entries */ - pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool SrcOnly) -@@ -92,6 +92,8 @@ pkgSrcRecords::Parser *pkgSrcRecords::Fi - - while (true) - { -+ // DEBUG: -+ //std::cerr << "start loop" << std::endl; - // Step to the next record, possibly switching files - while ((*Current)->Step() == false) - { -@@ -107,7 +109,7 @@ pkgSrcRecords::Parser *pkgSrcRecords::Fi - return 0; - - // Source name hit -- if ((*Current)->Package() == Package) -+ if ((*Current)->FileName() == Package) - return *Current; - - -diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/srcrecords.h apt-0.5.15cnc5/apt-pkg/srcrecords.h ---- apt-0.5.15cnc5.orig/apt-pkg/srcrecords.h 2003-12-23 23:20:10 +0300 -+++ apt-0.5.15cnc5/apt-pkg/srcrecords.h 2004-01-16 15:18:13 +0300 -@@ -66,6 +66,8 @@ class pkgSrcRecords - virtual unsigned long Offset() = 0; - virtual string AsStr() = 0; - -+ virtual string FileName() const = 0; -+ - virtual string Package() const = 0; - virtual string Version() const = 0; - virtual string Maintainer() const = 0; diff --git a/apt/apt-pkg/deb/debsrcrecords.h b/apt/apt-pkg/deb/debsrcrecords.h index 18a9339..89cb18b 100644 --- a/apt/apt-pkg/deb/debsrcrecords.h +++ b/apt/apt-pkg/deb/debsrcrecords.h @@ -34,6 +34,9 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);}; virtual bool Jump(unsigned long Off) {iOffset = Off; return Tags.Jump(Sect,Off);}; + // These refer to the archive file for the Version + virtual string FileName() const {return Sect.FindS("Filename");}; + virtual string Package() const {return Sect.FindS("Package");}; virtual string Version() const {return Sect.FindS("Version");}; virtual string Maintainer() const {return Sect.FindS("Maintainer");}; diff --git a/apt/apt-pkg/rpm/rpmrecords.cc b/apt/apt-pkg/rpm/rpmrecords.cc index 54b2c02..5763e60 100644 --- a/apt/apt-pkg/rpm/rpmrecords.cc +++ b/apt/apt-pkg/rpm/rpmrecords.cc @@ -199,7 +199,12 @@ string rpmRecordParser::SourcePkg() { // This must be the *package* name, not the *file* name. We have no // current way to extract it safely from the file name. - return ""; + char *str; + int_32 count, type; + assert(HeaderP != NULL); + int rc = headerGetEntry(HeaderP, RPMTAG_SOURCERPM, + &type, (void**)&str, &count); + return string(rc?str:""); } /*}}}*/ diff --git a/apt/apt-pkg/rpm/rpmsrcrecords.cc b/apt/apt-pkg/rpm/rpmsrcrecords.cc index 7cdd6cd..9cb5006 100644 --- a/apt/apt-pkg/rpm/rpmsrcrecords.cc +++ b/apt/apt-pkg/rpm/rpmsrcrecords.cc @@ -123,6 +123,20 @@ bool rpmSrcRecordParser::Jump(unsigned long Off) return true; } +// RecordParser::FileName - Return the archive filename on the site /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string rpmSrcRecordParser::FileName() const +{ + char *str; + int_32 count, type; + assert(HeaderP != NULL); + int rc = headerGetEntry(HeaderP, CRPMTAG_FILENAME, + &type, (void**)&str, &count); + return string(rc?str:""); +} + /*}}}*/ + string rpmSrcRecordParser::Package() const { char *str; diff --git a/apt/apt-pkg/rpm/rpmsrcrecords.h b/apt/apt-pkg/rpm/rpmsrcrecords.h index 41505ae..2b1cd04 100644 --- a/apt/apt-pkg/rpm/rpmsrcrecords.h +++ b/apt/apt-pkg/rpm/rpmsrcrecords.h @@ -44,6 +44,8 @@ public: virtual bool Step(); virtual bool Jump(unsigned long Off); + virtual string FileName() const; + virtual string Package() const; virtual string Version() const; virtual string Maintainer() const; diff --git a/apt/apt-pkg/srcrecords.cc b/apt/apt-pkg/srcrecords.cc index e0901e3..fa8d996 100644 --- a/apt/apt-pkg/srcrecords.cc +++ b/apt/apt-pkg/srcrecords.cc @@ -82,7 +82,7 @@ bool pkgSrcRecords::Restart() /*}}}*/ // SrcRecords::Find - Find the first source package with the given name /*{{{*/ // --------------------------------------------------------------------- -/* This searches on both source package names and output binary names and +/* This searches on both source package filenames and output binary names and returns the first found. A 'cursor' like system is used to allow this function to be called multiple times to get successive entries */ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool SrcOnly) @@ -92,6 +92,8 @@ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool SrcOnly) while (true) { + // DEBUG: + //std::cerr << "start loop" << std::endl; // Step to the next record, possibly switching files while ((*Current)->Step() == false) { @@ -107,7 +109,7 @@ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool SrcOnly) return 0; // Source name hit - if ((*Current)->Package() == Package) + if ((*Current)->FileName() == Package) return *Current; diff --git a/apt/apt-pkg/srcrecords.h b/apt/apt-pkg/srcrecords.h index 8bc013f..bb8880e 100644 --- a/apt/apt-pkg/srcrecords.h +++ b/apt/apt-pkg/srcrecords.h @@ -66,6 +66,8 @@ class pkgSrcRecords virtual unsigned long Offset() = 0; virtual string AsStr() = 0; + virtual string FileName() const = 0; + virtual string Package() const = 0; virtual string Version() const = 0; virtual string Maintainer() const = 0;