Author: jgg
Date: 1999-10-22 04:05:47 GMT
Regex, --all-versions and more OR stuff
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: algorithms.cc,v 1.25 1999/10/02 04:14:53 jgg Exp $
+// $Id: algorithms.cc,v 1.26 1999/10/22 04:05:47 jgg Exp $
/* ######################################################################
Algorithms - A set of misc algorithms
/* ######################################################################
Algorithms - A set of misc algorithms
if ((Flags[P->ID] & Protected) == Protected)
{
if (Debug == true)
if ((Flags[P->ID] & Protected) == Protected)
{
if (Debug == true)
- clog << " Reinet Failed because of protected " << P.Name() << endl;
+ clog << " Reinst Failed because of protected " << P.Name() << endl;
-
- // Upgrade the package if the candidate version will fix the problem.
- if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer)
- if (DoUpgrade(P) == false)
+ // Upgrade the package if the candidate version will fix the problem.
+ if ((Cache[Start] & pkgDepCache::DepCVer) == pkgDepCache::DepCVer)
+ {
+ if (DoUpgrade(P) == false)
+ {
+ if (Debug == true)
+ clog << " Reinst Failed because of " << P.Name() << endl;
+ Fail = true;
+ }
+ else
+ {
+ Fail = false;
+ break;
+ }
+ }
+ else
+ /* We let the algorithm deal with conflicts on its next iteration,
+ it is much smarter than us */
+ if (Start->Type == pkgCache::Dep::Conflicts)
+ continue;
+
- clog << " Reinst Failed because of " << P.Name() << endl;
+ clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
- else
- {
- /* We let the algorithm deal with conflicts on its next iteration,
- it is much smarter than us */
- if (Start->Type == pkgCache::Dep::Conflicts)
- continue;
-
- if (Debug == true)
- clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
- Fail = true;
- break;
- }
bool InOr = false;
pkgCache::DepIterator Start;
pkgCache::DepIterator End;
bool InOr = false;
pkgCache::DepIterator Start;
pkgCache::DepIterator End;
+ PackageKill *OldEnd;
+
+ enum {OrRemove,OrKeep} OrOp = OrRemove;
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
D.end() == false || InOr == true;)
{
// Compute a single dependency element (glob or)
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
D.end() == false || InOr == true;)
{
// Compute a single dependency element (glob or)
+ if (Start == End)
+ {
+ // Decide what to do
+ if (InOr == true)
+ {
+ if (OldEnd == LEnd && OrOp == OrRemove)
+ Cache.MarkDelete(I);
+ if (OldEnd == LEnd && OrOp == OrKeep)
+ Cache.MarkKeep(I);
+ }
+
+ OrOp = OrRemove;
+ InOr = Start != End;
+ OldEnd = LEnd;
+ }
// Dep is ok
if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
// Dep is ok
if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
-
- InOr = Start != End;
-
if (Debug == true)
clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
if (Debug == true)
clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
if a package has a dep on another package that cant be found */
pkgCache::Version **VList = Start.AllTargets();
if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
if a package has a dep on another package that cant be found */
pkgCache::Version **VList = Start.AllTargets();
if (*VList == 0 && (Flags[I->ID] & Protected) != Protected &&
- Start->Type != pkgCache::Dep::Conflicts &&
+ Start->Type != pkgCache::Dep::Conflicts &&
Cache[I].NowBroken() == false)
Cache[I].NowBroken() == false)
+ {
+ if (InOr == true)
+ {
+ /* No keep choice because the keep being OK could be the
+ result of another element in the OR group! */
+ continue;
+ }
+
}
/* See if a keep will do, unless the package is protected,
}
/* See if a keep will do, unless the package is protected,
- then installing it will be necessary */
+ then installing it will be necessary */
+ bool Installed = Cache[I].Install();
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
{
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
{
+ // Unwind operation will be keep now
+ if (OrOp == OrRemove)
+ OrOp = OrKeep;
+
+ // Restore
+ if (InOr == true && Installed == true)
+ Cache.MarkInstall(I,false);
+
if (Debug == true)
clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
}
if (Debug == true)
clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
}
- // Skip this if it is protected
+ // Skip adding to the kill list if it is protected
if ((Flags[Pkg->ID] & Protected) != 0)
continue;
if ((Flags[Pkg->ID] & Protected) != 0)
continue;
// Hm, nothing can possibly satisify this dep. Nuke it.
if (VList[0] == 0 && Start->Type != pkgCache::Dep::Conflicts &&
// Hm, nothing can possibly satisify this dep. Nuke it.
if (VList[0] == 0 && Start->Type != pkgCache::Dep::Conflicts &&
- (Flags[I->ID] & Protected) != Protected && InOr == false)
+ (Flags[I->ID] & Protected) != Protected)
+ bool Installed = Cache[I].Install();
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
{
Cache.MarkKeep(I);
if (Cache[I].InstBroken() == false)
{
+ // Unwind operation will be keep now
+ if (OrOp == OrRemove)
+ OrOp = OrKeep;
+
+ // Restore
+ if (InOr == true && Installed == true)
+ Cache.MarkInstall(I,false);
+
if (Debug == true)
clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
}
if (Debug == true)
clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
}
{
if (Debug == true)
clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
{
if (Debug == true)
clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
+ if (InOr == false)
+ Cache.MarkDelete(I);
}
Change = true;
Done = true;
}
}
Change = true;
Done = true;
}
// Try some more
if (InOr == true)
continue;
// Try some more
if (InOr == true)
continue;
if (Done == true)
break;
}
// Apply the kill list now
if (Cache[I].InstallVer != 0)
if (Done == true)
break;
}
// Apply the kill list now
if (Cache[I].InstallVer != 0)
for (PackageKill *J = KillList; J != LEnd; J++)
for (PackageKill *J = KillList; J != LEnd; J++)
- {
- Change = true;
- if ((Cache[J->Dep] & pkgDepCache::DepGNow) == 0)
- if (J->Dep->Type == pkgCache::Dep::Conflicts)
+ Change = true;
+ if ((Cache[J->Dep] & pkgDepCache::DepGNow) == 0)
+ {
+ if (J->Dep->Type == pkgCache::Dep::Conflicts)
+ {
+ if (Debug == true)
+ clog << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl;
+ Cache.MarkDelete(J->Pkg);
+ }
+ }
+ else
- clog << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl;
- Cache.MarkDelete(J->Pkg);
+ clog << " Fixing " << I.Name() << " via keep of " << J->Pkg.Name() << endl;
+ Cache.MarkKeep(J->Pkg);
- }
- else
- {
- if (Debug == true)
- clog << " Fixing " << I.Name() << " via keep of " << J->Pkg.Name() << endl;
- Cache.MarkKeep(J->Pkg);
- }
-
- if (Counter > 1)
- Scores[J->Pkg->ID] = Scores[I->ID];
- }
- }
+
+ if (Counter > 1)
+ Scores[J->Pkg->ID] = Scores[I->ID];
+ }
+ }
+ }
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cache.cc,v 1.40 1999/10/18 04:15:25 jgg Exp $
+// $Id: apt-cache.cc,v 1.41 1999/10/22 04:05:47 jgg Exp $
/* ######################################################################
apt-cache - Manages the cache files
/* ######################################################################
apt-cache - Manages the cache files
}
// Find the proper version to use. We should probably use the DepCache.
}
// Find the proper version to use. We should probably use the DepCache.
- pkgCache::VerIterator V = Cache.GetCandidateVer(Pkg);
- if (V.end() == true || V.FileList().end() == true)
- continue;
- if (DisplayRecord(V) == false)
- return false;
+ if (_config->FindB("APT::Cache::AllVersions","true") == true)
+ {
+ pkgCache::VerIterator V;
+ for (V = Pkg.VersionList(); V.end() == false; V++)
+ {
+ if (DisplayRecord(V) == false)
+ return false;
+ }
+ }
+ else
+ {
+ pkgCache::VerIterator V = Cache.GetCandidateVer(Pkg);
+ if (V.end() == true || V.FileList().end() == true)
+ continue;
+ if (DisplayRecord(V) == false)
+ return false;
+ }
{'i',"important","APT::Cache::Important",0},
{'f',"full","APT::Cache::ShowFull",0},
{'g',"no-generate","APT::Cache::NoGenerate",0},
{'i',"important","APT::Cache::Important",0},
{'f',"full","APT::Cache::ShowFull",0},
{'g',"no-generate","APT::Cache::NoGenerate",0},
+ {'a',"all-versions","APT::Cache::AllVersions",0},
{0,"names-only","APT::Cache::NamesOnly",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,"names-only","APT::Cache::NamesOnly",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-get.cc,v 1.81 1999/10/21 06:35:00 jgg Exp $
+// $Id: apt-get.cc,v 1.82 1999/10/22 04:05:47 jgg Exp $
/* ######################################################################
apt-get - Cover for dpkg
/* ######################################################################
apt-get - Cover for dpkg
// Print out each package and the failed dependencies
out <<" " << I.Name() << ":";
// Print out each package and the failed dependencies
out <<" " << I.Name() << ":";
- int Indent = strlen(I.Name()) + 3;
+ unsigned Indent = strlen(I.Name()) + 3;
bool First = true;
if (Cache[I].InstVerIter(Cache).end() == true)
{
bool First = true;
if (Cache[I].InstVerIter(Cache).end() == true)
{
if (Cache->IsImportantDep(End) == false ||
(Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
if (Cache->IsImportantDep(End) == false ||
(Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
continue;
-
- if (First == false)
- for (int J = 0; J != Indent; J++)
- out << ' ';
- First = false;
- out << ' ' << End.DepType() << ": " << End.TargetPkg().Name();
-
- // Show a quick summary of the version requirements
- if (End.TargetVer() != 0)
- out << " (" << End.CompType() << " " << End.TargetVer() <<
- ")";
-
- /* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = End.TargetPkg();
- if (Targ->ProvidesList == 0)
+ bool FirstOr = true;
+ while (1)
- out << " but ";
- pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
- if (Ver.end() == false)
- out << Ver.VerStr() << (Now?" is installed":" is to be installed");
+ if (First == false)
+ for (unsigned J = 0; J != Indent; J++)
+ out << ' ';
+ First = false;
+
+ if (FirstOr == false)
+ {
+ for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++)
+ out << ' ';
+ }
+ out << ' ' << End.DepType() << ": ";
+ FirstOr = false;
+
+ out << Start.TargetPkg().Name();
+
+ // Show a quick summary of the version requirements
+ if (Start.TargetVer() != 0)
+ out << " (" << Start.CompType() << " " << Start.TargetVer() <<
+ ")";
+
+ /* Show a summary of the target package if possible. In the case
+ of virtual packages we show nothing */
+ pkgCache::PkgIterator Targ = Start.TargetPkg();
+ if (Targ->ProvidesList == 0)
- if (Cache[Targ].CandidateVerIter(Cache).end() == true)
+ out << " but ";
+ pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
+ if (Ver.end() == false)
+ out << Ver.VerStr() << (Now?" is installed":" is to be installed");
+ else
- if (Targ->ProvidesList == 0)
- out << "it is not installable";
+ if (Cache[Targ].CandidateVerIter(Cache).end() == true)
+ {
+ if (Targ->ProvidesList == 0)
+ out << "it is not installable";
+ else
+ out << "it is a virtual package";
+ }
- out << "it is a virtual package";
- }
- else
- out << (Now?"it is not installed":"it is not going to be installed");
- }
- }
-
- out << endl;
+ out << (Now?"it is not installed":"it is not going to be installed");
+ }
+ }
+
+ if (Start != End)
+ cout << " or";
+ out << endl;
+
+ if (Start == End)
+ break;
+ Start++;
+ }
* apt-cache showsrc Closes: #45799
* De-Refs Single Pure virtual packages. Closes: #42437
* Regexs for install. Closes: #35304
* apt-cache showsrc Closes: #45799
* De-Refs Single Pure virtual packages. Closes: #42437
* Regexs for install. Closes: #35304
+ * Dependency reports now show OR group relations
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
-- Jason Gunthorpe <jgg@debian.org> Fri, 3 Sep 1999 09:04:28 -0700
dit(bf(-f --full))
Print full package records when searching. See bf(APT::Cache::ShowFull).
dit(bf(-f --full))
Print full package records when searching. See bf(APT::Cache::ShowFull).
+dit(bf(-a --all-versions))
+Print full records for all available versions, this is only applicable to the
+show command. See bf(APT::Cache::AllVersions)
+
dit(bf(-g --no-generate))
Do not perform automatic package cache regeneration, use the cache as it is.
See bf(APT::Cache::NoGenerate).
dit(bf(-g --no-generate))
Do not perform automatic package cache regeneration, use the cache as it is.
See bf(APT::Cache::NoGenerate).
If no package matches the given expression and the expression contains one
of '.', '?' or '*' then it is assumed to be a POSIX regex and it is applied
to all package names in the database. Any matches are then installed (or
If no package matches the given expression and the expression contains one
of '.', '?' or '*' then it is assumed to be a POSIX regex and it is applied
to all package names in the database. Any matches are then installed (or
+removed). Note that matching is done by substring so 'lo*' matches 'how-lo'
+and 'lowest'. If this is undesired prefix with a '^' character.
dit(bf(remove))
bf(remove) is identical to bf(install) except that packages are removed
dit(bf(remove))
bf(remove) is identical to bf(install) except that packages are removed
-// $Id: apt.conf,v 1.38 1999/10/03 21:09:27 jgg Exp $
+// $Id: apt.conf,v 1.39 1999/10/22 04:05:48 jgg Exp $
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
/* This file is an index of all APT configuration directives. It should
NOT actually be used as a real config file, though it is a completely
+ valid file. Most of the options have sane default values, unless
+ you have specific needs you should NOT include arbitary items in a custom
+ configuration.
In some instances involving filenames it is possible to set the default
directory when the path is evaluated. This means you can use relative
In some instances involving filenames it is possible to set the default
directory when the path is evaluated. This means you can use relative
Cache
{
Important "false";
Cache
{
Important "false";
- // Probably don't want to set this one..
- Options {"--force-downgrade";}
+ // Probably don't want to use force-downgrade..
+ Options {"--force-overwrite";"--force-downgrade";}
// Auto re-mounting of a readonly /usr
Pre-Invoke {"mount -o remount,rw /usr";};
// Auto re-mounting of a readonly /usr
Pre-Invoke {"mount -o remount,rw /usr";};
/* Whatever you do, do not use this configuration file!! Take out ONLY
the portions you need */
/* Whatever you do, do not use this configuration file!! Take out ONLY
the portions you need */
-ThisIsNotAValidConfigFile
+This Is Not A Valid Config File