reassign 153661 apt tag 153661 + patch thanks The fact that apt doesn't support pinning by codename is a missing feature in apt, as the field is available in the Release file. I've created a patch that adds pinning by codename with n= It probably requires an ABI bump.
diff -urN apt-0.6.46.4/apt-pkg/cacheiterators.h apt-0.6.46.4.new/apt-pkg/cacheiterators.h --- apt-0.6.46.4/apt-pkg/cacheiterators.h 2006-12-04 06:37:34.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/cacheiterators.h 2007-01-03 02:58:56.914687712 -0800 @@ -291,6 +291,7 @@ inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;}; inline const char *Origin() const {return File->Origin == 0?0:Owner->StrP + File->Origin;}; inline const char *Label() const {return File->Label == 0?0:Owner->StrP + File->Label;}; + inline const char *Codename() const {return File->Codename == 0?0:Owner->StrP + File->Codename;}; inline const char *Site() const {return File->Site == 0?0:Owner->StrP + File->Site;}; inline const char *Architecture() const {return File->Architecture == 0?0:Owner->StrP + File->Architecture;}; inline const char *IndexType() const {return File->IndexType == 0?0:Owner->StrP + File->IndexType;}; diff -urN apt-0.6.46.4/apt-pkg/deb/deblistparser.cc apt-0.6.46.4.new/apt-pkg/deb/deblistparser.cc --- apt-0.6.46.4/apt-pkg/deb/deblistparser.cc 2006-12-04 06:37:35.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/deb/deblistparser.cc 2007-01-03 02:40:14.253495180 -0800 @@ -593,6 +593,8 @@ FileI->Label = WriteUniqString(Start,Stop - Start); if (Section.Find("Architecture",Start,Stop) == true) FileI->Architecture = WriteUniqString(Start,Stop - Start); + if (Section.Find("Codename",Start,Stop) == true) + FileI->Codename = WriteUniqString(Start,Stop - Start); if (Section.FindFlag("NotAutomatic",FileI->Flags, pkgCache::Flag::NotAutomatic) == false) diff -urN apt-0.6.46.4/apt-pkg/pkgcache.cc apt-0.6.46.4.new/apt-pkg/pkgcache.cc --- apt-0.6.46.4/apt-pkg/pkgcache.cc 2006-12-04 06:37:34.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/pkgcache.cc 2007-01-03 03:12:56.321924112 -0800 @@ -596,6 +596,8 @@ Res = Res + (Res.empty() == true?"l=":",l=") + Label(); if (Component() != 0) Res = Res + (Res.empty() == true?"c=":",c=") + Component(); + if (Codename() != 0) + Res = Res + (Res.empty() == true?"n=":",n=") + Codename(); return Res; } /*}}}*/ diff -urN apt-0.6.46.4/apt-pkg/pkgcache.h apt-0.6.46.4.new/apt-pkg/pkgcache.h --- apt-0.6.46.4/apt-pkg/pkgcache.h 2006-12-04 06:37:34.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/pkgcache.h 2007-01-03 02:43:10.072938954 -0800 @@ -212,6 +212,7 @@ map_ptrloc Version; // Stringtable map_ptrloc Origin; // Stringtable map_ptrloc Label; // Stringtable + map_ptrloc Codename; // Stringtable map_ptrloc Architecture; // Stringtable map_ptrloc Site; // Stringtable map_ptrloc IndexType; // Stringtable diff -urN apt-0.6.46.4/apt-pkg/versionmatch.cc apt-0.6.46.4.new/apt-pkg/versionmatch.cc --- apt-0.6.46.4/apt-pkg/versionmatch.cc 2006-12-04 06:37:34.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/versionmatch.cc 2007-01-03 03:26:38.200428031 -0800 @@ -101,6 +101,8 @@ RelLabel = Fragments[J]+2; else if (stringcasecmp(Fragments[J],Fragments[J]+2,"c=") == 0) RelComponent = Fragments[J]+2; + else if (stringcasecmp(Fragments[J],Fragments[J]+2,"n=") == 0) + RelCodename = Fragments[J]+2; } if (RelVerStr.end()[-1] == '*') @@ -178,7 +180,7 @@ if (RelVerStr.empty() == true && RelOrigin.empty() == true && RelArchive.empty() == true && RelLabel.empty() == true && - RelComponent.empty() == true) + RelComponent.empty() == true && RelCodename.empty() == true) return false; if (RelVerStr.empty() == false) @@ -203,6 +205,10 @@ if (File->Component == 0 || stringcasecmp(RelComponent,File.Component()) != 0) return false; + if (RelCodename.empty() == false) + if (File->Codename == 0 || + stringcasecmp(RelCodename,File.Codename()) != 0) + return false; return true; } diff -urN apt-0.6.46.4/apt-pkg/versionmatch.h apt-0.6.46.4.new/apt-pkg/versionmatch.h --- apt-0.6.46.4/apt-pkg/versionmatch.h 2006-12-04 06:37:34.000000000 -0800 +++ apt-0.6.46.4.new/apt-pkg/versionmatch.h 2007-01-03 02:46:26.902266151 -0800 @@ -20,6 +20,8 @@ Archive (a=) Label (l=) Component (c=) + Codename (n=) + If there are no equals signs in the string then it is scanned in short form - if it starts with a number it is Version otherwise it is an Archive. @@ -53,6 +55,7 @@ string RelArchive; string RelLabel; string RelComponent; + string RelCodename; bool MatchAll; // Origin Matching diff -urN apt-0.6.46.4/debian/changelog apt-0.6.46.4.new/debian/changelog --- apt-0.6.46.4/debian/changelog 2006-12-04 08:33:54.000000000 -0800 +++ apt-0.6.46.4.new/debian/changelog 2007-01-03 03:31:11.429887326 -0800 @@ -1,3 +1,9 @@ +apt (0.6.46.5) unstable; urgency=low + + * Add n= Release file match for the Codename: field (closes: #153661) + + -- Ryan Murray <rmurray@debian.org> Wed, 3 Jan 2007 03:30:47 -0800 + apt (0.6.46.4) unstable; urgency=high * ack NMU (closes: #401017)
Attachment:
signature.asc
Description: PGP signature