summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-03-30 14:45:38 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-03-30 14:45:38 +0200
commit33dd02e3a95141d4e16677048614c3171c4c4ffc (patch)
tree586db3bd355f2e1ee0f0b0c1e5ab4e8872795d44
parent3f42500d6b9eb318c46cacafdcfd6beb707ef9e9 (diff)
convert some tabs to spaces to respect the style guide
-rw-r--r--apt-pkg/deb/deblistparser.cc39
-rw-r--r--apt-pkg/pkgcachegen.cc169
2 files changed, 109 insertions, 99 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 947e060e3..0551a5f7c 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -36,8 +36,8 @@ static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Impor
we would accept in general with checkArchitecture() */
debListParser::debListParser(FileFd *File, string const &Arch) : Tags(File),
Arch(Arch) {
- if (Arch == "native")
- this->Arch = _config->Find("APT::Architecture");
+ if (Arch == "native")
+ this->Arch = _config->Find("APT::Architecture");
}
/*}}}*/
// ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
@@ -56,10 +56,10 @@ unsigned long debListParser::UniqFindTagWrite(const char *Tag)
// ---------------------------------------------------------------------
/* This is to return the name of the package this section describes */
string debListParser::Package() {
- string const Result = Section.FindS("Package");
- if(unlikely(Result.empty() == true))
- _error->Error("Encountered a section with no Package: header");
- return Result;
+ string const Result = Section.FindS("Package");
+ if(unlikely(Result.empty() == true))
+ _error->Error("Encountered a section with no Package: header");
+ return Result;
}
/*}}}*/
// ListParser::Architecture - Return the package arch /*{{{*/
@@ -68,25 +68,26 @@ string debListParser::Package() {
Note that architecture "all" packages will get the architecture of the
Packages file parsed here. */
string debListParser::Architecture() {
- string const Result = Section.FindS("Architecture");
- if (Result.empty() == true || Result == "all") {
- if (Arch.empty() == true)
- /* FIXME: this is a problem for installed arch all
- packages as we don't know from which arch this
- package was installed - and therefore which
- dependency this package resolves. */
- return _config->Find("APT::Architecture");
- else
- return Arch;
- }
- return Result;
+ string const Result = Section.FindS("Architecture");
+ if (Result.empty() == true || Result == "all")
+ {
+ if (Arch.empty() == true)
+ /* FIXME: this is a problem for installed arch all
+ packages as we don't know from which arch this
+ package was installed - and therefore which
+ dependency this package resolves. */
+ return _config->Find("APT::Architecture");
+ else
+ return Arch;
+ }
+ return Result;
}
/*}}}*/
// ListParser::ArchitectureAll /*{{{*/
// ---------------------------------------------------------------------
/* */
bool debListParser::ArchitectureAll() {
- return Section.FindS("Architecture") == "all";
+ return Section.FindS("Architecture") == "all";
}
/*}}}*/
// ListParser::Version - Return the version string /*{{{*/
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 577e2f1d4..21240b951 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -335,29 +335,30 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
// CacheGenerator::NewGroup - Add a new group /*{{{*/
// ---------------------------------------------------------------------
/* This creates a new group structure and adds it to the hash table */
-bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name) {
- Grp = Cache.FindGrp(Name);
- if (Grp.end() == false)
- return true;
+bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name)
+{
+ Grp = Cache.FindGrp(Name);
+ if (Grp.end() == false)
+ return true;
- // Get a structure
- unsigned long const Group = Map.Allocate(sizeof(pkgCache::Group));
- if (unlikely(Group == 0))
- return false;
+ // Get a structure
+ unsigned long const Group = Map.Allocate(sizeof(pkgCache::Group));
+ if (unlikely(Group == 0))
+ return false;
- Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group);
- Grp->Name = Map.WriteString(Name);
- if (unlikely(Grp->Name == 0))
- return false;
+ Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group);
+ Grp->Name = Map.WriteString(Name);
+ if (unlikely(Grp->Name == 0))
+ return false;
- // Insert it into the hash table
- unsigned long const Hash = Cache.Hash(Name);
- Grp->Next = Cache.HeaderP->GrpHashTable[Hash];
- Cache.HeaderP->GrpHashTable[Hash] = Group;
+ // Insert it into the hash table
+ unsigned long const Hash = Cache.Hash(Name);
+ Grp->Next = Cache.HeaderP->GrpHashTable[Hash];
+ Cache.HeaderP->GrpHashTable[Hash] = Group;
- Cache.HeaderP->GroupCount++;
+ Cache.HeaderP->GroupCount++;
- return true;
+ return true;
}
/*}}}*/
// CacheGenerator::NewPackage - Add a new package /*{{{*/
@@ -526,68 +527,76 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
// CacheGenerator::FinishCache - do various finish operations /*{{{*/
// ---------------------------------------------------------------------
/* This prepares the Cache for delivery */
-bool pkgCacheGenerator::FinishCache(OpProgress &Progress) {
- // FIXME: add progress reporting for this operation
- // Do we have different architectures in your groups ?
- vector<string> archs = APT::Configuration::getArchitectures();
- if (archs.size() > 1) {
- // Create Conflicts in between the group
- for (pkgCache::GrpIterator G = GetCache().GrpBegin(); G.end() != true; G++) {
- string const PkgName = G.Name();
- for (pkgCache::PkgIterator P = G.PackageList(); P.end() != true; P = G.NextPkg(P)) {
- if (strcmp(P.Arch(),"all") == 0)
- continue;
- pkgCache::PkgIterator allPkg;
- for (pkgCache::VerIterator V = P.VersionList(); V.end() != true; V++) {
- string const Arch = V.Arch(true);
- map_ptrloc *OldDepLast = NULL;
- /* MultiArch handling introduces a lot of implicit Dependencies:
- - MultiArch: same → Co-Installable if they have the same version
- - Architecture: all → Need to be Co-Installable for internal reasons
- - All others conflict with all other group members */
- bool const coInstall = (V->MultiArch == pkgCache::Version::All ||
- V->MultiArch == pkgCache::Version::Same);
- if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true)
- allPkg = G.FindPkg("all");
- for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A) {
- if (*A == Arch)
- continue;
- /* We allow only one installed arch at the time
- per group, therefore each group member conflicts
- with all other group members */
- pkgCache::PkgIterator D = G.FindPkg(*A);
- if (D.end() == true)
- continue;
- if (coInstall == true) {
- // Replaces: ${self}:other ( << ${binary:Version})
- NewDepends(D, V, V.VerStr(),
- pkgCache::Dep::Less, pkgCache::Dep::Replaces,
- OldDepLast);
- // Breaks: ${self}:other (!= ${binary:Version})
- NewDepends(D, V, V.VerStr(),
- pkgCache::Dep::Less, pkgCache::Dep::DpkgBreaks,
- OldDepLast);
- NewDepends(D, V, V.VerStr(),
- pkgCache::Dep::Greater, pkgCache::Dep::DpkgBreaks,
- OldDepLast);
- if (V->MultiArch == pkgCache::Version::All) {
- // Depend on ${self}:all which does depend on nothing
- NewDepends(allPkg, V, V.VerStr(),
- pkgCache::Dep::Equals, pkgCache::Dep::Depends,
- OldDepLast);
- }
- } else {
- // Conflicts: ${self}:other
- NewDepends(D, V, "",
- pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
- OldDepLast);
- }
- }
- }
- }
- }
- }
- return true;
+bool pkgCacheGenerator::FinishCache(OpProgress &Progress)
+{
+ // FIXME: add progress reporting for this operation
+ // Do we have different architectures in your groups ?
+ vector<string> archs = APT::Configuration::getArchitectures();
+ if (archs.size() > 1)
+ {
+ // Create Conflicts in between the group
+ for (pkgCache::GrpIterator G = GetCache().GrpBegin(); G.end() != true; G++)
+ {
+ string const PkgName = G.Name();
+ for (pkgCache::PkgIterator P = G.PackageList(); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(),"all") == 0)
+ continue;
+ pkgCache::PkgIterator allPkg;
+ for (pkgCache::VerIterator V = P.VersionList(); V.end() != true; V++)
+ {
+ string const Arch = V.Arch(true);
+ map_ptrloc *OldDepLast = NULL;
+ /* MultiArch handling introduces a lot of implicit Dependencies:
+ - MultiArch: same → Co-Installable if they have the same version
+ - Architecture: all → Need to be Co-Installable for internal reasons
+ - All others conflict with all other group members */
+ bool const coInstall = (V->MultiArch == pkgCache::Version::All ||
+ V->MultiArch == pkgCache::Version::Same);
+ if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true)
+ allPkg = G.FindPkg("all");
+ for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
+ {
+ if (*A == Arch)
+ continue;
+ /* We allow only one installed arch at the time
+ per group, therefore each group member conflicts
+ with all other group members */
+ pkgCache::PkgIterator D = G.FindPkg(*A);
+ if (D.end() == true)
+ continue;
+ if (coInstall == true)
+ {
+ // Replaces: ${self}:other ( << ${binary:Version})
+ NewDepends(D, V, V.VerStr(),
+ pkgCache::Dep::Less, pkgCache::Dep::Replaces,
+ OldDepLast);
+ // Breaks: ${self}:other (!= ${binary:Version})
+ NewDepends(D, V, V.VerStr(),
+ pkgCache::Dep::Less, pkgCache::Dep::DpkgBreaks,
+ OldDepLast);
+ NewDepends(D, V, V.VerStr(),
+ pkgCache::Dep::Greater, pkgCache::Dep::DpkgBreaks,
+ OldDepLast);
+ if (V->MultiArch == pkgCache::Version::All)
+ {
+ // Depend on ${self}:all which does depend on nothing
+ NewDepends(allPkg, V, V.VerStr(),
+ pkgCache::Dep::Equals, pkgCache::Dep::Depends,
+ OldDepLast);
+ }
+ } else {
+ // Conflicts: ${self}:other
+ NewDepends(D, V, "",
+ pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+ OldDepLast);
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
}
/*}}}*/
// CacheGenerator::NewDepends - Create a dependency element /*{{{*/