#include <apti18n.h>
#include <sys/types.h>
-#include <regex.h>
#include <cstdlib>
#include <algorithm>
#include <iostream>
{
VerIterator Ver(Sim);
- out << Pkg.Name();
+ out << Pkg.FullName(true);
if (Current == true)
{
bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 1;
cout << "Inst ";
Describe(Pkg,cout,true,true);
Sim.MarkInstall(Pkg,false);
-
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ pkgCache::GrpIterator iG = iPkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (iG.FindPkg(P.Arch())->CurrentVer == 0)
+ continue;
+ Flags[P->ID] = 1;
+ Sim.MarkInstall(P, false);
+ }
+ }
+
// Look for broken conflicts+predepends.
for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
{
{
if ((Sim[End] & pkgDepCache::DepGInstall) == 0)
{
- cout << " [" << I.Name() << " on " << Start.TargetPkg().Name() << ']';
+ cout << " [" << I.FullName(false) << " on " << Start.TargetPkg().FullName(false) << ']';
if (Start->Type == pkgCache::Dep::Conflicts)
- _error->Error("Fatal, conflicts violated %s",I.Name());
+ _error->Error("Fatal, conflicts violated %s",I.FullName(false).c_str());
}
}
}
bool pkgSimulate::Configure(PkgIterator iPkg)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 2;
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (Flags[P->ID] == 1)
+ Flags[P->ID] = 2;
+ }
+ }
+
// Sim.MarkInstall(Pkg,false);
if (Sim[Pkg].InstBroken() == true)
{
- cout << "Conf " << Pkg.Name() << " broken" << endl;
+ cout << "Conf " << Pkg.FullName(false) << " broken" << endl;
Sim.Update();
continue;
if (D->Type == pkgCache::Dep::Obsoletes)
- cout << " Obsoletes:" << D.TargetPkg().Name();
+ cout << " Obsoletes:" << D.TargetPkg().FullName(false);
else if (D->Type == pkgCache::Dep::Conflicts)
- cout << " Conflicts:" << D.TargetPkg().Name();
+ cout << " Conflicts:" << D.TargetPkg().FullName(false);
else if (D->Type == pkgCache::Dep::DpkgBreaks)
- cout << " Breaks:" << D.TargetPkg().Name();
+ cout << " Breaks:" << D.TargetPkg().FullName(false);
else
- cout << " Depends:" << D.TargetPkg().Name();
+ cout << " Depends:" << D.TargetPkg().FullName(false);
}
cout << endl;
- _error->Error("Conf Broken %s",Pkg.Name());
+ _error->Error("Conf Broken %s",Pkg.FullName(false).c_str());
}
else
{
bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge)
{
// Adapt the iterator
- PkgIterator Pkg = Sim.FindPkg(iPkg.Name());
+ PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
Flags[Pkg->ID] = 3;
Sim.MarkDelete(Pkg);
+
+ if (strcmp(Pkg.Arch(),"all") == 0)
+ {
+ pkgCache::GrpIterator G = Pkg.Group();
+ pkgCache::GrpIterator iG = iPkg.Group();
+ for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P))
+ {
+ if (strcmp(P.Arch(), "all") == 0)
+ continue;
+ if (iG.FindPkg(P.Arch())->CurrentVer == 0)
+ continue;
+ Flags[P->ID] = 3;
+ Sim.MarkDelete(P);
+ }
+ }
+
if (Purge == true)
cout << "Purg ";
else
if (Sim[I].InstBroken() == true)
{
if (Flags[I->ID] == 0)
- cout << I.Name() << ' ';
+ cout << I.FullName(false) << ' ';
/* else
cout << I.Name() << "! ";*/
}
Cache.MarkInstall(I, false, 0, false);
else
return _error->Error(_("The package %s needs to be reinstalled, "
- "but I can't find an archive for it."),I.Name());
+ "but I can't find an archive for it."),I.FullName(true).c_str());
}
continue;
default:
if (I->InstState != pkgCache::State::Ok)
return _error->Error("The package %s is not ok and I "
- "don't know how to fix it!",I.Name());
+ "don't know how to fix it!",I.FullName(false).c_str());
}
}
return true;
return true;
}
/*}}}*/
-
// ProblemResolver::pkgProblemResolver - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
unsigned long Size = Cache.Head().PackageCount;
memset(Scores,0,sizeof(*Scores)*Size);
+ // Important Required Standard Optional Extra
+ signed short PrioMap[] = {
+ 0,
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Important",3),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Required",2),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Standard",1),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Optional",-1),
+ (signed short) _config->FindI("pkgProblemResolver::Scores::Extra",-2)
+ };
+ signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
+ signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);
+ signed short PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1);
+ signed short PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1);
+ signed short AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000);
+ signed short AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000);
+
+ if (_config->FindB("Debug::pkgProblemResolver::ShowScores",false) == true)
+ clog << "Settings used to calculate pkgProblemResolver::Scores::" << endl
+ << " Important => " << PrioMap[1] << endl
+ << " Required => " << PrioMap[2] << endl
+ << " Standard => " << PrioMap[3] << endl
+ << " Optional => " << PrioMap[4] << endl
+ << " Extra => " << PrioMap[5] << endl
+ << " Essentials => " << PrioEssentials << endl
+ << " InstalledAndNotObsolete => " << PrioInstalledAndNotObsolete << endl
+ << " Depends => " << PrioDepends << endl
+ << " Recommends => " << PrioRecommends << endl
+ << " AddProtected => " << AddProtected << endl
+ << " AddEssential => " << AddEssential << endl;
+
// Generate the base scores for a package based on its properties
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
to allow an obsolete essential packages to be removed by
a conflicts on a powerfull normal package (ie libc6) */
if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
- Score += 100;
+ Score += PrioEssentials;
// We transform the priority
- // Important Required Standard Optional Extra
- signed short PrioMap[] = {0,3,2,1,-1,-2};
if (Cache[I].InstVerIter(Cache)->Priority <= 5)
Score += PrioMap[Cache[I].InstVerIter(Cache)->Priority];
if those are not obsolete
*/
if (I->CurrentVer != 0 && Cache[I].CandidateVer != 0 && Cache[I].CandidateVerIter(Cache).Downloadable())
- Score += 1;
+ Score += PrioInstalledAndNotObsolete;
}
// Now that we have the base scores we go and propogate dependencies
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; D++)
{
- if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
- Scores[D.TargetPkg()->ID]++;
+ if (D->Type == pkgCache::Dep::Depends ||
+ D->Type == pkgCache::Dep::PreDepends)
+ Scores[D.TargetPkg()->ID] += PrioDepends;
+ else if (D->Type == pkgCache::Dep::Recommends)
+ Scores[D.TargetPkg()->ID] += PrioRecommends;
}
}
{
// Only do it for the install version
if ((pkgCache::Version *)D.ParentVer() != Cache[D.ParentPkg()].InstallVer ||
- (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends))
+ (D->Type != pkgCache::Dep::Depends &&
+ D->Type != pkgCache::Dep::PreDepends &&
+ D->Type != pkgCache::Dep::Recommends))
continue;
Scores[I->ID] += abs(OldScores[D.ParentPkg()->ID]);
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
if ((Flags[I->ID] & Protected) != 0)
- Scores[I->ID] += 10000;
+ Scores[I->ID] += AddProtected;
if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
- Scores[I->ID] += 5000;
- }
+ Scores[I->ID] += AddEssential;
+ }
}
/*}}}*/
// ProblemResolver::DoUpgrade - Attempt to upgrade this package /*{{{*/
if ((Flags[P->ID] & Protected) == Protected)
{
if (Debug == true)
- clog << " Reinst Failed because of protected " << P.Name() << endl;
+ clog << " Reinst Failed because of protected " << P.FullName(false) << endl;
Fail = true;
}
else
if (DoUpgrade(P) == false)
{
if (Debug == true)
- clog << " Reinst Failed because of " << P.Name() << endl;
+ clog << " Reinst Failed because of " << P.FullName(false) << endl;
Fail = true;
}
else
break;
if (Debug == true)
- clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl;
+ clog << " Reinst Failed early because of " << Start.TargetPkg().FullName(false) << endl;
Fail = true;
}
}
}
if (Debug == true)
- clog << " Re-Instated " << Pkg.Name() << endl;
+ clog << " Re-Instated " << Pkg.FullName(false) << endl;
return true;
}
/*}}}*/
*PEnd++ = I;
This = this;
qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
-
-/* for (pkgCache::Package **K = PList; K != PEnd; K++)
- if (Scores[(*K)->ID] != 0)
- {
- pkgCache::PkgIterator Pkg(Cache,*K);
- clog << Scores[(*K)->ID] << ' ' << Pkg.Name() <<
- ' ' << (pkgCache::Version *)Pkg.CurrentVer() << ' ' <<
- Cache[Pkg].InstallVer << ' ' << Cache[Pkg].CandidateVer << endl;
- } */
+
+ if (_config->FindB("Debug::pkgProblemResolver::ShowScores",false) == true)
+ {
+ clog << "Show Scores" << endl;
+ for (pkgCache::Package **K = PList; K != PEnd; K++)
+ if (Scores[(*K)->ID] != 0)
+ {
+ pkgCache::PkgIterator Pkg(Cache,*K);
+ clog << Scores[(*K)->ID] << ' ' << Pkg << std::endl;
+ }
+ }
if (Debug == true)
clog << "Starting 2" << endl;
-
+
/* Now consider all broken packages. For each broken package we either
remove the package or fix it's problem. We do this once, it should
not be possible for a loop to form (that is a < b < c and fixing b by
changing a breaks c) */
bool Change = true;
+ bool const TryFixByInstall = _config->FindB("pkgProblemResolver::FixByInstall", true);
for (int Counter = 0; Counter != 10 && Change == true; Counter++)
{
Change = false;
(Flags[I->ID] & ReInstateTried) == 0)
{
if (Debug == true)
- clog << " Try to Re-Instate " << I.Name() << endl;
+ clog << " Try to Re-Instate (" << Counter << ") " << I.FullName(false) << endl;
unsigned long OldBreaks = Cache.BrokenCount();
pkgCache::Version *OldVer = Cache[I].InstallVer;
Flags[I->ID] &= ReInstateTried;
}
else
if (Debug == true)
- clog << "Re-Instated " << I.Name() << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl;
+ clog << "Re-Instated " << I.FullName(false) << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl;
}
if (Cache[I].InstallVer == 0 || Cache[I].InstBroken() == false)
continue;
if (Debug == true)
- clog << "Investigating " << I.Name() << endl;
+ clog << "Investigating (" << Counter << ") " << I << endl;
// Isolate the problem dependency
PackageKill KillList[100];
if (Start == End)
{
// Decide what to do
- if (InOr == true)
+ if (InOr == true && OldEnd == LEnd)
{
- if (OldEnd == LEnd && OrOp == OrRemove)
+ if (OrOp == OrRemove)
{
if ((Flags[I->ID] & Protected) != Protected)
{
if (Debug == true)
- clog << " Or group remove for " << I.Name() << endl;
+ clog << " Or group remove for " << I.FullName(false) << endl;
Cache.MarkDelete(I);
Change = true;
- }
- }
- if (OldEnd == LEnd && OrOp == OrKeep)
+ }
+ }
+ else if (OrOp == OrKeep)
{
if (Debug == true)
- clog << " Or group keep for " << I.Name() << endl;
+ clog << " Or group keep for " << I.FullName(false) << endl;
Cache.MarkKeep(I, false, false);
Change = true;
}
}
if (Debug == true)
- clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
+ clog << "Broken " << Start << endl;
/* Look across the version list. If there are no possible
targets then we keep the package and bail. This is necessary
pkgCache::VerIterator Ver(Cache,*V);
pkgCache::PkgIterator Pkg = Ver.ParentPkg();
+ /* This is a conflicts, and the version we are looking
+ at is not the currently selected version of the
+ package, which means it is not necessary to
+ remove/keep */
+ if (Cache[Pkg].InstallVer != Ver &&
+ (Start->Type == pkgCache::Dep::Conflicts ||
+ Start->Type == pkgCache::Dep::DpkgBreaks ||
+ Start->Type == pkgCache::Dep::Obsoletes))
+ {
+ if (Debug)
+ clog << " Conflicts//Breaks against version "
+ << Ver.VerStr() << " for " << Pkg.Name()
+ << " but that is not InstVer, ignoring"
+ << endl;
+ continue;
+ }
+
if (Debug == true)
- clog << " Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] <<
- " as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl;
+ clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] <<
+ " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl;
/* Try to fix the package under consideration rather than
fiddle with the VList package */
Cache.MarkInstall(I, false, 0, false);
if (Debug == true)
- clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
}
else
{
if (InOr == false)
{
if (Debug == true)
- clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+ clog << " Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
Cache.MarkDelete(I);
- if (Counter > 1)
- {
- if (Scores[Pkg->ID] > Scores[I->ID])
- Scores[I->ID] = Scores[Pkg->ID];
- }
- }
+ if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
+ Scores[I->ID] = Scores[Pkg->ID];
+ }
+ else if (TryFixByInstall == true &&
+ Start.TargetPkg()->CurrentVer == 0 &&
+ Cache[Start.TargetPkg()].Delete() == false &&
+ Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
+ {
+ /* Before removing or keeping the package with the broken dependency
+ try instead to install the first not previously installed package
+ solving this dependency. This helps every time a previous solver
+ is removed by the resolver because of a conflict or alike but it is
+ dangerous as it could trigger new breaks/conflicts… */
+ if (Debug == true)
+ clog << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl;
+ unsigned long const OldBroken = Cache.BrokenCount();
+ Cache.MarkInstall(Start.TargetPkg(), true, 1, false);
+ // FIXME: we should undo the complete MarkInstall process here
+ if (Cache[Start.TargetPkg()].InstBroken() == true || Cache.BrokenCount() > OldBroken)
+ Cache.MarkDelete(Start.TargetPkg(), false, 1, false);
+ }
}
}
}
else
{
- /* This is a conflicts, and the version we are looking
- at is not the currently selected version of the
- package, which means it is not necessary to
- remove/keep */
- if (Cache[Pkg].InstallVer != Ver &&
- (Start->Type == pkgCache::Dep::Conflicts ||
- Start->Type == pkgCache::Dep::Obsoletes))
- continue;
-
if (Start->Type == pkgCache::Dep::DpkgBreaks)
{
// first, try upgradring the package, if that
// does not help, the breaks goes onto the
// kill list
+ //
// FIXME: use DoUpgrade(Pkg) instead?
- if (Cache[End] & pkgDepCache::DepGCVer)
+ if (Cache[End] & pkgDepCache::DepGCVer)
{
if (Debug)
- clog << " Upgrading " << Pkg.Name() << " due to Breaks field in " << I.Name() << endl;
+ clog << " Upgrading " << Pkg.FullName(false) << " due to Breaks field in " << I.FullName(false) << endl;
Cache.MarkInstall(Pkg, false, 0, false);
continue;
}
continue;
if (Debug == true)
- clog << " Added " << Pkg.Name() << " to the remove list" << endl;
+ clog << " Added " << Pkg.FullName(false) << " to the remove list" << endl;
LEnd->Pkg = Pkg;
LEnd->Dep = End;
Cache.MarkInstall(I, false, 0, false);
if (Debug == true)
- clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
+ clog << " Holding Back " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl;
}
else
{
if (Debug == true)
- clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl;
+ clog << " Removing " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl;
if (InOr == false)
Cache.MarkDelete(I);
}
J->Dep->Type == pkgCache::Dep::Obsoletes)
{
if (Debug == true)
- clog << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl;
+ clog << " Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl;
Cache.MarkDelete(J->Pkg);
}
}
else
{
if (Debug == true)
- clog << " Fixing " << I.Name() << " via keep of " << J->Pkg.Name() << endl;
+ clog << " Fixing " << I.FullName(false) << " via keep of " << J->Pkg.FullName(false) << endl;
Cache.MarkKeep(J->Pkg, false, false);
}
return _error->Error(_("Unable to correct problems, you have held broken packages."));
}
- // set the auto-flags (mvo: I'm not sure if we _really_ need this, but
- // I didn't managed
+ // set the auto-flags (mvo: I'm not sure if we _really_ need this)
pkgCache::PkgIterator I = Cache.PkgBegin();
for (;I.end() != true; I++) {
if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
if(_config->FindI("Debug::pkgAutoRemove",false)) {
- std::clog << "Resolve installed new pkg: " << I.Name()
+ std::clog << "Resolve installed new pkg: " << I.FullName(false)
<< " (now marking it as auto)" << std::endl;
}
Cache[I].Flags |= pkgCache::Flag::Auto;
unsigned long Size = Cache.Head().PackageCount;
- if (Debug == true)
- clog << "Entering ResolveByKeep" << endl;
-
MakeScores();
/* We have to order the packages so that the broken fixing pass
*PEnd++ = I;
This = this;
qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
-
+
+ if (_config->FindB("Debug::pkgProblemResolver::ShowScores",false) == true)
+ {
+ clog << "Show Scores" << endl;
+ for (pkgCache::Package **K = PList; K != PEnd; K++)
+ if (Scores[(*K)->ID] != 0)
+ {
+ pkgCache::PkgIterator Pkg(Cache,*K);
+ clog << Scores[(*K)->ID] << ' ' << Pkg << std::endl;
+ }
+ }
+
+ if (Debug == true)
+ clog << "Entering ResolveByKeep" << endl;
+
// Consider each broken package
pkgCache::Package **LastStop = 0;
for (pkgCache::Package **K = PList; K != PEnd; K++)
if ((Flags[I->ID] & Protected) == 0)
{
if (Debug == true)
- clog << "Keeping package " << I.Name() << endl;
+ clog << "Keeping package " << I.FullName(false) << endl;
Cache.MarkKeep(I, false, false);
if (Cache[I].InstBroken() == false)
{
while (true)
{
if (Debug == true)
- clog << "Package " << I.Name() << " has broken dep on " << Start.TargetPkg().Name() << endl;
-
+ clog << "Package " << I.FullName(false) << " " << Start << endl;
+
// Look at all the possible provides on this package
SPtrArray<pkgCache::Version *> VList = Start.AllTargets();
for (pkgCache::Version **V = VList; *V != 0; V++)
if ((Flags[I->ID] & Protected) == 0)
{
if (Debug == true)
- clog << " Keeping Package " << Pkg.Name() << " due to dep" << endl;
+ clog << " Keeping Package " << Pkg.FullName(false) << " due to " << Start.DepType() << endl;
Cache.MarkKeep(Pkg, false, false);
}
// Restart again.
if (K == LastStop)
- return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.Name());
+ return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false).c_str());
LastStop = K;
K = PList - 1;
}
}
}
/*}}}*/
-
// PrioSortList - Sort a list of versions by priority /*{{{*/
// ---------------------------------------------------------------------
/* This is ment to be used in conjunction with AllTargets to get a list
qsort(List,Count,sizeof(*List),PrioComp);
}
/*}}}*/
-
// CacheFile::ListUpdate - update the cache files /*{{{*/
// ---------------------------------------------------------------------
/* This is a simple wrapper to update the cache. it will fetch stuff
int PulseInterval)
{
pkgAcquire::RunResult res;
- pkgAcquire Fetcher(&Stat);
+ pkgAcquire Fetcher;
+ if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false)
+ return false;
// Populate it with the source selection
if (List.GetIndexes(&Fetcher) == false)
(*I)->Finished();
- // stripping username/password from URI if present
- string descUri = (*I)->DescURI();
- regex_t userPassRegex;
- regcomp(&userPassRegex, "\\://(\\w+)\\:(\\w+)@", REG_EXTENDED);
- regmatch_t userPassMatch;
- regexec(&userPassRegex, descUri.c_str(), 1, &userPassMatch, 0);
- if (userPassMatch.rm_so != -1) // regexp matched
- {
- // really stripping
- size_t stripStart = userPassMatch.rm_so + 3;
- size_t stripEnd = userPassMatch.rm_eo;
- descUri = descUri.substr(0, stripStart) +
- descUri.substr(stripEnd, string::npos);
- }
-
+ ::URI uri((*I)->DescURI());
+ uri.User.clear();
+ uri.Password.clear();
+ string descUri = string(uri);
_error->Warning(_("Failed to fetch %s %s\n"), descUri.c_str(),
(*I)->ErrorText.c_str());