diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-09-06 09:51:40 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-09-06 09:51:40 +0000 |
commit | 09af1a917c739e50e4e8590cc8402525b3f1f64d (patch) | |
tree | aae9b5e6b75920dd1c43afab0da590e4de11976e /ftparchive/writer.cc | |
parent | f8ad6f9b0dbcef95d3bbbe6481d3e10e9ed684d0 (diff) | |
parent | b8b1131a7d349db52a34a8cd6dd1872aebd50885 (diff) |
* merged with michael.vogt@ubuntu.com--2005/apt--mvo--0 to be in sync with debian
Patches applied:
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--base-0
tag of apt@packages.debian.org/apt--main--0--patch-79
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-1
* merged with mainline and apt--fixes--0
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-2
* patch from aj (slighly modified to use auto_ptr<>) applied
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-3
* changelog updated
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-4
* work for arch=all packages too now
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-5
* merged with apt--main--0
* michael.vogt@ubuntu.com--2005/apt--bts225947--0--patch-6
* fixed a incorrect po/he.po merge
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-7
* fixed incorrect man-page example
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-8
* changelog udpate
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-9
* we only need to check once for xmlto
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-10
* fix a bug in a man-page, fix a problem with overly long lines in apt-cdrom
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-11
* merged with apt--main--0
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-12
* fix a incorrect error message (it always added .gz regardless what was downloaded)
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-13
* merged with main
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-14
* added Hashsum support for file and cdrom
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-15
* added README.arch
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-16
* merged with main
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-17
* move the changelog to the right place
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-18
* Change pkgPolicy::Pin from private to protected
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-19
* added a default constructor for PrvIterator
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-20
* applied otavios patch to reread the statusFile on debSystem::Initialize
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-33
* merged with matt's tree
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-34
* merged with matts tree
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-35
* build debian and ubuntu package from the same source
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-36
* added debian/patches dir
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-37
* fix the breakage from my last commit (note to self: always, _always_ run baz diff before a commit)
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-38
* removed the lsb_release build patch (nobody except me seems to like it)
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-39
* merged from main
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-40
* merged the apt--sane-handle-timeout--0 branch
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-41
* merged apt--bts225947--0
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-42
* merged with apt--main
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-43
* added patch that adds a apt-secure man-page (thanks to jfs@computer.org)
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-44
* added author credits
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-45
* added apt-ftparchive.conf example
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-46
* corrected the utf8 of javier fernandes pena
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-47
* improve the timeout handling (again)
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-48
* merged with apt--fixes--0
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-49
* README.arch updates, comment in apt-pkg/algorithm.h added, apt-pkg/cacheiterators.h order in initlist changed to remove warning
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-50
* meda-change message is send over status-fd now
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-51
* include a human readable string for the MediaChange status-fd message as well
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-52
* finalizing changelog
* michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--base-0
tag of apt@packages.debian.org/apt--main--0--patch-87
* michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-1
* report timeouts (from Connect) and fail if they happen in pkgAcqMetaSig
* michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-2
* merged with the fixes branch to make it build again
* michael.vogt@ubuntu.com--2005/apt--sane-handle-timeout--0--patch-3
* merged with main
* otavio@debian.org--2005/apt--fixes--0--patch-28
Reread status configuration, needed for clients using independent apt ...
Diffstat (limited to 'ftparchive/writer.cc')
-rw-r--r-- | ftparchive/writer.cc | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc index 35a23a3d7..0b68d0bbf 100644 --- a/ftparchive/writer.cc +++ b/ftparchive/writer.cc @@ -36,7 +36,6 @@ #include "apt-ftparchive.h" #include "multicompress.h" /*}}}*/ - using namespace std; FTWScanner *FTWScanner::Owner; @@ -285,8 +284,9 @@ bool FTWScanner::Delink(string &FileName,const char *OriginalPath, // PackagesWriter::PackagesWriter - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -PackagesWriter::PackagesWriter(string DB,string Overrides,string ExtOverrides) : - Db(DB),Stats(Db.Stats) +PackagesWriter::PackagesWriter(string DB,string Overrides,string ExtOverrides, + string aArch) : + Db(DB),Stats(Db.Stats), Arch(aArch) { Output = stdout; SetExts(".deb .udeb .foo .bar .baz"); @@ -371,14 +371,22 @@ bool PackagesWriter::DoPackage(string FileName) // Lookup the overide information pkgTagSection &Tags = Db.Control.Section; string Package = Tags.FindS("Package"); - Override::Item Tmp; - Override::Item *OverItem = Over.GetItem(Package); + string Architecture; + // if we generate a Packages file for a given arch, we use it to + // look for overrides. if we run in "simple" mode without the + // "Architecures" variable in the config we use the architecure value + // from the deb file + if(Arch != "") + Architecture = Arch; + else + Architecture = Tags.FindS("Architecture"); + auto_ptr<Override::Item> OverItem(Over.GetItem(Package,Architecture)); if (Package.empty() == true) return _error->Error(_("Archive had no package field")); - + // If we need to do any rewriting of the header do it now.. - if (OverItem == 0) + if (OverItem.get() == 0) { if (NoOverride == false) { @@ -386,9 +394,9 @@ bool PackagesWriter::DoPackage(string FileName) ioprintf(c1out, _(" %s has no override entry\n"), Package.c_str()); } - OverItem = &Tmp; - Tmp.FieldOverride["Section"] = Tags.FindS("Section"); - Tmp.Priority = Tags.FindS("Priority"); + OverItem = auto_ptr<Override::Item>(new Override::Item); + OverItem->FieldOverride["Section"] = Tags.FindS("Section"); + OverItem->Priority = Tags.FindS("Priority"); } char Size[40]; @@ -557,7 +565,7 @@ bool SourcesWriter::DoPackage(string FileName) string BestPrio; string Bins = Tags.FindS("Binary"); char Buffer[Bins.length() + 1]; - Override::Item *OverItem = 0; + auto_ptr<Override::Item> OverItem(0); if (Bins.empty() == false) { strcpy(Buffer,Bins.c_str()); @@ -570,10 +578,10 @@ bool SourcesWriter::DoPackage(string FileName) unsigned char BestPrioV = pkgCache::State::Extra; for (unsigned I = 0; BinList[I] != 0; I++) { - Override::Item *Itm = BOver.GetItem(BinList[I]); - if (Itm == 0) + auto_ptr<Override::Item> Itm(BOver.GetItem(BinList[I])); + if (Itm.get() == 0) continue; - if (OverItem == 0) + if (OverItem.get() == 0) OverItem = Itm; unsigned char NewPrioV = debListParser::GetPrio(Itm->Priority); @@ -586,8 +594,7 @@ bool SourcesWriter::DoPackage(string FileName) } // If we need to do any rewriting of the header do it now.. - Override::Item Tmp; - if (OverItem == 0) + if (OverItem.get() == 0) { if (NoOverride == false) { @@ -595,15 +602,19 @@ bool SourcesWriter::DoPackage(string FileName) ioprintf(c1out, _(" %s has no override entry\n"), Tags.FindS("Source").c_str()); } - OverItem = &Tmp; + OverItem = auto_ptr<Override::Item>(new Override::Item); } - Override::Item *SOverItem = SOver.GetItem(Tags.FindS("Source")); - if (SOverItem == 0) + auto_ptr<Override::Item> SOverItem(SOver.GetItem(Tags.FindS("Source"))); + const auto_ptr<Override::Item> autoSOverItem(SOverItem); + if (SOverItem.get() == 0) { - SOverItem = BOver.GetItem(Tags.FindS("Source")); - if (SOverItem == 0) - SOverItem = OverItem; + SOverItem = auto_ptr<Override::Item>(BOver.GetItem(Tags.FindS("Source"))); + if (SOverItem.get() == 0) + { + SOverItem = auto_ptr<Override::Item>(new Override::Item); + *SOverItem = *OverItem; + } } // Add the dsc to the files hash list |