From 1d52ce01e449db043e0c8343e838cb686ed6250e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Oct 2006 13:41:09 +0200 Subject: * merged i18n fixes from apt--mvo --- apt-pkg/deb/dpkgpm.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 93dff390d..f66962387 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -355,28 +355,28 @@ bool pkgDPkgPM::Go(int OutStatusFd) static const struct DpkgState DpkgStatesOpMap[][5] = { // Install operation { - {"half-installed", _("Preparing %s")}, - {"unpacked", _("Unpacking %s") }, + {"half-installed", N_("Preparing %s")}, + {"unpacked", N_("Unpacking %s") }, {NULL, NULL} }, // Configure operation { - {"unpacked",_("Preparing to configure %s") }, - {"half-configured", _("Configuring %s") }, - { "installed", _("Installed %s")}, + {"unpacked",N_("Preparing to configure %s") }, + {"half-configured", N_("Configuring %s") }, + { "installed", N_("Installed %s")}, {NULL, NULL} }, // Remove operation { - {"half-configured", _("Preparing for removal of %s")}, - {"half-installed", _("Removing %s")}, - {"config-files", _("Removed %s")}, + {"half-configured", N_("Preparing for removal of %s")}, + {"half-installed", N_("Removing %s")}, + {"config-files", N_("Removed %s")}, {NULL, NULL} }, // Purge operation { - {"config-files", _("Preparing to completely remove %s")}, - {"not-installed", _("Completely removed %s")}, + {"config-files", N_("Preparing to completely remove %s")}, + {"not-installed", N_("Completely removed %s")}, {NULL, NULL} }, }; @@ -672,7 +672,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) { // only read the translation if there is actually a next // action - const char *translation = states[PackageOpsDone[pkg]].str; + const char *translation = _(states[PackageOpsDone[pkg]].str); char s[200]; snprintf(s, sizeof(s), translation, pkg); -- cgit v1.2.3-70-g09d2 From 5e457a9336967e4851e094a84f9f94f4141ee393 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 5 Jun 2007 16:14:08 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - apport integration added, this means that a apport report is written on dpkg failures --- apt-pkg/deb/dpkgpm.cc | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++- apt-pkg/deb/dpkgpm.h | 4 +++ debian/changelog | 3 ++ 3 files changed, 103 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index cebdafe7d..5c069458e 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,8 @@ using namespace std; // DPkgPM::pkgDPkgPM - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) : pkgPackageManager(Cache) +pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) + : pkgPackageManager(Cache), pkgFailures(0) { } /*}}}*/ @@ -654,6 +656,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) line[0]=0; if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) std::clog << "send: '" << status.str() << "'" << endl; + pkgFailures++; + WriteApportReport(list[1], list[3]); continue; } if(strncmp(action,"conffile",strlen("conffile")) == 0) @@ -746,3 +750,94 @@ void pkgDPkgPM::Reset() List.erase(List.begin(),List.end()); } /*}}}*/ +// pkgDpkgPM::WriteApportReport - write out error report pkg failure /*{{{*/ +// --------------------------------------------------------------------- +/* */ +void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) +{ + string pkgname, reportfile, srcpkgname, pkgver, arch; + string::size_type pos; + FILE *report; + + if (_config->FindB("Dpkg::ApportFailureReport",true) == false) + return; + + // only report the first error if we are in StopOnError=false mode + // to prevent bogus reports + if((_config->FindB("Dpkg::StopOnError",true) == false) && pkgFailures > 1) + return; + + // get the pkgname and reportfile + pkgname = flNotDir(pkgpath); + pos = pkgname.rfind('_'); + if(pos != string::npos) + pkgname = string(pkgname, 0, pos); + + // find the package versin and source package name + pkgCache::PkgIterator Pkg = Cache.FindPkg(pkgname); + if (Pkg.end() == true) + return; + pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg); + pkgver = Ver.VerStr(); + if (Ver.end() == true) + return; + pkgRecords Recs(Cache); + pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList()); + srcpkgname = Parse.SourcePkg(); + if(srcpkgname.empty()) + srcpkgname = pkgname; + + // if the file exists already, we check: + // - if it was reported already (touched by apport). + // If not, we do nothing, otherwise + // we overwrite it. This is the same behaviour as apport + // - if we have a report with the same pkgversion already + // then we skip it + reportfile = flCombine("/var/crash",pkgname+".0.crash"); + if(FileExists(reportfile)) + { + struct stat buf; + char strbuf[255]; + + // check atime/mtime + stat(reportfile.c_str(), &buf); + if(buf.st_mtime > buf.st_atime) + return; + + // check if the existing report is the same version + report = fopen(reportfile.c_str(),"r"); + while(fgets(strbuf, sizeof(strbuf), report) != NULL) + { + if(strstr(strbuf,"Package:") == strbuf) + { + char pkgname[255], version[255]; + if(sscanf(strbuf, "Package: %s %s", pkgname, version) == 2) + if(strcmp(pkgver.c_str(), version) == 0) + { + fclose(report); + return; + } + } + } + fclose(report); + } + + // now write the report + arch = _config->Find("APT::Architecture"); + report = fopen(reportfile.c_str(),"w"); + if(report == NULL) + return; + if(_config->FindB("DPkgPM::InitialReportOnly",false) == true) + chmod(reportfile.c_str(), 0); + else + chmod(reportfile.c_str(), 0600); + fprintf(report, "ProblemType: Package\n"); + fprintf(report, "Architecture: %s\n", arch.c_str()); + time_t now = time(NULL); + fprintf(report, "Date: %s" , ctime(&now)); + fprintf(report, "Package: %s %s\n", pkgname.c_str(), pkgver.c_str()); + fprintf(report, "SourcePackage: %s\n", srcpkgname.c_str()); + fprintf(report, "ErrorMessage:\n %s\n", errormsg); + fclose(report); +} + /*}}}*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 0b181dc43..1a1fdc191 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -23,6 +23,7 @@ using std::vector; class pkgDPkgPM : public pkgPackageManager { protected: + int pkgFailures; // used for progress reporting struct DpkgState @@ -48,6 +49,9 @@ class pkgDPkgPM : public pkgPackageManager bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); + // apport integration + void WriteApportReport(const char *pkgpath, const char *errormsg); + // The Actuall installation implementation virtual bool Install(PkgIterator Pkg,string File); virtual bool Configure(PkgIterator Pkg); diff --git a/debian/changelog b/debian/changelog index e0a735e2f..32f2ac68a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,9 @@ apt (0.6.46.4ubuntu11) UNRELEASED; urgency=low * *.po: Unfuzzy after upstream typo corrections * apt-pkg/policy.cc: - allow multiple packages (thanks to David Foerster) + * apt-pkg/deb/dpkgpm.cc: + - apport integration added, this means that a apport + report is written on dpkg failures -- Michael Vogt Tue, 17 Apr 2007 15:53:37 +0200 -- cgit v1.2.3-70-g09d2 From b3aac1bb35d4f8e11ffc45462f450632de9a571f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 3 Aug 2007 15:01:18 +0200 Subject: * debian/changelog: updated credits * apt-pkg/deb/dpkgpm.cc: merged from dpkg-log branch --- apt-pkg/deb/dpkgpm.cc | 6 ++++-- debian/changelog | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index befd9124c..08c95b7a4 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -846,12 +846,14 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) { - fclose(term_out); + if(term_out) + fclose(term_out); return false; } } } - fclose(term_out); + if(term_out) + fclose(term_out); if (RunScripts("DPkg::Post-Invoke") == false) return false; diff --git a/debian/changelog b/debian/changelog index 02b637553..a2dafbaea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,10 +9,11 @@ apt (0.7.6ubuntu1) gutsy; urgency=low - only send LastModified if we actually have one - send range request with if-range - delete failed downloads + (thanks to Thom May for his help here) * apt-pkg/deb/dpkgpm.{cc,h}: - merged dpkg-log branch, this lets you specify a Dir::Log::Terminal file to log dpkg output to - (ABI break) + (ABI break) * merged apt--sha256 branch to fully support the new sha256 checksums in the Packages and Release files (ABI break) -- cgit v1.2.3-70-g09d2 From 8ecd1fedeace0e22f96259e250094006c673d065 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 3 Aug 2007 18:43:46 +0200 Subject: - when writting apport reports, attach the dpkg terminal log too --- apt-pkg/deb/dpkgpm.cc | 29 +++++++++++++++++++++++++---- apt-pkg/deb/dpkgpm.h | 5 +++-- debian/changelog | 2 ++ 3 files changed, 30 insertions(+), 6 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 08c95b7a4..6cb444ef1 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -44,7 +44,8 @@ using namespace std; // --------------------------------------------------------------------- /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) - : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), PackagesDone(0) + : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), + PackagesDone(0), term_out(NULL) { } /*}}}*/ @@ -351,7 +352,7 @@ void pkgDPkgPM::DoStdin(int master) /* * read the terminal pty and write log */ -void pkgDPkgPM::DoTerminalPty(int master, FILE *term_out) +void pkgDPkgPM::DoTerminalPty(int master) { char term_buf[1024] = {0,}; @@ -569,7 +570,6 @@ bool pkgDPkgPM::Go(int OutStatusFd) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); string logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); - FILE *term_out = NULL; if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); @@ -812,7 +812,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) continue; if(FD_ISSET(master, &rfds)) - DoTerminalPty(master, term_out); + DoTerminalPty(master); if(FD_ISSET(0, &rfds)) DoStdin(master); if(FD_ISSET(_dpkgin, &rfds)) @@ -956,6 +956,27 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) fprintf(report, "Package: %s %s\n", pkgname.c_str(), pkgver.c_str()); fprintf(report, "SourcePackage: %s\n", srcpkgname.c_str()); fprintf(report, "ErrorMessage:\n %s\n", errormsg); + + // ensure that the log is flushed + if(term_out) + fflush(term_out); + + // attach terminal log it if we have it + string logfile_name = _config->FindFile("Dir::Log::Terminal"); + if (!logfile_name.empty()) + { + FILE *log = NULL; + char buf[1024]; + + fprintf(report, "DpkgTerminalLog:\n"); + log = fopen(logfile_name.c_str(),"r"); + if(log != NULL) + { + while( fgets(buf, sizeof(buf), log) != NULL) + fprintf(report, " %s", buf); + fclose(log); + } + } fclose(report); } /*}}}*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index f8e9e44a8..222add98f 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -26,7 +26,8 @@ class pkgDPkgPM : public pkgPackageManager // the buffer we use for the dpkg status-fd reading char dpkgbuf[1024]; int dpkgbuf_pos; - + FILE *term_out; + protected: int pkgFailures; @@ -71,7 +72,7 @@ class pkgDPkgPM : public pkgPackageManager // input processing void DoStdin(int master); - void DoTerminalPty(int master, FILE *out); + void DoTerminalPty(int master); void DoDpkgStatusFd(int statusfd, int OutStatusFd); void ProcessDpkgStatusLine(int OutStatusFd, char *line); diff --git a/debian/changelog b/debian/changelog index a2dafbaea..1e9511875 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ apt (0.7.6ubuntu1) gutsy; urgency=low - merged dpkg-log branch, this lets you specify a Dir::Log::Terminal file to log dpkg output to (ABI break) + - when writting apport reports, attach the dpkg + terminal log too * merged apt--sha256 branch to fully support the new sha256 checksums in the Packages and Release files (ABI break) -- cgit v1.2.3-70-g09d2 From 25ffa4e814c5e8cceae339476787291d3ee584cf Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Aug 2007 16:48:55 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - fix packagename extraction when writting apport reports --- apt-pkg/deb/dpkgpm.cc | 4 ++-- debian/changelog | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a65f6eb0a..dad8da9ed 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -895,9 +895,9 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) // get the pkgname and reportfile pkgname = flNotDir(pkgpath); - pos = pkgname.rfind('_'); + pos = pkgname.find('_'); if(pos != string::npos) - pkgname = string(pkgname, 0, pos); + pkgname = pkgname.substr(0, pos); // find the package versin and source package name pkgCache::PkgIterator Pkg = Cache.FindPkg(pkgname); diff --git a/debian/changelog b/debian/changelog index fbee91ee2..8dbe214ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.6ubuntu3) gutsy; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - fix packagename extraction when writting apport reports + + -- + apt (0.7.6ubuntu2) gutsy; urgency=low * doc/examples/sources.list: -- cgit v1.2.3-70-g09d2 From fb7bf91ccc01c6fa16ea2eb2b714d5a1b808c1ea Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 16 Aug 2007 01:10:35 +0100 Subject: dpkg-triggers: deal properly with new package states; 0.7.6ubuntu6 --- apt-pkg/algorithms.cc | 2 ++ apt-pkg/deb/deblistparser.cc | 2 ++ apt-pkg/deb/dpkgpm.cc | 7 ++++++- apt-pkg/pkgcache.cc | 6 ++++-- apt-pkg/pkgcache.h | 3 ++- debian/changelog | 6 ++++++ doc/cache.sgml | 2 ++ 7 files changed, 24 insertions(+), 4 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index b21fcbb2f..62727a852 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -257,6 +257,8 @@ bool pkgApplyStatus(pkgDepCache &Cache) re-unpacked (probably) */ case pkgCache::State::UnPacked: case pkgCache::State::HalfConfigured: + case pkgCache::State::TriggersAwaited: + case pkgCache::State::TriggersPending: if ((I->CurrentVer != 0 && I.CurrentVer().Downloadable() == true) || I.State() != pkgCache::PkgIterator::NeedsUnpack) Cache.MarkKeep(I, false, false); diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 074abea6d..896d4d6d8 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -293,6 +293,8 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg, {"installed",pkgCache::State::Installed}, {"half-installed",pkgCache::State::HalfInstalled}, {"config-files",pkgCache::State::ConfigFiles}, + {"triggers-awaited",pkgCache::State::TriggersAwaited}, + {"triggers-pending",pkgCache::State::TriggersPending}, {"post-inst-failed",pkgCache::State::HalfConfigured}, {"removal-failed",pkgCache::State::HalfInstalled}, {}}; diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index dad8da9ed..c386e4b24 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -521,7 +521,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // map the dpkg states to the operations that are performed // (this is sorted in the same way as Item::Ops) - static const struct DpkgState DpkgStatesOpMap[][5] = { + static const struct DpkgState DpkgStatesOpMap[][7] = { // Install operation { {"half-installed", N_("Preparing %s")}, @@ -532,12 +532,17 @@ bool pkgDPkgPM::Go(int OutStatusFd) { {"unpacked",N_("Preparing to configure %s") }, {"half-configured", N_("Configuring %s") }, + {"triggers-awaited", N_("Processing triggers for %s") }, + {"triggers-pending", N_("Processing triggers for %s") }, + {"half-configured", N_("Configuring %s") }, { "installed", N_("Installed %s")}, {NULL, NULL} }, // Remove operation { {"half-configured", N_("Preparing for removal of %s")}, + {"triggers-awaited", N_("Preparing for removal of %s")}, + {"triggers-pending", N_("Preparing for removal of %s")}, {"half-installed", N_("Removing %s")}, {"config-files", N_("Removed %s")}, {NULL, NULL} diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 7e3b9d78c..133899a27 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -49,7 +49,7 @@ pkgCache::Header::Header() /* Whenever the structures change the major version should be bumped, whenever the generator changes the minor version should be bumped. */ - MajorVersion = 6; + MajorVersion = 7; MinorVersion = 0; Dirty = false; @@ -274,7 +274,9 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const return NeedsUnpack; if (Pkg->CurrentState == pkgCache::State::UnPacked || - Pkg->CurrentState == pkgCache::State::HalfConfigured) + Pkg->CurrentState == pkgCache::State::HalfConfigured || + Pkg->CurrentState == pkgCache::State::TriggersPending || + Pkg->CurrentState == pkgCache::State::TriggersAwaited) return NeedsConfigure; if (Pkg->CurrentState == pkgCache::State::HalfInstalled || diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 83b7548a3..59d5003bb 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -81,7 +81,8 @@ class pkgCache enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4}; enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3}; enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2, - HalfInstalled=4,ConfigFiles=5,Installed=6}; + HalfInstalled=4,ConfigFiles=5,Installed=6, + TriggersAwaited=7,TriggersPending=8}; }; struct Flag diff --git a/debian/changelog b/debian/changelog index 7b71c3608..e526bc756 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +apt (0.7.6ubuntu6) gutsy; urgency=low + + * dpkg-triggers: Deal properly with new package states. + + -- Ian Jackson Wed, 15 Aug 2007 20:44:37 +0100 + apt (0.7.6ubuntu5) UNRELEASED; urgency=low * apt-pkg/acquire-item.cc: diff --git a/doc/cache.sgml b/doc/cache.sgml index e257dcd81..aea5a45c3 100644 --- a/doc/cache.sgml +++ b/doc/cache.sgml @@ -721,6 +721,8 @@ or'd with the current package. #define pkgSTATE_HalfInstalled 4 #define pkgSTATE_ConfigFiles 5 #define pkgSTATE_Installed 6 +#define pkgSTATE_TriggersAwaited 7 +#define pkgSTATE_TriggersPending 8 -- cgit v1.2.3-70-g09d2 From 5d053270a275d1c825c793151f50bf3b680f55ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Sep 2007 15:10:55 +0200 Subject: * apt-pkg/deb/dpkgpm.{cc,h}: - fix bug in dpkg log writing when a signal is caught during select() (LP: #134858) - write end marker in the log as well --- apt-pkg/deb/dpkgpm.cc | 78 ++++++++++++++++++++++++++++++++++----------------- apt-pkg/deb/dpkgpm.h | 4 +++ debian/changelog | 9 ++++++ 3 files changed, 65 insertions(+), 26 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c386e4b24..90ae413f4 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -498,6 +498,46 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ +bool pkgDPkgPM::OpenLog() +{ + string logdir = _config->FindDir("Dir::Log"); + if(not FileExists(logdir)) + return _error->Error(_("Directory '%s' missing"), logdir.c_str()); + string logfile_name = flCombine(logdir, + _config->Find("Dir::Log::Terminal")); + if (!logfile_name.empty()) + { + term_out = fopen(logfile_name.c_str(),"a"); + chmod(logfile_name.c_str(), 0600); + // output current time + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "\nLog started: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + } + return true; +} + +bool pkgDPkgPM::CloseLog() +{ + if(term_out) + { + char outstr[200]; + time_t t = time(NULL); + struct tm *tmp = localtime(&t); + strftime(outstr, sizeof(outstr), "%F %T", tmp); + fprintf(term_out, "Log ended: "); + fprintf(term_out, outstr); + fprintf(term_out, "\n"); + fclose(term_out); + } + term_out = NULL; + return true; +} + // DPkgPM::Go - Run the sequence /*{{{*/ // --------------------------------------------------------------------- @@ -571,24 +611,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) } // create log - string logdir = _config->FindDir("Dir::Log"); - if(not FileExists(logdir)) - return _error->Error(_("Directory '%s' missing"), logdir.c_str()); - string logfile_name = flCombine(logdir, - _config->Find("Dir::Log::Terminal")); - if (!logfile_name.empty()) - { - term_out = fopen(logfile_name.c_str(),"a"); - chmod(logfile_name.c_str(), 0600); - // output current time - char outstr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); - strftime(outstr, sizeof(outstr), "%F %T", tmp); - fprintf(term_out, "\nLog started: "); - fprintf(term_out, outstr); - fprintf(term_out, "\n"); - } + OpenLog(); // this loop is runs once per operation for (vector::iterator I = List.begin(); I != List.end();) @@ -818,10 +841,15 @@ bool pkgDPkgPM::Go(int OutStatusFd) tv.tv_sec = 1; tv.tv_usec = 0; select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); - if (select_ret < 0) - std::cerr << "Error in select()" << std::endl; - else if (select_ret == 0) - continue; + if (select_ret == 0) + continue; + else if (select_ret < 0 && errno == EINTR) + continue; + else if (select_ret < 0) + { + perror("select() returned error"); + continue; + } if(master >= 0 && FD_ISSET(master, &rfds)) DoTerminalPty(master); @@ -859,14 +887,12 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) { - if(term_out) - fclose(term_out); + CloseLog(); return false; } } } - if(term_out) - fclose(term_out); + CloseLog(); if (RunScripts("DPkg::Post-Invoke") == false) return false; diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index debde36a3..e5f197405 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -70,6 +70,10 @@ class pkgDPkgPM : public pkgPackageManager // apport integration void WriteApportReport(const char *pkgpath, const char *errormsg); + // dpkg log + bool OpenLog(); + bool CloseLog(); + // input processing void DoStdin(int master); void DoTerminalPty(int master); diff --git a/debian/changelog b/debian/changelog index 304588fab..b0f414126 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +apt (0.7.6ubuntu8) gutsy; urgency=low + + * apt-pkg/deb/dpkgpm.{cc,h}: + - fix bug in dpkg log writing when a signal is caught during + select() (LP: #134858) + - write end marker in the log as well + + -- Michael Vogt Wed, 05 Sep 2007 15:03:46 +0200 + apt (0.7.6ubuntu7) gutsy; urgency=low * reupload to fix FTBFS -- cgit v1.2.3-70-g09d2 From a44aeb52f0476ed56feff82b1cfd2fa84e7a1223 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 10 Sep 2007 15:09:28 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - fix progress reporting precent calculation (LP: #137798) --- apt-pkg/deb/dpkgpm.cc | 5 ++++- debian/changelog | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 90ae413f4..8b4e6701a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -572,17 +572,20 @@ bool pkgDPkgPM::Go(int OutStatusFd) { {"unpacked",N_("Preparing to configure %s") }, {"half-configured", N_("Configuring %s") }, +#if 0 {"triggers-awaited", N_("Processing triggers for %s") }, {"triggers-pending", N_("Processing triggers for %s") }, - {"half-configured", N_("Configuring %s") }, +#endif { "installed", N_("Installed %s")}, {NULL, NULL} }, // Remove operation { {"half-configured", N_("Preparing for removal of %s")}, +#if 0 {"triggers-awaited", N_("Preparing for removal of %s")}, {"triggers-pending", N_("Preparing for removal of %s")}, +#endif {"half-installed", N_("Removing %s")}, {"config-files", N_("Removed %s")}, {NULL, NULL} diff --git a/debian/changelog b/debian/changelog index b0f414126..e34dc385b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.6ubuntu9) gutsy; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - fix progress reporting precent calculation (LP: #137798) + + -- Michael Vogt Mon, 10 Sep 2007 14:57:53 +0200 + apt (0.7.6ubuntu8) gutsy; urgency=low * apt-pkg/deb/dpkgpm.{cc,h}: -- cgit v1.2.3-70-g09d2 From a60beec6cffa558221d845a05db63bdfff101e5c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 3 Oct 2007 02:19:54 +0200 Subject: * apt-pkg/deb/debmetaindex.cc: comparison with string literal results in unspecified behaviour; --- apt-pkg/deb/debmetaindex.cc | 2 +- debian/changelog | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 94995798f..c700f8d58 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -224,7 +224,7 @@ class debSLTypeDebian : public pkgSourceList::Type // This check insures that there will be only one Release file // queued for all the Packages files and Sources files it // corresponds to. - if ((*I)->GetType() == "deb") + if (strcmp((*I)->GetType(), "deb") == 0) { debReleaseIndex *Deb = (debReleaseIndex *) (*I); // This check insures that there will be only one Release file diff --git a/debian/changelog b/debian/changelog index 3f1641ee2..87b9dd024 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,15 +1,17 @@ apt (0.7.6ubuntu12) gutsy; urgency=low + [ Michael Vogt ] * cmdline/apt-mark: - Fix chmoding after have renamed the extended-states file (LP: #140019) (thanks to Laurent Bigonville, LP: #140019) + * apt-pkg/deb/debmetaindex.cc: comparison with string literal results + in unspecified behaviour; [Paul Sladen] - * Have 'cron.daily/apt' send D-Bus doesn't exist error messages to the bit bucket. Thanks to 'dasdda'. (LP: #115397) - -- + -- Michael Vogt Wed, 03 Oct 2007 02:17:45 +0200 apt (0.7.6ubuntu11) gutsy; urgency=low -- cgit v1.2.3-70-g09d2 From 986d97bb0d62d7529a6a0328c39ddbd47be879a1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 4 Oct 2007 19:35:59 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - fix crash in WriteApportReport (LP: #144537) --- apt-pkg/deb/dpkgpm.cc | 2 +- debian/changelog | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index e1e26e903..466d3628b 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -938,9 +938,9 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) if (Pkg.end() == true) return; pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg); - pkgver = Ver.VerStr(); if (Ver.end() == true) return; + pkgver = Ver.VerStr() == NULL ? "unknown" : Ver.VerStr(); pkgRecords Recs(Cache); pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList()); srcpkgname = Parse.SourcePkg(); diff --git a/debian/changelog b/debian/changelog index 375a6bb1e..a7cc0a5dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.6ubuntu13) gutsy; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - fix crash in WriteApportReport (LP: #144537) + + -- + apt (0.7.6ubuntu12) gutsy; urgency=low [ Michael Vogt ] -- cgit v1.2.3-70-g09d2 From c771f6d9c30f94e37050af49e887f20767822dbb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 15 Oct 2007 21:08:06 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - fix resource leak (LP: #148806) --- apt-pkg/deb/dpkgpm.cc | 5 ++++- debian/changelog | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 466d3628b..ff0a3c443 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -867,8 +867,11 @@ bool pkgDPkgPM::Go(int OutStatusFd) signal(SIGQUIT,old_SIGQUIT); signal(SIGINT,old_SIGINT); - if(master >= 0 && slave >= 0) + if(master >= 0) + { tcsetattr(0, TCSAFLUSH, &tt); + close(master); + } // Check for an error code. if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0) diff --git a/debian/changelog b/debian/changelog index 066234451..ddcc6895d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,7 @@ apt (0.7.6ubuntu14) gutsy; urgency=low + * apt-pkg/deb/dpkgpm.cc: + - fix resource leak (LP: #148806) * debian/apt.cron.daily: - only run the cron job if apt-get check succeeds (LP: #131719) -- cgit v1.2.3-70-g09d2 From 1fc825bf7be1e9842a0560261d684264c565589e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 24 Oct 2007 15:08:08 +0200 Subject: * apt-pkg/deb/dpkgpm.{cc,h}: - give up timeslice on EIO error in read from master terminal * apt-pkg/deb/dpkgpm.{cc,h}: - rewrite dpkgpm.cc to use pselect() instead of select() to block signals during select() (LP: #134858) --- apt-pkg/deb/dpkgpm.cc | 22 ++++++++++++++++++---- configure.in | 2 +- debian/changelog | 10 +++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ff0a3c443..7a6b222f6 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -358,7 +358,15 @@ void pkgDPkgPM::DoTerminalPty(int master) char term_buf[1024] = {0,}; int len=read(master, term_buf, sizeof(term_buf)); - if(len <= 0) + if(len == -1 && errno == EIO) + { + // this happens when the child is about to exit, we + // give it time to actually exit, otherwise we run + // into a race + usleep(500000); + return; + } + if(len <= 0) return; write(1, term_buf, len); if(term_out) @@ -819,7 +827,12 @@ bool pkgDPkgPM::Go(int OutStatusFd) // setups fds fd_set rfds; - struct timeval tv; + struct timespec tv; + sigset_t sigmask; + sigset_t original_sigmask; + sigemptyset(&sigmask); + sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); + int select_ret; while ((res=waitpid(Child,&Status, WNOHANG)) != Child) { if(res < 0) { @@ -842,8 +855,9 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(master >= 0) FD_SET(master, &rfds); tv.tv_sec = 1; - tv.tv_usec = 0; - select_ret = select(max(master, _dpkgin)+1, &rfds, NULL, NULL, &tv); + tv.tv_nsec = 0; + select_ret = pselect(max(master, _dpkgin)+1, &rfds, NULL, NULL, + &tv, &original_sigmask); if (select_ret == 0) continue; else if (select_ret < 0 && errno == EINTR) diff --git a/configure.in b/configure.in index 8683773c8..e6757c7a6 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.7.6ubuntu14") +AC_DEFINE_UNQUOTED(VERSION,"0.7.6ubuntu14.1") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) diff --git a/debian/changelog b/debian/changelog index 1bf5b95af..572c93ee0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,17 @@ apt (0.7.6ubuntu14.1) gutsy-proposed; urgency=low + [ Michael Vogt ] + * apt-pkg/deb/dpkgpm.{cc,h}: + - give up timeslice on EIO error in read from master terminal * debian/apt.cron.daily: - only run the cron job if apt-get check succeeds (LP: #131719) + + [ Martin Emrich ] + * apt-pkg/deb/dpkgpm.{cc,h}: + - rewrite dpkgpm.cc to use pselect() instead of select() + to block signals during select() (LP: #134858) - -- Michael Vogt Mo, 15 Oct 2007 22:56:22 +0200 + -- Michael Vogt Sat, 20 Oct 2007 07:51:12 +0200 apt (0.7.6ubuntu14) gutsy; urgency=low -- cgit v1.2.3-70-g09d2 From 5273f1bf4da222c54e7abe9f3c6482496f8e09fd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 1 Feb 2008 15:46:07 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - add APT::Apport::MaxReports to limit the maximum number of reports generated in a single run (default to 3) --- apt-pkg/deb/dpkgpm.cc | 5 ++--- debian/changelog | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8123a7aba..5ed6482fa 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -906,9 +906,8 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) if (_config->FindB("Dpkg::ApportFailureReport",true) == false) return; - // only report the first error if we are in StopOnError=false mode - // to prevent bogus reports - if((_config->FindB("Dpkg::StopOnError",true) == false) && pkgFailures > 1) + // only report the first error + if(pkgFailures > _config->FindI("APT::Apport::MaxReports", 3)) return; // get the pkgname and reportfile diff --git a/debian/changelog b/debian/changelog index 5bd5222cc..12b3b5ddc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.9ubuntu6) hardy; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - add APT::Apport::MaxReports to limit the maximum number + of reports generated in a single run (default to 3) + + -- + apt (0.7.9ubuntu5) hardy; urgency=low * Merged apt-authentication-reliabilty branch. This means -- cgit v1.2.3-70-g09d2 From ff38d63b19c0be1fb4be9a692fed2702d935d5e5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 5 Aug 2008 10:09:42 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - fix uninitialized variable that caused no apport reports to be written sometimes (thanks to Matt Zimmerman) --- apt-pkg/deb/dpkgpm.cc | 8 +++++++- debian/changelog | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 74f672dd9..ede1673bc 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -47,7 +47,7 @@ using namespace std; /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) : pkgPackageManager(Cache), dpkgbuf_pos(0), - term_out(NULL), PackagesDone(0), PackagesTotal(0) + term_out(NULL), PackagesDone(0), PackagesTotal(0), pkgFailures(0) { } /*}}}*/ @@ -946,11 +946,17 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) FILE *report; if (_config->FindB("Dpkg::ApportFailureReport",true) == false) + { + std::clog << "configured to not write apport reports" << std::endl; return; + } // only report the first error if(pkgFailures > _config->FindI("APT::Apport::MaxReports", 3)) + { + std::clog << _("No apport report written because MaxReports is reached already") << std::endl; return; + } // get the pkgname and reportfile pkgname = flNotDir(pkgpath); diff --git a/debian/changelog b/debian/changelog index e21260ffb..fb5fc9f77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.14ubuntu4) intrepid; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - fix uninitialized variable that caused no apport reports + to be written sometimes (thanks to Matt Zimmerman) + + -- + apt (0.7.14ubuntu3) intrepid; urgency=low [ Otavio Salvador ] -- cgit v1.2.3-70-g09d2 From d6a4afcb1b937e07aaf186346f064833f65acfbd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 11 Aug 2008 18:21:37 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - improve the filtering for duplicated apport reports (thanks to seb128 for pointing that problem out) --- apt-pkg/deb/dpkgpm.cc | 17 ++++++++++++++++- debian/changelog | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index e1b3c6bc0..08291854f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -387,6 +387,14 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) if(strncmp(action,"error",strlen("error")) == 0) { + // urgs, sometime has ":" in its error string so that we + // end up with the error message split between list[3] + // and list[4], e.g. the message: + // failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb ... + // concat them again + if( list[4] != NULL) + list[4][-1] = ':'; + status << "pmerror:" << list[1] << ":" << (PackagesDone/float(PackagesTotal)*100.0) << ":" << list[3] @@ -954,13 +962,20 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) return; } - // only report the first error + // only report the first errors if(pkgFailures > _config->FindI("APT::Apport::MaxReports", 3)) { std::clog << _("No apport report written because MaxReports is reached already") << std::endl; return; } + // check if its not a follow up error + const char *needle = dgettext("dpkg", "dependency problems - leaving unconfigured"); + if(strstr(errormsg, needle) != NULL) { + std::clog << _("No apport report written because the error message indicates its a followup error from a previous failure.") << std::endl; + return; + } + // get the pkgname and reportfile pkgname = flNotDir(pkgpath); pos = pkgname.find('_'); diff --git a/debian/changelog b/debian/changelog index 5df4cc26b..e7a3ea9ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,9 @@ apt (0.7.14ubuntu6) UNRELEASED; urgency=low - support having CDs with no Packages file (just a Packages.gz) by not forcing a verification on non-existing files (LP: #255545) + * apt-pkg/deb/dpkgpm.cc: + - improve the filtering for duplicated apport reports (thanks + to seb128 for pointing that problem out) -- Michael Vogt Thu, 07 Aug 2008 16:28:05 +0200 -- cgit v1.2.3-70-g09d2 From 5279f566ec5bba9f5003440ecc575dc4d32b756b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 11 Aug 2008 19:40:57 +0200 Subject: support a ":" in the dpkg error output --- apt-pkg/deb/dpkgpm.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 08291854f..8c353a9d9 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -341,7 +341,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) 'processing: trigproc: trigger' */ - char* list[5]; + char* list[6]; // dpkg sends multiline error messages sometimes (see // #374195 for a example. we should support this by // either patching dpkg to not send multiline over the @@ -390,10 +390,10 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) // urgs, sometime has ":" in its error string so that we // end up with the error message split between list[3] // and list[4], e.g. the message: - // failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb ... + // "failed in buffer_write(fd) (10, ret=-1): backend dpkg-deb ..." // concat them again - if( list[4] != NULL) - list[4][-1] = ':'; + if( list[4] != NULL ) + list[3][strlen(list[3])] = ':'; status << "pmerror:" << list[1] << ":" << (PackagesDone/float(PackagesTotal)*100.0) -- cgit v1.2.3-70-g09d2 From 2f0d5deabcd1d75400d302bdbb330184d4fe97ba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 11 Aug 2008 19:44:23 +0200 Subject: do not report disk full errors from dpkg via apport --- apt-pkg/deb/dpkgpm.cc | 7 +++++++ debian/changelog | 1 + 2 files changed, 8 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8c353a9d9..2e9dedefa 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -976,6 +977,12 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) return; } + // do not report disk-full failures + if(strstr(errormsg, strerror(ENOSPC)) != NULL) { + std::clog << _("No apport report written because the error message indicates a disk full error") << std::endl; + return; + } + // get the pkgname and reportfile pkgname = flNotDir(pkgpath); pos = pkgname.find('_'); diff --git a/debian/changelog b/debian/changelog index e7a3ea9ad..7c5ef5b0e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ apt (0.7.14ubuntu6) UNRELEASED; urgency=low * apt-pkg/deb/dpkgpm.cc: - improve the filtering for duplicated apport reports (thanks to seb128 for pointing that problem out) + - do not report disk full errors from dpkg via apport -- Michael Vogt Thu, 07 Aug 2008 16:28:05 +0200 -- cgit v1.2.3-70-g09d2 From 07dd557b6fd80ce2df235f1697189b6a8f190ff4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 24 Nov 2008 10:44:46 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - fix potential hang when in a backgroud process group --- apt-pkg/deb/dpkgpm.cc | 16 ++++++++++++---- configure.in | 2 +- debian/changelog | 7 ++++--- 3 files changed, 17 insertions(+), 8 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2e9dedefa..a88e23081 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -563,6 +563,11 @@ static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds, */ bool pkgDPkgPM::Go(int OutStatusFd) { + fd_set rfds; + struct timespec tv; + sigset_t sigmask; + sigset_t original_sigmask; + unsigned int MaxArgs = _config->FindI("Dpkg::MaxArgs",8*1024); unsigned int MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes",32*1024); bool NoTriggers = _config->FindB("DPkg::NoTriggers",false); @@ -777,7 +782,14 @@ bool pkgDPkgPM::Go(int OutStatusFd) rtt = tt; cfmakeraw(&rtt); rtt.c_lflag &= ~ECHO; + // block SIGTTOU during tcsetattr to prevent a hang if + // the process is a member of the background process group + // http://www.opengroup.org/onlinepubs/000095399/functions/tcsetattr.html + sigemptyset(&sigmask); + sigaddset(&sigmask, SIGTTOU); + sigprocmask(SIG_BLOCK,&sigmask, &original_sigmask); tcsetattr(0, TCSAFLUSH, &rtt); + sigprocmask(SIG_SETMASK, &original_sigmask, 0); } // Fork dpkg @@ -844,10 +856,6 @@ bool pkgDPkgPM::Go(int OutStatusFd) close(slave); // setups fds - fd_set rfds; - struct timespec tv; - sigset_t sigmask; - sigset_t original_sigmask; sigemptyset(&sigmask); sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); diff --git a/configure.in b/configure.in index 679e601a3..aaaa44f43 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.7.14ubuntu6") +AC_DEFINE_UNQUOTED(VERSION,"0.7.14ubuntu7") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) diff --git a/debian/changelog b/debian/changelog index 0c7e07c9b..042603ae6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,12 @@ -apt (0.7.14ubuntu7) intrepid; urgency=low +apt (0.7.14ubuntu7) jaunty; urgency=low * cmdline/apt-cache.cc: - remove the gettext from a string that consists entirely of variables (LP: #56792) - * + * apt-pkg/deb/dpkgpm.cc: + - fix potential hang when in a backgroud process group - -- + -- Michael Vogt Tue, 28 Oct 2008 21:09:12 +0100 apt (0.7.14ubuntu6) intrepid; urgency=low -- cgit v1.2.3-70-g09d2 From 3024a85e0ce1b732338cdb23c86a2111a9846c38 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 26 Nov 2008 11:19:11 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - filter "ENOMEM" errors when creating apport reports --- apt-pkg/deb/dpkgpm.cc | 6 ++++++ debian/changelog | 7 +++++++ 2 files changed, 13 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ae99e4324..a54c20330 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1027,6 +1027,12 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) return; } + // do not report out-of-memory failures + if(strstr(errormsg, strerror(ENOMEM)) != NULL) { + std::clog << _("No apport report written because the error message indicates a out of memory error") << std::endl; + return; + } + // get the pkgname and reportfile pkgname = flNotDir(pkgpath); pos = pkgname.find('_'); diff --git a/debian/changelog b/debian/changelog index acc413bea..0a8771b92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.19ubuntu2) jaunty; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - filter "ENOMEM" errors when creating apport reports + + -- + apt (0.7.19ubuntu1) jaunty; urgency=low * merge from debian -- cgit v1.2.3-70-g09d2 From ed3524975b9e07d3555509294ba13b81bff3c187 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 26 Nov 2008 17:38:31 +0100 Subject: * /apt-pkg/deb/debsystem.cc: - add 'sudo' to the error message to "run 'dpkg --configure -a'" (LP: #52697) --- apt-pkg/deb/debsystem.cc | 2 +- debian/changelog | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 11a84f1c6..7fa98f29d 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -79,7 +79,7 @@ bool debSystem::Lock() close(LockFD); LockFD = -1; return _error->Error("dpkg was interrupted, you must manually " - "run 'dpkg --configure -a' to correct the problem. "); + "run 'sudo dpkg --configure -a' to correct the problem. "); } LockCount++; diff --git a/debian/changelog b/debian/changelog index 0a8771b92..384abf64e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ apt (0.7.19ubuntu2) jaunty; urgency=low + [ Michael Vogt ] * apt-pkg/deb/dpkgpm.cc: - filter "ENOMEM" errors when creating apport reports + [ Ian Weisser ] + * /apt-pkg/deb/debsystem.cc: + - add 'sudo' to the error message to "run 'dpkg --configure -a'" + (LP: #52697) + -- apt (0.7.19ubuntu1) jaunty; urgency=low -- cgit v1.2.3-70-g09d2 From 12ede3486283262ee8c50506cf96dd2b266d713c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 26 Nov 2008 19:50:49 +0100 Subject: make dpkg string translatable --- apt-pkg/deb/debsystem.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 7fa98f29d..f2340a4ad 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -78,8 +78,8 @@ bool debSystem::Lock() { close(LockFD); LockFD = -1; - return _error->Error("dpkg was interrupted, you must manually " - "run 'sudo dpkg --configure -a' to correct the problem. "); + return _error->Error(_("dpkg was interrupted, you must manually " + "run 'sudo dpkg --configure -a' to correct the problem. ")); } LockCount++; -- cgit v1.2.3-70-g09d2 From bb3ac2f648764e7ee2a8cdc7739d56de6311c88f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 8 Dec 2008 10:50:59 -0800 Subject: apt-pkg/deb/debsystem.cc: add missing apti18n.h header --- apt-pkg/deb/debsystem.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index f2340a4ad..e1aacdbdb 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3-70-g09d2 From 236527f0fffe30fc8988e17d926778c23ac1f902 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Jan 2009 17:39:37 +0100 Subject: LP: #263089 --- apt-pkg/deb/debsystem.cc | 10 +++++----- cmdline/apt-get.cc | 2 +- debian/changelog | 2 ++ methods/gpgv.cc | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index e1aacdbdb..ee2039c75 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -18,7 +18,7 @@ #include #include #include - + #include #include #include @@ -67,11 +67,11 @@ bool debSystem::Lock() if (LockFD == -1) { if (errno == EACCES || errno == EAGAIN) - return _error->Error("Unable to lock the administration directory (%s), " - "is another process using it?",AdminDir.c_str()); + return _error->Error(_("Unable to lock the administration directory (%s), " + "is another process using it?"),AdminDir.c_str()); else - return _error->Error("Unable to lock the administration directory (%s), " - "are you root?",AdminDir.c_str()); + return _error->Error(_("Unable to lock the administration directory (%s), " + "are you root?"),AdminDir.c_str()); } // See if we need to abort with a dirty journal diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index d5869da43..38775f70d 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1297,7 +1297,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, // show name mismatches if (IsMatch == true && Parse->Package() != Src) - ioprintf(c1out, _("No source package '%s' picking '%s' instead"), Parse->Package(), Src); + ioprintf(c1out, _("No source package '%s' picking '%s' instead"), Parse->Package().c_str(), Src.c_str()); if (VerTag.empty() == false) { diff --git a/debian/changelog b/debian/changelog index 2c4802e3b..478638a63 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,8 @@ apt (0.7.19ubuntu3) jaunty; urgency=low * debian/apt.conf.autoremove: - readd "linux-image" (and friends) to the auto-remove blacklist + * fix some i18n issues (thanks to Gabor Kelemen) + LP: #263089 [ Christian Perrier ] * Translations: diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 9f4683e6e..f3277b300 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -264,7 +264,7 @@ bool GPGVMethod::Fetch(FetchItem *Itm) // least one bad signature. good signatures and NoPubKey signatures // happen easily when a file is signed with multiple signatures if(GoodSigners.empty() or !BadSigners.empty()) - return _error->Error(errmsg.c_str()); + return _error->Error("%s", errmsg.c_str()); } // Just pass the raw output up, because passing it as a real data -- cgit v1.2.3-70-g09d2 From d043faa8dfcfa4c432558f3f1b4ec149e33f9d8e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Jan 2009 17:40:42 +0100 Subject: merged from the mvo branch --- apt-pkg/deb/debsystem.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index ee2039c75..186918d25 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -97,7 +97,7 @@ bool debSystem::UnLock(bool NoErrors) return false; if (LockCount < 1) - return _error->Error("Not locked"); + return _error->Error(_("Not locked")); if (--LockCount == 0) { close(LockFD); -- cgit v1.2.3-70-g09d2 From 494c293c524e66bdbed117954db9d0bff38c82b4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 6 Mar 2009 10:15:28 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - revert termios patch (LP: #338514) --- apt-pkg/deb/dpkgpm.cc | 4 +--- debian/changelog | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a54c20330..d8c38427f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -793,16 +793,14 @@ bool pkgDPkgPM::Go(int OutStatusFd) sighandler_t old_SIGHUP = signal(SIGHUP,SIG_IGN); struct termios tt; - struct termios tt_out; struct winsize win; int master; int slave; // FIXME: setup sensible signal handling (*ick*) tcgetattr(0, &tt); - tcgetattr(1, &tt_out); ioctl(0, TIOCGWINSZ, (char *)&win); - if (openpty(&master, &slave, NULL, &tt_out, &win) < 0) + if (openpty(&master, &slave, NULL, &tt, &win) < 0) { const char *s = _("Can not write log, openpty() " "failed (/dev/pts not mounted?)\n"); diff --git a/debian/changelog b/debian/changelog index 480b42bf0..b485c36aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.20.2ubuntu2) UNRELEASED; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - revert termios patch (LP: #338514) + + -- Michael Vogt Fri, 06 Mar 2009 10:15:15 +0100 + apt (0.7.20.2ubuntu1) jaunty; urgency=low [ Christian Perrier ] -- cgit v1.2.3-70-g09d2 From 76dbdfc7f02096758f63bcb6d306b54d5a2d0d02 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Apr 2009 19:53:19 +0200 Subject: * fix problematic use of tolower() when calculating the version hash by using locale independant tolower_ascii() function. Thanks to M. Vefa Bicakci (LP: #80248) * build fixes for g++-4.4 * include dmesg output in apport package failures --- apt-pkg/acquire.cc | 3 +- apt-pkg/contrib/sha256.h | 1 + apt-pkg/contrib/strutl.cc | 11 + apt-pkg/contrib/strutl.h | 1 + apt-pkg/deb/deblistparser.cc | 2 +- apt-pkg/deb/dpkgpm.cc | 17 + apt-pkg/pkgcache.cc | 4 +- debian/changelog | 10 + po/apt-all.pot | 388 ++++++++++++----- po/ar.po | 994 ++++++++++++++++++++++++------------------- 10 files changed, 885 insertions(+), 546 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 38944bbac..2e6bd3401 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -24,7 +24,8 @@ #include #include - +#include + #include #include #include diff --git a/apt-pkg/contrib/sha256.h b/apt-pkg/contrib/sha256.h index 1951f053b..5934b5641 100644 --- a/apt-pkg/contrib/sha256.h +++ b/apt-pkg/contrib/sha256.h @@ -17,6 +17,7 @@ #include #include #include +#include using std::string; using std::min; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index fe9082f63..3b7a67db0 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1074,6 +1074,17 @@ char *safe_snprintf(char *Buffer,char *End,const char *Format,...) } /*}}}*/ +// tolower_ascii - tolower() function that ignores the locale /*{{{*/ +// --------------------------------------------------------------------- +/* */ +int tolower_ascii(int c) +{ + if (c >= 'A' and c <= 'Z') + return c + 32; + return c; +} + /*}}}*/ + // CheckDomainList - See if Host is in a , seperate list /*{{{*/ // --------------------------------------------------------------------- /* The domain list is a comma seperate list of domains that are suffix diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index d9972abf4..51416a24a 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -62,6 +62,7 @@ void ioprintf(ostream &out,const char *format,...) APT_FORMAT2; void strprintf(string &out,const char *format,...) APT_FORMAT2; char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3; bool CheckDomainList(const string &Host, const string &List); +int tolower_ascii(int c); #define APT_MKSTRCMP(name,func) \ inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 896d4d6d8..55ba1f8c4 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -213,7 +213,7 @@ unsigned short debListParser::VersionHash() for (; Start != End; Start++) { if (isspace(*Start) == 0) - *I++ = tolower(*Start); + *I++ = tolower_ascii(*Start); if (*Start == '<' && Start[1] != '<' && Start[1] != '=') *I++ = '='; if (*Start == '>' && Start[1] != '>' && Start[1] != '=') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index d8c38427f..f57bff32c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1123,6 +1123,23 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) fclose(log); } } + + // attach dmesg log (to learn about segfaults) + if (FileExists("/bin/dmesg")) + { + FILE *log = NULL; + char buf[1024]; + + fprintf(report, "Dmesg:\n"); + log = popen("/bin/dmesg","r"); + if(log != NULL) + { + while( fgets(buf, sizeof(buf), log) != NULL) + fprintf(report, " %s", buf); + fclose(log); + } + } fclose(report); + } /*}}}*/ diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 4fbf42c4b..6687864ee 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -163,7 +163,7 @@ unsigned long pkgCache::sHash(const string &Str) const { unsigned long Hash = 0; for (string::const_iterator I = Str.begin(); I != Str.end(); I++) - Hash = 5*Hash + tolower(*I); + Hash = 5*Hash + tolower_ascii(*I); return Hash % _count(HeaderP->HashTable); } @@ -171,7 +171,7 @@ unsigned long pkgCache::sHash(const char *Str) const { unsigned long Hash = 0; for (const char *I = Str; *I != 0; I++) - Hash = 5*Hash + tolower(*I); + Hash = 5*Hash + tolower_ascii(*I); return Hash % _count(HeaderP->HashTable); } diff --git a/debian/changelog b/debian/changelog index 07e25051e..a62e13bad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +apt (0.7.20.2ubuntu7) karmic; urgency=low + + * fix problematic use of tolower() when calculating the version + hash by using locale independant tolower_ascii() function. + Thanks to M. Vefa Bicakci (LP: #80248) + * build fixes for g++-4.4 + * include dmesg output in apport package failures + + -- Michael Vogt Fri, 24 Apr 2009 10:14:01 +0200 + apt (0.7.20.2ubuntu6) jaunty; urgency=low [ Jamie Strandboge ] diff --git a/po/apt-all.pot b/po/apt-all.pot index 804c23b48..55f35cafa 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -252,6 +252,7 @@ msgid "" msgstr "" #: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:815 +#: apt-pkg/pkgcachegen.cc:827 #, c-format msgid "Unable to write to %s" msgstr "" @@ -718,7 +719,7 @@ msgid "Unable to lock the download directory" msgstr "" #: cmdline/apt-get.cc:816 cmdline/apt-get.cc:2076 cmdline/apt-get.cc:2312 -#: apt-pkg/cachefile.cc:63 +#: apt-pkg/cachefile.cc:63 apt-pkg/cachefile.cc:65 msgid "The list of sources could not be read." msgstr "" @@ -781,6 +782,7 @@ msgid "Do you want to continue [Y/n]? " msgstr "" #: cmdline/apt-get.cc:976 cmdline/apt-get.cc:1383 cmdline/apt-get.cc:2209 +#: apt-pkg/algorithms.cc:1348 #, c-format msgid "Failed to fetch %s %s\n" msgstr "" @@ -889,7 +891,8 @@ msgstr "" msgid "Unable to lock the list directory" msgstr "" -#: cmdline/apt-get.cc:1410 cmdline/apt-get.cc:1412 +#: cmdline/apt-get.cc:1410 cmdline/apt-get.cc:1412 apt-pkg/algorithms.cc:1374 +#: apt-pkg/algorithms.cc:1376 msgid "" "Some index files failed to download, they have been ignored, or old ones " "used instead." @@ -993,6 +996,7 @@ msgid "Calculating upgrade... " msgstr "" #: cmdline/apt-get.cc:1891 methods/ftp.cc:702 methods/connect.cc:101 +#: methods/connect.cc:111 msgid "Failed" msgstr "" @@ -1373,6 +1377,8 @@ msgstr "" #: apt-inst/extract.cc:467 apt-pkg/contrib/configuration.cc:753 #: apt-pkg/contrib/cdromutl.cc:150 apt-pkg/sourcelist.cc:320 #: apt-pkg/acquire.cc:418 apt-pkg/clean.cc:34 +#: apt-pkg/contrib/configuration.cc:821 apt-pkg/acquire.cc:419 +#: methods/mirror.cc:85 #, c-format msgid "Unable to read %s" msgstr "" @@ -1404,7 +1410,9 @@ msgstr "" #. Build the status cache #: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:748 #: apt-pkg/pkgcachegen.cc:817 apt-pkg/pkgcachegen.cc:822 -#: apt-pkg/pkgcachegen.cc:945 +#: apt-pkg/pkgcachegen.cc:945 apt-pkg/pkgcachegen.cc:760 +#: apt-pkg/pkgcachegen.cc:829 apt-pkg/pkgcachegen.cc:834 +#: apt-pkg/pkgcachegen.cc:957 msgid "Reading package lists" msgstr "" @@ -1598,6 +1606,7 @@ msgid "Server closed the connection" msgstr "" #: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:471 methods/rsh.cc:190 +#: apt-pkg/contrib/fileutl.cc:538 msgid "Read error" msgstr "" @@ -1610,6 +1619,7 @@ msgid "Protocol corruption" msgstr "" #: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:510 methods/rsh.cc:232 +#: apt-pkg/contrib/fileutl.cc:577 msgid "Write error" msgstr "" @@ -1664,6 +1674,7 @@ msgid "Unable to accept connection" msgstr "" #: methods/ftp.cc:864 methods/http.cc:959 methods/rsh.cc:303 +#: methods/http.cc:993 msgid "Problem hashing file" msgstr "" @@ -1690,78 +1701,78 @@ msgstr "" msgid "Unable to invoke " msgstr "" -#: methods/connect.cc:64 +#: methods/connect.cc:64 methods/connect.cc:71 #, c-format msgid "Connecting to %s (%s)" msgstr "" -#: methods/connect.cc:71 +#: methods/connect.cc:71 methods/connect.cc:82 #, c-format msgid "[IP: %s %s]" msgstr "" -#: methods/connect.cc:80 +#: methods/connect.cc:80 methods/connect.cc:89 #, c-format msgid "Could not create a socket for %s (f=%u t=%u p=%u)" msgstr "" -#: methods/connect.cc:86 +#: methods/connect.cc:86 methods/connect.cc:95 #, c-format msgid "Cannot initiate the connection to %s:%s (%s)." msgstr "" -#: methods/connect.cc:93 +#: methods/connect.cc:93 methods/connect.cc:103 #, c-format msgid "Could not connect to %s:%s (%s), connection timed out" msgstr "" -#: methods/connect.cc:108 +#: methods/connect.cc:108 methods/connect.cc:118 #, c-format msgid "Could not connect to %s:%s (%s)." msgstr "" #. We say this mainly because the pause here is for the #. ssh connection that is still going -#: methods/connect.cc:136 methods/rsh.cc:425 +#: methods/connect.cc:136 methods/rsh.cc:425 methods/connect.cc:146 #, c-format msgid "Connecting to %s" msgstr "" -#: methods/connect.cc:167 +#: methods/connect.cc:167 methods/connect.cc:164 methods/connect.cc:183 #, c-format msgid "Could not resolve '%s'" msgstr "" -#: methods/connect.cc:173 +#: methods/connect.cc:173 methods/connect.cc:189 #, c-format msgid "Temporary failure resolving '%s'" msgstr "" -#: methods/connect.cc:176 +#: methods/connect.cc:176 methods/connect.cc:192 #, c-format msgid "Something wicked happened resolving '%s:%s' (%i)" msgstr "" -#: methods/connect.cc:223 +#: methods/connect.cc:223 methods/connect.cc:239 #, c-format msgid "Unable to connect to %s %s:" msgstr "" -#: methods/gpgv.cc:65 +#: methods/gpgv.cc:65 methods/gpgv.cc:71 #, c-format msgid "Couldn't access keyring: '%s'" msgstr "" -#: methods/gpgv.cc:101 +#: methods/gpgv.cc:101 methods/gpgv.cc:107 msgid "E: Argument list from Acquire::gpgv::Options too long. Exiting." msgstr "" -#: methods/gpgv.cc:205 +#: methods/gpgv.cc:205 methods/gpgv.cc:223 msgid "" "Internal error: Good signature, but could not determine key fingerprint?!" msgstr "" -#: methods/gpgv.cc:210 +#: methods/gpgv.cc:210 methods/gpgv.cc:228 msgid "At least one invalid signature was encountered." msgstr "" @@ -1770,15 +1781,15 @@ msgstr "" msgid "Could not execute '%s' to verify signature (is gnupg installed?)" msgstr "" -#: methods/gpgv.cc:219 +#: methods/gpgv.cc:219 methods/gpgv.cc:237 msgid "Unknown error executing gpgv" msgstr "" -#: methods/gpgv.cc:250 +#: methods/gpgv.cc:250 methods/gpgv.cc:271 methods/gpgv.cc:278 msgid "The following signatures were invalid:\n" msgstr "" -#: methods/gpgv.cc:257 +#: methods/gpgv.cc:257 methods/gpgv.cc:285 msgid "" "The following signatures couldn't be verified because the public key is not " "available:\n" @@ -1794,76 +1805,78 @@ msgstr "" msgid "Read error from %s process" msgstr "" -#: methods/http.cc:377 +#: methods/http.cc:377 methods/http.cc:378 msgid "Waiting for headers" msgstr "" -#: methods/http.cc:523 +#: methods/http.cc:523 methods/http.cc:524 #, c-format msgid "Got a single header line over %u chars" msgstr "" -#: methods/http.cc:531 +#: methods/http.cc:531 methods/http.cc:532 msgid "Bad header line" msgstr "" -#: methods/http.cc:550 methods/http.cc:557 +#: methods/http.cc:550 methods/http.cc:557 methods/http.cc:551 +#: methods/http.cc:558 msgid "The HTTP server sent an invalid reply header" msgstr "" -#: methods/http.cc:586 +#: methods/http.cc:586 methods/http.cc:587 msgid "The HTTP server sent an invalid Content-Length header" msgstr "" -#: methods/http.cc:601 +#: methods/http.cc:601 methods/http.cc:602 msgid "The HTTP server sent an invalid Content-Range header" msgstr "" -#: methods/http.cc:603 +#: methods/http.cc:603 methods/http.cc:604 msgid "This HTTP server has broken range support" msgstr "" -#: methods/http.cc:627 +#: methods/http.cc:627 methods/http.cc:628 msgid "Unknown date format" msgstr "" -#: methods/http.cc:774 +#: methods/http.cc:774 methods/http.cc:781 msgid "Select failed" msgstr "" -#: methods/http.cc:779 +#: methods/http.cc:779 methods/http.cc:786 msgid "Connection timed out" msgstr "" -#: methods/http.cc:802 +#: methods/http.cc:802 methods/http.cc:809 msgid "Error writing to output file" msgstr "" -#: methods/http.cc:833 +#: methods/http.cc:833 methods/http.cc:840 msgid "Error writing to file" msgstr "" -#: methods/http.cc:861 +#: methods/http.cc:861 methods/http.cc:868 msgid "Error writing to the file" msgstr "" -#: methods/http.cc:875 +#: methods/http.cc:875 methods/http.cc:882 msgid "Error reading from server. Remote end closed connection" msgstr "" -#: methods/http.cc:877 +#: methods/http.cc:877 methods/http.cc:884 msgid "Error reading from server" msgstr "" -#: methods/http.cc:1104 +#: methods/http.cc:1104 methods/http.cc:1143 msgid "Bad header data" msgstr "" -#: methods/http.cc:1121 methods/http.cc:1176 +#: methods/http.cc:1121 methods/http.cc:1176 methods/http.cc:1160 +#: methods/http.cc:1215 msgid "Connection failed" msgstr "" -#: methods/http.cc:1228 +#: methods/http.cc:1228 methods/http.cc:1307 msgid "Internal error" msgstr "" @@ -1876,7 +1889,7 @@ msgstr "" msgid "Couldn't make mmap of %lu bytes" msgstr "" -#: apt-pkg/contrib/strutl.cc:978 +#: apt-pkg/contrib/strutl.cc:978 apt-pkg/contrib/strutl.cc:1018 #, c-format msgid "Selection %s not found" msgstr "" @@ -1896,42 +1909,43 @@ msgstr "" msgid "Line %d too long (max %u)" msgstr "" -#: apt-pkg/contrib/configuration.cc:611 +#: apt-pkg/contrib/configuration.cc:611 apt-pkg/contrib/configuration.cc:662 #, c-format msgid "Syntax error %s:%u: Block starts with no name." msgstr "" -#: apt-pkg/contrib/configuration.cc:630 +#: apt-pkg/contrib/configuration.cc:630 apt-pkg/contrib/configuration.cc:681 #, c-format msgid "Syntax error %s:%u: Malformed tag" msgstr "" -#: apt-pkg/contrib/configuration.cc:647 +#: apt-pkg/contrib/configuration.cc:647 apt-pkg/contrib/configuration.cc:698 #, c-format msgid "Syntax error %s:%u: Extra junk after value" msgstr "" -#: apt-pkg/contrib/configuration.cc:687 +#: apt-pkg/contrib/configuration.cc:687 apt-pkg/contrib/configuration.cc:738 #, c-format msgid "Syntax error %s:%u: Directives can only be done at the top level" msgstr "" -#: apt-pkg/contrib/configuration.cc:694 +#: apt-pkg/contrib/configuration.cc:694 apt-pkg/contrib/configuration.cc:745 #, c-format msgid "Syntax error %s:%u: Too many nested includes" msgstr "" #: apt-pkg/contrib/configuration.cc:698 apt-pkg/contrib/configuration.cc:703 +#: apt-pkg/contrib/configuration.cc:749 apt-pkg/contrib/configuration.cc:754 #, c-format msgid "Syntax error %s:%u: Included from here" msgstr "" -#: apt-pkg/contrib/configuration.cc:707 +#: apt-pkg/contrib/configuration.cc:707 apt-pkg/contrib/configuration.cc:758 #, c-format msgid "Syntax error %s:%u: Unsupported directive '%s'" msgstr "" -#: apt-pkg/contrib/configuration.cc:741 +#: apt-pkg/contrib/configuration.cc:741 apt-pkg/contrib/configuration.cc:809 #, c-format msgid "Syntax error %s:%u: Extra junk at end of file" msgstr "" @@ -1998,78 +2012,80 @@ msgid "Unable to stat the mount point %s" msgstr "" #: apt-pkg/contrib/cdromutl.cc:146 apt-pkg/acquire.cc:424 apt-pkg/clean.cc:40 +#: apt-pkg/contrib/cdromutl.cc:180 apt-pkg/acquire.cc:425 +#: apt-pkg/acquire.cc:450 methods/mirror.cc:91 #, c-format msgid "Unable to change to %s" msgstr "" -#: apt-pkg/contrib/cdromutl.cc:187 +#: apt-pkg/contrib/cdromutl.cc:187 apt-pkg/contrib/cdromutl.cc:188 msgid "Failed to stat the cdrom" msgstr "" -#: apt-pkg/contrib/fileutl.cc:82 +#: apt-pkg/contrib/fileutl.cc:82 apt-pkg/contrib/fileutl.cc:149 #, c-format msgid "Not using locking for read only lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:87 +#: apt-pkg/contrib/fileutl.cc:87 apt-pkg/contrib/fileutl.cc:154 #, c-format msgid "Could not open lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:105 +#: apt-pkg/contrib/fileutl.cc:105 apt-pkg/contrib/fileutl.cc:172 #, c-format msgid "Not using locking for nfs mounted lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:109 +#: apt-pkg/contrib/fileutl.cc:109 apt-pkg/contrib/fileutl.cc:176 #, c-format msgid "Could not get lock %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:377 +#: apt-pkg/contrib/fileutl.cc:377 apt-pkg/contrib/fileutl.cc:444 #, c-format msgid "Waited for %s but it wasn't there" msgstr "" -#: apt-pkg/contrib/fileutl.cc:387 +#: apt-pkg/contrib/fileutl.cc:387 apt-pkg/contrib/fileutl.cc:454 #, c-format msgid "Sub-process %s received a segmentation fault." msgstr "" -#: apt-pkg/contrib/fileutl.cc:390 +#: apt-pkg/contrib/fileutl.cc:390 apt-pkg/contrib/fileutl.cc:457 #, c-format msgid "Sub-process %s returned an error code (%u)" msgstr "" -#: apt-pkg/contrib/fileutl.cc:392 +#: apt-pkg/contrib/fileutl.cc:392 apt-pkg/contrib/fileutl.cc:459 #, c-format msgid "Sub-process %s exited unexpectedly" msgstr "" -#: apt-pkg/contrib/fileutl.cc:436 +#: apt-pkg/contrib/fileutl.cc:436 apt-pkg/contrib/fileutl.cc:503 #, c-format msgid "Could not open file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:492 +#: apt-pkg/contrib/fileutl.cc:492 apt-pkg/contrib/fileutl.cc:559 #, c-format msgid "read, still have %lu to read but none left" msgstr "" -#: apt-pkg/contrib/fileutl.cc:522 +#: apt-pkg/contrib/fileutl.cc:522 apt-pkg/contrib/fileutl.cc:589 #, c-format msgid "write, still have %lu to write but couldn't" msgstr "" -#: apt-pkg/contrib/fileutl.cc:597 +#: apt-pkg/contrib/fileutl.cc:597 apt-pkg/contrib/fileutl.cc:664 msgid "Problem closing the file" msgstr "" -#: apt-pkg/contrib/fileutl.cc:603 +#: apt-pkg/contrib/fileutl.cc:603 apt-pkg/contrib/fileutl.cc:670 msgid "Problem unlinking the file" msgstr "" -#: apt-pkg/contrib/fileutl.cc:614 +#: apt-pkg/contrib/fileutl.cc:614 apt-pkg/contrib/fileutl.cc:681 msgid "Problem syncing the file" msgstr "" @@ -2245,40 +2261,40 @@ msgstr "" msgid "Index file type '%s' is not supported" msgstr "" -#: apt-pkg/algorithms.cc:247 +#: apt-pkg/algorithms.cc:247 apt-pkg/algorithms.cc:248 #, c-format msgid "" "The package %s needs to be reinstalled, but I can't find an archive for it." msgstr "" -#: apt-pkg/algorithms.cc:1105 +#: apt-pkg/algorithms.cc:1105 apt-pkg/algorithms.cc:1107 msgid "" "Error, pkgProblemResolver::Resolve generated breaks, this may be caused by " "held packages." msgstr "" -#: apt-pkg/algorithms.cc:1107 +#: apt-pkg/algorithms.cc:1107 apt-pkg/algorithms.cc:1109 msgid "Unable to correct problems, you have held broken packages." msgstr "" -#: apt-pkg/acquire.cc:59 +#: apt-pkg/acquire.cc:59 apt-pkg/acquire.cc:60 #, c-format msgid "Lists directory %spartial is missing." msgstr "" -#: apt-pkg/acquire.cc:63 +#: apt-pkg/acquire.cc:63 apt-pkg/acquire.cc:64 #, c-format msgid "Archive directory %spartial is missing." msgstr "" #. only show the ETA if it makes sense #. two days -#: apt-pkg/acquire.cc:827 +#: apt-pkg/acquire.cc:827 apt-pkg/acquire.cc:829 #, c-format msgid "Retrieving file %li of %li (%s remaining)" msgstr "" -#: apt-pkg/acquire.cc:829 +#: apt-pkg/acquire.cc:829 apt-pkg/acquire.cc:831 #, c-format msgid "Retrieving file %li of %li" msgstr "" @@ -2293,17 +2309,17 @@ msgstr "" msgid "Method %s did not start correctly" msgstr "" -#: apt-pkg/acquire-worker.cc:398 +#: apt-pkg/acquire-worker.cc:398 apt-pkg/acquire-worker.cc:413 #, c-format msgid "Please insert the disc labeled: '%s' in the drive '%s' and press enter." msgstr "" -#: apt-pkg/init.cc:124 +#: apt-pkg/init.cc:124 apt-pkg/init.cc:125 #, c-format msgid "Packaging system '%s' is not supported" msgstr "" -#: apt-pkg/init.cc:140 +#: apt-pkg/init.cc:140 apt-pkg/init.cc:141 msgid "Unable to determine a suitable packaging system type" msgstr "" @@ -2316,11 +2332,11 @@ msgstr "" msgid "You must put some 'source' URIs in your sources.list" msgstr "" -#: apt-pkg/cachefile.cc:69 +#: apt-pkg/cachefile.cc:69 apt-pkg/cachefile.cc:71 msgid "The package lists or status file could not be parsed or opened." msgstr "" -#: apt-pkg/cachefile.cc:73 +#: apt-pkg/cachefile.cc:73 apt-pkg/cachefile.cc:75 msgid "You may want to run apt-get update to correct these problems" msgstr "" @@ -2351,123 +2367,125 @@ msgstr "" msgid "Error occurred while processing %s (UsePackage1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:153 +#: apt-pkg/pkgcachegen.cc:153 apt-pkg/pkgcachegen.cc:164 #, c-format msgid "Error occurred while processing %s (NewFileDesc1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:178 +#: apt-pkg/pkgcachegen.cc:178 apt-pkg/pkgcachegen.cc:189 #, c-format msgid "Error occurred while processing %s (UsePackage2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:182 +#: apt-pkg/pkgcachegen.cc:182 apt-pkg/pkgcachegen.cc:193 #, c-format msgid "Error occurred while processing %s (NewFileVer1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:213 +#: apt-pkg/pkgcachegen.cc:213 apt-pkg/pkgcachegen.cc:224 #, c-format msgid "Error occurred while processing %s (NewVersion1)" msgstr "" -#: apt-pkg/pkgcachegen.cc:217 +#: apt-pkg/pkgcachegen.cc:217 apt-pkg/pkgcachegen.cc:228 #, c-format msgid "Error occurred while processing %s (UsePackage3)" msgstr "" -#: apt-pkg/pkgcachegen.cc:221 +#: apt-pkg/pkgcachegen.cc:221 apt-pkg/pkgcachegen.cc:232 #, c-format msgid "Error occurred while processing %s (NewVersion2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:245 +#: apt-pkg/pkgcachegen.cc:245 apt-pkg/pkgcachegen.cc:256 #, c-format msgid "Error occurred while processing %s (NewFileDesc2)" msgstr "" -#: apt-pkg/pkgcachegen.cc:251 +#: apt-pkg/pkgcachegen.cc:251 apt-pkg/pkgcachegen.cc:262 msgid "Wow, you exceeded the number of package names this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:254 +#: apt-pkg/pkgcachegen.cc:254 apt-pkg/pkgcachegen.cc:265 msgid "Wow, you exceeded the number of versions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:257 +#: apt-pkg/pkgcachegen.cc:257 apt-pkg/pkgcachegen.cc:268 msgid "Wow, you exceeded the number of descriptions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:260 +#: apt-pkg/pkgcachegen.cc:260 apt-pkg/pkgcachegen.cc:271 msgid "Wow, you exceeded the number of dependencies this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:288 +#: apt-pkg/pkgcachegen.cc:288 apt-pkg/pkgcachegen.cc:299 #, c-format msgid "Error occurred while processing %s (FindPkg)" msgstr "" -#: apt-pkg/pkgcachegen.cc:301 +#: apt-pkg/pkgcachegen.cc:301 apt-pkg/pkgcachegen.cc:312 #, c-format msgid "Error occurred while processing %s (CollectFileProvides)" msgstr "" -#: apt-pkg/pkgcachegen.cc:307 +#: apt-pkg/pkgcachegen.cc:307 apt-pkg/pkgcachegen.cc:318 #, c-format msgid "Package %s %s was not found while processing file dependencies" msgstr "" -#: apt-pkg/pkgcachegen.cc:678 +#: apt-pkg/pkgcachegen.cc:678 apt-pkg/pkgcachegen.cc:690 #, c-format msgid "Couldn't stat source package list %s" msgstr "" -#: apt-pkg/pkgcachegen.cc:763 +#: apt-pkg/pkgcachegen.cc:763 apt-pkg/pkgcachegen.cc:775 msgid "Collecting File Provides" msgstr "" #: apt-pkg/pkgcachegen.cc:890 apt-pkg/pkgcachegen.cc:897 +#: apt-pkg/pkgcachegen.cc:902 apt-pkg/pkgcachegen.cc:909 msgid "IO Error saving source cache" msgstr "" -#: apt-pkg/acquire-item.cc:127 +#: apt-pkg/acquire-item.cc:127 apt-pkg/acquire-item.cc:134 #, c-format msgid "rename failed, %s (%s -> %s)." msgstr "" -#: apt-pkg/acquire-item.cc:401 +#: apt-pkg/acquire-item.cc:401 apt-pkg/acquire-item.cc:451 msgid "MD5Sum mismatch" msgstr "" #: apt-pkg/acquire-item.cc:647 apt-pkg/acquire-item.cc:1408 +#: apt-pkg/acquire-item.cc:707 apt-pkg/acquire-item.cc:1478 msgid "Hash Sum mismatch" msgstr "" -#: apt-pkg/acquire-item.cc:1100 +#: apt-pkg/acquire-item.cc:1100 apt-pkg/acquire-item.cc:1170 msgid "There is no public key available for the following key IDs:\n" msgstr "" -#: apt-pkg/acquire-item.cc:1213 +#: apt-pkg/acquire-item.cc:1213 apt-pkg/acquire-item.cc:1283 #, c-format msgid "" "I wasn't able to locate a file for the %s package. This might mean you need " "to manually fix this package. (due to missing arch)" msgstr "" -#: apt-pkg/acquire-item.cc:1272 +#: apt-pkg/acquire-item.cc:1272 apt-pkg/acquire-item.cc:1342 #, c-format msgid "" "I wasn't able to locate file for the %s package. This might mean you need to " "manually fix this package." msgstr "" -#: apt-pkg/acquire-item.cc:1313 +#: apt-pkg/acquire-item.cc:1313 apt-pkg/acquire-item.cc:1383 #, c-format msgid "" "The package index files are corrupted. No Filename: field for package %s." msgstr "" -#: apt-pkg/acquire-item.cc:1400 +#: apt-pkg/acquire-item.cc:1400 apt-pkg/acquire-item.cc:1470 msgid "Size mismatch" msgstr "" @@ -2553,88 +2571,92 @@ msgstr "" msgid "Source list entries for this disc are:\n" msgstr "" -#: apt-pkg/indexcopy.cc:263 apt-pkg/indexcopy.cc:823 +#: apt-pkg/indexcopy.cc:263 apt-pkg/indexcopy.cc:823 apt-pkg/indexcopy.cc:832 #, c-format msgid "Wrote %i records.\n" msgstr "" -#: apt-pkg/indexcopy.cc:265 apt-pkg/indexcopy.cc:825 +#: apt-pkg/indexcopy.cc:265 apt-pkg/indexcopy.cc:825 apt-pkg/indexcopy.cc:834 #, c-format msgid "Wrote %i records with %i missing files.\n" msgstr "" -#: apt-pkg/indexcopy.cc:268 apt-pkg/indexcopy.cc:828 +#: apt-pkg/indexcopy.cc:268 apt-pkg/indexcopy.cc:828 apt-pkg/indexcopy.cc:837 #, c-format msgid "Wrote %i records with %i mismatched files\n" msgstr "" -#: apt-pkg/indexcopy.cc:271 apt-pkg/indexcopy.cc:831 +#: apt-pkg/indexcopy.cc:271 apt-pkg/indexcopy.cc:831 apt-pkg/indexcopy.cc:840 #, c-format msgid "Wrote %i records with %i missing files and %i mismatched files\n" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:513 +#: apt-pkg/deb/dpkgpm.cc:513 apt-pkg/deb/dpkgpm.cc:532 #, c-format msgid "Directory '%s' missing" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:596 +#: apt-pkg/deb/dpkgpm.cc:596 apt-pkg/deb/dpkgpm.cc:621 #, c-format msgid "Preparing %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:597 +#: apt-pkg/deb/dpkgpm.cc:597 apt-pkg/deb/dpkgpm.cc:622 #, c-format msgid "Unpacking %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:602 +#: apt-pkg/deb/dpkgpm.cc:602 apt-pkg/deb/dpkgpm.cc:627 #, c-format msgid "Preparing to configure %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:603 +#: apt-pkg/deb/dpkgpm.cc:603 apt-pkg/deb/dpkgpm.cc:52 +#: apt-pkg/deb/dpkgpm.cc:628 #, c-format msgid "Configuring %s" msgstr "" #: apt-pkg/deb/dpkgpm.cc:605 apt-pkg/deb/dpkgpm.cc:606 +#: apt-pkg/deb/dpkgpm.cc:630 apt-pkg/deb/dpkgpm.cc:631 #, c-format msgid "Processing triggers for %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:608 +#: apt-pkg/deb/dpkgpm.cc:608 apt-pkg/deb/dpkgpm.cc:633 #, c-format msgid "Installed %s" msgstr "" #: apt-pkg/deb/dpkgpm.cc:613 apt-pkg/deb/dpkgpm.cc:615 -#: apt-pkg/deb/dpkgpm.cc:616 +#: apt-pkg/deb/dpkgpm.cc:616 apt-pkg/deb/dpkgpm.cc:638 +#: apt-pkg/deb/dpkgpm.cc:640 apt-pkg/deb/dpkgpm.cc:641 #, c-format msgid "Preparing for removal of %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:618 +#: apt-pkg/deb/dpkgpm.cc:618 apt-pkg/deb/dpkgpm.cc:53 +#: apt-pkg/deb/dpkgpm.cc:643 #, c-format msgid "Removing %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:619 +#: apt-pkg/deb/dpkgpm.cc:619 apt-pkg/deb/dpkgpm.cc:644 #, c-format msgid "Removed %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:624 +#: apt-pkg/deb/dpkgpm.cc:624 apt-pkg/deb/dpkgpm.cc:649 #, c-format msgid "Preparing to completely remove %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:625 +#: apt-pkg/deb/dpkgpm.cc:625 apt-pkg/deb/dpkgpm.cc:650 #, c-format msgid "Completely removed %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:775 +#: apt-pkg/deb/dpkgpm.cc:775 apt-pkg/deb/dpkgpm.cc:805 msgid "Can not write log, openpty() failed (/dev/pts not mounted?)\n" msgstr "" @@ -2645,3 +2667,143 @@ msgstr "" #: methods/rsh.cc:330 msgid "Connection closed prematurely" msgstr "" + +#: methods/gpgv.cc:232 +#, c-format +msgid "Could not execute '%s' to verify signature (is gpgv installed?)" +msgstr "" + +#: methods/http.cc:978 apt-pkg/contrib/mmap.cc:196 +msgid "Failed to truncate file" +msgstr "" + +#: apt-pkg/contrib/mmap.cc:213 apt-pkg/contrib/mmap.cc:276 +#, c-format +msgid "" +"Dynamic MMap ran out of room. Please increase the size of APT::Cache-Limit. " +"Current value: %lu. (man 5 apt.conf)" +msgstr "" + +#. d means days, h means hours, min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:335 +#, c-format +msgid "%lid %lih %limin %lis" +msgstr "" + +#. h means hours, min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:342 +#, c-format +msgid "%lih %limin %lis" +msgstr "" + +#. min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:349 +#, c-format +msgid "%limin %lis" +msgstr "" + +#. s means seconds +#: apt-pkg/contrib/strutl.cc:354 +#, c-format +msgid "%lis" +msgstr "" + +#: apt-pkg/acquire-item.cc:1244 +#, c-format +msgid "" +"A error occurred during the signature verification. The repository is not " +"updated and the previous index files will be used.GPG error: %s: %s\n" +msgstr "" + +#: apt-pkg/acquire-item.cc:1253 +#, c-format +msgid "GPG error: %s: %s" +msgstr "" + +#: apt-pkg/indexrecords.cc:40 +#, c-format +msgid "Unable to parse Release file %s" +msgstr "" + +#: apt-pkg/indexrecords.cc:47 +#, c-format +msgid "No sections in Release file %s" +msgstr "" + +#: apt-pkg/indexrecords.cc:81 +#, c-format +msgid "No Hash entry in Release file %s" +msgstr "" + +#: apt-pkg/cdrom.cc:678 +#, c-format +msgid "" +"Found %zu package indexes, %zu source indexes, %zu translation indexes and %" +"zu signatures\n" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:51 +#, c-format +msgid "Installing %s" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:54 +#, c-format +msgid "Running post-installation trigger %s" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1011 +msgid "No apport report written because MaxReports is reached already" +msgstr "" + +#. check if its not a follow up error +#: apt-pkg/deb/dpkgpm.cc:1016 +msgid "dependency problems - leaving unconfigured" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1018 +msgid "" +"No apport report written because the error message indicates its a followup " +"error from a previous failure." +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1024 +msgid "" +"No apport report written because the error message indicates a disk full " +"error" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1030 +msgid "" +"No apport report written because the error message indicates a out of memory " +"error" +msgstr "" + +#: apt-pkg/deb/debsystem.cc:70 +#, c-format +msgid "" +"Unable to lock the administration directory (%s), is another process using " +"it?" +msgstr "" + +#: apt-pkg/deb/debsystem.cc:73 +#, c-format +msgid "Unable to lock the administration directory (%s), are you root?" +msgstr "" + +#: apt-pkg/deb/debsystem.cc:82 +msgid "" +"dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to " +"correct the problem. " +msgstr "" + +#: apt-pkg/deb/debsystem.cc:100 +msgid "Not locked" +msgstr "" + +#. FIXME: fallback to a default mirror here instead +#. and provide a config option to define that default +#: methods/mirror.cc:172 +#, c-format +msgid "No mirror file '%s' found " +msgstr "" diff --git a/po/ar.po b/po/ar.po index 22cb495cb..afc52c7a8 100644 --- a/po/ar.po +++ b/po/ar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: apt_po\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-11-12 22:07+0100\n" +"POT-Creation-Date: 2007-06-07 00:57+0200\n" "PO-Revision-Date: 2006-10-20 21:28+0300\n" "Last-Translator: Ossama M. Khayat \n" "Language-Team: Arabic \n" @@ -31,7 +31,8 @@ msgid "Unable to locate package %s" msgstr "تعذر العثور على الحزمة %s" #: cmdline/apt-cache.cc:247 -msgid "Total package names: " +#, fuzzy +msgid "Total package names : " msgstr "أسماء الحزم الكلية :" #: cmdline/apt-cache.cc:287 @@ -60,7 +61,7 @@ msgstr "مجموع النسخ الفريدة:" #: cmdline/apt-cache.cc:295 #, fuzzy -msgid "Total distinct descriptions: " +msgid "Total Distinct Descriptions: " msgstr "مجموع النسخ الفريدة:" #: cmdline/apt-cache.cc:297 @@ -160,10 +161,10 @@ msgid " %4i %s\n" msgstr " %4i %s\n" #: cmdline/apt-cache.cc:1714 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70 -#: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:547 -#: cmdline/apt-get.cc:2573 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:550 +#: cmdline/apt-get.cc:2564 cmdline/apt-sortpkgs.cc:144 #, fuzzy, c-format -msgid "%s %s for %s compiled on %s %s\n" +msgid "%s %s for %s %s compiled on %s %s\n" msgstr "%s %s لـ%s %s مُجمّع على %s %s\n" #: cmdline/apt-cache.cc:1721 @@ -189,8 +190,8 @@ msgid "" " show - Show a readable record for the package\n" " depends - Show raw dependency information for a package\n" " rdepends - Show reverse dependency information for a package\n" -" pkgnames - List the names of all packages in the system\n" -" dotty - Generate package graphs for GraphViz\n" +" pkgnames - List the names of all packages\n" +" dotty - Generate package graphs for GraphVis\n" " xvcg - Generate package graphs for xvcg\n" " policy - Show policy settings\n" "\n" @@ -256,7 +257,8 @@ msgid "" " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n" msgstr "" -#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:827 +#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:815 +#: apt-pkg/pkgcachegen.cc:827 #, c-format msgid "Unable to write to %s" msgstr "تعذرت الكتابة إلى %s" @@ -265,31 +267,31 @@ msgstr "تعذرت الكتابة إلى %s" msgid "Cannot get debconf version. Is debconf installed?" msgstr "تعذر الحصول على نسخة debconf. هل هي مثبتة؟" -#: ftparchive/apt-ftparchive.cc:164 ftparchive/apt-ftparchive.cc:338 +#: ftparchive/apt-ftparchive.cc:167 ftparchive/apt-ftparchive.cc:341 msgid "Package extension list is too long" msgstr "قائمة توسيعات الحزمة طويلة جداً" -#: ftparchive/apt-ftparchive.cc:166 ftparchive/apt-ftparchive.cc:180 -#: ftparchive/apt-ftparchive.cc:203 ftparchive/apt-ftparchive.cc:253 -#: ftparchive/apt-ftparchive.cc:267 ftparchive/apt-ftparchive.cc:289 +#: ftparchive/apt-ftparchive.cc:169 ftparchive/apt-ftparchive.cc:183 +#: ftparchive/apt-ftparchive.cc:206 ftparchive/apt-ftparchive.cc:256 +#: ftparchive/apt-ftparchive.cc:270 ftparchive/apt-ftparchive.cc:292 #, c-format msgid "Error processing directory %s" msgstr "خطأ في معالجة الدليل %s" -#: ftparchive/apt-ftparchive.cc:251 +#: ftparchive/apt-ftparchive.cc:254 msgid "Source extension list is too long" msgstr "قائمة توسيعات المصدر طويلة جداً" -#: ftparchive/apt-ftparchive.cc:368 +#: ftparchive/apt-ftparchive.cc:371 msgid "Error writing header to contents file" msgstr "خطأ في كتابة الترويسة إلى ملف المحتويات" -#: ftparchive/apt-ftparchive.cc:398 +#: ftparchive/apt-ftparchive.cc:401 #, c-format msgid "Error processing contents %s" msgstr "خطأ في معالجة المحتويات %s" -#: ftparchive/apt-ftparchive.cc:553 +#: ftparchive/apt-ftparchive.cc:556 msgid "" "Usage: apt-ftparchive [options] command\n" "Commands: packages binarypath [overridefile [pathprefix]]\n" @@ -331,303 +333,303 @@ msgid "" " -o=? Set an arbitrary configuration option" msgstr "" -#: ftparchive/apt-ftparchive.cc:759 +#: ftparchive/apt-ftparchive.cc:762 msgid "No selections matched" msgstr "لم تُطابق أية تحديدات" -#: ftparchive/apt-ftparchive.cc:832 +#: ftparchive/apt-ftparchive.cc:835 #, c-format msgid "Some files are missing in the package file group `%s'" msgstr "بعض الملفات مفقودة في مجموعة ملف الحزمة `%s'" -#: ftparchive/cachedb.cc:43 +#: ftparchive/cachedb.cc:47 #, c-format msgid "DB was corrupted, file renamed to %s.old" msgstr "قاعدة البيانات كانت فاسدة، فتم تغيير اسمها إلى %s.old" -#: ftparchive/cachedb.cc:61 +#: ftparchive/cachedb.cc:65 #, c-format msgid "DB is old, attempting to upgrade %s" msgstr "قاعدة البيانات قديمة، محاولة ترقية %s" -#: ftparchive/cachedb.cc:72 +#: ftparchive/cachedb.cc:76 msgid "" "DB format is invalid. If you upgraded from a older version of apt, please " "remove and re-create the database." msgstr "" -#: ftparchive/cachedb.cc:77 +#: ftparchive/cachedb.cc:81 #, c-format msgid "Unable to open DB file %s: %s" msgstr "تعذر فتح ملف قاعدة البيانات %s: %s" -#: ftparchive/cachedb.cc:123 apt-inst/extract.cc:178 apt-inst/extract.cc:190 -#: apt-inst/extract.cc:207 apt-inst/deb/dpkgdb.cc:117 +#: ftparchive/cachedb.cc:127 apt-inst/extract.cc:181 apt-inst/extract.cc:193 +#: apt-inst/extract.cc:210 apt-inst/deb/dpkgdb.cc:121 #, c-format msgid "Failed to stat %s" msgstr "" -#: ftparchive/cachedb.cc:238 +#: ftparchive/cachedb.cc:242 msgid "Archive has no control record" msgstr "" -#: ftparchive/cachedb.cc:444 +#: ftparchive/cachedb.cc:448 msgid "Unable to get a cursor" msgstr "" -#: ftparchive/writer.cc:76 +#: ftparchive/writer.cc:79 #, c-format msgid "W: Unable to read directory %s\n" msgstr "W: تعذرت قراءة الدليل %s\n" -#: ftparchive/writer.cc:81 +#: ftparchive/writer.cc:84 #, c-format msgid "W: Unable to stat %s\n" msgstr "" -#: ftparchive/writer.cc:132 +#: ftparchive/writer.cc:135 msgid "E: " msgstr "E: " -#: ftparchive/writer.cc:134 +#: ftparchive/writer.cc:137 msgid "W: " msgstr "W: " -#: ftparchive/writer.cc:141 +#: ftparchive/writer.cc:144 msgid "E: Errors apply to file " msgstr "" -#: ftparchive/writer.cc:158 ftparchive/writer.cc:188 +#: ftparchive/writer.cc:161 ftparchive/writer.cc:191 #, c-format msgid "Failed to resolve %s" msgstr "" -#: ftparchive/writer.cc:170 +#: ftparchive/writer.cc:173 msgid "Tree walking failed" msgstr "" -#: ftparchive/writer.cc:195 +#: ftparchive/writer.cc:198 #, c-format msgid "Failed to open %s" msgstr "فشل فتح %s" -#: ftparchive/writer.cc:254 +#: ftparchive/writer.cc:257 #, c-format msgid " DeLink %s [%s]\n" msgstr " DeLink %s [%s]\n" -#: ftparchive/writer.cc:262 +#: ftparchive/writer.cc:265 #, c-format msgid "Failed to readlink %s" msgstr "" -#: ftparchive/writer.cc:266 +#: ftparchive/writer.cc:269 #, c-format msgid "Failed to unlink %s" msgstr "" -#: ftparchive/writer.cc:273 +#: ftparchive/writer.cc:276 #, c-format msgid "*** Failed to link %s to %s" msgstr "*** فشل ربط %s بـ%s" -#: ftparchive/writer.cc:283 +#: ftparchive/writer.cc:286 #, c-format msgid " DeLink limit of %sB hit.\n" msgstr "" -#: ftparchive/writer.cc:387 +#: ftparchive/writer.cc:390 msgid "Archive had no package field" msgstr "" -#: ftparchive/writer.cc:395 ftparchive/writer.cc:610 +#: ftparchive/writer.cc:398 ftparchive/writer.cc:613 #, c-format msgid " %s has no override entry\n" msgstr "" -#: ftparchive/writer.cc:440 ftparchive/writer.cc:698 +#: ftparchive/writer.cc:443 ftparchive/writer.cc:701 #, c-format msgid " %s maintainer is %s not %s\n" msgstr "" -#: ftparchive/writer.cc:620 +#: ftparchive/writer.cc:623 #, c-format msgid " %s has no source override entry\n" msgstr "" -#: ftparchive/writer.cc:624 +#: ftparchive/writer.cc:627 #, c-format msgid " %s has no binary override entry either\n" msgstr "" -#: ftparchive/contents.cc:321 +#: ftparchive/contents.cc:317 #, c-format msgid "Internal error, could not locate member %s" msgstr "خطأ داخلي، تعذر العثور على العضو %s" -#: ftparchive/contents.cc:358 ftparchive/contents.cc:389 +#: ftparchive/contents.cc:353 ftparchive/contents.cc:384 msgid "realloc - Failed to allocate memory" msgstr "realloc - فشل تعيين الذاكرة" -#: ftparchive/override.cc:34 ftparchive/override.cc:142 +#: ftparchive/override.cc:38 ftparchive/override.cc:146 #, c-format msgid "Unable to open %s" msgstr "تعذر فتح %s" -#: ftparchive/override.cc:60 ftparchive/override.cc:166 +#: ftparchive/override.cc:64 ftparchive/override.cc:170 #, c-format msgid "Malformed override %s line %lu #1" msgstr "" -#: ftparchive/override.cc:74 ftparchive/override.cc:178 +#: ftparchive/override.cc:78 ftparchive/override.cc:182 #, c-format msgid "Malformed override %s line %lu #2" msgstr "" -#: ftparchive/override.cc:88 ftparchive/override.cc:191 +#: ftparchive/override.cc:92 ftparchive/override.cc:195 #, c-format msgid "Malformed override %s line %lu #3" msgstr "" -#: ftparchive/override.cc:127 ftparchive/override.cc:201 +#: ftparchive/override.cc:131 ftparchive/override.cc:205 #, c-format msgid "Failed to read the override file %s" msgstr "" -#: ftparchive/multicompress.cc:72 +#: ftparchive/multicompress.cc:75 #, c-format msgid "Unknown compression algorithm '%s'" msgstr "" -#: ftparchive/multicompress.cc:102 +#: ftparchive/multicompress.cc:105 #, c-format msgid "Compressed output %s needs a compression set" msgstr "" -#: ftparchive/multicompress.cc:169 methods/rsh.cc:91 +#: ftparchive/multicompress.cc:172 methods/rsh.cc:91 msgid "Failed to create IPC pipe to subprocess" msgstr "" -#: ftparchive/multicompress.cc:195 +#: ftparchive/multicompress.cc:198 msgid "Failed to create FILE*" msgstr "" -#: ftparchive/multicompress.cc:198 +#: ftparchive/multicompress.cc:201 msgid "Failed to fork" msgstr "" -#: ftparchive/multicompress.cc:212 +#: ftparchive/multicompress.cc:215 msgid "Compress child" msgstr "" -#: ftparchive/multicompress.cc:235 +#: ftparchive/multicompress.cc:238 #, c-format msgid "Internal error, failed to create %s" msgstr "خطأ داخلي، تعذر إنشاء %s" -#: ftparchive/multicompress.cc:286 +#: ftparchive/multicompress.cc:289 msgid "Failed to create subprocess IPC" msgstr "" -#: ftparchive/multicompress.cc:321 +#: ftparchive/multicompress.cc:324 msgid "Failed to exec compressor " msgstr "" -#: ftparchive/multicompress.cc:360 +#: ftparchive/multicompress.cc:363 msgid "decompressor" msgstr "" -#: ftparchive/multicompress.cc:403 +#: ftparchive/multicompress.cc:406 msgid "IO to subprocess/file failed" msgstr "" -#: ftparchive/multicompress.cc:455 +#: ftparchive/multicompress.cc:458 msgid "Failed to read while computing MD5" msgstr "" -#: ftparchive/multicompress.cc:472 +#: ftparchive/multicompress.cc:475 #, c-format msgid "Problem unlinking %s" msgstr "" -#: ftparchive/multicompress.cc:487 apt-inst/extract.cc:185 +#: ftparchive/multicompress.cc:490 apt-inst/extract.cc:188 #, c-format msgid "Failed to rename %s to %s" msgstr "فشل تغيير اسم %s إلى %s" -#: cmdline/apt-get.cc:124 +#: cmdline/apt-get.cc:121 msgid "Y" msgstr "Y" -#: cmdline/apt-get.cc:146 cmdline/apt-get.cc:1651 +#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1655 #, c-format msgid "Regex compilation error - %s" msgstr "" -#: cmdline/apt-get.cc:241 +#: cmdline/apt-get.cc:238 msgid "The following packages have unmet dependencies:" msgstr "" -#: cmdline/apt-get.cc:331 +#: cmdline/apt-get.cc:328 #, c-format msgid "but %s is installed" msgstr "إلا أن %s مثبت" -#: cmdline/apt-get.cc:333 +#: cmdline/apt-get.cc:330 #, c-format msgid "but %s is to be installed" msgstr "إلا أنه سيتم تثبيت %s" -#: cmdline/apt-get.cc:340 +#: cmdline/apt-get.cc:337 msgid "but it is not installable" msgstr "إلا أنه غير قابل للتثبيت" -#: cmdline/apt-get.cc:342 +#: cmdline/apt-get.cc:339 msgid "but it is a virtual package" msgstr "إلا أنها حزمة وهمية" -#: cmdline/apt-get.cc:345 +#: cmdline/apt-get.cc:342 msgid "but it is not installed" msgstr "إلا أنها غير مثبتة" -#: cmdline/apt-get.cc:345 +#: cmdline/apt-get.cc:342 msgid "but it is not going to be installed" msgstr "إلا أنه لن يتم تثبيتها" -#: cmdline/apt-get.cc:350 +#: cmdline/apt-get.cc:347 msgid " or" msgstr " أو" -#: cmdline/apt-get.cc:379 +#: cmdline/apt-get.cc:376 msgid "The following NEW packages will be installed:" msgstr "سيتم تثبيت الحزم الجديدة التالية:" -#: cmdline/apt-get.cc:405 +#: cmdline/apt-get.cc:402 msgid "The following packages will be REMOVED:" msgstr "سيتم إزالة الحزم التالية:" -#: cmdline/apt-get.cc:427 +#: cmdline/apt-get.cc:424 msgid "The following packages have been kept back:" msgstr "سيتم الإبقاء على الحزم التالية:" -#: cmdline/apt-get.cc:448 +#: cmdline/apt-get.cc:445 msgid "The following packages will be upgraded:" msgstr "ستتم ترقية الحزم التالية:" -#: cmdline/apt-get.cc:469 +#: cmdline/apt-get.cc:466 msgid "The following packages will be DOWNGRADED:" msgstr "سيتم تثبيط الحزم التالية:" -#: cmdline/apt-get.cc:489 +#: cmdline/apt-get.cc:486 msgid "The following held packages will be changed:" msgstr "سيتم تغيير الحزم المبقاة التالية:" -#: cmdline/apt-get.cc:542 +#: cmdline/apt-get.cc:539 #, c-format msgid "%s (due to %s) " msgstr "%s (بسبب %s) " -#: cmdline/apt-get.cc:550 +#: cmdline/apt-get.cc:547 msgid "" "WARNING: The following essential packages will be removed.\n" "This should NOT be done unless you know exactly what you are doing!" @@ -635,143 +637,143 @@ msgstr "" "تحذير: ستتم إزالة الحزم الأساسية التالية.\n" "لا يجب أن تقوم بهذا إلى إن كنت تعرف تماماً ما تقوم به!" -#: cmdline/apt-get.cc:581 +#: cmdline/apt-get.cc:578 #, c-format msgid "%lu upgraded, %lu newly installed, " msgstr "%lu سيتم ترقيتها، %lu مثبتة حديثاً، " -#: cmdline/apt-get.cc:585 +#: cmdline/apt-get.cc:582 #, c-format msgid "%lu reinstalled, " msgstr "%lu أعيد تثبيتها، " -#: cmdline/apt-get.cc:587 +#: cmdline/apt-get.cc:584 #, c-format msgid "%lu downgraded, " msgstr "%lu مثبطة، " -#: cmdline/apt-get.cc:589 +#: cmdline/apt-get.cc:586 #, c-format msgid "%lu to remove and %lu not upgraded.\n" msgstr "%lu لإزالتها و %lu لم يتم ترقيتها.\n" -#: cmdline/apt-get.cc:593 +#: cmdline/apt-get.cc:590 #, c-format msgid "%lu not fully installed or removed.\n" msgstr "%lu غير مثبتة بالكامل أو مزالة.\n" -#: cmdline/apt-get.cc:667 +#: cmdline/apt-get.cc:664 msgid "Correcting dependencies..." msgstr "تصحيح المعتمدات..." -#: cmdline/apt-get.cc:670 +#: cmdline/apt-get.cc:667 msgid " failed." msgstr " فشل." -#: cmdline/apt-get.cc:673 +#: cmdline/apt-get.cc:670 msgid "Unable to correct dependencies" msgstr "لم يمكن تصحيح المعتمدات" -#: cmdline/apt-get.cc:676 +#: cmdline/apt-get.cc:673 msgid "Unable to minimize the upgrade set" msgstr "لم يمكن تقليص مجموعة الترقية" -#: cmdline/apt-get.cc:678 +#: cmdline/apt-get.cc:675 msgid " Done" msgstr " تم" -#: cmdline/apt-get.cc:682 +#: cmdline/apt-get.cc:679 msgid "You might want to run `apt-get -f install' to correct these." msgstr "قد ترغب بتنفيذ الأمر `apt-get -f install' لتصحيح هذه." -#: cmdline/apt-get.cc:685 +#: cmdline/apt-get.cc:682 msgid "Unmet dependencies. Try using -f." msgstr "مُعتمدات غير مستوفاة. حاول استخدام -f." -#: cmdline/apt-get.cc:707 +#: cmdline/apt-get.cc:704 msgid "WARNING: The following packages cannot be authenticated!" msgstr "تحذير: تعذرت المصادقة على الحزم التالية!" -#: cmdline/apt-get.cc:711 +#: cmdline/apt-get.cc:708 msgid "Authentication warning overridden.\n" msgstr "تم غض النظر عن تحذير المصادقة.\n" -#: cmdline/apt-get.cc:718 +#: cmdline/apt-get.cc:715 msgid "Install these packages without verification [y/N]? " msgstr "تثبيت هذه الحزم دون التحقق منها [y/N]؟ " -#: cmdline/apt-get.cc:720 +#: cmdline/apt-get.cc:717 msgid "Some packages could not be authenticated" msgstr "تعذرت المصادقة على بعض الحزم" -#: cmdline/apt-get.cc:729 cmdline/apt-get.cc:881 +#: cmdline/apt-get.cc:726 cmdline/apt-get.cc:873 msgid "There are problems and -y was used without --force-yes" msgstr "هناك مشاكل وتم استخدام -y دون --force-yes" -#: cmdline/apt-get.cc:773 +#: cmdline/apt-get.cc:770 msgid "Internal error, InstallPackages was called with broken packages!" msgstr "خطأ داخلي، تم طلب InstallPackages مع وجود حزم معطوبة!" -#: cmdline/apt-get.cc:782 +#: cmdline/apt-get.cc:779 msgid "Packages need to be removed but remove is disabled." msgstr "حزم بحاجة للإزالة لكن الإزالة مُعطّلة." -#: cmdline/apt-get.cc:793 +#: cmdline/apt-get.cc:790 msgid "Internal error, Ordering didn't finish" msgstr "خطأ داخلي، لم تنته عملية الترتيب" -#: cmdline/apt-get.cc:809 cmdline/apt-get.cc:1992 cmdline/apt-get.cc:2025 +#: cmdline/apt-get.cc:806 cmdline/apt-get.cc:1995 cmdline/apt-get.cc:2028 msgid "Unable to lock the download directory" msgstr "تعذر قَفْل دليل التنزيل" -#: cmdline/apt-get.cc:819 cmdline/apt-get.cc:2073 cmdline/apt-get.cc:2319 -#: apt-pkg/cachefile.cc:65 +#: cmdline/apt-get.cc:816 cmdline/apt-get.cc:2076 cmdline/apt-get.cc:2312 +#: apt-pkg/cachefile.cc:63 apt-pkg/cachefile.cc:65 msgid "The list of sources could not be read." msgstr "تعذرت قراءة قائمة المصادر." -#: cmdline/apt-get.cc:834 +#: cmdline/apt-get.cc:831 msgid "How odd.. The sizes didn't match, email apt@packages.debian.org" msgstr "يا للغرابة.. لم تتطابق الأحجام، الرجاء مراسلة apt@packages.debian.org" -#: cmdline/apt-get.cc:839 +#: cmdline/apt-get.cc:836 #, c-format msgid "Need to get %sB/%sB of archives.\n" msgstr "بحاجة إلى جلب %sب/%sب من الأرشيف.\n" -#: cmdline/apt-get.cc:842 +#: cmdline/apt-get.cc:839 #, c-format msgid "Need to get %sB of archives.\n" msgstr "بحاجة إلى جلب %sب من الأرشيف.\n" -#: cmdline/apt-get.cc:847 +#: cmdline/apt-get.cc:844 #, fuzzy, c-format -msgid "After this operation, %sB of additional disk space will be used.\n" +msgid "After unpacking %sB of additional disk space will be used.\n" msgstr "بعد الاستخراج %sب من المساحة الإضافيّة سيتمّ استخدامها.\n" -#: cmdline/apt-get.cc:850 +#: cmdline/apt-get.cc:847 #, fuzzy, c-format -msgid "After this operation, %sB disk space will be freed.\n" +msgid "After unpacking %sB disk space will be freed.\n" msgstr "بعد الاستخراج %sب من المساحة ستفرّغ.\n" -#: cmdline/apt-get.cc:864 cmdline/apt-get.cc:2168 +#: cmdline/apt-get.cc:861 cmdline/apt-get.cc:2166 #, c-format msgid "Couldn't determine free space in %s" msgstr "تعذر حساب المساحة الحرة في %s" -#: cmdline/apt-get.cc:871 +#: cmdline/apt-get.cc:864 #, c-format msgid "You don't have enough free space in %s." msgstr "ليس هناك مساحة كافية في %s." -#: cmdline/apt-get.cc:887 cmdline/apt-get.cc:907 +#: cmdline/apt-get.cc:879 cmdline/apt-get.cc:899 msgid "Trivial Only specified but this is not a trivial operation." msgstr "" -#: cmdline/apt-get.cc:889 +#: cmdline/apt-get.cc:881 msgid "Yes, do as I say!" msgstr "نعم، افعل ما أقوله!" -#: cmdline/apt-get.cc:891 +#: cmdline/apt-get.cc:883 #, c-format msgid "" "You are about to do something potentially harmful.\n" @@ -782,28 +784,29 @@ msgstr "" "كي تستمر اكتب العبارة '%s'\n" " ؟] " -#: cmdline/apt-get.cc:897 cmdline/apt-get.cc:916 +#: cmdline/apt-get.cc:889 cmdline/apt-get.cc:908 msgid "Abort." msgstr "إجهاض." -#: cmdline/apt-get.cc:912 +#: cmdline/apt-get.cc:904 msgid "Do you want to continue [Y/n]? " msgstr "هل تريد الاستمرار [Y/n]؟" -#: cmdline/apt-get.cc:984 cmdline/apt-get.cc:2216 apt-pkg/algorithms.cc:1349 +#: cmdline/apt-get.cc:976 cmdline/apt-get.cc:1383 cmdline/apt-get.cc:2209 +#: apt-pkg/algorithms.cc:1348 #, c-format msgid "Failed to fetch %s %s\n" msgstr "فشل إحضار %s %s\n" -#: cmdline/apt-get.cc:1002 +#: cmdline/apt-get.cc:994 msgid "Some files failed to download" msgstr "فشل تنزيل بعض الملفات" -#: cmdline/apt-get.cc:1003 cmdline/apt-get.cc:2225 +#: cmdline/apt-get.cc:995 cmdline/apt-get.cc:2218 msgid "Download complete and in download only mode" msgstr "اكتمل التنزيل وفي وضع التنزيل فقط" -#: cmdline/apt-get.cc:1009 +#: cmdline/apt-get.cc:1001 msgid "" "Unable to fetch some archives, maybe run apt-get update or try with --fix-" "missing?" @@ -811,47 +814,47 @@ msgstr "" "تعذر إحضار بعض الأرشيف، ربما يمكنك محاولة تنفيذ apt-get update أو إضافة --" "fix-missing؟" -#: cmdline/apt-get.cc:1013 +#: cmdline/apt-get.cc:1005 msgid "--fix-missing and media swapping is not currently supported" msgstr "--fix-missing وتبديل الأوساط غير مدعومة حالياً" -#: cmdline/apt-get.cc:1018 +#: cmdline/apt-get.cc:1010 msgid "Unable to correct missing packages." msgstr "تعذر تصحيح الحزم المفقودة." -#: cmdline/apt-get.cc:1019 +#: cmdline/apt-get.cc:1011 msgid "Aborting install." msgstr "إجهاض التثبيت." -#: cmdline/apt-get.cc:1053 +#: cmdline/apt-get.cc:1045 #, c-format msgid "Note, selecting %s instead of %s\n" msgstr "لاحظ، تحديد %s بدلاً من %s\n" -#: cmdline/apt-get.cc:1063 +#: cmdline/apt-get.cc:1055 #, c-format msgid "Skipping %s, it is already installed and upgrade is not set.\n" msgstr "تخطّي %s، حيث أنها مثبتة ولم يتمّ تعيين الترقية.\n" -#: cmdline/apt-get.cc:1081 +#: cmdline/apt-get.cc:1073 #, c-format msgid "Package %s is not installed, so not removed\n" msgstr "الحزمة %s غير مُثبّتة، لذلك لن تُزال\n" -#: cmdline/apt-get.cc:1092 +#: cmdline/apt-get.cc:1084 #, c-format msgid "Package %s is a virtual package provided by:\n" msgstr "الحزمة %s وهميّة وتوفّرها:\n" -#: cmdline/apt-get.cc:1104 +#: cmdline/apt-get.cc:1096 msgid " [Installed]" msgstr " [مُثبّتة]" -#: cmdline/apt-get.cc:1109 +#: cmdline/apt-get.cc:1101 msgid "You should explicitly select one to install." msgstr "يجب اختيار واحدة بالتحديد لتثبيتها." -#: cmdline/apt-get.cc:1114 +#: cmdline/apt-get.cc:1106 #, c-format msgid "" "Package %s is not available, but is referred to by another package.\n" @@ -859,124 +862,121 @@ msgid "" "is only available from another source\n" msgstr "" -#: cmdline/apt-get.cc:1133 +#: cmdline/apt-get.cc:1125 msgid "However the following packages replace it:" msgstr "على أيّ فإن الحزم التالية تحلّ مكانها:" -#: cmdline/apt-get.cc:1136 +#: cmdline/apt-get.cc:1128 #, c-format msgid "Package %s has no installation candidate" msgstr "الحزمة %s ليس لها مرشح تثبيت" -#: cmdline/apt-get.cc:1156 +#: cmdline/apt-get.cc:1148 #, c-format msgid "Reinstallation of %s is not possible, it cannot be downloaded.\n" msgstr "إعادة تثبيت %s غير ممكنة، حيث أنّه لا يمكن تنزيلها.\n" -#: cmdline/apt-get.cc:1164 +#: cmdline/apt-get.cc:1156 #, c-format msgid "%s is already the newest version.\n" msgstr "%s هي النسخة الأحدث.\n" -#: cmdline/apt-get.cc:1193 +#: cmdline/apt-get.cc:1185 #, c-format msgid "Release '%s' for '%s' was not found" msgstr "تعذر العثور على الإصدارة '%s' للحزمة '%s'" -#: cmdline/apt-get.cc:1195 +#: cmdline/apt-get.cc:1187 #, c-format msgid "Version '%s' for '%s' was not found" msgstr "تعذر العثور على النسخة '%s' للحزمة '%s'" -#: cmdline/apt-get.cc:1201 +#: cmdline/apt-get.cc:1193 #, c-format msgid "Selected version %s (%s) for %s\n" msgstr "النسخة المحددة %s (%s) للإصدارة %s\n" -#: cmdline/apt-get.cc:1338 +#: cmdline/apt-get.cc:1330 msgid "The update command takes no arguments" msgstr "لا يقبل الأمر update أية مُعطيات" -#: cmdline/apt-get.cc:1351 +#: cmdline/apt-get.cc:1343 msgid "Unable to lock the list directory" msgstr "تعذر قفل دليل القائمة" -#: cmdline/apt-get.cc:1403 +#: cmdline/apt-get.cc:1410 cmdline/apt-get.cc:1412 apt-pkg/algorithms.cc:1374 +#: apt-pkg/algorithms.cc:1376 +msgid "" +"Some index files failed to download, they have been ignored, or old ones " +"used instead." +msgstr "" + +#: cmdline/apt-get.cc:1433 msgid "We are not supposed to delete stuff, can't start AutoRemover" msgstr "" -#: cmdline/apt-get.cc:1435 +#: cmdline/apt-get.cc:1465 #, fuzzy msgid "" "The following packages were automatically installed and are no longer " "required:" msgstr "سيتم تثبيت الحزم الجديدة التالية:" -#: cmdline/apt-get.cc:1437 +#: cmdline/apt-get.cc:1467 msgid "Use 'apt-get autoremove' to remove them." msgstr "" -#: cmdline/apt-get.cc:1442 +#: cmdline/apt-get.cc:1472 msgid "" "Hmm, seems like the AutoRemover destroyed something which really\n" "shouldn't happen. Please file a bug report against apt." msgstr "" -#. -#. if (Packages == 1) -#. { -#. c1out << endl; -#. c1out << -#. _("Since you only requested a single operation it is extremely likely that\n" -#. "the package is simply not installable and a bug report against\n" -#. "that package should be filed.") << endl; -#. } -#. -#: cmdline/apt-get.cc:1445 cmdline/apt-get.cc:1735 +#: cmdline/apt-get.cc:1475 cmdline/apt-get.cc:1736 msgid "The following information may help to resolve the situation:" msgstr "قد تساعد المعلومات التالية في حل المشكلة:" -#: cmdline/apt-get.cc:1449 +#: cmdline/apt-get.cc:1479 #, fuzzy msgid "Internal Error, AutoRemover broke stuff" msgstr "خطأ داخلي، عطب AllUpgrade بعض الأشياء" -#: cmdline/apt-get.cc:1468 +#: cmdline/apt-get.cc:1498 msgid "Internal error, AllUpgrade broke stuff" msgstr "خطأ داخلي، عطب AllUpgrade بعض الأشياء" -#: cmdline/apt-get.cc:1523 +#: cmdline/apt-get.cc:1543 #, fuzzy, c-format msgid "Couldn't find task %s" msgstr "تعذر العثور على الحزمة %s" -#: cmdline/apt-get.cc:1638 cmdline/apt-get.cc:1674 +#: cmdline/apt-get.cc:1642 cmdline/apt-get.cc:1678 #, c-format msgid "Couldn't find package %s" msgstr "تعذر العثور على الحزمة %s" -#: cmdline/apt-get.cc:1661 +#: cmdline/apt-get.cc:1665 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "لاحظ، تحديد %s بسبب صيغة regex '%s'\n" -#: cmdline/apt-get.cc:1692 +#: cmdline/apt-get.cc:1695 #, fuzzy, c-format -msgid "%s set to manually installed.\n" +msgid "%s set to manual installed.\n" msgstr "إلا أنه سيتم تثبيت %s" -#: cmdline/apt-get.cc:1705 +#: cmdline/apt-get.cc:1708 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "قد ترغب بتشغيل `apt-get -f install' لتصحيح هذه:" -#: cmdline/apt-get.cc:1708 +#: cmdline/apt-get.cc:1711 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" "مُعتمدات غير مستوفاة. جرب 'apt-get -f install' بدون أسماء حزم (أو حدّد حلاً)." -#: cmdline/apt-get.cc:1720 +#: cmdline/apt-get.cc:1723 msgid "" "Some packages could not be installed. This may mean that you have\n" "requested an impossible situation or if you are using the unstable\n" @@ -984,152 +984,160 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1738 +#: cmdline/apt-get.cc:1731 +msgid "" +"Since you only requested a single operation it is extremely likely that\n" +"the package is simply not installable and a bug report against\n" +"that package should be filed." +msgstr "" + +#: cmdline/apt-get.cc:1739 msgid "Broken packages" msgstr "حزم معطوبة" -#: cmdline/apt-get.cc:1767 +#: cmdline/apt-get.cc:1770 msgid "The following extra packages will be installed:" msgstr "سيتم تثبيت الحزم الإضافيّة التالية:" -#: cmdline/apt-get.cc:1856 +#: cmdline/apt-get.cc:1859 msgid "Suggested packages:" msgstr "الحزم المقترحة:" -#: cmdline/apt-get.cc:1857 +#: cmdline/apt-get.cc:1860 msgid "Recommended packages:" msgstr "الحزم المستحسنة:" -#: cmdline/apt-get.cc:1885 +#: cmdline/apt-get.cc:1888 msgid "Calculating upgrade... " msgstr "حساب الترقية..." -#: cmdline/apt-get.cc:1888 methods/ftp.cc:702 methods/connect.cc:112 +#: cmdline/apt-get.cc:1891 methods/ftp.cc:702 methods/connect.cc:101 +#: methods/connect.cc:111 msgid "Failed" msgstr "فشل" -#: cmdline/apt-get.cc:1893 +#: cmdline/apt-get.cc:1896 msgid "Done" msgstr "تمّ" -#: cmdline/apt-get.cc:1960 cmdline/apt-get.cc:1968 +#: cmdline/apt-get.cc:1963 cmdline/apt-get.cc:1971 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:2068 +#: cmdline/apt-get.cc:2071 msgid "Must specify at least one package to fetch source for" msgstr "يجب تحديد حزمة واحدة على الأقل لجلب مصدرها" -#: cmdline/apt-get.cc:2098 cmdline/apt-get.cc:2337 +#: cmdline/apt-get.cc:2101 cmdline/apt-get.cc:2330 #, c-format msgid "Unable to find a source package for %s" msgstr "تعذر العثور على مصدر الحزمة %s" -#: cmdline/apt-get.cc:2147 +#: cmdline/apt-get.cc:2145 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "تخطي الملف '%s' المنزل مسبقاً\n" -#: cmdline/apt-get.cc:2175 +#: cmdline/apt-get.cc:2169 #, c-format msgid "You don't have enough free space in %s" msgstr "ليس هناك مساحة كافية في %s" -#: cmdline/apt-get.cc:2181 +#: cmdline/apt-get.cc:2174 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "يجب جلب %sب/%sب من الأرشيفات المصدرية.\n" -#: cmdline/apt-get.cc:2184 +#: cmdline/apt-get.cc:2177 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "يجب جلب %sب من الأرشيفات المصدريّة.\n" -#: cmdline/apt-get.cc:2190 +#: cmdline/apt-get.cc:2183 #, c-format msgid "Fetch source %s\n" msgstr "إحضار المصدر %s\n" -#: cmdline/apt-get.cc:2221 +#: cmdline/apt-get.cc:2214 msgid "Failed to fetch some archives." msgstr "فشل إحضار بعض الأرشيفات." -#: cmdline/apt-get.cc:2249 +#: cmdline/apt-get.cc:2242 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2261 +#: cmdline/apt-get.cc:2254 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "أمر فك الحزمة '%s' فشل.\n" -#: cmdline/apt-get.cc:2262 +#: cmdline/apt-get.cc:2255 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2279 +#: cmdline/apt-get.cc:2272 #, c-format msgid "Build command '%s' failed.\n" msgstr "أمر البناء '%s' فشل.\n" -#: cmdline/apt-get.cc:2298 +#: cmdline/apt-get.cc:2291 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2314 +#: cmdline/apt-get.cc:2307 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2342 +#: cmdline/apt-get.cc:2335 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2362 +#: cmdline/apt-get.cc:2355 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2414 +#: cmdline/apt-get.cc:2407 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2467 +#: cmdline/apt-get.cc:2459 #, c-format msgid "" "%s dependency for %s cannot be satisfied because no available versions of " "package %s can satisfy version requirements" msgstr "" -#: cmdline/apt-get.cc:2503 +#: cmdline/apt-get.cc:2494 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2528 +#: cmdline/apt-get.cc:2519 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2542 +#: cmdline/apt-get.cc:2533 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2546 +#: cmdline/apt-get.cc:2537 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2578 +#: cmdline/apt-get.cc:2569 msgid "Supported modules:" msgstr "الوحدات المدعومة:" -#: cmdline/apt-get.cc:2619 +#: cmdline/apt-get.cc:2610 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -1144,8 +1152,6 @@ msgid "" " upgrade - Perform an upgrade\n" " install - Install new packages (pkg is libc6 not libc6.deb)\n" " remove - Remove packages\n" -" autoremove - Remove automatically all unused packages\n" -" purge - Remove and purge packages\n" " source - Download source archives\n" " build-dep - Configure build-dependencies for source packages\n" " dist-upgrade - Distribution upgrade, see apt-get(8)\n" @@ -1161,7 +1167,7 @@ msgid "" " -d Download only - do NOT install or unpack archives\n" " -s No-act. Perform ordering simulation\n" " -y Assume Yes to all queries and do not prompt\n" -" -f Attempt to correct a system with broken dependencies in place\n" +" -f Attempt to continue if the integrity check fails\n" " -m Attempt to continue if archives are unlocatable\n" " -u Show a list of upgraded packages as well\n" " -b Build the source package after fetching it\n" @@ -1232,28 +1238,24 @@ msgstr "" msgid "Bad default setting!" msgstr "إعداد افتراضيّ سيّء!" -#: dselect/install:51 dselect/install:83 dselect/install:87 dselect/install:94 -#: dselect/install:105 dselect/update:45 +#: dselect/install:51 dselect/install:83 dselect/install:87 dselect/install:93 +#: dselect/install:104 dselect/update:45 msgid "Press enter to continue." msgstr "اضغط مفتاح الإدخال للاستمرار." -#: dselect/install:91 -msgid "Do you want to erase any previously downloaded .deb files?" -msgstr "" - -#: dselect/install:101 +#: dselect/install:100 msgid "Some errors occurred while unpacking. I'm going to configure the" msgstr "حدثت بعض الأخطاء أثناء فك الحزمة. سأقوم بتهيئة " -#: dselect/install:102 +#: dselect/install:101 msgid "packages that were installed. This may result in duplicate errors" msgstr "الحزم التي تم تثبيتها. قد يتسبب هذا بظهر أخطاء متكررة" -#: dselect/install:103 +#: dselect/install:102 msgid "or errors caused by missing dependencies. This is OK, only the errors" msgstr "أو أخطاء سبّبتها المُعتمدات المفقودة. لا بأس بهذا، فقط الأخطاء" -#: dselect/install:104 +#: dselect/install:103 msgid "" "above this message are important. Please fix them and run [I]nstall again" msgstr "أعلى هذه الرسالة مهمّة. الرجاء تصحيحها وتشغيل التثبيت مجدداً" @@ -1262,188 +1264,192 @@ msgstr "أعلى هذه الرسالة مهمّة. الرجاء تصحيحها msgid "Merging available information" msgstr "دمج المعلومات المتوفرة" -#: apt-inst/contrib/extracttar.cc:114 +#: apt-inst/contrib/extracttar.cc:117 msgid "Failed to create pipes" msgstr "" -#: apt-inst/contrib/extracttar.cc:141 +#: apt-inst/contrib/extracttar.cc:144 msgid "Failed to exec gzip " msgstr "فشل تنفيذ gzip" -#: apt-inst/contrib/extracttar.cc:178 apt-inst/contrib/extracttar.cc:204 +#: apt-inst/contrib/extracttar.cc:181 apt-inst/contrib/extracttar.cc:207 msgid "Corrupted archive" msgstr "أرشيف فاسد" -#: apt-inst/contrib/extracttar.cc:193 +#: apt-inst/contrib/extracttar.cc:196 msgid "Tar checksum failed, archive corrupted" msgstr "فشل تحقّق Checksum لملف Tar، الأرشيف فاسد" -#: apt-inst/contrib/extracttar.cc:296 +#: apt-inst/contrib/extracttar.cc:299 #, c-format msgid "Unknown TAR header type %u, member %s" msgstr "" -#: apt-inst/contrib/arfile.cc:70 +#: apt-inst/contrib/arfile.cc:73 msgid "Invalid archive signature" msgstr "توقيع الأرشيف غير صالح" -#: apt-inst/contrib/arfile.cc:78 +#: apt-inst/contrib/arfile.cc:81 msgid "Error reading archive member header" msgstr "" -#: apt-inst/contrib/arfile.cc:90 apt-inst/contrib/arfile.cc:102 +#: apt-inst/contrib/arfile.cc:93 apt-inst/contrib/arfile.cc:105 msgid "Invalid archive member header" msgstr "" -#: apt-inst/contrib/arfile.cc:128 +#: apt-inst/contrib/arfile.cc:131 msgid "Archive is too short" msgstr "الأرشيف قصير جداً" -#: apt-inst/contrib/arfile.cc:132 +#: apt-inst/contrib/arfile.cc:135 msgid "Failed to read the archive headers" msgstr "فشلت قراءة ترويسات الأرشيف" -#: apt-inst/filelist.cc:380 +#: apt-inst/filelist.cc:384 msgid "DropNode called on still linked node" msgstr "" -#: apt-inst/filelist.cc:412 +#: apt-inst/filelist.cc:416 msgid "Failed to locate the hash element!" msgstr "" -#: apt-inst/filelist.cc:459 +#: apt-inst/filelist.cc:463 msgid "Failed to allocate diversion" msgstr "" -#: apt-inst/filelist.cc:464 +#: apt-inst/filelist.cc:468 msgid "Internal error in AddDiversion" msgstr "خطأ داخلي في AddDiversion" -#: apt-inst/filelist.cc:477 +#: apt-inst/filelist.cc:481 #, c-format msgid "Trying to overwrite a diversion, %s -> %s and %s/%s" msgstr "" -#: apt-inst/filelist.cc:506 +#: apt-inst/filelist.cc:510 #, c-format msgid "Double add of diversion %s -> %s" msgstr "" -#: apt-inst/filelist.cc:549 +#: apt-inst/filelist.cc:553 #, c-format msgid "Duplicate conf file %s/%s" msgstr "ملف تهيئة مُزدوج %s/%s" -#: apt-inst/dirstream.cc:41 apt-inst/dirstream.cc:46 apt-inst/dirstream.cc:49 +#: apt-inst/dirstream.cc:45 apt-inst/dirstream.cc:50 apt-inst/dirstream.cc:53 #, c-format msgid "Failed to write file %s" msgstr "فشلت كتابة الملف %s" -#: apt-inst/dirstream.cc:92 apt-inst/dirstream.cc:100 +#: apt-inst/dirstream.cc:96 apt-inst/dirstream.cc:104 #, c-format msgid "Failed to close file %s" msgstr "فشل إغلاق الملف %s" -#: apt-inst/extract.cc:93 apt-inst/extract.cc:164 +#: apt-inst/extract.cc:96 apt-inst/extract.cc:167 #, c-format msgid "The path %s is too long" msgstr "المسار %s طويل جداً" -#: apt-inst/extract.cc:124 +#: apt-inst/extract.cc:127 #, c-format msgid "Unpacking %s more than once" msgstr "فكّ تحزيم %s أكثر من مرّة" -#: apt-inst/extract.cc:134 +#: apt-inst/extract.cc:137 #, c-format msgid "The directory %s is diverted" msgstr "" -#: apt-inst/extract.cc:144 +#: apt-inst/extract.cc:147 #, c-format msgid "The package is trying to write to the diversion target %s/%s" msgstr "" -#: apt-inst/extract.cc:154 apt-inst/extract.cc:297 +#: apt-inst/extract.cc:157 apt-inst/extract.cc:300 msgid "The diversion path is too long" msgstr "" -#: apt-inst/extract.cc:240 +#: apt-inst/extract.cc:243 #, c-format msgid "The directory %s is being replaced by a non-directory" msgstr "" -#: apt-inst/extract.cc:280 +#: apt-inst/extract.cc:283 msgid "Failed to locate node in its hash bucket" msgstr "" -#: apt-inst/extract.cc:284 +#: apt-inst/extract.cc:287 msgid "The path is too long" msgstr "المسار طويل جداً" -#: apt-inst/extract.cc:414 +#: apt-inst/extract.cc:417 #, c-format msgid "Overwrite package match with no version for %s" msgstr "" -#: apt-inst/extract.cc:431 +#: apt-inst/extract.cc:434 #, c-format msgid "File %s/%s overwrites the one in the package %s" msgstr "" -#: apt-inst/extract.cc:464 apt-pkg/contrib/configuration.cc:821 +#: apt-inst/extract.cc:467 apt-pkg/contrib/configuration.cc:753 #: apt-pkg/contrib/cdromutl.cc:150 apt-pkg/sourcelist.cc:320 #: apt-pkg/acquire.cc:418 apt-pkg/clean.cc:34 +#: apt-pkg/contrib/configuration.cc:821 apt-pkg/acquire.cc:419 +#: methods/mirror.cc:85 #, c-format msgid "Unable to read %s" msgstr "تعذرت قراءة %s" -#: apt-inst/extract.cc:491 +#: apt-inst/extract.cc:494 #, c-format msgid "Unable to stat %s" msgstr "" -#: apt-inst/deb/dpkgdb.cc:51 apt-inst/deb/dpkgdb.cc:57 +#: apt-inst/deb/dpkgdb.cc:55 apt-inst/deb/dpkgdb.cc:61 #, c-format msgid "Failed to remove %s" msgstr "تعذرت إزالة %s" -#: apt-inst/deb/dpkgdb.cc:106 apt-inst/deb/dpkgdb.cc:108 +#: apt-inst/deb/dpkgdb.cc:110 apt-inst/deb/dpkgdb.cc:112 #, c-format msgid "Unable to create %s" msgstr "تعذر إنشاء %s" -#: apt-inst/deb/dpkgdb.cc:114 +#: apt-inst/deb/dpkgdb.cc:118 #, c-format msgid "Failed to stat %sinfo" msgstr "" -#: apt-inst/deb/dpkgdb.cc:119 +#: apt-inst/deb/dpkgdb.cc:123 msgid "The info and temp directories need to be on the same filesystem" msgstr "" #. Build the status cache -#: apt-inst/deb/dpkgdb.cc:135 apt-pkg/pkgcachegen.cc:760 +#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:748 +#: apt-pkg/pkgcachegen.cc:817 apt-pkg/pkgcachegen.cc:822 +#: apt-pkg/pkgcachegen.cc:945 apt-pkg/pkgcachegen.cc:760 #: apt-pkg/pkgcachegen.cc:829 apt-pkg/pkgcachegen.cc:834 #: apt-pkg/pkgcachegen.cc:957 msgid "Reading package lists" msgstr "قراءة قوائم الحزم" -#: apt-inst/deb/dpkgdb.cc:176 +#: apt-inst/deb/dpkgdb.cc:180 #, c-format msgid "Failed to change to the admin dir %sinfo" msgstr "فشل تغيير دليل الإدارة إلى %sinfo" -#: apt-inst/deb/dpkgdb.cc:197 apt-inst/deb/dpkgdb.cc:351 -#: apt-inst/deb/dpkgdb.cc:444 +#: apt-inst/deb/dpkgdb.cc:201 apt-inst/deb/dpkgdb.cc:355 +#: apt-inst/deb/dpkgdb.cc:448 msgid "Internal error getting a package name" msgstr "خطأ داخلي أثناء الحصول على اسم الحزمة" -#: apt-inst/deb/dpkgdb.cc:201 apt-inst/deb/dpkgdb.cc:382 +#: apt-inst/deb/dpkgdb.cc:205 apt-inst/deb/dpkgdb.cc:386 msgid "Reading file listing" msgstr "قراءة سرد الملفات" -#: apt-inst/deb/dpkgdb.cc:212 +#: apt-inst/deb/dpkgdb.cc:216 #, c-format msgid "" "Failed to open the list file '%sinfo/%s'. If you cannot restore this file " @@ -1451,77 +1457,77 @@ msgid "" "package!" msgstr "" -#: apt-inst/deb/dpkgdb.cc:225 apt-inst/deb/dpkgdb.cc:238 +#: apt-inst/deb/dpkgdb.cc:229 apt-inst/deb/dpkgdb.cc:242 #, c-format msgid "Failed reading the list file %sinfo/%s" msgstr "فشلت قراءة ملف القائمة %sinfo/%s" -#: apt-inst/deb/dpkgdb.cc:262 +#: apt-inst/deb/dpkgdb.cc:266 msgid "Internal error getting a node" msgstr "خطأ داخلي أثناء الحصول على node" -#: apt-inst/deb/dpkgdb.cc:305 +#: apt-inst/deb/dpkgdb.cc:309 #, c-format msgid "Failed to open the diversions file %sdiversions" msgstr "" -#: apt-inst/deb/dpkgdb.cc:320 +#: apt-inst/deb/dpkgdb.cc:324 msgid "The diversion file is corrupted" msgstr "" -#: apt-inst/deb/dpkgdb.cc:327 apt-inst/deb/dpkgdb.cc:332 -#: apt-inst/deb/dpkgdb.cc:337 +#: apt-inst/deb/dpkgdb.cc:331 apt-inst/deb/dpkgdb.cc:336 +#: apt-inst/deb/dpkgdb.cc:341 #, c-format msgid "Invalid line in the diversion file: %s" msgstr "" -#: apt-inst/deb/dpkgdb.cc:358 +#: apt-inst/deb/dpkgdb.cc:362 msgid "Internal error adding a diversion" msgstr "" -#: apt-inst/deb/dpkgdb.cc:379 +#: apt-inst/deb/dpkgdb.cc:383 msgid "The pkg cache must be initialized first" msgstr "" -#: apt-inst/deb/dpkgdb.cc:439 +#: apt-inst/deb/dpkgdb.cc:443 #, c-format msgid "Failed to find a Package: header, offset %lu" msgstr "" -#: apt-inst/deb/dpkgdb.cc:461 +#: apt-inst/deb/dpkgdb.cc:465 #, c-format msgid "Bad ConfFile section in the status file. Offset %lu" msgstr "" -#: apt-inst/deb/dpkgdb.cc:466 +#: apt-inst/deb/dpkgdb.cc:470 #, c-format msgid "Error parsing MD5. Offset %lu" msgstr "" -#: apt-inst/deb/debfile.cc:38 apt-inst/deb/debfile.cc:43 +#: apt-inst/deb/debfile.cc:42 apt-inst/deb/debfile.cc:47 #, c-format msgid "This is not a valid DEB archive, missing '%s' member" msgstr "" -#: apt-inst/deb/debfile.cc:50 +#: apt-inst/deb/debfile.cc:52 #, c-format -msgid "This is not a valid DEB archive, it has no '%s', '%s' or '%s' member" +msgid "This is not a valid DEB archive, it has no '%s' or '%s' member" msgstr "" -#: apt-inst/deb/debfile.cc:110 +#: apt-inst/deb/debfile.cc:112 #, c-format msgid "Couldn't change to %s" msgstr "تعذر التغيير إلى %s" -#: apt-inst/deb/debfile.cc:140 +#: apt-inst/deb/debfile.cc:138 msgid "Internal error, could not locate member" msgstr "خطأ داخلي، تعذر العثور على العضو" -#: apt-inst/deb/debfile.cc:173 +#: apt-inst/deb/debfile.cc:171 msgid "Failed to locate a valid control file" msgstr "فشل العثور على ملف تحكّم صالح" -#: apt-inst/deb/debfile.cc:258 +#: apt-inst/deb/debfile.cc:256 msgid "Unparsable control file" msgstr "" @@ -1622,7 +1628,8 @@ msgstr "انتهى وقت الاتصال" msgid "Server closed the connection" msgstr "أغلق الخادم الاتصال" -#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:538 methods/rsh.cc:190 +#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:471 methods/rsh.cc:190 +#: apt-pkg/contrib/fileutl.cc:538 msgid "Read error" msgstr "خطأ في القراءة" @@ -1634,7 +1641,8 @@ msgstr "" msgid "Protocol corruption" msgstr "" -#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:577 methods/rsh.cc:232 +#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:510 methods/rsh.cc:232 +#: apt-pkg/contrib/fileutl.cc:577 msgid "Write error" msgstr "خطأ في الكتابة" @@ -1688,7 +1696,8 @@ msgstr "" msgid "Unable to accept connection" msgstr "تعذر قبول الاتصال" -#: methods/ftp.cc:864 methods/http.cc:960 methods/rsh.cc:303 +#: methods/ftp.cc:864 methods/http.cc:959 methods/rsh.cc:303 +#: methods/http.cc:993 msgid "Problem hashing file" msgstr "" @@ -1715,95 +1724,95 @@ msgstr "استعلام" msgid "Unable to invoke " msgstr "" -#: methods/connect.cc:70 +#: methods/connect.cc:64 methods/connect.cc:71 #, c-format msgid "Connecting to %s (%s)" msgstr "الاتصال بـ%s (%s)" -#: methods/connect.cc:81 +#: methods/connect.cc:71 methods/connect.cc:82 #, c-format msgid "[IP: %s %s]" msgstr "[IP: %s %s]" -#: methods/connect.cc:90 +#: methods/connect.cc:80 methods/connect.cc:89 #, c-format msgid "Could not create a socket for %s (f=%u t=%u p=%u)" msgstr "" -#: methods/connect.cc:96 +#: methods/connect.cc:86 methods/connect.cc:95 #, c-format msgid "Cannot initiate the connection to %s:%s (%s)." msgstr "تعذر تمهيد الاتصال بـ%s:%s (%s)." -#: methods/connect.cc:104 +#: methods/connect.cc:93 methods/connect.cc:103 #, c-format msgid "Could not connect to %s:%s (%s), connection timed out" msgstr "تعذر الاتصال بـ%s:%s (%s)، انتهى وقت الاتصال" -#: methods/connect.cc:119 +#: methods/connect.cc:108 methods/connect.cc:118 #, c-format msgid "Could not connect to %s:%s (%s)." msgstr "تعذر الاتصال بـ%s:%s (%s)." #. We say this mainly because the pause here is for the #. ssh connection that is still going -#: methods/connect.cc:147 methods/rsh.cc:425 +#: methods/connect.cc:136 methods/rsh.cc:425 methods/connect.cc:146 #, c-format msgid "Connecting to %s" msgstr "الاتصال بـ%s" -#: methods/connect.cc:165 methods/connect.cc:184 +#: methods/connect.cc:167 methods/connect.cc:164 methods/connect.cc:183 #, c-format msgid "Could not resolve '%s'" msgstr "" -#: methods/connect.cc:190 +#: methods/connect.cc:173 methods/connect.cc:189 #, c-format msgid "Temporary failure resolving '%s'" msgstr "" -#: methods/connect.cc:193 +#: methods/connect.cc:176 methods/connect.cc:192 #, c-format msgid "Something wicked happened resolving '%s:%s' (%i)" msgstr "" -#: methods/connect.cc:240 +#: methods/connect.cc:223 methods/connect.cc:239 #, c-format msgid "Unable to connect to %s %s:" msgstr "تعذر الاتصال بـ%s %s:" -#: methods/gpgv.cc:65 +#: methods/gpgv.cc:65 methods/gpgv.cc:71 #, c-format msgid "Couldn't access keyring: '%s'" msgstr "" -#: methods/gpgv.cc:101 +#: methods/gpgv.cc:101 methods/gpgv.cc:107 msgid "E: Argument list from Acquire::gpgv::Options too long. Exiting." msgstr "" -#: methods/gpgv.cc:205 +#: methods/gpgv.cc:205 methods/gpgv.cc:223 msgid "" "Internal error: Good signature, but could not determine key fingerprint?!" msgstr "" -#: methods/gpgv.cc:210 +#: methods/gpgv.cc:210 methods/gpgv.cc:228 msgid "At least one invalid signature was encountered." msgstr "" #: methods/gpgv.cc:214 #, c-format -msgid "Could not execute '%s' to verify signature (is gpgv installed?)" +msgid "Could not execute '%s' to verify signature (is gnupg installed?)" msgstr "" -#: methods/gpgv.cc:219 +#: methods/gpgv.cc:219 methods/gpgv.cc:237 msgid "Unknown error executing gpgv" msgstr "" -#: methods/gpgv.cc:250 +#: methods/gpgv.cc:250 methods/gpgv.cc:271 methods/gpgv.cc:278 msgid "The following signatures were invalid:\n" msgstr "" -#: methods/gpgv.cc:257 +#: methods/gpgv.cc:257 methods/gpgv.cc:285 msgid "" "The following signatures couldn't be verified because the public key is not " "available:\n" @@ -1819,81 +1828,78 @@ msgstr "" msgid "Read error from %s process" msgstr "" -#: methods/http.cc:377 +#: methods/http.cc:377 methods/http.cc:378 msgid "Waiting for headers" msgstr "بانتظار الترويسات" -#: methods/http.cc:523 +#: methods/http.cc:523 methods/http.cc:524 #, c-format msgid "Got a single header line over %u chars" msgstr "" -#: methods/http.cc:531 +#: methods/http.cc:531 methods/http.cc:532 msgid "Bad header line" msgstr "سطر ترويسة سيء" -#: methods/http.cc:550 methods/http.cc:557 +#: methods/http.cc:550 methods/http.cc:557 methods/http.cc:551 +#: methods/http.cc:558 msgid "The HTTP server sent an invalid reply header" msgstr "أرسل خادم http ترويسة ردّ غير صالحة" -#: methods/http.cc:586 +#: methods/http.cc:586 methods/http.cc:587 msgid "The HTTP server sent an invalid Content-Length header" msgstr "أرسل خادم http ترويسة طول محتويات (ِContent-Length) غير صالحة" -#: methods/http.cc:601 +#: methods/http.cc:601 methods/http.cc:602 msgid "The HTTP server sent an invalid Content-Range header" msgstr "أرسل خادم http ترويسة مدى محتويات (ِContent-Range) غير صالحة" -#: methods/http.cc:603 +#: methods/http.cc:603 methods/http.cc:604 msgid "This HTTP server has broken range support" msgstr "خادم http له دعم مدى معطوب" -#: methods/http.cc:627 +#: methods/http.cc:627 methods/http.cc:628 msgid "Unknown date format" msgstr "نسق تاريخ مجهول" -#: methods/http.cc:774 +#: methods/http.cc:774 methods/http.cc:781 msgid "Select failed" msgstr "فشل التحديد" -#: methods/http.cc:779 +#: methods/http.cc:779 methods/http.cc:786 msgid "Connection timed out" msgstr "انتهى وقت الاتصال" -#: methods/http.cc:802 +#: methods/http.cc:802 methods/http.cc:809 msgid "Error writing to output file" msgstr "خطأ في الكتابة إلى ملف المُخرجات" -#: methods/http.cc:833 +#: methods/http.cc:833 methods/http.cc:840 msgid "Error writing to file" msgstr "خطأ في الكتابة إلى الملف" -#: methods/http.cc:861 +#: methods/http.cc:861 methods/http.cc:868 msgid "Error writing to the file" msgstr "خطأ في الكتابة إلى الملف" -#: methods/http.cc:875 +#: methods/http.cc:875 methods/http.cc:882 msgid "Error reading from server. Remote end closed connection" msgstr "خطأ في القراءة من الخادم. أقفل الطرف الآخر الاتصال" -#: methods/http.cc:877 +#: methods/http.cc:877 methods/http.cc:884 msgid "Error reading from server" msgstr "خطأ في القراءة من الخادم" -#: methods/http.cc:945 apt-pkg/contrib/mmap.cc:196 -#, fuzzy -msgid "Failed to truncate file" -msgstr "فشلت كتابة الملف %s" - -#: methods/http.cc:1105 +#: methods/http.cc:1104 methods/http.cc:1143 msgid "Bad header data" msgstr "بيانات ترويسة سيئة" -#: methods/http.cc:1122 methods/http.cc:1177 +#: methods/http.cc:1121 methods/http.cc:1176 methods/http.cc:1160 +#: methods/http.cc:1215 msgid "Connection failed" msgstr "فشل الاتصال" -#: methods/http.cc:1229 +#: methods/http.cc:1228 methods/http.cc:1307 msgid "Internal error" msgstr "خطأ داخلي" @@ -1906,11 +1912,7 @@ msgstr "" msgid "Couldn't make mmap of %lu bytes" msgstr "" -#: apt-pkg/contrib/mmap.cc:213 -msgid "Dynamic MMap ran out of room" -msgstr "" - -#: apt-pkg/contrib/strutl.cc:1014 +#: apt-pkg/contrib/strutl.cc:978 apt-pkg/contrib/strutl.cc:1018 #, c-format msgid "Selection %s not found" msgstr "تعذر العثور على التحديد %s" @@ -1925,42 +1927,48 @@ msgstr "اختصار نوع مجهول: '%c'" msgid "Opening configuration file %s" msgstr "فتح ملف التهيئة %s" -#: apt-pkg/contrib/configuration.cc:662 +#: apt-pkg/contrib/configuration.cc:515 +#, fuzzy, c-format +msgid "Line %d too long (max %u)" +msgstr "السطر %d طويل جداً (أقصاه %d)" + +#: apt-pkg/contrib/configuration.cc:611 apt-pkg/contrib/configuration.cc:662 #, c-format msgid "Syntax error %s:%u: Block starts with no name." msgstr "" -#: apt-pkg/contrib/configuration.cc:681 +#: apt-pkg/contrib/configuration.cc:630 apt-pkg/contrib/configuration.cc:681 #, c-format msgid "Syntax error %s:%u: Malformed tag" msgstr "" -#: apt-pkg/contrib/configuration.cc:698 +#: apt-pkg/contrib/configuration.cc:647 apt-pkg/contrib/configuration.cc:698 #, c-format msgid "Syntax error %s:%u: Extra junk after value" msgstr "" -#: apt-pkg/contrib/configuration.cc:738 +#: apt-pkg/contrib/configuration.cc:687 apt-pkg/contrib/configuration.cc:738 #, c-format msgid "Syntax error %s:%u: Directives can only be done at the top level" msgstr "" -#: apt-pkg/contrib/configuration.cc:745 +#: apt-pkg/contrib/configuration.cc:694 apt-pkg/contrib/configuration.cc:745 #, c-format msgid "Syntax error %s:%u: Too many nested includes" msgstr "" +#: apt-pkg/contrib/configuration.cc:698 apt-pkg/contrib/configuration.cc:703 #: apt-pkg/contrib/configuration.cc:749 apt-pkg/contrib/configuration.cc:754 #, c-format msgid "Syntax error %s:%u: Included from here" msgstr "" -#: apt-pkg/contrib/configuration.cc:758 +#: apt-pkg/contrib/configuration.cc:707 apt-pkg/contrib/configuration.cc:758 #, c-format msgid "Syntax error %s:%u: Unsupported directive '%s'" msgstr "" -#: apt-pkg/contrib/configuration.cc:809 +#: apt-pkg/contrib/configuration.cc:741 apt-pkg/contrib/configuration.cc:809 #, c-format msgid "Syntax error %s:%u: Extra junk at end of file" msgstr "" @@ -2026,80 +2034,81 @@ msgstr "عمليّة غير صالحة %s" msgid "Unable to stat the mount point %s" msgstr "" -#: apt-pkg/contrib/cdromutl.cc:146 apt-pkg/contrib/cdromutl.cc:180 -#: apt-pkg/acquire.cc:424 apt-pkg/acquire.cc:449 apt-pkg/clean.cc:40 +#: apt-pkg/contrib/cdromutl.cc:146 apt-pkg/acquire.cc:424 apt-pkg/clean.cc:40 +#: apt-pkg/contrib/cdromutl.cc:180 apt-pkg/acquire.cc:425 +#: apt-pkg/acquire.cc:450 methods/mirror.cc:91 #, c-format msgid "Unable to change to %s" msgstr "" -#: apt-pkg/contrib/cdromutl.cc:188 +#: apt-pkg/contrib/cdromutl.cc:187 apt-pkg/contrib/cdromutl.cc:188 msgid "Failed to stat the cdrom" msgstr "" -#: apt-pkg/contrib/fileutl.cc:149 +#: apt-pkg/contrib/fileutl.cc:82 apt-pkg/contrib/fileutl.cc:149 #, c-format msgid "Not using locking for read only lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:154 +#: apt-pkg/contrib/fileutl.cc:87 apt-pkg/contrib/fileutl.cc:154 #, c-format msgid "Could not open lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:172 +#: apt-pkg/contrib/fileutl.cc:105 apt-pkg/contrib/fileutl.cc:172 #, c-format msgid "Not using locking for nfs mounted lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:176 +#: apt-pkg/contrib/fileutl.cc:109 apt-pkg/contrib/fileutl.cc:176 #, c-format msgid "Could not get lock %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:444 +#: apt-pkg/contrib/fileutl.cc:377 apt-pkg/contrib/fileutl.cc:444 #, c-format msgid "Waited for %s but it wasn't there" msgstr "" -#: apt-pkg/contrib/fileutl.cc:454 +#: apt-pkg/contrib/fileutl.cc:387 apt-pkg/contrib/fileutl.cc:454 #, c-format msgid "Sub-process %s received a segmentation fault." msgstr "" -#: apt-pkg/contrib/fileutl.cc:457 +#: apt-pkg/contrib/fileutl.cc:390 apt-pkg/contrib/fileutl.cc:457 #, c-format msgid "Sub-process %s returned an error code (%u)" msgstr "" -#: apt-pkg/contrib/fileutl.cc:459 +#: apt-pkg/contrib/fileutl.cc:392 apt-pkg/contrib/fileutl.cc:459 #, c-format msgid "Sub-process %s exited unexpectedly" msgstr "" -#: apt-pkg/contrib/fileutl.cc:503 +#: apt-pkg/contrib/fileutl.cc:436 apt-pkg/contrib/fileutl.cc:503 #, c-format msgid "Could not open file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:559 +#: apt-pkg/contrib/fileutl.cc:492 apt-pkg/contrib/fileutl.cc:559 #, c-format msgid "read, still have %lu to read but none left" msgstr "" -#: apt-pkg/contrib/fileutl.cc:589 +#: apt-pkg/contrib/fileutl.cc:522 apt-pkg/contrib/fileutl.cc:589 #, c-format msgid "write, still have %lu to write but couldn't" msgstr "" -#: apt-pkg/contrib/fileutl.cc:664 +#: apt-pkg/contrib/fileutl.cc:597 apt-pkg/contrib/fileutl.cc:664 msgid "Problem closing the file" msgstr "مشكلة في إغلاق الملف" -#: apt-pkg/contrib/fileutl.cc:670 +#: apt-pkg/contrib/fileutl.cc:603 apt-pkg/contrib/fileutl.cc:670 msgid "Problem unlinking the file" msgstr "" -#: apt-pkg/contrib/fileutl.cc:681 +#: apt-pkg/contrib/fileutl.cc:614 apt-pkg/contrib/fileutl.cc:681 msgid "Problem syncing the file" msgstr "مشكلة في مزامنة الملف" @@ -2276,46 +2285,40 @@ msgstr "" msgid "Index file type '%s' is not supported" msgstr "" -#: apt-pkg/algorithms.cc:248 +#: apt-pkg/algorithms.cc:247 apt-pkg/algorithms.cc:248 #, c-format msgid "" "The package %s needs to be reinstalled, but I can't find an archive for it." msgstr "" -#: apt-pkg/algorithms.cc:1107 +#: apt-pkg/algorithms.cc:1105 apt-pkg/algorithms.cc:1107 msgid "" "Error, pkgProblemResolver::Resolve generated breaks, this may be caused by " "held packages." msgstr "" -#: apt-pkg/algorithms.cc:1109 +#: apt-pkg/algorithms.cc:1107 apt-pkg/algorithms.cc:1109 msgid "Unable to correct problems, you have held broken packages." msgstr "" -#: apt-pkg/algorithms.cc:1375 apt-pkg/algorithms.cc:1377 -msgid "" -"Some index files failed to download, they have been ignored, or old ones " -"used instead." -msgstr "" - -#: apt-pkg/acquire.cc:59 +#: apt-pkg/acquire.cc:59 apt-pkg/acquire.cc:60 #, c-format msgid "Lists directory %spartial is missing." msgstr "" -#: apt-pkg/acquire.cc:63 +#: apt-pkg/acquire.cc:63 apt-pkg/acquire.cc:64 #, c-format msgid "Archive directory %spartial is missing." msgstr "" #. only show the ETA if it makes sense #. two days -#: apt-pkg/acquire.cc:828 +#: apt-pkg/acquire.cc:827 apt-pkg/acquire.cc:829 #, c-format msgid "Retrieving file %li of %li (%s remaining)" msgstr "" -#: apt-pkg/acquire.cc:830 +#: apt-pkg/acquire.cc:829 apt-pkg/acquire.cc:831 #, c-format msgid "Retrieving file %li of %li" msgstr "" @@ -2330,17 +2333,17 @@ msgstr "" msgid "Method %s did not start correctly" msgstr "" -#: apt-pkg/acquire-worker.cc:399 +#: apt-pkg/acquire-worker.cc:398 apt-pkg/acquire-worker.cc:413 #, c-format msgid "Please insert the disc labeled: '%s' in the drive '%s' and press enter." msgstr "الرجاء إدخال القرص المُسمّى '%s' في السوّاقة '%s' وضغط مفتاح الإدخال." -#: apt-pkg/init.cc:124 +#: apt-pkg/init.cc:124 apt-pkg/init.cc:125 #, c-format msgid "Packaging system '%s' is not supported" msgstr "نظام الحزم '%s' غير مدعوم" -#: apt-pkg/init.cc:140 +#: apt-pkg/init.cc:140 apt-pkg/init.cc:141 msgid "Unable to determine a suitable packaging system type" msgstr "" @@ -2353,11 +2356,11 @@ msgstr "" msgid "You must put some 'source' URIs in your sources.list" msgstr "" -#: apt-pkg/cachefile.cc:71 +#: apt-pkg/cachefile.cc:69 apt-pkg/cachefile.cc:71 msgid "The package lists or status file could not be parsed or opened." msgstr "" -#: apt-pkg/cachefile.cc:75 +#: apt-pkg/cachefile.cc:73 apt-pkg/cachefile.cc:75 msgid "You may want to run apt-get update to correct these problems" msgstr "قد يساعدك تنفيذ الأمر apt-get update في تصحيح هذه المشاكل" @@ -2388,124 +2391,126 @@ msgstr "حدث خطأ أثناء معالجة %s (NewPackage)" msgid "Error occurred while processing %s (UsePackage1)" msgstr "حدث خطأ أثناء معالجة %s (UserPackage1)" -#: apt-pkg/pkgcachegen.cc:164 +#: apt-pkg/pkgcachegen.cc:153 apt-pkg/pkgcachegen.cc:164 #, fuzzy, c-format msgid "Error occurred while processing %s (NewFileDesc1)" msgstr "حدث خطأ أثناء معالجة %s (NewFileVer1)" -#: apt-pkg/pkgcachegen.cc:189 +#: apt-pkg/pkgcachegen.cc:178 apt-pkg/pkgcachegen.cc:189 #, c-format msgid "Error occurred while processing %s (UsePackage2)" msgstr "حدث خطأ أثناء معالجة %s (UserPackage2)" -#: apt-pkg/pkgcachegen.cc:193 +#: apt-pkg/pkgcachegen.cc:182 apt-pkg/pkgcachegen.cc:193 #, c-format msgid "Error occurred while processing %s (NewFileVer1)" msgstr "حدث خطأ أثناء معالجة %s (NewFileVer1)" -#: apt-pkg/pkgcachegen.cc:224 +#: apt-pkg/pkgcachegen.cc:213 apt-pkg/pkgcachegen.cc:224 #, c-format msgid "Error occurred while processing %s (NewVersion1)" msgstr "حدث خطأ أثناء معالجة %s (NewVersion1)" -#: apt-pkg/pkgcachegen.cc:228 +#: apt-pkg/pkgcachegen.cc:217 apt-pkg/pkgcachegen.cc:228 #, c-format msgid "Error occurred while processing %s (UsePackage3)" msgstr "حدث خطأ أثناء معالجة %s (UsePackage3)" -#: apt-pkg/pkgcachegen.cc:232 +#: apt-pkg/pkgcachegen.cc:221 apt-pkg/pkgcachegen.cc:232 #, c-format msgid "Error occurred while processing %s (NewVersion2)" msgstr "حدث خطأ أثناء معالجة %s (NewVersion2)" -#: apt-pkg/pkgcachegen.cc:256 +#: apt-pkg/pkgcachegen.cc:245 apt-pkg/pkgcachegen.cc:256 #, fuzzy, c-format msgid "Error occurred while processing %s (NewFileDesc2)" msgstr "حدث خطأ أثناء معالجة %s (NewFileVer1)" -#: apt-pkg/pkgcachegen.cc:262 +#: apt-pkg/pkgcachegen.cc:251 apt-pkg/pkgcachegen.cc:262 msgid "Wow, you exceeded the number of package names this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:265 +#: apt-pkg/pkgcachegen.cc:254 apt-pkg/pkgcachegen.cc:265 msgid "Wow, you exceeded the number of versions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:268 +#: apt-pkg/pkgcachegen.cc:257 apt-pkg/pkgcachegen.cc:268 msgid "Wow, you exceeded the number of descriptions this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:271 +#: apt-pkg/pkgcachegen.cc:260 apt-pkg/pkgcachegen.cc:271 msgid "Wow, you exceeded the number of dependencies this APT is capable of." msgstr "" -#: apt-pkg/pkgcachegen.cc:299 +#: apt-pkg/pkgcachegen.cc:288 apt-pkg/pkgcachegen.cc:299 #, c-format msgid "Error occurred while processing %s (FindPkg)" msgstr "" -#: apt-pkg/pkgcachegen.cc:312 +#: apt-pkg/pkgcachegen.cc:301 apt-pkg/pkgcachegen.cc:312 #, c-format msgid "Error occurred while processing %s (CollectFileProvides)" msgstr "" -#: apt-pkg/pkgcachegen.cc:318 +#: apt-pkg/pkgcachegen.cc:307 apt-pkg/pkgcachegen.cc:318 #, c-format msgid "Package %s %s was not found while processing file dependencies" msgstr "" -#: apt-pkg/pkgcachegen.cc:690 +#: apt-pkg/pkgcachegen.cc:678 apt-pkg/pkgcachegen.cc:690 #, c-format msgid "Couldn't stat source package list %s" msgstr "" -#: apt-pkg/pkgcachegen.cc:775 +#: apt-pkg/pkgcachegen.cc:763 apt-pkg/pkgcachegen.cc:775 msgid "Collecting File Provides" msgstr "" +#: apt-pkg/pkgcachegen.cc:890 apt-pkg/pkgcachegen.cc:897 #: apt-pkg/pkgcachegen.cc:902 apt-pkg/pkgcachegen.cc:909 msgid "IO Error saving source cache" msgstr "" -#: apt-pkg/acquire-item.cc:127 +#: apt-pkg/acquire-item.cc:127 apt-pkg/acquire-item.cc:134 #, c-format msgid "rename failed, %s (%s -> %s)." msgstr "فشل إعادة التسمية ، %s (%s -> %s)." -#: apt-pkg/acquire-item.cc:401 +#: apt-pkg/acquire-item.cc:401 apt-pkg/acquire-item.cc:451 msgid "MD5Sum mismatch" msgstr "MD5Sum غير متطابقة" -#: apt-pkg/acquire-item.cc:658 apt-pkg/acquire-item.cc:1426 +#: apt-pkg/acquire-item.cc:647 apt-pkg/acquire-item.cc:1408 +#: apt-pkg/acquire-item.cc:707 apt-pkg/acquire-item.cc:1478 #, fuzzy msgid "Hash Sum mismatch" msgstr "MD5Sum غير متطابقة" -#: apt-pkg/acquire-item.cc:1118 +#: apt-pkg/acquire-item.cc:1100 apt-pkg/acquire-item.cc:1170 msgid "There is no public key available for the following key IDs:\n" msgstr "" -#: apt-pkg/acquire-item.cc:1231 +#: apt-pkg/acquire-item.cc:1213 apt-pkg/acquire-item.cc:1283 #, c-format msgid "" "I wasn't able to locate a file for the %s package. This might mean you need " "to manually fix this package. (due to missing arch)" msgstr "" -#: apt-pkg/acquire-item.cc:1290 +#: apt-pkg/acquire-item.cc:1272 apt-pkg/acquire-item.cc:1342 #, c-format msgid "" "I wasn't able to locate file for the %s package. This might mean you need to " "manually fix this package." msgstr "" -#: apt-pkg/acquire-item.cc:1331 +#: apt-pkg/acquire-item.cc:1313 apt-pkg/acquire-item.cc:1383 #, c-format msgid "" "The package index files are corrupted. No Filename: field for package %s." msgstr "" -#: apt-pkg/acquire-item.cc:1418 +#: apt-pkg/acquire-item.cc:1400 apt-pkg/acquire-item.cc:1470 msgid "Size mismatch" msgstr "الحجم غير متطابق" @@ -2560,8 +2565,8 @@ msgstr "" #: apt-pkg/cdrom.cc:678 #, c-format msgid "" -"Found %zu package indexes, %zu source indexes, %zu translation indexes and %" -"zu signatures\n" +"Found %u package indexes, %u source indexes, %u translation indexes and %u " +"signatures\n" msgstr "" #: apt-pkg/cdrom.cc:715 @@ -2594,98 +2599,92 @@ msgstr "كتابة لائحة المصادر الجديدة\n" msgid "Source list entries for this disc are:\n" msgstr "" -#: apt-pkg/indexcopy.cc:263 apt-pkg/indexcopy.cc:823 +#: apt-pkg/indexcopy.cc:263 apt-pkg/indexcopy.cc:823 apt-pkg/indexcopy.cc:832 #, c-format msgid "Wrote %i records.\n" msgstr "" -#: apt-pkg/indexcopy.cc:265 apt-pkg/indexcopy.cc:825 +#: apt-pkg/indexcopy.cc:265 apt-pkg/indexcopy.cc:825 apt-pkg/indexcopy.cc:834 #, c-format msgid "Wrote %i records with %i missing files.\n" msgstr "" -#: apt-pkg/indexcopy.cc:268 apt-pkg/indexcopy.cc:828 +#: apt-pkg/indexcopy.cc:268 apt-pkg/indexcopy.cc:828 apt-pkg/indexcopy.cc:837 #, c-format msgid "Wrote %i records with %i mismatched files\n" msgstr "" -#: apt-pkg/indexcopy.cc:271 apt-pkg/indexcopy.cc:831 +#: apt-pkg/indexcopy.cc:271 apt-pkg/indexcopy.cc:831 apt-pkg/indexcopy.cc:840 #, c-format msgid "Wrote %i records with %i missing files and %i mismatched files\n" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:49 -#, fuzzy, c-format -msgid "Installing %s" -msgstr "تم تثبيت %s" - -#: apt-pkg/deb/dpkgpm.cc:50 apt-pkg/deb/dpkgpm.cc:612 -#, c-format -msgid "Configuring %s" -msgstr "تهيئة %s" - -#: apt-pkg/deb/dpkgpm.cc:51 apt-pkg/deb/dpkgpm.cc:627 -#, c-format -msgid "Removing %s" -msgstr "إزالة %s" - -#: apt-pkg/deb/dpkgpm.cc:52 -#, c-format -msgid "Running post-installation trigger %s" -msgstr "" - -#: apt-pkg/deb/dpkgpm.cc:521 +#: apt-pkg/deb/dpkgpm.cc:513 apt-pkg/deb/dpkgpm.cc:532 #, c-format msgid "Directory '%s' missing" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:605 +#: apt-pkg/deb/dpkgpm.cc:596 apt-pkg/deb/dpkgpm.cc:621 #, c-format msgid "Preparing %s" msgstr "تحضير %s" -#: apt-pkg/deb/dpkgpm.cc:606 +#: apt-pkg/deb/dpkgpm.cc:597 apt-pkg/deb/dpkgpm.cc:622 #, c-format msgid "Unpacking %s" msgstr "فتح %s" -#: apt-pkg/deb/dpkgpm.cc:611 +#: apt-pkg/deb/dpkgpm.cc:602 apt-pkg/deb/dpkgpm.cc:627 #, c-format msgid "Preparing to configure %s" msgstr "التحضير لتهيئة %s" -#: apt-pkg/deb/dpkgpm.cc:614 apt-pkg/deb/dpkgpm.cc:615 +#: apt-pkg/deb/dpkgpm.cc:603 apt-pkg/deb/dpkgpm.cc:52 +#: apt-pkg/deb/dpkgpm.cc:628 +#, c-format +msgid "Configuring %s" +msgstr "تهيئة %s" + +#: apt-pkg/deb/dpkgpm.cc:605 apt-pkg/deb/dpkgpm.cc:606 +#: apt-pkg/deb/dpkgpm.cc:630 apt-pkg/deb/dpkgpm.cc:631 #, fuzzy, c-format msgid "Processing triggers for %s" msgstr "خطأ في معالجة الدليل %s" -#: apt-pkg/deb/dpkgpm.cc:617 +#: apt-pkg/deb/dpkgpm.cc:608 apt-pkg/deb/dpkgpm.cc:633 #, c-format msgid "Installed %s" msgstr "تم تثبيت %s" -#: apt-pkg/deb/dpkgpm.cc:622 apt-pkg/deb/dpkgpm.cc:624 -#: apt-pkg/deb/dpkgpm.cc:625 +#: apt-pkg/deb/dpkgpm.cc:613 apt-pkg/deb/dpkgpm.cc:615 +#: apt-pkg/deb/dpkgpm.cc:616 apt-pkg/deb/dpkgpm.cc:638 +#: apt-pkg/deb/dpkgpm.cc:640 apt-pkg/deb/dpkgpm.cc:641 #, c-format msgid "Preparing for removal of %s" msgstr "التحضير لإزالة %s" -#: apt-pkg/deb/dpkgpm.cc:628 +#: apt-pkg/deb/dpkgpm.cc:618 apt-pkg/deb/dpkgpm.cc:53 +#: apt-pkg/deb/dpkgpm.cc:643 +#, c-format +msgid "Removing %s" +msgstr "إزالة %s" + +#: apt-pkg/deb/dpkgpm.cc:619 apt-pkg/deb/dpkgpm.cc:644 #, c-format msgid "Removed %s" msgstr "تم إزالة %s" -#: apt-pkg/deb/dpkgpm.cc:633 +#: apt-pkg/deb/dpkgpm.cc:624 apt-pkg/deb/dpkgpm.cc:649 #, c-format msgid "Preparing to completely remove %s" msgstr "التحضير لإزالة %s بالكامل" -#: apt-pkg/deb/dpkgpm.cc:634 +#: apt-pkg/deb/dpkgpm.cc:625 apt-pkg/deb/dpkgpm.cc:650 #, c-format msgid "Completely removed %s" msgstr "تمت إزالة %s بالكامل" -#: apt-pkg/deb/dpkgpm.cc:791 +#: apt-pkg/deb/dpkgpm.cc:775 apt-pkg/deb/dpkgpm.cc:805 msgid "Can not write log, openpty() failed (/dev/pts not mounted?)\n" msgstr "" @@ -2697,9 +2696,146 @@ msgstr "" msgid "Connection closed prematurely" msgstr "" +#: methods/gpgv.cc:232 +#, c-format +msgid "Could not execute '%s' to verify signature (is gpgv installed?)" +msgstr "" + +#: methods/http.cc:978 apt-pkg/contrib/mmap.cc:196 #, fuzzy -#~ msgid "Line %d too long (max %lu)" -#~ msgstr "السطر %d طويل جداً (أقصاه %d)" +msgid "Failed to truncate file" +msgstr "فشلت كتابة الملف %s" + +#: apt-pkg/contrib/mmap.cc:213 apt-pkg/contrib/mmap.cc:276 +#, c-format +msgid "" +"Dynamic MMap ran out of room. Please increase the size of APT::Cache-Limit. " +"Current value: %lu. (man 5 apt.conf)" +msgstr "" + +#. d means days, h means hours, min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:335 +#, c-format +msgid "%lid %lih %limin %lis" +msgstr "" + +#. h means hours, min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:342 +#, c-format +msgid "%lih %limin %lis" +msgstr "" + +#. min means minutes, s means seconds +#: apt-pkg/contrib/strutl.cc:349 +#, c-format +msgid "%limin %lis" +msgstr "" + +#. s means seconds +#: apt-pkg/contrib/strutl.cc:354 +#, c-format +msgid "%lis" +msgstr "" + +#: apt-pkg/acquire-item.cc:1244 +#, c-format +msgid "" +"A error occurred during the signature verification. The repository is not " +"updated and the previous index files will be used.GPG error: %s: %s\n" +msgstr "" + +#: apt-pkg/acquire-item.cc:1253 +#, c-format +msgid "GPG error: %s: %s" +msgstr "" + +#: apt-pkg/indexrecords.cc:40 +#, fuzzy, c-format +msgid "Unable to parse Release file %s" +msgstr "تعذر فتح ملف قاعدة البيانات %s: %s" + +#: apt-pkg/indexrecords.cc:47 +#, fuzzy, c-format +msgid "No sections in Release file %s" +msgstr "لاحظ، تحديد %s بدلاً من %s\n" + +#: apt-pkg/indexrecords.cc:81 +#, c-format +msgid "No Hash entry in Release file %s" +msgstr "" + +#: apt-pkg/cdrom.cc:678 +#, c-format +msgid "" +"Found %zu package indexes, %zu source indexes, %zu translation indexes and %" +"zu signatures\n" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:51 +#, fuzzy, c-format +msgid "Installing %s" +msgstr "تم تثبيت %s" + +#: apt-pkg/deb/dpkgpm.cc:54 +#, c-format +msgid "Running post-installation trigger %s" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1011 +msgid "No apport report written because MaxReports is reached already" +msgstr "" + +#. check if its not a follow up error +#: apt-pkg/deb/dpkgpm.cc:1016 +msgid "dependency problems - leaving unconfigured" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1018 +msgid "" +"No apport report written because the error message indicates its a followup " +"error from a previous failure." +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1024 +msgid "" +"No apport report written because the error message indicates a disk full " +"error" +msgstr "" + +#: apt-pkg/deb/dpkgpm.cc:1030 +msgid "" +"No apport report written because the error message indicates a out of memory " +"error" +msgstr "" + +#: apt-pkg/deb/debsystem.cc:70 +#, c-format +msgid "" +"Unable to lock the administration directory (%s), is another process using " +"it?" +msgstr "" + +#: apt-pkg/deb/debsystem.cc:73 +#, fuzzy, c-format +msgid "Unable to lock the administration directory (%s), are you root?" +msgstr "تعذر قفل دليل القائمة" + +#: apt-pkg/deb/debsystem.cc:82 +msgid "" +"dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to " +"correct the problem. " +msgstr "" + +#: apt-pkg/deb/debsystem.cc:100 +msgid "Not locked" +msgstr "" + +#. FIXME: fallback to a default mirror here instead +#. and provide a config option to define that default +#: methods/mirror.cc:172 +#, c-format +msgid "No mirror file '%s' found " +msgstr "" #, fuzzy #~ msgid "Line %d too long (max %d)" -- cgit v1.2.3-70-g09d2 From 5c8a2aa8d5fa2f5e3342e9abd2b750f1615a226a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 28 Apr 2009 16:55:10 +0200 Subject: include apt ordering into apport package failures --- apt-pkg/deb/dpkgpm.cc | 6 ++++++ debian/changelog | 1 + 2 files changed, 7 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index f57bff32c..b41b38bd5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1124,6 +1124,12 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) } } + // log the ordering + const char *ops_str[] = {"Install", "Configure","Remove","Purge"}; + fprintf(report, "AptOrdering:\n"); + for (vector::iterator I = List.begin(); I != List.end(); I++) + fprintf(report, " %s: %s\n", (*I).Pkg.Name(), ops_str[(*I).Op]); + // attach dmesg log (to learn about segfaults) if (FileExists("/bin/dmesg")) { diff --git a/debian/changelog b/debian/changelog index a62e13bad..d3d28d0dc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ apt (0.7.20.2ubuntu7) karmic; urgency=low Thanks to M. Vefa Bicakci (LP: #80248) * build fixes for g++-4.4 * include dmesg output in apport package failures + * include apt ordering into apport package failures -- Michael Vogt Fri, 24 Apr 2009 10:14:01 +0200 -- cgit v1.2.3-70-g09d2 From 076c46e5fe4a0ec150952017650c4cc778dc2fd2 Mon Sep 17 00:00:00 2001 From: Matt Zimmerman Date: Thu, 6 Aug 2009 17:44:51 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - Suppress apport reports on dpkg short reads (these I/O errors are not generally indicative of a bug in the packaging) --- apt-pkg/deb/dpkgpm.cc | 7 +++++++ debian/changelog | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 4403eaefe..3e23720e0 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1078,6 +1078,13 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) return; } + // do not report dpkg I/O errors + // XXX - this message is localized, but this only matches the English version. This is better than nothing. + if(strstr(errormsg, "short read in buffer_copy (")) { + std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl; + return; + } + // get the pkgname and reportfile pkgname = flNotDir(pkgpath); pos = pkgname.find('_'); diff --git a/debian/changelog b/debian/changelog index f6c282f42..3d5db8114 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,18 @@ apt (0.7.23ubuntu1) karmic; urgency=low + [ Michael Vogt ] * merged from the debian-sid bzr branch * cmdline/apt-get.cc: - honor APT::Get::Only-Source properly in FindSrc() (thanks to Martin Pitt for reporting the problem) - -- Michael Vogt Thu, 30 Jul 2009 15:27:30 +0200 + [ Matt Zimmerman ] + * apt-pkg/deb/dpkgpm.cc: + - Suppress apport reports on dpkg short reads (these I/O errors are not + generally indicative of a bug in the packaging) + + -- Matt Zimmerman Thu, 06 Aug 2009 16:37:04 +0100 apt (0.7.22) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 2183a0862311cf2fbb82f61ecdcdf3816ce90040 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Dec 2009 10:40:37 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - include df -l output in the apport log as well (thanks to tjaalton) --- apt-pkg/deb/dpkgpm.cc | 17 +++++++++++++++++ debian/changelog | 3 +++ 2 files changed, 20 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 7daa55a58..500d4a260 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1243,6 +1243,23 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) fclose(log); } } + + // attach df -l log (to learn about filesystem status) + if (FileExists("/bin/df")) + { + FILE *log = NULL; + char buf[1024]; + + fprintf(report, "Df:\n"); + log = popen("/bin/df -l","r"); + if(log != NULL) + { + while( fgets(buf, sizeof(buf), log) != NULL) + fprintf(report, " %s", buf); + fclose(log); + } + } + fclose(report); } diff --git a/debian/changelog b/debian/changelog index 20bcf9bb9..0113fb95a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ apt (0.7.24ubuntu1) UNRELEASED; urgency=low triggers-pending state. dpkg will deal with the trigger and it if does it before we trigger it, dpkg will error out (LP: #414631) + * apt-pkg/deb/dpkgpm.cc: + - include df -l output in the apport log as well (thanks to + tjaalton) [ Matt Zimmerman ] * apt-pkg/deb/dpkgpm.cc: -- cgit v1.2.3-70-g09d2 From 5bf15716398fdb767ca6249a0155219b88d7ae60 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 19 Dec 2009 16:25:56 +0100 Subject: Implement the first step toward Multi-Arch by setting up a Group infrastructor for packages. APT is now aware of the fact that a package A in architecture X can't satisfy a dependency on package A in architecture Y - to handle these packages are now identified by name and architecture, so different architectures of the same package are handled internally as completly different packages. This is great for pinning, dependency checking and in many other situations, but sometimes we need to know which archs are available for a given package: Here Groups come to our rescue! --- apt-pkg/cacheiterators.h | 37 ++++++++++++-- apt-pkg/deb/deblistparser.cc | 40 +++++++++++----- apt-pkg/deb/deblistparser.h | 1 + apt-pkg/pkgcache.cc | 112 ++++++++++++++++++++++++++++++++++++------- apt-pkg/pkgcache.h | 30 ++++++++++-- apt-pkg/pkgcachegen.cc | 111 +++++++++++++++++++++++++++++------------- apt-pkg/pkgcachegen.h | 6 ++- 7 files changed, 267 insertions(+), 70 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 1da5c6f02..35d3aa228 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -31,10 +31,8 @@ #define PKGLIB_CACHEITERATORS_H // abstract Iterator template /*{{{*/ /* This template provides the very basic iterator methods we - need to have for doing some walk-over-the-cache magic, */ + need to have for doing some walk-over-the-cache magic */ template class pkgCache::Iterator { - __attribute__ ((deprecated)) void _dummy(); // FIXME: Who on earth uses this method ??? - protected: Str *S; pkgCache *Owner; @@ -75,6 +73,35 @@ template class pkgCache::Iterator { // Constructors - look out for the variable assigning inline Iterator() : S(0), Owner(0) {}; inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}; +}; + /*}}}*/ +// Group Iterator /*{{{*/ +/* Packages with the same name are collected in a Group so someone only + interest in package names can iterate easily over the names, so the + different architectures can be treated as of the "same" package + (apt internally treat them as totally different packages) */ +class pkgCache::GrpIterator: public Iterator { + protected: + inline Group* OwnerPointer() const { + return Owner->GrpP; + }; + + public: + void operator ++(int) {if (S != Owner->GrpP) S = Owner->GrpP + S->Next;}; + virtual void operator ++() {operator ++(0);}; + + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; + inline PkgIterator PackageList() const; + PkgIterator FindPkg(string Arch = "any"); + PkgIterator NextPkg(PkgIterator const &Pkg); + + // Constructors + inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg) { + if (S == 0) + S = OwnerPointer(); + }; + inline GrpIterator() : Iterator() {}; + }; /*}}}*/ // Package Iterator /*{{{*/ @@ -103,6 +130,8 @@ class pkgCache::PkgIterator: public Iterator { inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}; + inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}; + inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}; inline VerIterator VersionList() const; inline VerIterator CurrentVer() const; @@ -339,6 +368,8 @@ class pkgCache::DescFileIterator : public Iterator { }; /*}}}*/ // Inlined Begin functions cant be in the class because of order problems /*{{{*/ +inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const + {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}; inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const {return VerIterator(*Owner,Owner->VerP + S->VersionList);}; inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 25a1df3f9..fe68aec0b 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -53,12 +53,25 @@ unsigned long debListParser::UniqFindTagWrite(const char *Tag) // ListParser::Package - Return the package name /*{{{*/ // --------------------------------------------------------------------- /* This is to return the name of the package this section describes */ -string debListParser::Package() -{ - string Result = Section.FindS("Package"); - if (Result.empty() == true) - _error->Error("Encountered a section with no Package: header"); - return Result; +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; +} + /*}}}*/ +// ListParser::Architecture - Return the package arch /*{{{*/ +// --------------------------------------------------------------------- +/* This will return the Architecture of the package this section describes + 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) + return Arch; + if (Result == "all") + return Arch; + return Result; } /*}}}*/ // ListParser::Version - Return the version string /*{{{*/ @@ -78,8 +91,10 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) { // Parse the section Ver->Section = UniqFindTagWrite("Section"); - Ver->Arch = UniqFindTagWrite("Architecture"); - + + // Parse the architecture + Ver->Arch = WriteUniqString(Architecture()); + // Archive Size Ver->Size = (unsigned)Section.FindI("Size"); @@ -537,6 +552,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, return true; string Package; + string const pkgArch = Ver.Arch(); string Version; unsigned int Op; @@ -546,7 +562,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); - if (NewDepends(Ver,Package,Version,Op,Type) == false) + if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false) return false; if (Start == Stop) break; @@ -619,6 +635,7 @@ bool debListParser::Step() if (Section.Find("Architecture",Start,Stop) == false) return true; + //FIXME: Accept different Architectures here if (stringcmp(Arch,Start,Stop) == 0) return true; @@ -641,8 +658,9 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI, if (Tags.Step(Section) == false) return false; - //mvo: I don't think we need to fill that in (it's unused since apt-0.6) - //FileI->Architecture = WriteUniqString(Arch); + // FIXME: Do we need it now for multi-arch? + // mvo: I don't think we need to fill that in (it's unused since apt-0.6) +// FileI->Architecture = WriteUniqString(Arch); // apt-secure does no longer download individual (per-section) Release // file. to provide Component pinning we use the section name now diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 1c709229f..5f91e073e 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -46,6 +46,7 @@ class debListParser : public pkgCacheGenerator::ListParser // These all operate against the current section virtual string Package(); + virtual string Architecture(); virtual string Version(); virtual bool NewVersion(pkgCache::VerIterator Ver); virtual string Description(); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 2f8bde6f7..2b5f53f6f 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -79,7 +79,8 @@ pkgCache::Header::Header() StringList = 0; VerSysName = 0; Architecture = 0; - memset(HashTable,0,sizeof(HashTable)); + memset(PkgHashTable,0,sizeof(PkgHashTable)); + memset(GrpHashTable,0,sizeof(GrpHashTable)); memset(Pools,0,sizeof(Pools)); } /*}}}*/ @@ -118,6 +119,7 @@ bool pkgCache::ReMap() { // Apply the typecasts. HeaderP = (Header *)Map.Data(); + GrpP = (Group *)Map.Data(); PkgP = (Package *)Map.Data(); VerFileP = (VerFile *)Map.Data(); DescFileP = (DescFile *)Map.Data(); @@ -165,7 +167,7 @@ unsigned long pkgCache::sHash(const string &Str) const unsigned long Hash = 0; for (string::const_iterator I = Str.begin(); I != Str.end(); I++) Hash = 5*Hash + tolower_ascii(*I); - return Hash % _count(HeaderP->HashTable); + return Hash % _count(HeaderP->PkgHashTable); } unsigned long pkgCache::sHash(const char *Str) const @@ -173,24 +175,40 @@ unsigned long pkgCache::sHash(const char *Str) const unsigned long Hash = 0; for (const char *I = Str; *I != 0; I++) Hash = 5*Hash + tolower_ascii(*I); - return Hash % _count(HeaderP->HashTable); + return Hash % _count(HeaderP->PkgHashTable); } /*}}}*/ // Cache::FindPkg - Locate a package by name /*{{{*/ // --------------------------------------------------------------------- /* Returns 0 on error, pointer to the package otherwise */ -pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) -{ - // Look at the hash bucket - Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)]; - for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage) - { - if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] && - stringcasecmp(Name,StrP + Pkg->Name) == 0) - return PkgIterator(*this,Pkg); - } - return PkgIterator(*this,0); +pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string Arch) { + /* We make a detour via the GrpIterator here as + on a multi-arch environment a group is easier to + find than a package (less entries in the buckets) */ + pkgCache::GrpIterator Grp = FindGrp(Name); + if (Grp.end() == true) + return PkgIterator(*this,0); + + return Grp.FindPkg(Arch); +} + /*}}}*/ +// Cache::FindGrp - Locate a group by name /*{{{*/ +// --------------------------------------------------------------------- +/* Returns End-Pointer on error, pointer to the group otherwise */ +pkgCache::GrpIterator pkgCache::FindGrp(const string &Name) { + if (unlikely(Name.empty() == true)) + return GrpIterator(*this,0); + + // Look at the hash bucket for the group + Group *Grp = GrpP + HeaderP->GrpHashTable[sHash(Name)]; + for (; Grp != GrpP; Grp = GrpP + Grp->Next) { + if (Grp->Name != 0 && StrP[Grp->Name] == Name[0] && + stringcasecmp(Name, StrP + Grp->Name) == 0) + return GrpIterator(*this, Grp); + } + + return GrpIterator(*this,0); } /*}}}*/ // Cache::CompTypeDeb - Return a string describing the compare type /*{{{*/ @@ -242,6 +260,68 @@ const char *pkgCache::Priority(unsigned char Prio) return 0; } /*}}}*/ +// GrpIterator::FindPkg - Locate a package by arch /*{{{*/ +// --------------------------------------------------------------------- +/* Returns an End-Pointer on error, pointer to the package otherwise */ +pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) { + if (unlikely(IsGood() == false || S->FirstPackage == 0)) + return PkgIterator(*Owner, 0); + + static string const myArch = _config->Find("APT::Architecture"); + /* Most of the time the package for our native architecture is + the one we add at first to the cache, but this would be the + last one we check, so we do it now. */ + if (Arch == "native" || Arch == myArch) { + Arch = myArch; + pkgCache::Package *Pkg = Owner->PkgP + S->LastPackage; + if (stringcasecmp(Arch, Owner->StrP + Pkg->Arch) == 0) + return PkgIterator(*Owner, Pkg); + } + + /* If we accept any package we simply return the "first" + package in this group (the last one added). */ + if (Arch == "any") + return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage); + + /* Iterate over the list to find the matching arch + unfortunately this list includes "package noise" + (= different packages with same calculated hash), + so we need to check the name also */ + for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP; + Pkg = Owner->PkgP + Pkg->NextPackage) { + if (S->Name == Pkg->Name && + stringcasecmp(Arch, Owner->StrP + Pkg->Arch) == 0) + return PkgIterator(*Owner, Pkg); + if ((Owner->PkgP + S->LastPackage) == Pkg) + break; + } + + return PkgIterator(*Owner, 0); +} + /*}}}*/ +// GrpIterator::NextPkg - Locate the next package in the group /*{{{*/ +// --------------------------------------------------------------------- +/* Returns an End-Pointer on error, pointer to the package otherwise. + We can't simply ++ to the next as the list of packages includes + "package noise" (= packages with the same hash value but different name) */ +pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const &LastPkg) { + if (unlikely(IsGood() == false || S->FirstPackage == 0 || + LastPkg.end() == true)) + return PkgIterator(*Owner, 0); + + // Iterate over the list to find the next package + pkgCache::Package *Pkg = Owner->PkgP + LastPkg.Index(); + Pkg = Owner->PkgP + Pkg->NextPackage; + for (; Pkg != Owner->PkgP; Pkg = Owner->PkgP + Pkg->NextPackage) { + if (S->Name == Pkg->Name) + return PkgIterator(*Owner, Pkg); + if ((Owner->PkgP + S->LastPackage) == Pkg) + break; + } + + return PkgIterator(*Owner, 0); +} + /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical package in the hash table. */ @@ -252,10 +332,10 @@ void pkgCache::PkgIterator::operator ++(int) S = Owner->PkgP + S->NextPackage; // Follow the hash table - while (S == Owner->PkgP && (HashIndex+1) < (signed)_count(Owner->HeaderP->HashTable)) + while (S == Owner->PkgP && (HashIndex+1) < (signed)_count(Owner->HeaderP->PkgHashTable)) { HashIndex++; - S = Owner->PkgP + Owner->HeaderP->HashTable[HashIndex]; + S = Owner->PkgP + Owner->HeaderP->PkgHashTable[HashIndex]; } }; /*}}}*/ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 359f8a590..b3d2752d2 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -32,6 +32,7 @@ class pkgCache /*{{{*/ public: // Cache element predeclarations struct Header; + struct Group; struct Package; struct PackageFile; struct Version; @@ -44,6 +45,7 @@ class pkgCache /*{{{*/ // Iterators template class Iterator; + class GrpIterator; class PkgIterator; class VerIterator; class DescIterator; @@ -97,6 +99,7 @@ class pkgCache /*{{{*/ // Pointers to the arrays of items Header *HeaderP; + Group *GrpP; Package *PkgP; VerFile *VerFileP; DescFile *DescFileP; @@ -121,7 +124,9 @@ class pkgCache /*{{{*/ const char *Priority(unsigned char Priority); // Accessors - PkgIterator FindPkg(const string &Name); + GrpIterator FindGrp(const string &Name); + PkgIterator FindPkg(const string &Name, string Arch = "native"); + Header &Head() {return *HeaderP;}; inline PkgIterator PkgBegin(); inline PkgIterator PkgEnd(); @@ -161,6 +166,7 @@ struct pkgCache::Header unsigned short DescFileSz; // Structure counts + unsigned long GroupCount; unsigned long PackageCount; unsigned long VersionCount; unsigned long DescriptionCount; @@ -180,22 +186,36 @@ struct pkgCache::Header /* Allocation pools, there should be one of these for each structure excluding the header */ - DynamicMMap::Pool Pools[8]; + DynamicMMap::Pool Pools[9]; - // Rapid package name lookup - map_ptrloc HashTable[2*1048]; + // Rapid package and group name lookup + // Notice: Increase only both table sizes as the + // hashmethod assume the size of the Pkg one + map_ptrloc PkgHashTable[2*1048]; + map_ptrloc GrpHashTable[2*1048]; bool CheckSizes(Header &Against) const; Header(); }; /*}}}*/ +struct pkgCache::Group { /*{{{*/ + map_ptrloc Name; // Stringtable + + // Linked List + map_ptrloc FirstPackage;// Package + map_ptrloc LastPackage; // Package + map_ptrloc Next; // Group +}; + /*}}}*/ struct pkgCache::Package /*{{{*/ { // Pointers map_ptrloc Name; // Stringtable + map_ptrloc Arch; // StringTable (StringItem) map_ptrloc VersionList; // Version map_ptrloc CurrentVer; // Version map_ptrloc Section; // StringTable (StringItem) + map_ptrloc Group; // Group the Package belongs to // Linked list map_ptrloc NextPackage; // Package @@ -254,7 +274,7 @@ struct pkgCache::Version /*{{{*/ map_ptrloc VerStr; // Stringtable map_ptrloc Section; // StringTable (StringItem) map_ptrloc Arch; // StringTable - + // Lists map_ptrloc FileList; // VerFile map_ptrloc NextVer; // Version diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 68180c702..c37f6f48e 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -108,12 +108,12 @@ bool pkgCacheGenerator::MergeList(ListParser &List, while (List.Step() == true) { // Get a pointer to the package structure - string PackageName = List.Package(); + string const PackageName = List.Package(); if (PackageName.empty() == true) return false; - + pkgCache::PkgIterator Pkg; - if (NewPackage(Pkg,PackageName) == false) + if (NewPackage(Pkg, PackageName, List.Architecture()) == false) return _error->Error(_("Error occurred while processing %s (NewPackage)"),PackageName.c_str()); Counter++; if (Counter % 100 == 0 && Progress != 0) @@ -323,33 +323,71 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List) return true; } /*}}}*/ +// 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; + + // 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; + + // 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++; + + return true; +} + /*}}}*/ // CacheGenerator::NewPackage - Add a new package /*{{{*/ // --------------------------------------------------------------------- /* This creates a new package structure and adds it to the hash table */ -bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name) -{ - Pkg = Cache.FindPkg(Name); - if (Pkg.end() == false) - return true; +bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, + const string &Arch) { + pkgCache::GrpIterator Grp; + if (unlikely(NewGroup(Grp, Name) == false)) + return false; + + Pkg = Grp.FindPkg(Arch); + if (Pkg.end() == false) + return true; // Get a structure - unsigned long Package = Map.Allocate(sizeof(pkgCache::Package)); - if (Package == 0) + unsigned long const Package = Map.Allocate(sizeof(pkgCache::Package)); + if (unlikely(Package == 0)) return false; - Pkg = pkgCache::PkgIterator(Cache,Cache.PkgP + Package); - + // Insert it into the hash table - unsigned long Hash = Cache.Hash(Name); - Pkg->NextPackage = Cache.HeaderP->HashTable[Hash]; - Cache.HeaderP->HashTable[Hash] = Package; - - // Set the name and the ID - Pkg->Name = Map.WriteString(Name); - if (Pkg->Name == 0) + unsigned long const Hash = Cache.Hash(Name); + Pkg->NextPackage = Cache.HeaderP->PkgHashTable[Hash]; + Cache.HeaderP->PkgHashTable[Hash] = Package; + + // remember the packages in the group + Grp->FirstPackage = Package; + if (Grp->LastPackage == 0) + Grp->LastPackage = Package; + + // Set the name, arch and the ID + Pkg->Name = Grp->Name; + Pkg->Group = Grp.Index(); + Pkg->Arch = WriteUniqString(Arch.c_str()); + if (unlikely(Pkg->Arch == 0)) return false; Pkg->ID = Cache.HeaderP->PackageCount++; - + return true; } /*}}}*/ @@ -474,6 +512,7 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, version and to the package that it is pointing to. */ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, const string &PackageName, + const string &Arch, const string &Version, unsigned int Op, unsigned int Type) @@ -481,8 +520,8 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, pkgCache &Cache = Owner->Cache; // Get a structure - unsigned long Dependency = Owner->Map.Allocate(sizeof(pkgCache::Dependency)); - if (Dependency == 0) + unsigned long const Dependency = Owner->Map.Allocate(sizeof(pkgCache::Dependency)); + if (unlikely(Dependency == 0)) return false; // Fill it in @@ -492,11 +531,17 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, Dep->CompareOp = Op; Dep->ID = Cache.HeaderP->DependsCount++; - // Locate the target package - pkgCache::PkgIterator Pkg; - if (Owner->NewPackage(Pkg,PackageName) == false) + pkgCache::GrpIterator Grp; + if (unlikely(Owner->NewGroup(Grp, PackageName) == false)) return false; - + + // Locate the target package + pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch); + if (Pkg.end() == true) { + if (unlikely(Owner->NewPackage(Pkg, PackageName, Arch) == false)) + return false; + } + // Probe the reverse dependency list for a version string that matches if (Version.empty() == false) { @@ -504,7 +549,7 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, if (I->Version != 0 && I.TargetVer() == Version) Dep->Version = I->Version;*/ if (Dep->Version == 0) - if ((Dep->Version = WriteString(Version)) == 0) + if (unlikely((Dep->Version = WriteString(Version)) == 0)) return false; } @@ -524,7 +569,7 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, } // Is it a file dependency? - if (PackageName[0] == '/') + if (unlikely(PackageName[0] == '/')) FoundFileDeps = true; Dep->NextDepends = *OldDepLast; @@ -544,12 +589,12 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, pkgCache &Cache = Owner->Cache; // We do not add self referencing provides - if (Ver.ParentPkg().Name() == PackageName) + if (unlikely(Ver.ParentPkg().Name() == PackageName)) return true; // Get a structure - unsigned long Provides = Owner->Map.Allocate(sizeof(pkgCache::Provides)); - if (Provides == 0) + unsigned long const Provides = Owner->Map.Allocate(sizeof(pkgCache::Provides)); + if (unlikely(Provides == 0)) return false; Cache.HeaderP->ProvidesCount++; @@ -558,12 +603,12 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, Prv->Version = Ver.Index(); Prv->NextPkgProv = Ver->ProvidesList; Ver->ProvidesList = Prv.Index(); - if (Version.empty() == false && (Prv->ProvideVersion = WriteString(Version)) == 0) + if (Version.empty() == false && unlikely((Prv->ProvideVersion = WriteString(Version)) == 0)) return false; // Locate the target package pkgCache::PkgIterator Pkg; - if (Owner->NewPackage(Pkg,PackageName) == false) + if (unlikely(Owner->NewPackage(Pkg,PackageName,string(Ver.Arch())) == false)) return false; // Link it to the package diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 108b34207..4a2419b24 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -51,7 +51,8 @@ class pkgCacheGenerator /*{{{*/ // Flag file dependencies bool FoundFileDeps; - bool NewPackage(pkgCache::PkgIterator &Pkg,const string &PkgName); + bool NewGroup(pkgCache::GrpIterator &Grp,const string &Name); + bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const string &Arch); bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next); @@ -96,7 +97,7 @@ class pkgCacheGenerator::ListParser inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; inline unsigned long WriteString(const string &S) {return Owner->Map.WriteString(S);}; inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);}; - bool NewDepends(pkgCache::VerIterator Ver,const string &Package, + bool NewDepends(pkgCache::VerIterator Ver,const string &Package, const string &Arch, const string &Version,unsigned int Op, unsigned int Type); bool NewProvides(pkgCache::VerIterator Ver,const string &Package, @@ -106,6 +107,7 @@ class pkgCacheGenerator::ListParser // These all operate against the current section virtual string Package() = 0; + virtual string Architecture() = 0; virtual string Version() = 0; virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; virtual string Description() = 0; -- cgit v1.2.3-70-g09d2 From 5dd4c8b811d9c7bc33e50254811f5bc0fc37f872 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Dec 2009 12:38:19 +0100 Subject: merge Goswin Brederlow "support download of index files for different archs" patch which includes the following big changes: - Declare the unused [vendor] field in sources.list as option field, e.g. deb [arch=amd64,i386 lang=en_GB have=fun] http://example.org - When fetching index files download them for all APT::Architectures (overrideable with the options field above) - Allow all architectures of APT::Architectures to be in the Cache - Add the architecture to status and progress informations - Add b= (Binary architecture) to policy This commit doesn't incude the "pin-hack" as the Group structure will take care of this (and does it already to some extend). --- apt-pkg/aptconfiguration.cc | 25 ++++ apt-pkg/aptconfiguration.h | 16 +++ apt-pkg/cdrom.cc | 34 ++--- apt-pkg/clean.cc | 6 +- apt-pkg/contrib/strutl.cc | 17 +++ apt-pkg/contrib/strutl.h | 1 + apt-pkg/deb/debindexfile.cc | 15 ++- apt-pkg/deb/debindexfile.h | 4 +- apt-pkg/deb/deblistparser.cc | 57 ++++++--- apt-pkg/deb/deblistparser.h | 2 +- apt-pkg/deb/debmetaindex.cc | 292 +++++++++++++++++++++++++++---------------- apt-pkg/deb/debmetaindex.h | 28 +++-- apt-pkg/metaindex.h | 4 +- apt-pkg/pkgcache.cc | 8 +- apt-pkg/sourcelist.cc | 81 ++++++------ apt-pkg/sourcelist.h | 8 +- apt-pkg/versionmatch.cc | 8 +- apt-pkg/versionmatch.h | 2 + 18 files changed, 394 insertions(+), 214 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 899004d9f..1ec526646 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -223,4 +224,28 @@ std::vector const Configuration::getLanguages(bool const &All, return codes; } /*}}}*/ +// getArchitectures - Return Vector of prefered Architectures /*{{{*/ +std::vector const Configuration::getArchitectures(bool const &Cached) { + using std::string; + + std::vector static archs; + if (likely(Cached == true) && archs.empty() == false) + return archs; + + string const arch = _config->Find("APT::Architecture"); + archs = _config->FindVector("APT::Architectures"); + if (archs.empty() == true || + std::find(archs.begin(), archs.end(), arch) == archs.end()) + archs.push_back(arch); + return archs; +} + /*}}}*/ +// checkArchitecture - are we interested in the given Architecture? /*{{{*/ +bool const Configuration::checkArchitecture(std::string const &Arch) { + if (Arch == "all") + return true; + std::vector const archs = getArchitectures(true); + return (std::find(archs.begin(), archs.end(), Arch) != archs.end()); +} + /*}}}*/ } diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index f2f04a39b..b6650e20c 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -66,6 +66,22 @@ public: /*{{{*/ std::vector static const getLanguages(bool const &All = false, bool const &Cached = true, char const * const Locale = 0); + /** \brief Returns a vector of Architectures we support + * + * \param Cached saves the result so we need to calculated it only once + * this parameter should ony be used for testing purposes. + * + * \return a vector of Architectures in prefered order + */ + std::vector static const getArchitectures(bool const &Cached = true); + + /** \brief Are we interested in the given Architecture? + * + * \param Arch we want to check + * \return true if we are interested, false otherwise + */ + bool static const checkArchitecture(std::string const &Arch); + /*}}}*/ }; /*}}}*/ diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 72d8e4d41..271bca409 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -6,6 +6,8 @@ #include #include #include +#include + #include #include #include @@ -216,33 +218,23 @@ int pkgCdrom::Score(string Path) /* Here we drop everything that is not this machines arch */ bool pkgCdrom::DropBinaryArch(vector &List) { - char S[300]; - snprintf(S,sizeof(S),"/binary-%s/", - _config->Find("Apt::Architecture").c_str()); - + for (unsigned int I = 0; I < List.size(); I++) { const char *Str = List[I].c_str(); - - const char *Res; - if ((Res = strstr(Str,"/binary-")) == 0) + const char *Start, *End; + if ((Start = strstr(Str,"/binary-")) == 0) continue; - // Weird, remove it. - if (strlen(Res) < strlen(S)) - { - List.erase(List.begin() + I); - I--; - continue; - } - - // See if it is our arch - if (stringcmp(Res,Res + strlen(S),S) == 0) - continue; - - // Erase it + // Between Start and End is the architecture + Start += 8; + if ((End = strstr(Start,"/")) != 0 && Start != End && + APT::Configuration::checkArchitecture(string(Start, --End)) == true) + continue; // okay, architecture is accepted + + // not accepted -> Erase it List.erase(List.begin() + I); - I--; + --I; // the next entry is at the same index after the erase } return true; diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 0d1dfbf74..629afd7cf 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -26,7 +27,6 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache) { bool CleanInstalled = _config->FindB("APT::Clean-Installed",true); - string MyArch = _config->Find("APT::Architecture"); DIR *D = opendir(Dir.c_str()); if (D == 0) @@ -75,9 +75,9 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache) for (I = Start; *I != 0 && *I != '.' ;I++); if (*I != '.') continue; - string Arch = DeQuoteString(string(Start,I-Start)); + string const Arch = DeQuoteString(string(Start,I-Start)); - if (Arch != "all" && Arch != MyArch) + if (APT::Configuration::checkArchitecture(Arch) == false) continue; // Lookup the package diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 4c05f2df8..bed51881f 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -983,6 +983,23 @@ bool TokSplitString(char Tok,char *Input,char **List, return true; } /*}}}*/ +// ExplodeString - Split a string up into a vector /*{{{*/ +// --------------------------------------------------------------------- +/* This can be used to split a given string up into a vector, so the + propose is the same as in the method above and this one is a bit slower + also, but the advantage is that we an iteratable vector */ +vector ExplodeString(string const &haystack, char const &split) { + string::const_iterator start = haystack.begin(); + string::const_iterator end = start; + vector exploded; + do { + for (; end != haystack.end() && *end != split; ++end); + exploded.push_back(string(start, end)); + start = end; + } while (end != haystack.end() && (++end) != haystack.end()); + return exploded; +} + /*}}}*/ // RegexChoice - Simple regex list/list matcher /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 2b2e147fb..3bdb65b4d 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -59,6 +59,7 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0) bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); +vector ExplodeString(string const &haystack, char const &split=','); void ioprintf(ostream &out,const char *format,...) APT_FORMAT2; void strprintf(string &out,const char *format,...) APT_FORMAT2; char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3; diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 5beb83665..73d72c729 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -149,9 +149,12 @@ unsigned long debSourcesIndex::Size() const // PackagesIndex::debPackagesIndex - Contructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Trusted) : - pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section) +debPackagesIndex::debPackagesIndex(string const &URI, string const &Dist, string const &Section, + bool const &Trusted, string const &Arch) : + pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section), Architecture(Arch) { + if (Architecture == "native") + Architecture = _config->Find("APT::Architecture"); } /*}}}*/ // PackagesIndex::ArchiveInfo - Short version of the archive url /*{{{*/ @@ -171,6 +174,8 @@ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const Res += " "; Res += Ver.ParentPkg().Name(); Res += " "; + Res += Ver.Arch(); + Res += " "; Res += Ver.VerStr(); return Res; } @@ -204,6 +209,8 @@ string debPackagesIndex::Info(const char *Type) const else Info += Dist + '/' + Section; Info += " "; + Info += Architecture; + Info += " "; Info += Type; return Info; } @@ -227,7 +234,7 @@ string debPackagesIndex::IndexURI(const char *Type) const } else Res = URI + "dists/" + Dist + '/' + Section + - "/binary-" + _config->Find("APT::Architecture") + '/'; + "/binary-" + Architecture + '/'; Res += Type; return Res; @@ -259,7 +266,7 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const { string PackageFile = IndexFile("Packages"); FileFd Pkg(PackageFile,FileFd::ReadOnly); - debListParser Parser(&Pkg); + debListParser Parser(&Pkg, Architecture); if (_error->PendingError() == true) return _error->Error("Problem opening %s",PackageFile.c_str()); diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index c0e8d7d8e..766e8b214 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -46,6 +46,7 @@ class debPackagesIndex : public pkgIndexFile string URI; string Dist; string Section; + string Architecture; string Info(const char *Type) const; string IndexFile(const char *Type) const; @@ -69,7 +70,8 @@ class debPackagesIndex : public pkgIndexFile virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - debPackagesIndex(string URI,string Dist,string Section,bool Trusted); + debPackagesIndex(string const &URI, string const &Dist, string const &Section, + bool const &Trusted, string const &Arch = "native"); }; class debTranslationsIndex : public pkgIndexFile diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index fe68aec0b..b57eca813 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -32,10 +32,13 @@ static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Impor // ListParser::debListParser - Constructor /*{{{*/ // --------------------------------------------------------------------- -/* */ -debListParser::debListParser(FileFd *File) : Tags(File) -{ - Arch = _config->Find("APT::architecture"); +/* Provide an architecture and only this one and "all" will be accepted + in Step(), if no Architecture is given we will accept every arch + 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"); } /*}}}*/ // ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/ @@ -64,13 +67,19 @@ string debListParser::Package() { // --------------------------------------------------------------------- /* This will return the Architecture of the package this section describes Note that architecture "all" packages will get the architecture of the - Packages file parsed here */ + Packages file parsed here. */ string debListParser::Architecture() { string const Result = Section.FindS("Architecture"); - if (Result.empty() == true) - return Arch; - if (Result == "all") - return Arch; + 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; } /*}}}*/ @@ -199,8 +208,12 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg, { if (Pkg->Section == 0) Pkg->Section = UniqFindTagWrite("Section"); - if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) - return false; + + // Packages which are not from "our" arch doesn't get the essential flag + string const static myArch = _config->Find("APT::Architecture"); + if (Pkg->Arch != 0 && myArch == Pkg.Arch()) + if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) + return false; if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false) return false; @@ -630,17 +643,23 @@ bool debListParser::Step() /* See if this is the correct Architecture, if it isn't then we drop the whole section. A missing arch tag only happens (in theory) inside the Status file, so that is a positive return */ - const char *Start; - const char *Stop; - if (Section.Find("Architecture",Start,Stop) == false) + string const Architecture = Section.FindS("Architecture"); + if (Architecture.empty() == true) return true; - //FIXME: Accept different Architectures here - if (stringcmp(Arch,Start,Stop) == 0) - return true; + if (Arch.empty() == true) + { + if (APT::Configuration::checkArchitecture(Architecture) == true) + return true; + } + else + { + if (Architecture == Arch) + return true; - if (stringcmp(Start,Stop,"all") == 0) - return true; + if (Architecture == "all") + return true; + } iOffset = Tags.Offset(); } diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 5f91e073e..cba4f8e5d 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -69,7 +69,7 @@ class debListParser : public pkgCacheGenerator::ListParser bool const &StripMultiArch = false); static const char *ConvertRelation(const char *I,unsigned int &Op); - debListParser(FileFd *File); + debListParser(FileFd *File, string const &Arch = ""); }; #endif diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 8f28f053b..eb01a0156 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -8,9 +8,11 @@ #include #include +#include + using namespace std; -string debReleaseIndex::Info(const char *Type, const string Section) const +string debReleaseIndex::Info(const char *Type, string const &Section, string const &Arch) const { string Info = ::URI::SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') @@ -19,7 +21,11 @@ string debReleaseIndex::Info(const char *Type, const string Section) const Info += Dist; } else - Info += Dist + '/' + Section; + { + Info += Dist + '/' + Section; + if (Arch.empty() == true) + Info += " " + Arch; + } Info += " "; Info += Type; return Info; @@ -61,16 +67,21 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const return Res; } -string debReleaseIndex::IndexURISuffix(const char *Type, const string Section) const +string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const { string Res =""; if (Dist[Dist.size() - 1] != '/') - Res += Section + "/binary-" + _config->Find("APT::Architecture") + '/'; + { + if (Arch == "native") + Res += Section + "/binary-" + _config->Find("APT::Architecture") + '/'; + else + Res += Section + "/binary-" + Arch + '/'; + } return Res + Type; } -string debReleaseIndex::IndexURI(const char *Type, const string Section) const +string debReleaseIndex::IndexURI(const char *Type, string const &Section, string const &Arch) const { if (Dist[Dist.size() - 1] == '/') { @@ -82,10 +93,10 @@ string debReleaseIndex::IndexURI(const char *Type, const string Section) const return Res + Type; } else - return URI + "dists/" + Dist + '/' + IndexURISuffix(Type, Section); + return URI + "dists/" + Dist + '/' + IndexURISuffix(Type, Section, Arch); } -string debReleaseIndex::SourceIndexURISuffix(const char *Type, const string Section) const +string debReleaseIndex::SourceIndexURISuffix(const char *Type, const string &Section) const { string Res =""; if (Dist[Dist.size() - 1] != '/') @@ -93,7 +104,7 @@ string debReleaseIndex::SourceIndexURISuffix(const char *Type, const string Sect return Res + Type; } -string debReleaseIndex::SourceIndexURI(const char *Type, const string Section) const +string debReleaseIndex::SourceIndexURI(const char *Type, const string &Section) const { string Res; if (Dist[Dist.size() - 1] == '/') @@ -108,44 +119,61 @@ string debReleaseIndex::SourceIndexURI(const char *Type, const string Section) c return URI + "dists/" + Dist + "/" + SourceIndexURISuffix(Type, Section); } -debReleaseIndex::debReleaseIndex(string URI,string Dist) -{ - this->URI = URI; - this->Dist = Dist; - this->Indexes = NULL; - this->Type = "deb"; +debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) { + this->URI = URI; + this->Dist = Dist; + this->Indexes = NULL; + this->Type = "deb"; } -debReleaseIndex::~debReleaseIndex() -{ - for (vector::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) - delete *I; +debReleaseIndex::~debReleaseIndex() { + for (map >::const_iterator A = ArchEntries.begin(); + A != ArchEntries.end(); ++A) + for (vector::const_iterator S = A->second.begin(); + S != A->second.end(); ++S) + delete *S; } -vector * debReleaseIndex::ComputeIndexTargets() const -{ - vector * IndexTargets = new vector ; - for (vector ::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); - I++) - { - IndexTarget * Target = new IndexTarget(); - Target->ShortDesc = (*I)->IsSrc ? "Sources" : "Packages"; - Target->MetaKey - = (*I)->IsSrc ? SourceIndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section) - : IndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section); - Target->URI - = (*I)->IsSrc ? SourceIndexURI(Target->ShortDesc.c_str(), (*I)->Section) - : IndexURI(Target->ShortDesc.c_str(), (*I)->Section); - - Target->Description = Info (Target->ShortDesc.c_str(), (*I)->Section); - IndexTargets->push_back (Target); - } - return IndexTargets; +vector * debReleaseIndex::ComputeIndexTargets() const { + vector * IndexTargets = new vector ; + + map >::const_iterator const src = ArchEntries.find("source"); + if (src != ArchEntries.end()) { + vector const SectionEntries = src->second; + for (vector::const_iterator I = SectionEntries.begin(); + I != SectionEntries.end(); ++I) { + IndexTarget * Target = new IndexTarget(); + Target->ShortDesc = "Sources"; + Target->MetaKey = SourceIndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section); + Target->URI = SourceIndexURI(Target->ShortDesc.c_str(), (*I)->Section); + Target->Description = Info (Target->ShortDesc.c_str(), (*I)->Section); + IndexTargets->push_back (Target); + } + } + + // Only source release + if (IndexTargets->empty() == false && ArchEntries.size() == 1) + return IndexTargets; + + for (map >::const_iterator a = ArchEntries.begin(); + a != ArchEntries.end(); ++a) { + if (a->first == "source") + continue; + for (vector ::const_iterator I = a->second.begin(); + I != a->second.end(); ++I) { + IndexTarget * Target = new IndexTarget(); + Target->ShortDesc = "Packages"; + Target->MetaKey = IndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section, a->first); + Target->URI = IndexURI(Target->ShortDesc.c_str(), (*I)->Section, a->first); + Target->Description = Info (Target->ShortDesc.c_str(), (*I)->Section, a->first); + IndexTargets->push_back (Target); + } + } + + return IndexTargets; } /*}}}*/ -bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const +bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const { // special case for --print-uris if (GetAll) { @@ -170,23 +198,27 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const ComputeIndexTargets(), new indexRecords (Dist)); - // Queue the translations - std::vector const lang = APT::Configuration::getLanguages(true); - for (vector::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) { - - if((*I)->IsSrc) - continue; - - for (vector::const_iterator l = lang.begin(); - l != lang.end(); l++) - { - debTranslationsIndex i = debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str()); - i.GetIndexes(Owner); - } - } - - return true; + // Queue the translations + std::vector const lang = APT::Configuration::getLanguages(true); + map > sections; + for (map >::const_iterator a = ArchEntries.begin(); + a != ArchEntries.end(); ++a) { + if (a->first == "source") + continue; + for (vector::const_iterator I = a->second.begin(); + I != a->second.end(); I++) + sections[(*I)->Section].insert(lang.begin(), lang.end()); + } + + for (map >::const_iterator s = sections.begin(); + s != sections.end(); ++s) + for (set::const_iterator l = s->second.begin(); + l != s->second.end(); l++) { + debTranslationsIndex i = debTranslationsIndex(URI,Dist,s->first,(*l).c_str()); + i.GetIndexes(Owner); + } + + return true; } bool debReleaseIndex::IsTrusted() const @@ -203,71 +235,111 @@ bool debReleaseIndex::IsTrusted() const return false; } -vector *debReleaseIndex::GetIndexFiles() -{ - if (Indexes != NULL) - return Indexes; - - Indexes = new vector ; - std::vector const lang = APT::Configuration::getLanguages(true); - for (vector::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) { - if ((*I)->IsSrc) - Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted())); - else - { - Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted())); - - for (vector::const_iterator l = lang.begin(); - l != lang.end(); l++) - Indexes->push_back(new debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str())); - } - } +vector *debReleaseIndex::GetIndexFiles() { + if (Indexes != NULL) + return Indexes; + + Indexes = new vector ; + map >::const_iterator const src = ArchEntries.find("source"); + if (src != ArchEntries.end()) { + vector const SectionEntries = src->second; + for (vector::const_iterator I = SectionEntries.begin(); + I != SectionEntries.end(); I++) + Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted())); + } + + // Only source release + if (Indexes->empty() == false && ArchEntries.size() == 1) + return Indexes; + + std::vector const lang = APT::Configuration::getLanguages(true); + map > sections; + for (map >::const_iterator a = ArchEntries.begin(); + a != ArchEntries.end(); ++a) { + if (a->first == "source") + continue; + for (vector::const_iterator I = a->second.begin(); + I != a->second.end(); I++) { + Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted(), a->first)); + sections[(*I)->Section].insert(lang.begin(), lang.end()); + } + } + + for (map >::const_iterator s = sections.begin(); + s != sections.end(); ++s) + for (set::const_iterator l = s->second.begin(); + l != s->second.end(); l++) + Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str())); + + return Indexes; +} - return Indexes; +void debReleaseIndex::PushSectionEntry(vector const &Archs, const debSectionEntry *Entry) { + for (vector::const_iterator a = Archs.begin(); + a != Archs.end(); ++a) + ArchEntries[*a].push_back(new debSectionEntry(Entry->Section, Entry->IsSrc)); + delete Entry; } -void debReleaseIndex::PushSectionEntry(const debSectionEntry *Entry) -{ - SectionEntries.push_back(Entry); +void debReleaseIndex::PushSectionEntry(string const &Arch, const debSectionEntry *Entry) { + ArchEntries[Arch].push_back(Entry); } -debReleaseIndex::debSectionEntry::debSectionEntry (string Section, bool IsSrc): Section(Section) -{ - this->IsSrc = IsSrc; +void debReleaseIndex::PushSectionEntry(const debSectionEntry *Entry) { + if (Entry->IsSrc == true) + PushSectionEntry("source", Entry); + else { + for (map >::iterator a = ArchEntries.begin(); + a != ArchEntries.end(); ++a) { + a->second.push_back(Entry); + } + } } +debReleaseIndex::debSectionEntry::debSectionEntry (string const &Section, + bool const &IsSrc): Section(Section), IsSrc(IsSrc) +{} + class debSLTypeDebian : public pkgSourceList::Type { protected: - bool CreateItemInternal(vector &List,string URI, - string Dist,string Section, - bool IsSrc) const + bool CreateItemInternal(vector &List, string const &URI, + string const &Dist, string const &Section, + bool const &IsSrc, map const &Options) const { - for (vector::const_iterator I = List.begin(); + map::const_iterator const arch = Options.find("arch"); + vector const Archs = + (arch != Options.end()) ? ExplodeString(arch->second) : + APT::Configuration::getArchitectures(); + + for (vector::const_iterator I = List.begin(); I != List.end(); I++) { - // This check insures that there will be only one Release file - // queued for all the Packages files and Sources files it - // corresponds to. - if (strcmp((*I)->GetType(), "deb") == 0) + // We only worry about debian entries here + if (strcmp((*I)->GetType(), "deb") != 0) + continue; + + debReleaseIndex *Deb = (debReleaseIndex *) (*I); + /* This check insures that there will be only one Release file + queued for all the Packages files and Sources files it + corresponds to. */ + if (Deb->GetURI() == URI && Deb->GetDist() == Dist) { - debReleaseIndex *Deb = (debReleaseIndex *) (*I); - // This check insures that there will be only one Release file - // queued for all the Packages files and Sources files it - // corresponds to. - if (Deb->GetURI() == URI && Deb->GetDist() == Dist) - { - Deb->PushSectionEntry(new debReleaseIndex::debSectionEntry(Section, IsSrc)); - return true; - } + if (IsSrc == true) + Deb->PushSectionEntry("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + return true; } } // No currently created Release file indexes this entry, so we create a new one. // XXX determine whether this release is trusted or not - debReleaseIndex *Deb = new debReleaseIndex(URI,Dist); - Deb->PushSectionEntry (new debReleaseIndex::debSectionEntry(Section, IsSrc)); + debReleaseIndex *Deb = new debReleaseIndex(URI, Dist); + if (IsSrc == true) + Deb->PushSectionEntry ("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); List.push_back(Deb); return true; } @@ -277,10 +349,11 @@ class debSLTypeDeb : public debSLTypeDebian { public: - bool CreateItem(vector &List,string URI, - string Dist,string Section) const + bool CreateItem(vector &List, string const &URI, + string const &Dist, string const &Section, + std::map const &Options) const { - return CreateItemInternal(List, URI, Dist, Section, false); + return CreateItemInternal(List, URI, Dist, Section, false, Options); } debSLTypeDeb() @@ -294,10 +367,11 @@ class debSLTypeDebSrc : public debSLTypeDebian { public: - bool CreateItem(vector &List,string URI, - string Dist,string Section) const + bool CreateItem(vector &List, string const &URI, + string const &Dist, string const &Section, + std::map const &Options) const { - return CreateItemInternal(List, URI, Dist, Section, true); + return CreateItemInternal(List, URI, Dist, Section, true, Options); } debSLTypeDebSrc() diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 8e6a1463b..360fa5419 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -5,40 +5,44 @@ #include #include +#include + class debReleaseIndex : public metaIndex { public: class debSectionEntry { public: - debSectionEntry (string Section, bool IsSrc); - bool IsSrc; - string Section; + debSectionEntry (string const &Section, bool const &IsSrc); + string const Section; + bool const IsSrc; }; private: - vector SectionEntries; + std::map > ArchEntries; public: - debReleaseIndex(string URI, string Dist); + debReleaseIndex(string const &URI, string const &Dist); ~debReleaseIndex(); - virtual string ArchiveURI(string File) const {return URI + File;}; - virtual bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const; + virtual string ArchiveURI(string const &File) const {return URI + File;}; + virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const; vector * ComputeIndexTargets() const; - string Info(const char *Type, const string Section) const; + string Info(const char *Type, string const &Section, string const &Arch="") const; string MetaIndexInfo(const char *Type) const; string MetaIndexFile(const char *Types) const; string MetaIndexURI(const char *Type) const; - string IndexURI(const char *Type, const string Section) const; - string IndexURISuffix(const char *Type, const string Section) const; - string SourceIndexURI(const char *Type, const string Section) const; - string SourceIndexURISuffix(const char *Type, const string Section) const; + string IndexURI(const char *Type, string const &Section, string const &Arch="native") const; + string IndexURISuffix(const char *Type, string const &Section, string const &Arch="native") const; + string SourceIndexURI(const char *Type, const string &Section) const; + string SourceIndexURISuffix(const char *Type, const string &Section) const; virtual vector *GetIndexFiles(); virtual bool IsTrusted() const; + void PushSectionEntry(vector const &Archs, const debSectionEntry *Entry); + void PushSectionEntry(string const &Arch, const debSectionEntry *Entry); void PushSectionEntry(const debSectionEntry *Entry); }; diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h index 779b6ab14..1d2140799 100644 --- a/apt-pkg/metaindex.h +++ b/apt-pkg/metaindex.h @@ -33,8 +33,8 @@ class metaIndex virtual const char* GetType() const {return Type;} // Interface for acquire - virtual string ArchiveURI(string /*File*/) const = 0; - virtual bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const = 0; + virtual string ArchiveURI(string const& /*File*/) const = 0; + virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0; virtual vector *GetIndexFiles() = 0; virtual bool IsTrusted() const = 0; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 2b5f53f6f..c945c59bf 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -406,7 +406,7 @@ operator<<(ostream& out, pkgCache::PkgIterator Pkg) string candidate = string(Pkg.CandVersion() == 0 ? "none" : Pkg.CandVersion()); string newest = string(Pkg.VersionList().end() ? "none" : Pkg.VersionList().VerStr()); - out << Pkg.Name() << " < " << current; + out << Pkg.Name() << " [ " << Pkg.Arch() << " ] < " << current; if (current != candidate) out << " -> " << candidate; if ( newest != "none" && candidate != newest) @@ -699,7 +699,9 @@ string pkgCache::VerIterator::RelStr() else Res += File.Site(); } - } + } + if (S->Arch != 0) + Res.append(" [").append(Arch()).append("]"); return Res; } /*}}}*/ @@ -738,6 +740,8 @@ string pkgCache::PkgFileIterator::RelStr() Res = Res + (Res.empty() == true?"l=":",l=") + Label(); if (Component() != 0) Res = Res + (Res.empty() == true?"c=":",c=") + Component(); + if (Architecture() != 0) + Res = Res + (Res.empty() == true?"b=":",b=") + Architecture(); return Res; } /*}}}*/ diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 4b3abe918..6b7a299d6 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -79,13 +79,51 @@ bool pkgSourceList::Type::FixupURI(string &URI) const Weird types may override this. */ bool pkgSourceList::Type::ParseLine(vector &List, const char *Buffer, - unsigned long CurLine, - string File) const + unsigned long const &CurLine, + string const &File) const { + for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces + + // Parse option field if it exists + // e.g.: [ option1=value1 option2=value2 ] + map Options; + if (Buffer != 0 && Buffer[0] == '[') + { + ++Buffer; // ignore the [ + for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces + while (*Buffer != ']') + { + // get one option, e.g. option1=value1 + string option; + if (ParseQuoteWord(Buffer,option) == false) + return _error->Error(_("Malformed line %lu in source list %s ([option] unparseable)"),CurLine,File.c_str()); + + if (option.length() < 3) + return _error->Error(_("Malformed line %lu in source list %s ([option] too short)"),CurLine,File.c_str()); + + size_t const needle = option.find('='); + if (needle == string::npos) + return _error->Error(_("Malformed line %lu in source list %s ([%s] is not an assignment)"),CurLine,File.c_str(), option.c_str()); + + string const key = string(option, 0, needle); + string const value = string(option, needle + 1, option.length()); + + if (key.empty() == true) + return _error->Error(_("Malformed line %lu in source list %s ([%s] has no key)"),CurLine,File.c_str(), option.c_str()); + + if (value.empty() == true) + return _error->Error(_("Malformed line %lu in source list %s ([%s] key %s has no value)"),CurLine,File.c_str(),option.c_str(),key.c_str()); + + Options[key] = value; + } + ++Buffer; // ignore the ] + for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces + } + string URI; string Dist; - string Section; - + string Section; + if (ParseQuoteWord(Buffer,URI) == false) return _error->Error(_("Malformed line %lu in source list %s (URI)"),CurLine,File.c_str()); if (ParseQuoteWord(Buffer,Dist) == false) @@ -100,7 +138,7 @@ bool pkgSourceList::Type::ParseLine(vector &List, if (ParseQuoteWord(Buffer,Section) == true) return _error->Error(_("Malformed line %lu in source list %s (absolute dist)"),CurLine,File.c_str()); Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture")); - return CreateItem(List,URI,Dist,Section); + return CreateItem(List, URI, Dist, Section, Options); } // Grab the rest of the dists @@ -109,7 +147,7 @@ bool pkgSourceList::Type::ParseLine(vector &List, do { - if (CreateItem(List,URI,Dist,Section) == false) + if (CreateItem(List, URI, Dist, Section, Options) == false) return false; } while (ParseQuoteWord(Buffer,Section) == true); @@ -246,36 +284,7 @@ bool pkgSourceList::ReadAppend(string File) if (Parse == 0) return _error->Error(_("Type '%s' is not known on line %u in source list %s"),LineType.c_str(),CurLine,File.c_str()); - // Vendor name specified - if (C[0] == '[') - { - string VendorID; - - if (ParseQuoteWord(C,VendorID) == false) - return _error->Error(_("Malformed line %u in source list %s (vendor id)"),CurLine,File.c_str()); - - if (VendorID.length() < 2 || VendorID.end()[-1] != ']') - return _error->Error(_("Malformed line %u in source list %s (vendor id)"),CurLine,File.c_str()); - VendorID = string(VendorID,1,VendorID.size()-2); - -// for (vector::const_iterator iter = VendorList.begin(); -// iter != VendorList.end(); iter++) -// { -// if ((*iter)->GetVendorID() == VendorID) -// { -// if (_config->FindB("Debug::sourceList", false)) -// std::cerr << "Comparing VendorID \"" << VendorID << "\" with \"" << (*iter)->GetVendorID() << '"' << std::endl; -// Verifier = *iter; -// break; -// } -// } - -// if (Verifier == 0) -// return _error->Error(_("Unknown vendor ID '%s' in line %u of source list %s"), -// VendorID.c_str(),CurLine,File.c_str()); - } - - if (Parse->ParseLine(SrcList,C,CurLine,File) == false) + if (Parse->ParseLine(SrcList, C, CurLine, File) == false) return false; } return true; diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index b9e4389ed..e15314a5e 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -57,9 +58,10 @@ class pkgSourceList bool FixupURI(string &URI) const; virtual bool ParseLine(vector &List, const char *Buffer, - unsigned long CurLine,string File) const; - virtual bool CreateItem(vector &List,string URI, - string Dist,string Section) const = 0; + unsigned long const &CurLine,string const &File) const; + virtual bool CreateItem(vector &List,string const &URI, + string const &Dist,string const &Section, + std::map const &Options) const = 0; Type(); virtual ~Type() {}; }; diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index b4d1d4696..e5f0fafd2 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -100,6 +100,8 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) 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,"b=") == 0) + RelArchitecture = Fragments[J]+2; } if (RelVerStr.end()[-1] == '*') @@ -178,7 +180,7 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (RelVerStr.empty() == true && RelOrigin.empty() == true && RelArchive.empty() == true && RelLabel.empty() == true && RelRelease.empty() == true && RelCodename.empty() == true && - RelComponent.empty() == true) + RelComponent.empty() == true && RelArchitecture.empty() == true) return false; if (RelVerStr.empty() == false) @@ -211,6 +213,10 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (File->Component == 0 || stringcasecmp(RelComponent,File.Component()) != 0) return false; + if (RelArchitecture.empty() == false) + if (File->Architecture == 0 || + stringcasecmp(RelArchitecture,File.Architecture()) != 0) + return false; return true; } diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index a8f3c84ac..a8da072ae 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -23,6 +23,7 @@ Codename (n=) e.g. etch, lenny, squeeze, sid Label (l=) Component (c=) + Binary Architecture (b=) 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 or a Codename. @@ -55,6 +56,7 @@ class pkgVersionMatch string RelArchive; string RelLabel; string RelComponent; + string RelArchitecture; bool MatchAll; // Origin Matching -- cgit v1.2.3-70-g09d2 From 25396fb06350344996a20d05423562f08a4165db Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Dec 2009 19:39:47 +0100 Subject: Split ListParser::NewDepends into two methods to use these new method for creating the dependencies needed for our groups: For now for all groups only one package can be installed at the same time which conflicts with each other packages in the group. The exceptions are architecture all package. Also, the Multi-Arch field is now parsed, but not used for now. --- apt-pkg/cacheiterators.h | 14 ++++- apt-pkg/deb/deblistparser.cc | 24 ++++++++ apt-pkg/pkgcache.cc | 27 +++++++++ apt-pkg/pkgcache.h | 12 +++- apt-pkg/pkgcachegen.cc | 133 ++++++++++++++++++++++++++++++++----------- apt-pkg/pkgcachegen.h | 6 +- 6 files changed, 176 insertions(+), 40 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 35d3aa228..33d2ed6be 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -81,13 +81,21 @@ template class pkgCache::Iterator { different architectures can be treated as of the "same" package (apt internally treat them as totally different packages) */ class pkgCache::GrpIterator: public Iterator { + long HashIndex; + protected: inline Group* OwnerPointer() const { return Owner->GrpP; }; public: - void operator ++(int) {if (S != Owner->GrpP) S = Owner->GrpP + S->Next;}; + // This constructor is the 'begin' constructor, never use it. + inline GrpIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) { + S = OwnerPointer(); + operator ++(0); + }; + + virtual void operator ++(int); virtual void operator ++() {operator ++(0);}; inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; @@ -96,11 +104,11 @@ class pkgCache::GrpIterator: public Iterator { PkgIterator NextPkg(PkgIterator const &Pkg); // Constructors - inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg) { + inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); }; - inline GrpIterator() : Iterator() {}; + inline GrpIterator() : Iterator(), HashIndex(0) {}; }; /*}}}*/ diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b57eca813..f683de423 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -104,6 +104,30 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) // Parse the architecture Ver->Arch = WriteUniqString(Architecture()); + // Parse multi-arch + if (Section.FindS("Architecture") == "all") + /* Arch all packages can't have a Multi-Arch field, + but we need a special treatment for them nonetheless */ + Ver->MultiArch = pkgCache::Version::All; + else + { + string const MultiArch = Section.FindS("Multi-Arch"); + if (MultiArch.empty() == true) + Ver->MultiArch = pkgCache::Version::None; + else if (MultiArch == "same") + Ver->MultiArch = pkgCache::Version::Same; + else if (MultiArch == "foreign") + Ver->MultiArch = pkgCache::Version::Foreign; + else if (MultiArch == "allowed") + Ver->MultiArch = pkgCache::Version::Allowed; + else + { + _error->Warning("Unknown Multi-Arch type »%s« for package »%s«", + MultiArch.c_str(), Section.FindS("Package").c_str()); + Ver->MultiArch = pkgCache::Version::None; + } + } + // Archive Size Ver->Size = (unsigned)Section.FindI("Size"); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index c945c59bf..1e4c7edb3 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -182,6 +182,16 @@ unsigned long pkgCache::sHash(const char *Str) const // Cache::FindPkg - Locate a package by name /*{{{*/ // --------------------------------------------------------------------- /* Returns 0 on error, pointer to the package otherwise */ +pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) { + size_t const found = Name.find(':'); + if (found == string::npos) + return FindPkg(Name, "native"); + return FindPkg(Name.substr(0, found), Name.substr(found+1, string::npos)); +} + /*}}}*/ +// Cache::FindPkg - Locate a package by name /*{{{*/ +// --------------------------------------------------------------------- +/* Returns 0 on error, pointer to the package otherwise */ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string Arch) { /* We make a detour via the GrpIterator here as on a multi-arch environment a group is easier to @@ -322,6 +332,23 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const return PkgIterator(*Owner, 0); } /*}}}*/ +// GrpIterator::operator ++ - Postfix incr /*{{{*/ +// --------------------------------------------------------------------- +/* This will advance to the next logical group in the hash table. */ +void pkgCache::GrpIterator::operator ++(int) +{ + // Follow the current links + if (S != Owner->GrpP) + S = Owner->GrpP + S->Next; + + // Follow the hash table + while (S == Owner->GrpP && (HashIndex+1) < (signed)_count(Owner->HeaderP->GrpHashTable)) + { + HashIndex++; + S = Owner->GrpP + Owner->HeaderP->GrpHashTable[HashIndex]; + } +}; + /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical package in the hash table. */ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index b3d2752d2..5f50001d0 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -125,9 +125,12 @@ class pkgCache /*{{{*/ // Accessors GrpIterator FindGrp(const string &Name); - PkgIterator FindPkg(const string &Name, string Arch = "native"); + PkgIterator FindPkg(const string &Name); + PkgIterator FindPkg(const string &Name, string Arch); Header &Head() {return *HeaderP;}; + inline GrpIterator GrpBegin(); + inline GrpIterator GrpEnd(); inline PkgIterator PkgBegin(); inline PkgIterator PkgEnd(); inline PkgFileIterator FileBegin(); @@ -274,7 +277,8 @@ struct pkgCache::Version /*{{{*/ map_ptrloc VerStr; // Stringtable map_ptrloc Section; // StringTable (StringItem) map_ptrloc Arch; // StringTable - + enum {None, All, Foreign, Same, Allowed} MultiArch; + // Lists map_ptrloc FileList; // VerFile map_ptrloc NextVer; // Version @@ -337,6 +341,10 @@ struct pkgCache::StringItem /*{{{*/ /*}}}*/ #include +inline pkgCache::GrpIterator pkgCache::GrpBegin() + {return GrpIterator(*this);}; +inline pkgCache::GrpIterator pkgCache::GrpEnd() + {return GrpIterator(*this,GrpP);}; inline pkgCache::PkgIterator pkgCache::PkgBegin() {return PkgIterator(*this);}; inline pkgCache::PkgIterator pkgCache::PkgEnd() diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index c37f6f48e..2a4a30349 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,7 @@ typedef vector::iterator FileIterator; // CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/ // --------------------------------------------------------------------- -/* We set the diry flag and make sure that is written to the disk */ +/* We set the dirty flag and make sure that is written to the disk */ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) : Map(*pMap), Cache(pMap,false), Progress(Prog), FoundFileDeps(0) @@ -506,21 +507,58 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, return Description; } /*}}}*/ -// ListParser::NewDepends - Create a dependency element /*{{{*/ +// 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 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)) { + for (pkgCache::VerIterator V = P.VersionList(); V.end() != true; V++) { + // Arch all packages are "co-installable" + if (V->MultiArch == pkgCache::Version::All) + continue; + string const Arch = V.Arch(); + map_ptrloc *OldDepLast = NULL; + for (vector::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; + // Conflicts: ${self}:other + NewDepends(D, V, "", + pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, + OldDepLast); + } + } + } + } + } + return true; +} + /*}}}*/ +// CacheGenerator::NewDepends - Create a dependency element /*{{{*/ // --------------------------------------------------------------------- /* This creates a dependency element in the tree. It is linked to the version and to the package that it is pointing to. */ -bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, - const string &PackageName, - const string &Arch, - const string &Version, - unsigned int Op, - unsigned int Type) +bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver, + string const &Version, + unsigned int const &Op, + unsigned int const &Type, + map_ptrloc *OldDepLast) { - pkgCache &Cache = Owner->Cache; - // Get a structure - unsigned long const Dependency = Owner->Map.Allocate(sizeof(pkgCache::Dependency)); + unsigned long const Dependency = Map.Allocate(sizeof(pkgCache::Dependency)); if (unlikely(Dependency == 0)) return false; @@ -530,17 +568,6 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, Dep->Type = Type; Dep->CompareOp = Op; Dep->ID = Cache.HeaderP->DependsCount++; - - pkgCache::GrpIterator Grp; - if (unlikely(Owner->NewGroup(Grp, PackageName) == false)) - return false; - - // Locate the target package - pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch); - if (Pkg.end() == true) { - if (unlikely(Owner->NewPackage(Pkg, PackageName, Arch) == false)) - return false; - } // Probe the reverse dependency list for a version string that matches if (Version.empty() == false) @@ -549,29 +576,23 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, if (I->Version != 0 && I.TargetVer() == Version) Dep->Version = I->Version;*/ if (Dep->Version == 0) - if (unlikely((Dep->Version = WriteString(Version)) == 0)) + if (unlikely((Dep->Version = Map.WriteString(Version)) == 0)) return false; } - + // Link it to the package Dep->Package = Pkg.Index(); Dep->NextRevDepends = Pkg->RevDepends; Pkg->RevDepends = Dep.Index(); - - /* Link it to the version (at the end of the list) - Caching the old end point speeds up generation substantially */ - if (OldDepVer != Ver) + + // Do we know where to link the Dependency to? + if (OldDepLast == NULL) { OldDepLast = &Ver->DependsList; for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++) OldDepLast = &D->NextDepends; - OldDepVer = Ver; } - // Is it a file dependency? - if (unlikely(PackageName[0] == '/')) - FoundFileDeps = true; - Dep->NextDepends = *OldDepLast; *OldDepLast = Dep.Index(); OldDepLast = &Dep->NextDepends; @@ -579,6 +600,41 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, return true; } /*}}}*/ +// ListParser::NewDepends - Create the environment for a new dependency /*{{{*/ +// --------------------------------------------------------------------- +/* This creates a Group and the Package to link this dependency to if + needed and handles also the caching of the old endpoint */ +bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, + const string &PackageName, + const string &Arch, + const string &Version, + unsigned int Op, + unsigned int Type) +{ + pkgCache::GrpIterator Grp; + if (unlikely(Owner->NewGroup(Grp, PackageName) == false)) + return false; + + // Locate the target package + pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch); + if (Pkg.end() == true) { + if (unlikely(Owner->NewPackage(Pkg, PackageName, Arch) == false)) + return false; + } + + // Is it a file dependency? + if (unlikely(PackageName[0] == '/')) + FoundFileDeps = true; + + /* Caching the old end point speeds up generation substantially */ + if (OldDepVer != Ver) { + OldDepLast = NULL; + OldDepVer = Ver; + } + + return Owner->NewDepends(Pkg, Ver, Version, Op, Type, OldDepLast); +} + /*}}}*/ // ListParser::NewProvides - Create a Provides element /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -925,6 +981,9 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, if (BuildCache(Gen,Progress,CurrentSize,TotalSize, Files.begin()+EndOfSource,Files.end()) == false) return false; + + // FIXME: move me to a better place + Gen.FinishCache(Progress); } else { @@ -965,6 +1024,9 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, if (BuildCache(Gen,Progress,CurrentSize,TotalSize, Files.begin()+EndOfSource,Files.end()) == false) return false; + + // FIXME: move me to a better place + Gen.FinishCache(Progress); } if (_error->PendingError() == true) @@ -1010,7 +1072,10 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) if (BuildCache(Gen,Progress,CurrentSize,TotalSize, Files.begin()+EndOfSource,Files.end()) == false) return false; - + + // FIXME: move me to a better place + Gen.FinishCache(Progress); + if (_error->PendingError() == true) return false; *OutMap = Map.UnGuard(); diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 4a2419b24..53f09b991 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -55,6 +55,9 @@ class pkgCacheGenerator /*{{{*/ bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const string &Arch); bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List); + bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver, + string const &Version, unsigned int const &Op, + unsigned int const &Type, map_ptrloc *OldDepLast); unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next); map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next); @@ -73,7 +76,8 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - + bool FinishCache(OpProgress &Progress); + pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress); ~pkgCacheGenerator(); }; -- cgit v1.2.3-70-g09d2 From a29b2c0b9c4e7b1c36433c9c6dd5d24697f9c4b6 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 26 Jan 2010 11:57:29 +0100 Subject: Change history branch so that it does not break the apt ABI for the pkgPackageManager interface (can be reverted on the next ABI break) --- apt-pkg/deb/dpkgpm.cc | 34 +++++++++++++++++++++++----------- apt-pkg/deb/dpkgpm.h | 4 +--- apt-pkg/packagemanager.h | 6 +++++- debian/changelog | 8 ++++++++ 4 files changed, 37 insertions(+), 15 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2f84a5a87..e928776af 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -562,7 +562,7 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ // DPkgPM::WriteHistoryTag /*{{{*/ -void pkgDPkgPM::WriteHistoryTag(string tag, string value) +void pkgDPkgPM::WriteHistoryTag(FILE *history_out, string tag, string value) { if (value.size() > 0) { @@ -602,7 +602,7 @@ bool pkgDPkgPM::OpenLog() _config->Find("Dir::Log::History")); if (!history_name.empty()) { - history_out = fopen(history_name.c_str(),"a"); + FILE *history_out = fopen(history_name.c_str(),"a"); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); string remove, purge, install, upgrade, downgrade; @@ -622,12 +622,12 @@ bool pkgDPkgPM::OpenLog() remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); } } - WriteHistoryTag("Install", install); - WriteHistoryTag("Upgrade", upgrade); - WriteHistoryTag("Downgrade",downgrade); - WriteHistoryTag("Remove",remove); - WriteHistoryTag("Purge",purge); - fflush(history_out); + WriteHistoryTag(history_out, "Install", install); + WriteHistoryTag(history_out, "Upgrade", upgrade); + WriteHistoryTag(history_out, "Downgrade",downgrade); + WriteHistoryTag(history_out, "Remove",remove); + WriteHistoryTag(history_out, "Purge",purge); + fclose(history_out); } return true; @@ -650,10 +650,11 @@ bool pkgDPkgPM::CloseLog() } term_out = NULL; - if(history_out) + string history_name = flCombine(_config->FindDir("Dir::Log"), + _config->Find("Dir::Log::History")); + if (!history_name.empty()) { - if (dpkg_error.size() > 0) - fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); + FILE *history_out = fopen(history_name.c_str(),"a"); fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); } @@ -1125,6 +1126,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) if(stopOnError) RunScripts("DPkg::Post-Invoke"); + string dpkg_error; if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]); else if (WIFEXITED(Status) != 0) @@ -1133,7 +1135,17 @@ bool pkgDPkgPM::Go(int OutStatusFd) strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]); if(dpkg_error.size() > 0) + { _error->Error(dpkg_error.c_str()); + string history_name = flCombine(_config->FindDir("Dir::Log"), + _config->Find("Dir::Log::History")); + if (!history_name.empty()) + { + FILE *history_out = fopen(history_name.c_str(),"a"); + fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); + fclose(history_out); + } + } if(stopOnError) { diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index ce3e20f2e..160486bf9 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -29,8 +29,6 @@ class pkgDPkgPM : public pkgPackageManager char dpkgbuf[1024]; int dpkgbuf_pos; FILE *term_out; - FILE *history_out; - string dpkg_error; protected: int pkgFailures; @@ -70,7 +68,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); - void WriteHistoryTag(string tag, string value); + void WriteHistoryTag(FILE* history_out, string tag, string value); // apport integration void WriteApportReport(const char *pkgpath, const char *errormsg); diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index af1476b7a..44f5d5ef7 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -49,7 +49,11 @@ class pkgPackageManager : protected pkgCache::Namespace bool Debug; bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); - void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); + // binary-compat change, fix on next abi break + void ImmediateAdd(PkgIterator P, bool UseInstallVer) { + ImmediateAdd(P, UseInstallVer, 0); + } + void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth); virtual OrderResult OrderInstall(); bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver); bool CreateOrderList(); diff --git a/debian/changelog b/debian/changelog index e6afafe99..9615201b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.25ubuntu2) lucid; urgency=low + + * Change history branch so that it does not break the + apt ABI for the pkgPackageManager interface + (can be reverted on the next ABI break) + + -- Michael Vogt Wed, 23 Dec 2009 10:14:16 +0100 + apt (0.7.25ubuntu1) lucid; urgency=low * Merged from the mvo branch -- cgit v1.2.3-70-g09d2 From 857e9c13d8d9808fcd1ac8ff3469f6c0b90b7fea Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Feb 2010 12:38:13 +0100 Subject: Drop the Arch information from the Version structure as we can get the information from the parent package now --- apt-pkg/cacheiterators.h | 2 +- apt-pkg/deb/deblistparser.cc | 10 +++++++--- apt-pkg/deb/deblistparser.h | 1 + apt-pkg/pkgcache.cc | 4 ++-- apt-pkg/pkgcache.h | 1 - apt-pkg/pkgcachegen.h | 1 + 6 files changed, 12 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 33d2ed6be..d8e044f88 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -178,7 +178,7 @@ class pkgCache::VerIterator : public Iterator { // Accessors inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; - inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}; + inline const char *Arch() const {return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;}; inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; inline DescIterator DescriptionList() const; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index f683de423..26841d3d2 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -83,6 +83,13 @@ string debListParser::Architecture() { return Result; } /*}}}*/ +// ListParser::ArchitectureAll /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool debListParser::ArchitectureAll() { + return Section.FindS("Architecture") == "all"; +} + /*}}}*/ // ListParser::Version - Return the version string /*{{{*/ // --------------------------------------------------------------------- /* This is to return the string describing the version in debian form, @@ -101,9 +108,6 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) // Parse the section Ver->Section = UniqFindTagWrite("Section"); - // Parse the architecture - Ver->Arch = WriteUniqString(Architecture()); - // Parse multi-arch if (Section.FindS("Architecture") == "all") /* Arch all packages can't have a Multi-Arch field, diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index cba4f8e5d..8da051530 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -47,6 +47,7 @@ class debListParser : public pkgCacheGenerator::ListParser // These all operate against the current section virtual string Package(); virtual string Architecture(); + virtual bool ArchitectureAll(); virtual string Version(); virtual bool NewVersion(pkgCache::VerIterator Ver); virtual string Description(); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 1e4c7edb3..7d98869ea 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -399,7 +399,7 @@ const char * pkgCache::PkgIterator::CandVersion() const { //TargetVer is empty, so don't use it. - VerIterator version = pkgPolicy::pkgPolicy(Owner).GetCandidateVer(*this); + VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this); if (version.IsGood()) return version.VerStr(); return 0; @@ -727,7 +727,7 @@ string pkgCache::VerIterator::RelStr() Res += File.Site(); } } - if (S->Arch != 0) + if (S->ParentPkg != 0) Res.append(" [").append(Arch()).append("]"); return Res; } diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 5f50001d0..5edeedfd1 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -276,7 +276,6 @@ struct pkgCache::Version /*{{{*/ { map_ptrloc VerStr; // Stringtable map_ptrloc Section; // StringTable (StringItem) - map_ptrloc Arch; // StringTable enum {None, All, Foreign, Same, Allowed} MultiArch; // Lists diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 53f09b991..ca5d74a9f 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -112,6 +112,7 @@ class pkgCacheGenerator::ListParser // These all operate against the current section virtual string Package() = 0; virtual string Architecture() = 0; + virtual bool ArchitectureAll() = 0; virtual string Version() = 0; virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; virtual string Description() = 0; -- cgit v1.2.3-70-g09d2 From 67e0766f0eab85ce1aeacee75fc6b200f36996c9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 10 Feb 2010 22:45:58 +0100 Subject: Foreign Versions add an implicit Provides to the other packages in the group --- apt-pkg/deb/deblistparser.cc | 55 +++++++++++++++++++++++++++++--------------- apt-pkg/pkgcachegen.cc | 7 +++--- apt-pkg/pkgcachegen.h | 4 ++-- 3 files changed, 42 insertions(+), 24 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 26841d3d2..b6082cdd5 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -618,29 +618,46 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) { const char *Start; const char *Stop; - if (Section.Find("Provides",Start,Stop) == false) - return true; - - string Package; - string Version; - unsigned int Op; - - while (1) + if (Section.Find("Provides",Start,Stop) == true) { - Start = ParseDepends(Start,Stop,Package,Version,Op); - if (Start == 0) - return _error->Error("Problem parsing Provides line"); - if (Op != pkgCache::Dep::NoOp) { - _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str()); - } else { - if (NewProvides(Ver,Package,Version) == false) - return false; + string Package; + string Version; + string const Arch = Ver.Arch(); + unsigned int Op; + + while (1) + { + Start = ParseDepends(Start,Stop,Package,Version,Op); + if (Start == 0) + return _error->Error("Problem parsing Provides line"); + if (Op != pkgCache::Dep::NoOp) { + _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str()); + } else { + if (NewProvides(Ver, Package, Arch, Version) == false) + return false; + } + + if (Start == Stop) + break; } + } - if (Start == Stop) - break; + if (Ver->MultiArch != pkgCache::Version::Foreign) + return true; + + std::vector const archs = APT::Configuration::getArchitectures(); + if (archs.size() <= 1) + return true; + + string const Package = Ver.ParentPkg().Name(); + string const Version = Ver.VerStr(); + for (std::vector::const_iterator a = archs.begin(); + a != archs.end(); ++a) + { + if (NewProvides(Ver, Package, *a, Version) == false) + return false; } - + return true; } /*}}}*/ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 037c0cb63..ebda325f7 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -668,13 +668,14 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, // --------------------------------------------------------------------- /* */ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, - const string &PackageName, + const string &PkgName, + const string &PkgArch, const string &Version) { pkgCache &Cache = Owner->Cache; // We do not add self referencing provides - if (unlikely(Ver.ParentPkg().Name() == PackageName)) + if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch()) return true; // Get a structure @@ -693,7 +694,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, // Locate the target package pkgCache::PkgIterator Pkg; - if (unlikely(Owner->NewPackage(Pkg,PackageName,string(Ver.Arch())) == false)) + if (unlikely(Owner->NewPackage(Pkg,PkgName, PkgArch) == false)) return false; // Link it to the package diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index ca5d74a9f..46d0cd893 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -104,8 +104,8 @@ class pkgCacheGenerator::ListParser bool NewDepends(pkgCache::VerIterator Ver,const string &Package, const string &Arch, const string &Version,unsigned int Op, unsigned int Type); - bool NewProvides(pkgCache::VerIterator Ver,const string &Package, - const string &Version); + bool NewProvides(pkgCache::VerIterator Ver,const string &PkgName, + const string &PkgArch, const string &Version); public: -- cgit v1.2.3-70-g09d2 From 4d174dc84ea184b5afa81abb3b94e2ef3380ece8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 11 Feb 2010 12:19:48 +0100 Subject: Add Multi-Arch: allowed support by creating an implicit provide of name:any for such packages, so dependencies in this style can be easily resolved. --- apt-pkg/deb/deblistparser.cc | 6 ++++++ apt-pkg/pkgcache.cc | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b6082cdd5..3726a6a04 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -642,6 +642,12 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) } } + if (Ver->MultiArch == pkgCache::Version::Allowed) + { + string const Package = string(Ver.ParentPkg().Name()).append(":").append("any"); + NewProvides(Ver, Package, "any", Ver.VerStr()); + } + if (Ver->MultiArch != pkgCache::Version::Foreign) return true; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 7d98869ea..2d4ee1010 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -186,7 +186,10 @@ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) { size_t const found = Name.find(':'); if (found == string::npos) return FindPkg(Name, "native"); - return FindPkg(Name.substr(0, found), Name.substr(found+1, string::npos)); + string const Arch = Name.substr(found+1); + if (Arch == "any") + return FindPkg(Name, "any"); + return FindPkg(Name.substr(0, found), Arch); } /*}}}*/ // Cache::FindPkg - Locate a package by name /*{{{*/ -- cgit v1.2.3-70-g09d2 From 803ea2a87f81252b2c0d541b8502ed206ce57c84 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Feb 2010 00:04:31 +0100 Subject: Add yet another pseudo package which isn't as pseudo as the others: Arch all packages are now represented by arch depending packages which all depend on a package with the same name and the special arch "all". This packages has NO dependencies, but beside this the same information. It is the only package which has a size, the arch depending ones all have a zero size. While the arch depending pseudo packages are used for dependency resolution the arch "all" package is used for downloading and ordering of the package. --- apt-pkg/algorithms.cc | 52 ++++++++++++++++++++++++++++++++++++++++---- apt-pkg/cacheiterators.h | 1 + apt-pkg/deb/deblistparser.cc | 22 +++++++++++++++++-- apt-pkg/depcache.cc | 4 ++++ apt-pkg/depcache.h | 1 + apt-pkg/orderlist.cc | 4 ++++ apt-pkg/packagemanager.cc | 23 +++++++++++++++----- apt-pkg/pkgcache.cc | 12 ++++++++++ apt-pkg/pkgcache.h | 2 +- apt-pkg/pkgcachegen.cc | 20 +++++++++++++---- cmdline/apt-cache.cc | 2 ++ cmdline/apt-get.cc | 14 +++++++++--- 12 files changed, 137 insertions(+), 20 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 34da745de..c905cffa9 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -83,13 +83,28 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid 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++) { @@ -131,9 +146,22 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) 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) { @@ -181,10 +209,26 @@ bool pkgSimulate::Configure(PkgIterator iPkg) 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 diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index e8cf28496..43cbe1377 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -200,6 +200,7 @@ class pkgCache::VerIterator : public Iterator { string RelStr(); bool Automatic() const; + bool Pseudo() const; VerFileIterator NewestFile() const; inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator(Owner, Trg) { diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 3726a6a04..b3d95164a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -148,6 +148,24 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) Ver->Priority = pkgCache::State::Extra; } + if (Ver->MultiArch == pkgCache::Version::All) + { + /* We maintain a "pseudo" arch=all package for architecture all versions + on which these versions can depend on. This pseudo package is many used + for downloading/installing: The other pseudo-packages will degenerate + to a NOP in the download/install step - this package will ensure that + it is downloaded only one time and installed only one time -- even if + the architecture bound versions coming in and out on regular basis. */ + if (strcmp(Ver.Arch(true),"all") == 0) + return true; + else + { + // our pseudo packages have no size to not confuse the fetcher + Ver->Size = 0; + Ver->InstalledSize = 0; + } + } + if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false) return false; if (ParseDepends(Ver,"Pre-Depends",pkgCache::Dep::PreDepends) == false) @@ -593,7 +611,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, return true; string Package; - string const pkgArch = Ver.Arch(); + string const pkgArch = Ver.Arch(true); string Version; unsigned int Op; @@ -622,7 +640,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) { string Package; string Version; - string const Arch = Ver.Arch(); + string const Arch = Ver.Arch(true); unsigned int Op; while (1) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index b04181d76..e817adb77 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -896,6 +896,10 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, AddStates(Pkg); Update(Pkg); AddSizes(Pkg); + + // if we remove the pseudo package, we also need to remove the "real" + if (Pkg->CurrentVer != 0 && Pkg.CurrentVer().Pseudo() == true) + MarkDelete(Pkg.Group().FindPkg("all"), rPurge, Depth+1, FromUser); } /*}}}*/ // DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 63cd954ad..ab1021a44 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -333,6 +333,7 @@ class pkgDepCache : protected pkgCache::Namespace inline Header &Head() {return *Cache->HeaderP;}; inline PkgIterator PkgBegin() {return Cache->PkgBegin();}; inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Name);}; + inline PkgIterator FindPkg(string const &Name, string const &Arch) {return Cache->FindPkg(Name, Arch);}; inline pkgCache &GetCache() {return *Cache;}; inline pkgVersioningSystem &VS() {return *Cache->VS;}; diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 0ee2e2bc8..2e7618b55 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -126,6 +126,10 @@ bool pkgOrderList::IsMissing(PkgIterator Pkg) if (FileList[Pkg->ID].empty() == false) return false; + + if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == true) + return false; + return true; } /*}}}*/ diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 1ab3203a1..08e7fc00f 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -80,7 +80,10 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, // Skip already processed packages if (List->IsNow(Pkg) == false) continue; - + + if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == true) + continue; + new pkgAcqArchive(Owner,Sources,Recs,Cache[Pkg].InstVerIter(Cache), FileNames[Pkg->ID]); } @@ -277,8 +280,10 @@ bool pkgPackageManager::ConfigureAll() for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) { PkgIterator Pkg(Cache,*I); - - if (ConfigurePkgs == true && Configure(Pkg) == false) + + if (ConfigurePkgs == true && + pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false && + Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -310,7 +315,9 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) { PkgIterator Pkg(Cache,*I); - if (ConfigurePkgs == true && Configure(Pkg) == false) + if (ConfigurePkgs == true && + pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false && + Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -457,7 +464,10 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg) return true; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); - return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); + + if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false) + return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); + return true; } /*}}}*/ // PM::SmartUnPack - Install helper /*{{{*/ @@ -565,7 +575,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) P.end() == false; P++) CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); - if (Install(Pkg,FileNames[Pkg->ID]) == false) + if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false && + Install(Pkg,FileNames[Pkg->ID]) == false) return false; List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 2d4ee1010..04a2c7234 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -649,6 +649,18 @@ bool pkgCache::VerIterator::Automatic() const return false; } /*}}}*/ +// VerIterator::Pseudo - Check if this version is a pseudo one /*{{{*/ +// --------------------------------------------------------------------- +/* Sometimes you have the need to express dependencies with versions + which doesn't really exist or exist multiply times for "different" + packages. We need these versions for dependency resolution but they + are a problem everytime we need to download/install something. */ +bool pkgCache::VerIterator::Pseudo() const +{ + return (S->MultiArch == pkgCache::Version::All && + strcmp(Arch(true),"all") != 0); +} + /*}}}*/ // VerIterator::NewestFile - Return the newest file version relation /*{{{*/ // --------------------------------------------------------------------- /* This looks at the version numbers associated with all of the sources diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 5edeedfd1..012caac76 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -357,7 +357,7 @@ inline pkgCache::PkgFileIterator pkgCache::FileEnd() class pkgCache::Namespace /*{{{*/ { public: - + typedef pkgCache::GrpIterator GrpIterator; typedef pkgCache::PkgIterator PkgIterator; typedef pkgCache::VerIterator VerIterator; typedef pkgCache::DescIterator DescIterator; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index ebda325f7..c1b546a00 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -115,9 +115,10 @@ bool pkgCacheGenerator::MergeList(ListParser &List, /* As we handle Arch all packages as architecture bounded we add all information to every (simulated) arch package */ std::vector genArch; - if (List.ArchitectureAll() == true) + if (List.ArchitectureAll() == true) { genArch = APT::Configuration::getArchitectures(); - else + genArch.push_back("all"); + } else genArch.push_back(List.Architecture()); for (std::vector::const_iterator arch = genArch.begin(); @@ -531,8 +532,11 @@ bool pkgCacheGenerator::FinishCache(OpProgress &Progress) { 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(); + 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 @@ -540,6 +544,8 @@ bool pkgCacheGenerator::FinishCache(OpProgress &Progress) { - 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::const_iterator A = archs.begin(); A != archs.end(); ++A) { if (*A == Arch) continue; @@ -561,6 +567,12 @@ bool pkgCacheGenerator::FinishCache(OpProgress &Progress) { 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, "", @@ -675,7 +687,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, pkgCache &Cache = Owner->Cache; // We do not add self referencing provides - if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch()) + if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch(true)) return true; // Get a structure diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index cd806286c..275daa187 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1587,6 +1587,8 @@ bool Policy(CommandLine &CmdL) } for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg)) { + if (strcmp(Pkg.Arch(),"all") == 0) + continue; if (myArch == Pkg.Arch()) cout << Pkg.Name() << ":" << endl; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 2597a6acb..93065004c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -233,7 +233,7 @@ bool ShowList(ostream &out,string Title,string List,string VersionsList) if it is not the main architecture */ string ShowPkg(pkgCache::PkgIterator const Pkg) { string p = Pkg.Name(); - if (_config->Find("APT::Architecture") != Pkg.Arch()) + if (strcmp(Pkg.Arch(),"all") != 0 && _config->Find("APT::Architecture") != Pkg.Arch()) p.append(":").append(Pkg.Arch()); return p; } @@ -385,6 +385,8 @@ void ShowNew(ostream &out,CacheFile &Cache) { pkgCache::PkgIterator I(Cache,Cache.List[J]); if (Cache[I].NewInstall() == true) { + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; List += ShowPkg(I) + " "; VersionsList += string(Cache[I].CandVersion) + "\n"; } @@ -407,6 +409,8 @@ void ShowDel(ostream &out,CacheFile &Cache) pkgCache::PkgIterator I(Cache,Cache.List[J]); if (Cache[I].Delete() == true) { + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) List += ShowPkg(I) + "* "; else @@ -455,7 +459,9 @@ void ShowUpgraded(ostream &out,CacheFile &Cache) // Not interesting if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true) continue; - + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; + List += ShowPkg(I) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } @@ -476,7 +482,9 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache) // Not interesting if (Cache[I].Downgrade() == false || Cache[I].NewInstall() == true) continue; - + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; + List += ShowPkg(I) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } -- cgit v1.2.3-70-g09d2 From 42d71ab5fe58953a680bd300a99d173e23430d7c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Feb 2010 17:17:16 +0100 Subject: In SingleArch environments we don't need the arch "all" pseudo package for handling arch:all packages, so we create only one package and stop calling it a pseudo package. --- apt-pkg/deb/deblistparser.cc | 2 +- apt-pkg/pkgcache.cc | 9 +++++++-- apt-pkg/pkgcachegen.cc | 3 ++- cmdline/apt-get.cc | 3 +++ 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b3d95164a..1948aedf3 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -158,7 +158,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) the architecture bound versions coming in and out on regular basis. */ if (strcmp(Ver.Arch(true),"all") == 0) return true; - else + else if (Ver.Pseudo() == true) { // our pseudo packages have no size to not confuse the fetcher Ver->Size = 0; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 04a2c7234..d4268b31c 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -657,8 +657,13 @@ bool pkgCache::VerIterator::Automatic() const are a problem everytime we need to download/install something. */ bool pkgCache::VerIterator::Pseudo() const { - return (S->MultiArch == pkgCache::Version::All && - strcmp(Arch(true),"all") != 0); + if (S->MultiArch == pkgCache::Version::All && + strcmp(Arch(true),"all") != 0) + { + GrpIterator const Grp = ParentPkg().Group(); + return (Grp->LastPackage != Grp->FirstPackage); + } + return false; } /*}}}*/ // VerIterator::NewestFile - Return the newest file version relation /*{{{*/ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index c1b546a00..6d103c6b6 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -117,7 +117,8 @@ bool pkgCacheGenerator::MergeList(ListParser &List, std::vector genArch; if (List.ArchitectureAll() == true) { genArch = APT::Configuration::getArchitectures(); - genArch.push_back("all"); + if (genArch.size() != 1) + genArch.push_back("all"); } else genArch.push_back(List.Architecture()); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 93065004c..343226bc3 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -585,6 +585,9 @@ void Stats(ostream &out,pkgDepCache &Dep) unsigned long ReInstall = 0; for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++) { + if (pkgCache::VerIterator(Dep, Dep[I].CandidateVer).Pseudo() == true) + continue; + if (Dep[I].NewInstall() == true) Install++; else -- cgit v1.2.3-70-g09d2 From 4cc6f8dc52144f773b96ee99070d1be0821b984e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 13 Feb 2010 01:59:22 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - stdin redirected to /dev/null takes all CPU (Closes: #569488) Thanks to Aurelien Jarno for providing (again) a patch! --- apt-pkg/deb/dpkgpm.cc | 2 +- debian/changelog | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 565f01b84..3dca2b209 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1005,7 +1005,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) // wait for input or output here FD_ZERO(&rfds); - if (!stdin_is_dev_null) + if (master >= 0 && !stdin_is_dev_null) FD_SET(0, &rfds); FD_SET(_dpkgin, &rfds); if(master >= 0) diff --git a/debian/changelog b/debian/changelog index a81a2abd0..5d2527cbd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,9 @@ apt (0.7.26) UNRELEASED; urgency=low - add APT::FTPArchive::AlwaysStat to disable the too aggressive caching if versions are build multiply times (not recommend) Patch by Christoph Goehre, thanks! (Closes: #463260) + * apt-pkg/deb/dpkgpm.cc: + - stdin redirected to /dev/null takes all CPU (Closes: #569488) + Thanks to Aurelien Jarno for providing (again) a patch! [ Ivan Masár ] * Slovak translation update. Closes: #568294 -- cgit v1.2.3-70-g09d2 From ee60a63480f7d1a963d7ef2a8e399d0f9b651d71 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 14 Feb 2010 22:24:55 +0100 Subject: Pseudo() doesn't work in the Cache generation step as the check if only one package is in the group will generate false positives - as the others will (maybe) added a little time later in the process. --- apt-pkg/deb/deblistparser.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index bfc0e762e..84eab44a7 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -155,9 +155,10 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) to a NOP in the download/install step - this package will ensure that it is downloaded only one time and installed only one time -- even if the architecture bound versions coming in and out on regular basis. */ + bool const static multiArch = APT::Configuration::getArchitectures().size() > 1; if (strcmp(Ver.Arch(true),"all") == 0) return true; - else if (Ver.Pseudo() == true) + else if (multiArch == true) { // our pseudo packages have no size to not confuse the fetcher Ver->Size = 0; -- cgit v1.2.3-70-g09d2 From 1a31359bfe4fdbf9ac1a25ab0b9f013d37099ac4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 15 Feb 2010 13:05:53 +0100 Subject: * aptconfiguration.cc: - include all existing Translation files in the Cache (Closes: 564137) Previously if APT was executed with a different LC_* all these invocations needed to rebuild the Cache as too many files were included or missing: Now the lists-directory is checked for Translation-files and all these included in getLanguages() regardless of the environment setting (after a "none" so APT will not use them for displaying information). --- apt-pkg/aptconfiguration.cc | 78 ++++++++++++++++++++++++++++++++++++---- apt-pkg/deb/debmetaindex.cc | 5 ++- debian/changelog | 2 ++ test/libapt/getlanguages_test.cc | 22 ++++++++++-- test/libapt/run-tests.sh | 7 ++++ 5 files changed, 105 insertions(+), 9 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index f1989599b..429219cbd 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -14,9 +14,12 @@ #include #include -#include -#include +#include +#include + #include +#include +#include /*}}}*/ namespace APT { // getCompressionTypes - Return Vector of usbale compressiontypes /*{{{*/ @@ -119,6 +122,37 @@ std::vector const Configuration::getLanguages(bool const &All, } } + // Include all Language codes we have a Translation file for in /var/lib/apt/lists + // so they will be all included in the Cache. + std::vector builtin; + DIR *D = opendir(_config->FindDir("Dir::State::lists").c_str()); + if (D != 0) { + builtin.push_back("none"); + for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) { + string const name = Ent->d_name; + size_t const foundDash = name.rfind("-"); + size_t const foundUnderscore = name.rfind("_"); + if (foundDash == string::npos || foundUnderscore == string::npos || + foundDash <= foundUnderscore || + name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation") + continue; + string const c = name.substr(foundDash+1); + if (unlikely(c.empty() == true) || c == "en") + continue; + // Skip unusual files, like backups or that alike + string::const_iterator s = c.begin(); + for (;s != c.end(); ++s) { + if (isalpha(*s) == 0) + break; + } + if (s != c.end()) + continue; + if (std::find(builtin.begin(), builtin.end(), c) != builtin.end()) + continue; + builtin.push_back(c); + } + } + // get the environment language codes: LC_MESSAGES (and later LANGUAGE) // we extract both, a long and a short code and then we will // check if we actually need both (rare) or if the short is enough @@ -134,7 +168,11 @@ std::vector const Configuration::getLanguages(bool const &All, if (envLong == "C") { codes.push_back("en"); allCodes = codes; - return codes; + allCodes.insert(allCodes.end(), builtin.begin(), builtin.end()); + if (All == true) + return allCodes; + else + return codes; } // to save the servers from unneeded queries, we only try also long codes @@ -159,8 +197,16 @@ std::vector const Configuration::getLanguages(bool const &All, if (oldAcquire.empty() == false && oldAcquire != "environment") { if (oldAcquire != "none") codes.push_back(oldAcquire); + codes.push_back("en"); allCodes = codes; - return codes; + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + if (All == true) + return allCodes; + else + return codes; } // It is very likely we will need to environment codes later, @@ -207,7 +253,14 @@ std::vector const Configuration::getLanguages(bool const &All, } else if (forceLang != "none") codes.push_back(forceLang); allCodes = codes; - return codes; + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + if (All == true) + return allCodes; + else + return codes; } std::vector const lang = _config->FindVector("Acquire::Languages"); @@ -217,7 +270,14 @@ std::vector const Configuration::getLanguages(bool const &All, if (envShort != "en") codes.push_back("en"); allCodes = codes; - return codes; + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + if (All == true) + return allCodes; + else + return codes; } // the configs define the order, so add the environment @@ -245,6 +305,12 @@ std::vector const Configuration::getLanguages(bool const &All, codes.push_back(*l); allCodes.push_back(*l); } + + for (std::vector::const_iterator b = builtin.begin(); + b != builtin.end(); ++b) + if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end()) + allCodes.push_back(*b); + if (All == true) return allCodes; else diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index eb01a0156..0e4e6df9e 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -214,6 +214,7 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const s != sections.end(); ++s) for (set::const_iterator l = s->second.begin(); l != s->second.end(); l++) { + if (*l == "none") continue; debTranslationsIndex i = debTranslationsIndex(URI,Dist,s->first,(*l).c_str()); i.GetIndexes(Owner); } @@ -268,8 +269,10 @@ vector *debReleaseIndex::GetIndexFiles() { for (map >::const_iterator s = sections.begin(); s != sections.end(); ++s) for (set::const_iterator l = s->second.begin(); - l != s->second.end(); l++) + l != s->second.end(); l++) { + if (*l == "none") continue; Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str())); + } return Indexes; } diff --git a/debian/changelog b/debian/changelog index f328b11a7..fdce01098 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,8 @@ apt (0.7.26) UNRELEASED; urgency=low Thanks to Aurelien Jarno for providing (again) a patch! * buildlib/apti18n.h.in, po/makefile: - add ngettext support with P_() + * aptconfiguration.cc: + - include all existing Translation files in the Cache (Closes: 564137) [ Ivan Masár ] * Slovak translation update. Closes: #568294 diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index fb7afb4ef..0db190b50 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -16,9 +16,15 @@ void dumpVector(std::vector vec) { int main(int argc,char *argv[]) { + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + char const* env[2]; env[0] = "de_DE.UTF-8"; env[1] = ""; + std::vector vec = APT::Configuration::getLanguages(false, false, env); equals(vec.size(), 2); equals(vec[0], "de"); @@ -87,6 +93,16 @@ int main(int argc,char *argv[]) equals(vec[0], "de"); equals(vec[1], "en"); + _config->Set("Dir::State::lists", argv[1]); + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec.size(), 5); + equals(vec[0], "de"); + equals(vec[1], "en"); + equals(vec[2], "none"); + equals(vec[3], "pt"); + equals(vec[4], "tr"); + + _config->Set("Dir::State::lists", "/non-existing-dir"); _config->Set("Acquire::Languages::1", "none"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(false, false, env); @@ -113,12 +129,14 @@ int main(int argc,char *argv[]) _config->Set("APT::Acquire::Translation", "ast_DE"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 1); + equals(vec.size(), 2); equals(vec[0], "ast_DE"); + equals(vec[1], "en"); _config->Set("APT::Acquire::Translation", "none"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "en"); return 0; } diff --git a/test/libapt/run-tests.sh b/test/libapt/run-tests.sh index 1fcfb6861..f9df1af5f 100755 --- a/test/libapt/run-tests.sh +++ b/test/libapt/run-tests.sh @@ -39,6 +39,13 @@ do "${tmppath}/01invalíd" ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list" ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list" + elif [ $name = "getLanguages${EXT}" ]; then + echo "Prepare Testarea for \033[1;35m$name\033[0m ..." + tmppath=$(mktemp -d) + touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \ + "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \ + "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \ + "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" fi echo -n "Testing with \033[1;35m${name}\033[0m ... " -- cgit v1.2.3-70-g09d2 From b7044b4b7483259f6dbca4fce56320dbde6da02a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 18 Feb 2010 00:55:35 +0100 Subject: doesn't use a default separator in ExplodeString (halfway losted in merge) --- apt-pkg/deb/debmetaindex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 0e4e6df9e..947a7f04b 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -313,7 +313,7 @@ class debSLTypeDebian : public pkgSourceList::Type { map::const_iterator const arch = Options.find("arch"); vector const Archs = - (arch != Options.end()) ? ExplodeString(arch->second) : + (arch != Options.end()) ? ExplodeString(arch->second, ',') : APT::Configuration::getArchitectures(); for (vector::const_iterator I = List.begin(); -- cgit v1.2.3-70-g09d2 From 569cc9349d26cc6a886111023df21ba569b1ffbe Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Mar 2010 10:56:25 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - fix error message construction in OpenLog() --- apt-pkg/deb/dpkgpm.cc | 16 +++++++++------- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index fb6054f79..ad1ea77fd 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -564,35 +564,37 @@ void pkgDPkgPM::WriteHistoryTag(string tag, string value) // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() { - string logdir = _config->FindDir("Dir::Log"); + string const logdir = _config->FindDir("Dir::Log"); if(not FileExists(logdir)) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); // get current time char timestr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); + time_t const t = time(NULL); + struct tm const * const tmp = localtime(&t); strftime(timestr, sizeof(timestr), "%F %T", tmp); // open terminal log - string logfile_name = flCombine(logdir, + string const logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); if (term_out == NULL) - return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str()); + return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str()); chmod(logfile_name.c_str(), 0600); fprintf(term_out, "\nLog started: %s\n", timestr); } - // write - string history_name = flCombine(logdir, + // write your history + string const history_name = flCombine(logdir, _config->Find("Dir::Log::History")); if (!history_name.empty()) { history_out = fopen(history_name.c_str(),"a"); + if (history_out == NULL) + return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str()); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); string remove, purge, install, upgrade, downgrade; diff --git a/debian/changelog b/debian/changelog index 417c23e8c..d1983ee9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ apt (0.7.26) UNRELEASED; urgency=low * doc/apt_preferences.5.xml: - fix two typos and be more verbose in the novice warning. Thanks to Osamu Aoki for pointing it out! (Closes: #567669) + * apt-pkg/deb/dpkgpm.cc: + - fix error message construction in OpenLog() -- David Kalnischkies Fri, 19 Feb 2010 21:21:43 +0100 -- cgit v1.2.3-70-g09d2 From 2bb255740bf18b5e0524fe833523303abb5c9051 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Mar 2010 19:41:30 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - if available store the Commandline in the history * apt-pkg/contrib/cmndline.cc: - save Commandline in Commandline::AsString for logging --- apt-pkg/contrib/cmndline.cc | 42 ++++++++++++++++++++++++++++++++- apt-pkg/contrib/cmndline.h | 1 + apt-pkg/deb/dpkgpm.cc | 2 ++ debian/changelog | 3 +++ test/libapt/commandlineasstring_test.cc | 39 ++++++++++++++++++++++++++++++ test/libapt/makefile | 6 +++++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 test/libapt/commandlineasstring_test.cc (limited to 'apt-pkg/deb') diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index bfd53695e..0b16bf51a 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -135,7 +135,9 @@ bool CommandLine::Parse(int argc,const char **argv) for (; I != argc; I++) *Files++ = argv[I]; *Files = 0; - + + SaveInConfig(argc, argv); + return true; } /*}}}*/ @@ -351,3 +353,41 @@ bool CommandLine::DispatchArg(Dispatch *Map,bool NoMatch) return false; } /*}}}*/ +// CommandLine::SaveInConfig - for output later in a logfile or so /*{{{*/ +// --------------------------------------------------------------------- +/* We save the commandline here to have it around later for e.g. logging. + It feels a bit like a hack here and isn't bulletproof, but it is better + than nothing after all. */ +void CommandLine::SaveInConfig(unsigned int const &argc, char const * const * const argv) +{ + char cmdline[300]; + unsigned int length = 0; + bool lastWasOption = false; + bool closeQuote = false; + for (unsigned int i = 0; i < argc; ++i, ++length) + { + for (unsigned int j = 0; argv[i][j] != '\0' && length < sizeof(cmdline)-1; ++j, ++length) + { + cmdline[length] = argv[i][j]; + if (lastWasOption == true && argv[i][j] == '=') + { + // That is possibly an option: Quote it if it includes spaces, + // the benefit is that this will eliminate also most false positives + const char* c = &argv[i][j+1]; + for (; *c != '\0' && *c != ' '; ++c); + if (*c == '\0') continue; + cmdline[++length] = '"'; + closeQuote = true; + } + } + if (closeQuote == true) + cmdline[length++] = '"'; + // Problem: detects also --hello + if (cmdline[length-1] == 'o') + lastWasOption = true; + cmdline[length] = ' '; + } + cmdline[--length] = '\0'; + _config->Set("CommandLine::AsString", cmdline); +} + /*}}}*/ diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h index e28071e81..7c0c71aa7 100644 --- a/apt-pkg/contrib/cmndline.h +++ b/apt-pkg/contrib/cmndline.h @@ -60,6 +60,7 @@ class CommandLine Configuration *Conf; bool HandleOpt(int &I,int argc,const char *argv[], const char *&Opt,Args *A,bool PreceedeMatch = false); + void static SaveInConfig(unsigned int const &argc, char const * const * const argv); public: diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ad1ea77fd..9ba60060c 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -614,6 +614,8 @@ bool pkgDPkgPM::OpenLog() remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); } } + if (_config->Exists("Commandline::AsString") == true) + WriteHistoryTag("Commandline", _config->Find("Commandline::AsString")); WriteHistoryTag("Install", install); WriteHistoryTag("Upgrade", upgrade); WriteHistoryTag("Downgrade",downgrade); diff --git a/debian/changelog b/debian/changelog index b05498f12..506e70a25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,9 +14,12 @@ apt (0.7.26) UNRELEASED; urgency=low Thanks to Osamu Aoki for pointing it out! (Closes: #567669) * apt-pkg/deb/dpkgpm.cc: - fix error message construction in OpenLog() + - if available store the Commandline in the history * cmdline/apt-get.cc: - add a --only-upgrade flag to install command (Closes: #572259) - fix memory leaks in error conditions in DoSource() + * apt-pkg/contrib/cmndline.cc: + - save Commandline in Commandline::AsString for logging -- David Kalnischkies Fri, 19 Feb 2010 21:21:43 +0100 diff --git a/test/libapt/commandlineasstring_test.cc b/test/libapt/commandlineasstring_test.cc new file mode 100644 index 000000000..a38957d7e --- /dev/null +++ b/test/libapt/commandlineasstring_test.cc @@ -0,0 +1,39 @@ +#include +#include + +#include + +#include "assert.h" + +class CLT: public CommandLine { + + public: + std::string static AsString(const char * const * const argv, + unsigned int const argc) { + std::string const static conf = "Commandline::AsString"; + _config->Clear(conf); + SaveInConfig(argc, argv); + return _config->Find(conf); + } +}; + +#define CMD(y,z) equals(CLT::AsString(argv, y), z); + +int main() { + { + const char* const argv[] = {"apt-get", "install", "-sf"}; + CMD(3, "apt-get install -sf"); + } + { + const char* const argv[] = {"apt-cache", "-s", "apt", "-so", "Debug::test=Test"}; + CMD(5, "apt-cache -s apt -so Debug::test=Test"); + } + { + const char* const argv[] = {"apt-cache", "-s", "apt", "-so", "Debug::test=Das ist ein Test"}; + CMD(5, "apt-cache -s apt -so Debug::test=\"Das ist ein Test\""); + } + { + const char* const argv[] = {"apt-cache", "-s", "apt", "--hallo", "test=1.0"}; + CMD(5, "apt-cache -s apt --hallo test=1.0"); + } +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 08f581e6d..cb76d5ee6 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -23,3 +23,9 @@ PROGRAM = GetListOfFilesInDir${BASENAME} SLIBS = -lapt-pkg SOURCE = getlistoffilesindir_test.cc include $(PROGRAM_H) + +# Program for testing CommandLine reconstruction +PROGRAM = commandlineasstring${BASENAME} +SLIBS = -lapt-pkg +SOURCE = commandlineasstring_test.cc +include $(PROGRAM_H) -- cgit v1.2.3-70-g09d2 From ea5624c3d04c35f5a269b6f7431c135330c9b9b5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 13 Mar 2010 14:11:22 +0100 Subject: * apt-pkg/deb/debversion.cc: - consider absent of debian revision equivalent to 0 (Closes: #573592) This moves the existing testcase for version comparison to "my" directory, adds a few more tests (e.g. the tests used in cupt) and rewrites the testcases runner: The runner does now call dpkg --compare-versions to check what dpkg thinks about the comparison - all done in less code ;) --- apt-pkg/deb/debversion.cc | 18 ++- debian/changelog | 2 + test/libapt/compareversion_test.cc | 123 ++++++++++++++++++++ test/libapt/makefile | 6 + test/makefile | 7 -- test/versions.lst | 64 +++++++++- test/versiontest.cc | 233 ------------------------------------- 7 files changed, 207 insertions(+), 246 deletions(-) create mode 100644 test/libapt/compareversion_test.cc delete mode 100644 test/versiontest.cc (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index ad45e9a44..755ffbe96 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -190,8 +190,22 @@ int debVersioningSystem::DoCmpVersion(const char *A,const char *AEnd, dlhs++; if (drhs != rhs) drhs++; - - return CmpFragment(dlhs,AEnd,drhs,BEnd); + + // no debian revision need to be treated like -0 + if (*(dlhs-1) == '-' && *(drhs-1) == '-') + return CmpFragment(dlhs,AEnd,drhs,BEnd); + else if (*(dlhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(dlhs,AEnd,null, null+1); + } + else if (*(drhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(null, null+1, drhs, BEnd); + } + else + return 0; } /*}}}*/ // debVS::CheckDep - Check a single dependency /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 506e70a25..b0d7cb536 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,8 @@ apt (0.7.26) UNRELEASED; urgency=low - fix memory leaks in error conditions in DoSource() * apt-pkg/contrib/cmndline.cc: - save Commandline in Commandline::AsString for logging + * apt-pkg/deb/debversion.cc: + - consider absent of debian revision equivalent to 0 (Closes: #573592) -- David Kalnischkies Fri, 19 Feb 2010 21:21:43 +0100 diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc new file mode 100644 index 000000000..b6213e84c --- /dev/null +++ b/test/libapt/compareversion_test.cc @@ -0,0 +1,123 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +/* ###################################################################### + + Version Test - Simple program to run through a file and comare versions. + + Each version is compared and the result is checked against an expected + result in the file. The format of the file is + a b Res + Where Res is -1, 1, 0. dpkg -D=1 --compare-versions a "<" b can be + used to determine what Res should be. # at the start of the line + is a comment and blank lines are skipped + + The runner will also call dpkg --compare-versions to check if APT and + dpkg have (still) the same idea. + + ##################################################################### */ + /*}}}*/ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +bool callDPkg(const char *val, const char *ref, const char &op) { + pid_t Process = ExecFork(); + if (Process == 0) + { + const char * args[6]; + args[0] = "/usr/bin/dpkg"; + args[1] = "--compare-versions"; + args[2] = val; + args[3] = (op == 1) ? ">>" : ( (op == 0) ? "=" : "<<"); + args[4] = ref; + args[5] = 0; + execv(args[0], (char**) args); + exit(1); + } + int Ret; + waitpid(Process, &Ret, 0); + return WIFEXITED(Ret) == true && WEXITSTATUS(Ret) == 0; +} + +void assertVersion(int const &CurLine, string const &A, string const &B, int const &Expected) { + int Res = debVS.CmpVersion(A.c_str(), B.c_str()); + bool const dpkg = callDPkg(A.c_str(),B.c_str(), Expected); + Res = (Res < 0) ? -1 : ( (Res > 0) ? 1 : Res); + + if (Res != Expected) + _error->Error("Comparison failed on line %u. '%s' '%s' '%s' %i != %i",CurLine,A.c_str(),((Expected == 1) ? "<<" : ( (Expected == 0) ? "=" : ">>")) ,B.c_str(),Res,Expected); + if (dpkg == false) + _error->Error("DPkg differ with line: %u. '%s' '%s' '%s' == false",CurLine,A.c_str(),((Expected == 1) ? "<<" : ( (Expected == 0) ? "=" : ">>")),B.c_str()); +} + +bool RunTest(const char *File) +{ + ifstream F(File,ios::in); + if (!F != 0) + return false; + + char Buffer[300]; + int CurLine = 0; + + while (1) + { + F.getline(Buffer,sizeof(Buffer)); + CurLine++; + if (F.eof() != 0) + return true; + if (!F != 0) + return _error->Error("Line %u in %s is too long",CurLine,File); + + // Comment + if (Buffer[0] == '#' || Buffer[0] == 0) + continue; + + // First version + char *I; + char *Start = Buffer; + for (I = Buffer; *I != 0 && *I != ' '; I++); + string A(Start, I - Start); + + if (*I == 0) + return _error->Error("Invalid line %u",CurLine); + + // Second version + I++; + Start = I; + for (I = Start; *I != 0 && *I != ' '; I++); + string B(Start,I - Start); + + if (*I == 0 || I[1] == 0) + return _error->Error("Invalid line %u",CurLine); + + // Result + I++; + int const Expected = atoi(I); + assertVersion(CurLine, A, B, Expected); + // Check the reverse as well + assertVersion(CurLine, B, A, Expected*-1); + } +} + +int main(int argc, char *argv[]) +{ + if (argc <= 1) + RunTest("../versions.lst"); + else + RunTest(argv[1]); + + // Print any errors or warnings found + _error->DumpErrors(); + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index cb76d5ee6..98bdb3348 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -29,3 +29,9 @@ PROGRAM = commandlineasstring${BASENAME} SLIBS = -lapt-pkg SOURCE = commandlineasstring_test.cc include $(PROGRAM_H) + +# Program for testing debians version comparing +PROGRAM = compareversion${BASENAME} +SLIBS = -lapt-pkg +SOURCE = compareversion_test.cc +include $(PROGRAM_H) diff --git a/test/makefile b/test/makefile index fb9123d0a..b8c104eae 100644 --- a/test/makefile +++ b/test/makefile @@ -24,13 +24,6 @@ LIB_MAKES = apt-pkg/makefile apt-inst/makefile SOURCE = scratch.cc include $(PROGRAM_H) -# Version compare tester -PROGRAM=versiontest -SLIBS = -lapt-pkg -LIB_MAKES = apt-pkg/makefile -SOURCE = versiontest.cc -include $(PROGRAM_H) - # Version compare tester PROGRAM=testextract SLIBS = -lapt-pkg -lapt-inst diff --git a/test/versions.lst b/test/versions.lst index efc19c4f0..517214151 100644 --- a/test/versions.lst +++ b/test/versions.lst @@ -10,10 +10,11 @@ 1.3 1.2.2 1 # Important attributes -- . -1 -p - -1 -a - -1 -z - -1 +# disabled as dpkg --compare-versions doesn't like them… +#- . -1 +#p - -1 +#a - -1 +#z - -1 a . -1 z . -1 @@ -22,6 +23,10 @@ z . -1 1:1.25-4 1:1.25-8 -1 0:1.18.36 1.18.36 0 +# native version +1.18.36 1.18.35 1 +0:1.18.36 1.18.35 1 + # Funky, but allowed, characters in upstream version 9:1.18.36:5.4-20 10:0.5.1-22 -1 9:1.18.36:5.4-20 9:1.18.36:5.5-1 -1 @@ -49,3 +54,54 @@ III-alpha9.8 III-alpha9.8-1.5 -1 # #205960 3.0~rc1-1 3.0-1 -1 + +# #573592 - debian policy 5.6.12 +1.0 1.0-0 0 +0.2 1.0-0 -1 +1.0 1.0-0+b1 -1 +1.0 1.0-0~ 1 + +# if a version includes a dash +# it should be the debrev dash - policy says so… +0:0-0-0 0-0 1 + +# do we like strange versions? Yes we like strange versions… +0 0 0 +0 00 0 + +# "steal" the testcases from cupt +1.2.3 1.2.3 0 # identical +4.4.3-2 4.4.3-2 0 # identical +1:2ab:5 1:2ab:5 0 # this is correct... +7:1-a:b-5 7:1-a:b-5 0 # and this +57:1.2.3abYZ+~-4-5 57:1.2.3abYZ+~-4-5 0 # and those too +1.2.3 0:1.2.3 0 # zero epoch +1.2.3 1.2.3-0 0 # zero revision +009 9 0 # zeroes... +009ab5 9ab5 0 # there as well +1.2.3 1.2.3-1 -1 # added non-zero revision +1.2.3 1.2.4 -1 # just bigger +1.2.4 1.2.3 1 # order doesn't matter +1.2.24 1.2.3 1 # bigger, eh? +0.10.0 0.8.7 1 # bigger, eh? +3.2 2.3 1 # major number rocks +1.3.2a 1.3.2 1 # letters rock +0.5.0~git 0.5.0~git2 -1 # numbers rock +2a 21 -1 # but not in all places +1.3.2a 1.3.2b -1 # but there is another letter +1:1.2.3 1.2.4 1 # epoch rocks +1:1.2.3 1:1.2.4 -1 # bigger anyway +1.2a+~bCd3 1.2a++ -1 # tilde doesn't rock +1.2a+~bCd3 1.2a+~ 1 # but first is longer! +5:2 304-2 1 # epoch rocks +5:2 304:2 -1 # so big epoch? +25:2 3:2 1 # 25 > 3, obviously +1:2:123 1:12:3 -1 # 12 > 2 +1.2-5 1.2-3-5 -1 # 1.2 < 1.2-3 +5.10.0 5.005 1 # preceding zeroes don't matters +3a9.8 3.10.2 -1 # letters are before all letter symbols +3a9.8 3~10 1 # but after the tilde +1.4+OOo3.0.0~ 1.4+OOo3.0.0-4 -1 # another tilde check +2.4.7-1 2.4.7-z -1 # revision comparing +1.002-1+b2 1.00 1 # whatever... +2.2.4-47978_Debian_lenny 2.2.4-47978_Debian_lenny 0 # and underscore... diff --git a/test/versiontest.cc b/test/versiontest.cc deleted file mode 100644 index 4ede4b280..000000000 --- a/test/versiontest.cc +++ /dev/null @@ -1,233 +0,0 @@ -// -*- mode: cpp; mode: fold -*- -// Description /*{{{*/ -// $Id: versiontest.cc,v 1.5 2003/08/18 15:55:19 mdz Exp $ -/* ###################################################################### - - Version Test - Simple program to run through a file and comare versions. - - Each version is compared and the result is checked against an expected - result in the file. The format of the file is - a b Res - Where Res is -1, 1, 0. dpkg -D=1 --compare-versions a "<" b can be - used to determine what Res should be. # at the start of the line - is a comment and blank lines are skipped - - ##################################################################### */ - /*}}}*/ -#include -#include -#include -#include -#include -#include - -using namespace std; - - static int verrevcmp(const char *val, const char *ref) -{ - int vc, rc; - long vl, rl; - const char *vp, *rp; - - if (!val) - val = ""; - if (!ref) - ref = ""; - for (;;) - { - vp = val; - while (*vp && !isdigit(*vp)) - vp++; - rp = ref; - while (*rp && !isdigit(*rp)) - rp++; - for (;;) - { - vc= val == vp ? 0 : *val++; - rc= ref == rp ? 0 : *ref++; - if (!rc && !vc) - break; - if (vc && !isalpha(vc)) - vc += 256; /* assumes ASCII character set */ - if (rc && !isalpha(rc)) - rc += 256; - if (vc != rc) - return vc - rc; - } - val = vp; - ref = rp; - vl = 0; - if (isdigit(*vp)) - vl = strtol(val,(char**)&val,10); - rl = 0; - if (isdigit(*rp)) - rl = strtol(ref,(char**)&ref,10); - if (vl != rl) - return vl - rl; - if (!*val && !*ref) - return 0; - if (!*val) - return -1; - if (!*ref) - return +1; - } -} - -#if 0 -static int verrevcmp(const char *val, const char *ref) -{ - int vc, rc; - long vl, rl; - const char *vp, *rp; - - if (!val) val= ""; - if (!ref) ref= ""; - for (;;) - { - vp= val; while (*vp && !isdigit(*vp) && *vp != '~') vp++; - rp= ref; while (*rp && !isdigit(*rp) && *rp != '~') rp++; - for (;;) - { - vc= val == vp ? 0 : *val++; - rc= ref == rp ? 0 : *ref++; - if (!rc && !vc) break; - if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */ - if (rc && !isalpha(rc)) rc += 256; - if (vc != rc) return vc - rc; - } - - val= vp; - ref= rp; - if (*vp == '~') val++; - if (*rp == '~') ref++; - vl=0; if (isdigit(*val)) vl= strtol(val,(char**)&val,10); - rl=0; if (isdigit(*ref)) rl= strtol(ref,(char**)&ref,10); - if (vl == 0 && rl == 0) - { - if (*vp == '~' && *rp != '~') return -1; - if (*vp != '~' && *rp == '~') return +1; - } - if (*vp == '~') - vl *= -1; - if (*rp == '~') - rl *= -1; - if (vl != rl) return vl - rl; - if (!*val && !*ref) return 0; - if (!*val) - { - if (*ref == '~') - return +1; - else - return -1; - } - - if (!*ref) - { - if (*val == '~') - return -1; - else - return +1; - } - } -} -#endif - -bool RunTest(const char *File) -{ - ifstream F(File,ios::in); - if (!F != 0) - return false; - - char Buffer[300]; - int CurLine = 0; - - while (1) - { - F.getline(Buffer,sizeof(Buffer)); - CurLine++; - if (F.eof() != 0) - return true; - if (!F != 0) - return _error->Error("Line %u in %s is too long",CurLine,File); - - // Comment - if (Buffer[0] == '#' || Buffer[0] == 0) - continue; - - // First version - char *I; - char *Start = Buffer; - for (I = Buffer; *I != 0 && *I != ' '; I++); - string A(Start, I - Start); - - if (*I == 0) - return _error->Error("Invalid line %u",CurLine); - - // Second version - I++; - Start = I; - for (I = Start; *I != 0 && *I != ' '; I++); - string B(Start,I - Start); - - if (*I == 0 || I[1] == 0) - return _error->Error("Invalid line %u",CurLine); - - // Result - I++; - int Expected = atoi(I); - int Res = debVS.CmpVersion(A.c_str(), B.c_str()); - int Res2 = verrevcmp(A.c_str(),B.c_str()); - cout << "'" << A << "' ? '" << B << "' = " << Res << " (= " << Expected << ") " << Res2 << endl; - - if (Res < 0) - Res = -1; - else if (Res > 0) - Res = 1; - - if (Res != Expected) - _error->Error("Comparison failed on line %u. '%s' ? '%s' %i != %i",CurLine,A.c_str(),B.c_str(),Res,Expected); - - // Check the reverse as well - Expected = -1*Expected; - Res = debVS.CmpVersion(B.c_str(), A.c_str()); - Res2 = verrevcmp(B.c_str(),A.c_str()); - - cout << "'" << B << "' ? '" << A << "' = " << Res << " (= " << Expected << ") " << Res2 << endl; - - if (Res < 0) - Res = -1; - else if (Res > 0) - Res = 1; - - if (Res != Expected) - _error->Error("Comparison failed on line %u. '%s' ? '%s' %i != %i",CurLine,B.c_str(),A.c_str(),Res,Expected); - } -} - -int main(int argc, char *argv[]) -{ - if (argc <= 1) - { - cerr << "You must specify a test file" << endl; - return 0; - } - - RunTest(argv[1]); - - // Print any errors or warnings found - if (_error->empty() == false) - { - string Err; - while (_error->empty() == false) - { - - bool Type = _error->PopMessage(Err); - if (Type == true) - cout << "E: " << Err << endl; - else - cout << "W: " << Err << endl; - } - - return 0; - } -} -- cgit v1.2.3-70-g09d2 From 306eacf617b8ea8c87b31258c55a5373be4ad946 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 18 Mar 2010 18:07:51 +0100 Subject: generate "negative" dependencies against all architectures of a package Negative means here Conflicts, Replaces and Breaks - this adds again a whole lot of dependencies. --- apt-pkg/deb/deblistparser.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 84eab44a7..5c9cf6d4b 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -609,7 +609,10 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, const char *Stop; if (Section.Find(Tag,Start,Stop) == false) return true; - + + static std::vector const archs = APT::Configuration::getArchitectures(); + static bool const multiArch = archs.size() <= 1; + string Package; string const pkgArch = Ver.Arch(true); string Version; @@ -620,8 +623,18 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, Start = ParseDepends(Start,Stop,Package,Version,Op); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); - - if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false) + + if (multiArch == true && + (Type == pkgCache::Dep::Conflicts || + Type == pkgCache::Dep::DpkgBreaks || + Type == pkgCache::Dep::Replaces)) + { + for (std::vector::const_iterator a = archs.begin(); + a != archs.end(); ++a) + if (NewDepends(Ver,Package,*a,Version,Op,Type) == false) + return false; + } + else if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false) return false; if (Start == Stop) break; -- cgit v1.2.3-70-g09d2 From 6bc703c22970055d9e1a1b4e3e0efe74f4cefda5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 21 Mar 2010 21:48:09 +0100 Subject: Add with pkgCacheGen::Essential a way to control which packages get the essential flag: * native is the default and will only mark packages of the main arch * all will mark all packages which have these flag in Packages * none will obviously do the opposite * installed will only mark packages which are installed as essential, so it will behave in the same way as dpkg does it. It is mostly needed sometimes for debugging but some users with special needs might like to switch the mode as well under the expense to be on their own… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/deb/deblistparser.cc | 16 +++++++++++++--- doc/examples/configure-index | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 5c9cf6d4b..947e060e3 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -255,9 +255,13 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg, if (Pkg->Section == 0) Pkg->Section = UniqFindTagWrite("Section"); - // Packages which are not from "our" arch doesn't get the essential flag + // Packages which are not from the "native" arch doesn't get the essential flag + // in the default "native" mode - it is also possible to mark "all" or "none". + // The "installed" mode is handled by ParseStatus(), See #544481 and friends. string const static myArch = _config->Find("APT::Architecture"); - if (Pkg->Arch != 0 && myArch == Pkg.Arch()) + string const static essential = _config->Find("pkgCacheGen::Essential", "native"); + if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) || + essential == "all") if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) return false; if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false) @@ -333,7 +337,13 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg, const char *Stop; if (Section.Find("Status",Start,Stop) == false) return true; - + + // UsePackage() is responsible for setting the flag in the default case + bool const static essential = _config->Find("pkgCacheGen::Essential", "") == "installed"; + if (essential == true && + Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false) + return false; + // Isolate the first word const char *I = Start; for(; I < Stop && *I != ' '; I++); diff --git a/doc/examples/configure-index b/doc/examples/configure-index index f07302efd..f08a42ec7 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -432,6 +432,8 @@ Debug } +pkgCacheGen::Essential "native"; // other modes: all, none, installed + /* Whatever you do, do not use this configuration file!! Take out ONLY the portions you need! */ This Is Not A Valid Config File -- cgit v1.2.3-70-g09d2 From 1c56c17a3c5548a3bb86c0d7967c0f790c7c2cca Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Mar 2010 17:02:27 +0100 Subject: cherry pick -r 1956..1957 lp:~donkult/apt/sid --- apt-pkg/deb/debversion.cc | 18 ++++++++++++++++-- debian/changelog | 9 +++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index ad45e9a44..755ffbe96 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -190,8 +190,22 @@ int debVersioningSystem::DoCmpVersion(const char *A,const char *AEnd, dlhs++; if (drhs != rhs) drhs++; - - return CmpFragment(dlhs,AEnd,drhs,BEnd); + + // no debian revision need to be treated like -0 + if (*(dlhs-1) == '-' && *(drhs-1) == '-') + return CmpFragment(dlhs,AEnd,drhs,BEnd); + else if (*(dlhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(dlhs,AEnd,null, null+1); + } + else if (*(drhs-1) == '-') + { + const char* null = "0"; + return CmpFragment(null, null+1, drhs, BEnd); + } + else + return 0; } /*}}}*/ // debVS::CheckDep - Check a single dependency /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 4164fd726..bf07b9f30 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +apt (0.7.25.3ubuntu4) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/deb/debversion.cc: + - consider absent of debian revision equivalent to 0 (Closes: #573592) + LP: #540228 + + -- Michael Vogt Fri, 26 Mar 2010 16:57:49 +0100 + apt (0.7.25.3ubuntu3) lucid; urgency=low * apt-pkg/indexfile.cc: -- cgit v1.2.3-70-g09d2 From c5a4be87d94e3f48aad955107bbaf17b0a7c93cc Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Mar 2010 17:27:47 +0100 Subject: cherry pick -r 1954..1955 lp:~donkult/apt/sid --- apt-pkg/deb/dpkgpm.cc | 16 +++++++++------- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8ecb683d4..18c731788 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -575,35 +575,37 @@ void pkgDPkgPM::WriteHistoryTag(FILE *history_out, string tag, string value) // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() { - string logdir = _config->FindDir("Dir::Log"); + string const logdir = _config->FindDir("Dir::Log"); if(not FileExists(logdir)) return _error->Error(_("Directory '%s' missing"), logdir.c_str()); // get current time char timestr[200]; - time_t t = time(NULL); - struct tm *tmp = localtime(&t); + time_t const t = time(NULL); + struct tm const * const tmp = localtime(&t); strftime(timestr, sizeof(timestr), "%F %T", tmp); // open terminal log - string logfile_name = flCombine(logdir, + string const logfile_name = flCombine(logdir, _config->Find("Dir::Log::Terminal")); if (!logfile_name.empty()) { term_out = fopen(logfile_name.c_str(),"a"); if (term_out == NULL) - return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str()); + return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str()); chmod(logfile_name.c_str(), 0600); fprintf(term_out, "\nLog started: %s\n", timestr); } - // write - string history_name = flCombine(logdir, + // write your history + string const history_name = flCombine(logdir, _config->Find("Dir::Log::History")); if (!history_name.empty()) { FILE *history_out = fopen(history_name.c_str(),"a"); + if (history_out == NULL) + return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str()); chmod(history_name.c_str(), 0644); fprintf(history_out, "\nStart-Date: %s\n", timestr); string remove, purge, install, upgrade, downgrade; diff --git a/debian/changelog b/debian/changelog index 5f5a43098..b26f18153 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ apt (0.7.25.3ubuntu4) UNRELEASED; urgency=low LP: #540228 * cmdline/apt-get.cc, apt-pkg/cdrom.cc: - fix memory leaks in error conditions in DoSource() + * apt-pkg/deb/dpkgpm.cc: + - fix error message construction in OpenLog() -- Michael Vogt Fri, 26 Mar 2010 16:57:49 +0100 -- cgit v1.2.3-70-g09d2 From 3f42500d6b9eb318c46cacafdcfd6beb707ef9e9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 30 Mar 2010 14:25:57 +0200 Subject: rename ExplodeString to VectorizeString --- apt-pkg/aptconfiguration.cc | 2 +- apt-pkg/contrib/strutl.cc | 6 +++--- apt-pkg/contrib/strutl.h | 2 +- apt-pkg/deb/debmetaindex.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index a1379ce7d..2acf8dd9f 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -221,7 +221,7 @@ std::vector const Configuration::getLanguages(bool const &All, const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE"); string envLang = Locale == 0 ? language_env : *(Locale+1); if (envLang.empty() == false) { - std::vector env = ExplodeString(envLang,':'); + std::vector env = VectorizeString(envLang,':'); short addedLangs = 0; // add a maximum of 3 fallbacks from the environment for (std::vector::const_iterator e = env.begin(); e != env.end() && addedLangs < 3; ++e) { diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index ab47cdede..7eb986ac0 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1000,12 +1000,12 @@ bool TokSplitString(char Tok,char *Input,char **List, return true; } /*}}}*/ -// ExplodeString - Split a string up into a vector /*{{{*/ +// VectorizeString - Split a string up into a vector of strings /*{{{*/ // --------------------------------------------------------------------- /* This can be used to split a given string up into a vector, so the propose is the same as in the method above and this one is a bit slower - also, but the advantage is that we an iteratable vector */ -vector ExplodeString(string const &haystack, char const &split) + also, but the advantage is that we have an iteratable vector */ +vector VectorizeString(string const &haystack, char const &split) { string::const_iterator start = haystack.begin(); string::const_iterator end = start; diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index cdf78f317..d8070d3f5 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -52,7 +52,7 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0) bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); -vector ExplodeString(string const &haystack, char const &split); +vector VectorizeString(string const &haystack, char const &split) __attrib_const; void ioprintf(ostream &out,const char *format,...) __like_printf(2); void strprintf(string &out,const char *format,...) __like_printf(2); char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3); diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 947a7f04b..8df3ed18d 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -313,7 +313,7 @@ class debSLTypeDebian : public pkgSourceList::Type { map::const_iterator const arch = Options.find("arch"); vector const Archs = - (arch != Options.end()) ? ExplodeString(arch->second, ',') : + (arch != Options.end()) ? VectorizeString(arch->second, ',') : APT::Configuration::getArchitectures(); for (vector::const_iterator I = List.begin(); -- cgit v1.2.3-70-g09d2 From 33dd02e3a95141d4e16677048614c3171c4c4ffc Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 30 Mar 2010 14:45:38 +0200 Subject: convert some tabs to spaces to respect the style guide --- apt-pkg/deb/deblistparser.cc | 39 +++++----- apt-pkg/pkgcachegen.cc | 169 +++++++++++++++++++++++-------------------- 2 files changed, 109 insertions(+), 99 deletions(-) (limited to 'apt-pkg/deb') 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 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::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 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::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 /*{{{*/ -- cgit v1.2.3-70-g09d2 From 5e8b2b74ab565ffb72e035ce89a7a991d4de3dcf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 3 Apr 2010 17:57:41 +0200 Subject: Initialize history_out always with NULL so apt will not segfault later in the event of a failure in OpenLog() (which will happen if called with Debug::NoLocking as user) --- apt-pkg/deb/dpkgpm.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c0efa7b59..14a4968f7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -105,7 +105,7 @@ ionice(int PID) /* */ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) : pkgPackageManager(Cache), dpkgbuf_pos(0), - term_out(NULL), PackagesDone(0), PackagesTotal(0) + term_out(NULL), history_out(NULL), PackagesDone(0), PackagesTotal(0) { } /*}}}*/ @@ -651,6 +651,7 @@ bool pkgDPkgPM::CloseLog() fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); } + history_out = NULL; return true; } -- cgit v1.2.3-70-g09d2 From 05bae55fb7fe23b2061182a60db2f2f914a2d3ec Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 14 Apr 2010 18:01:11 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - remove Chroot-Directory from files passed to install commands. Thanks to Kel Modderman for report & patch! (Closes: #577226) --- apt-pkg/deb/dpkgpm.cc | 14 +++++++++++++- debian/changelog | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 14a4968f7..ca8faa8a5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -124,7 +124,19 @@ bool pkgDPkgPM::Install(PkgIterator Pkg,string File) if (File.empty() == true || Pkg.end() == true) return _error->Error("Internal Error, No file name for %s",Pkg.Name()); - List.push_back(Item(Item::Install,Pkg,File)); + // If the filename string begins with DPkg::Chroot-Directory, return the + // substr that is within the chroot so dpkg can access it. + string const chrootdir = _config->FindDir("DPkg::Chroot-Directory","/"); + if (chrootdir != "/" && File.find(chrootdir) == 0) + { + size_t len = chrootdir.length(); + if (chrootdir.at(len - 1) == '/') + len--; + List.push_back(Item(Item::Install,Pkg,File.substr(len))); + } + else + List.push_back(Item(Item::Install,Pkg,File)); + return true; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 6cf067952..7d2417cf4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,9 @@ apt (0.7.26~exp4) experimental; urgency=low - display MD5Sum in --print-uris if not forced to use another method instead of displaying the strongest available (Closes: #576420) - regex for package names executed on Grp- not PkgIterator + * apt-pkg/deb/dpkgpm.cc: + - remove Chroot-Directory from files passed to install commands. + Thanks to Kel Modderman for report & patch! (Closes: #577226) -- David Kalnischkies Sat, 03 Apr 2010 14:58:39 +0200 -- cgit v1.2.3-70-g09d2 From eea96cc7c1092f96c5929876608d09d9af292954 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 May 2010 09:58:23 +0200 Subject: * apt-pkg/deb/debrecords.cc: - fix max tag buffer size (LP: #545336, closes: #578959) --- apt-pkg/deb/debrecords.cc | 3 ++- debian/changelog | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 8ed0bb7eb..57d30dc62 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -19,7 +19,8 @@ /* */ debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : File(FileName,FileFd::ReadOnly), - Tags(&File,Cache.Head().MaxVerFileSize + 200) + Tags(&File, std::max(Cache.Head().MaxVerFileSize, + Cache.Head().MaxDescFileSize) + 200) { } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 8e8ecca09..7ff516fc2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ -apt (0.7.25.3ubuntu8) UNRELEASED; urgency=low +apt (0.7.25.3ubuntu8) lucid-proposedUNRELEASED; urgency=low + [ Loïc Minier ] * Use https:// in Vcs-Bzr URL. - -- Loïc Minier Thu, 22 Apr 2010 10:57:24 +0200 + [ Michael Vogt ] + * apt-pkg/deb/debrecords.cc: + - fix max tag buffer size (LP: #545336, closes: #578959) + + -- Michael Vogt Wed, 05 May 2010 09:57:53 +0200 apt (0.7.25.3ubuntu7) lucid; urgency=low -- cgit v1.2.3-70-g09d2 From b3514c569564ebd7ee90c04f0af325510e129386 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 24 May 2010 13:40:50 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - add 'disappear' to the known processing states, thanks Jonathan Nieder --- apt-pkg/deb/dpkgpm.cc | 4 +++- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index ca8faa8a5..a640a0c77 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -50,6 +50,7 @@ namespace std::make_pair("configure", N_("Configuring %s")), std::make_pair("remove", N_("Removing %s")), std::make_pair("purge", N_("Completely removing %s")), + std::make_pair("disappear", N_("Noting disappearance of %s")), std::make_pair("trigproc", N_("Running post-installation trigger %s")) }; @@ -419,7 +420,8 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) 'processing: install: pkg' 'processing: configure: pkg' 'processing: remove: pkg' - 'processing: purge: pkg' - but for apt is it a ignored "unknown" action + 'processing: purge: pkg' + 'processing: disappear: pkg' 'processing: trigproc: trigger' */ diff --git a/debian/changelog b/debian/changelog index 0d114c915..c9a7f2e35 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,8 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - do not say explicit target_release_{name,version,codename}, it should be clear by itself and 'man' can break lines again (Closes: #566166) - remove the gnome-apt reference as it is removed from unstable + * apt-pkg/deb/dpkgpm.cc: + - add 'disappear' to the known processing states, thanks Jonathan Nieder [ Jari Aalto ] * debian/rules: -- cgit v1.2.3-70-g09d2 From 642ebc1a04c9c7915474c57f1143a9389ee6636a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 24 May 2010 20:10:11 +0200 Subject: - show at the end of the install process a list of disappeared packages * apt-pkg/packagemanager.h: - export info about disappeared packages with GetDisappearedPackages() --- apt-pkg/deb/dpkgpm.cc | 5 +++++ apt-pkg/packagemanager.h | 16 ++++++++++++++-- cmdline/apt-get.cc | 21 +++++++++++++++++++-- debian/changelog | 3 +++ 4 files changed, 41 insertions(+), 4 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a640a0c77..8318fe37f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -468,6 +468,9 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) write(OutStatusFd, status.str().c_str(), status.str().size()); if (Debug == true) std::clog << "send: '" << status.str() << "'" << endl; + + if (strncmp(action, "disappear", strlen("disappear")) == 0) + disappearedPkgs.insert(string(pkg_or_trigger)); return; } @@ -913,6 +916,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) { if((*I).Pkg.end() == true) continue; + if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end()) + continue; Args[n++] = I->Pkg.Name(); Size += strlen(Args[n-1]); } diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index af1476b7a..efd2cfac6 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -28,6 +28,7 @@ #include #include #include +#include using std::string; @@ -47,7 +48,15 @@ class pkgPackageManager : protected pkgCache::Namespace pkgDepCache &Cache; pkgOrderList *List; bool Debug; - + + /** \brief saves packages dpkg let disappear + + This way APT can retreat from trying to configure these + packages later on and a frontend can choose to display a + notice to inform the user about these disappears. + */ + std::set disappearedPkgs; + bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); virtual OrderResult OrderInstall(); @@ -93,7 +102,10 @@ class pkgPackageManager : protected pkgCache::Namespace // stuff that needs to be done after the fork OrderResult DoInstallPostFork(int statusFd=-1); bool FixMissing(); - + + /** \brief returns all packages dpkg let disappear */ + inline std::set GetDisappearedPackages() { return disappearedPkgs; }; + pkgPackageManager(pkgDepCache *Cache); virtual ~pkgPackageManager(); }; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index dd5ef1743..44235e358 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1044,7 +1044,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, if (Res == pkgPackageManager::Failed || _error->PendingError() == true) return false; if (Res == pkgPackageManager::Completed) - return true; + break; // Reload the fetcher object and loop again for media swapping Fetcher.Shutdown(); @@ -1052,7 +1052,24 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, return false; _system->Lock(); - } + } + + std::set const disappearedPkgs = PM->GetDisappearedPackages(); + if (disappearedPkgs.empty() == true) + return true; + + string disappear; + for (std::set::const_iterator d = disappearedPkgs.begin(); + d != disappearedPkgs.end(); ++d) + disappear.append(*d).append(" "); + + ShowList(c1out, P_("The following package disappeared from your system as\n" + "all files have been overwritten by other packages:", + "The following packages disappeared from your system as\n" + "all files have been overwritten by other packages:", disappearedPkgs.size()), disappear, ""); + c0out << _("Note: This is done automatic and on purpose by dpkg.") << std::endl; + + return true; } /*}}}*/ // TryToInstall - Try to install a single package /*{{{*/ diff --git a/debian/changelog b/debian/changelog index c9a7f2e35..f932b48a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - rerun dpkg-source in source if --fix-broken is given (Closes: #576752) - don't suggest held packages as they are installed (Closes: #578135) - handle multiple --{tar,diff,dsc}-only options correctly + - show at the end of the install process a list of disappeared packages * cmdline/apt-cache.cc: - use GroupCount for package names in stats and add a package struct line * methods/rred.cc: @@ -37,6 +38,8 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - remove the gnome-apt reference as it is removed from unstable * apt-pkg/deb/dpkgpm.cc: - add 'disappear' to the known processing states, thanks Jonathan Nieder + * apt-pkg/packagemanager.h: + - export info about disappeared packages with GetDisappearedPackages() [ Jari Aalto ] * debian/rules: -- cgit v1.2.3-70-g09d2 From 6cb1060b58d8add6e04cc30241d3ef0f45ad226d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 May 2010 15:17:52 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - write Disappeared also to the history.log --- apt-pkg/deb/dpkgpm.cc | 33 ++++++++++++++++++++++++--------- apt-pkg/deb/dpkgpm.h | 2 +- debian/changelog | 8 ++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8318fe37f..35b10975f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -568,15 +568,15 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd) } /*}}}*/ // DPkgPM::WriteHistoryTag /*{{{*/ -void pkgDPkgPM::WriteHistoryTag(string tag, string value) +void pkgDPkgPM::WriteHistoryTag(string const &tag, string value) { - if (value.size() > 0) - { - // poor mans rstrip(", ") - if (value[value.size()-2] == ',' && value[value.size()-1] == ' ') - value.erase(value.size() - 2, 2); - fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str()); - } + size_t const length = value.length(); + if (length == 0) + return; + // poor mans rstrip(", ") + if (value[length-2] == ',' && value[length-1] == ' ') + value.erase(length - 2, 2); + fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str()); } /*}}}*/ // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() @@ -663,7 +663,22 @@ bool pkgDPkgPM::CloseLog() if(history_out) { - if (dpkg_error.size() > 0) + if (disappearedPkgs.empty() == false) + { + string disappear; + for (std::set::const_iterator d = disappearedPkgs.begin(); + d != disappearedPkgs.end(); ++d) + { + pkgCache::PkgIterator P = Cache.FindPkg(*d); + disappear.append(*d); + if (P.end() == true) + disappear.append(", "); + else + disappear.append(" (").append(Cache[P].CurVersion).append("), "); + } + WriteHistoryTag("Disappeared", disappear); + } + if (dpkg_error.empty() == false) fprintf(history_out, "Error: %s\n", dpkg_error.c_str()); fprintf(history_out, "End-Date: %s\n", timestr); fclose(history_out); diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 330c788a2..b1459b1f6 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -68,7 +68,7 @@ class pkgDPkgPM : public pkgPackageManager // Helpers bool RunScriptsWithPkgs(const char *Cnf); bool SendV2Pkgs(FILE *F); - void WriteHistoryTag(string tag, string value); + void WriteHistoryTag(string const &tag, string value); // dpkg log bool OpenLog(); diff --git a/debian/changelog b/debian/changelog index 3771ca415..ee571a537 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.26~exp6) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/deb/dpkgpm.cc: + - write Disappeared also to the history.log + + -- David Kalnischkies Thu, 27 May 2010 15:12:02 +0200 + apt (0.7.26~exp5) experimental; urgency=low [ David Kalnischkies ] -- cgit v1.2.3-70-g09d2 From eb6f9bac96a2b1938df598f4fd7c68d22c68a230 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 May 2010 18:13:52 +0200 Subject: forward manual-installed bit on package disappearance --- apt-pkg/deb/dpkgpm.cc | 47 ++++++++++++++++++++++++++++++++++++++++++++++- apt-pkg/deb/dpkgpm.h | 15 +++++++++++++++ debian/changelog | 3 ++- 3 files changed, 63 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 35b10975f..0ac6ac168 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -470,7 +470,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) std::clog << "send: '" << status.str() << "'" << endl; if (strncmp(action, "disappear", strlen("disappear")) == 0) - disappearedPkgs.insert(string(pkg_or_trigger)); + handleDisappearAction(pkg_or_trigger); return; } @@ -530,6 +530,51 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) << " action: " << action << endl; } /*}}}*/ +// DPkgPM::handleDisappearAction /*{{{*/ +void pkgDPkgPM::handleDisappearAction(string const &pkgname) +{ + // record the package name for display and stuff later + disappearedPkgs.insert(pkgname); + + pkgCache::PkgIterator Pkg = Cache.FindPkg(pkgname); + if (unlikely(Pkg.end() == true)) + return; + // the disappeared package was auto-installed - nothing to do + if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) + return; + pkgCache::VerIterator PkgVer = Pkg.CurrentVer(); + if (unlikely(PkgVer.end() == true)) + return; + /* search in the list of dependencies for (Pre)Depends, + check if this dependency has a Replaces on our package + and if so transfer the manual installed flag to it */ + for (pkgCache::DepIterator Dep = PkgVer.DependsList(); Dep.end() != true; ++Dep) + { + if (Dep->Type != pkgCache::Dep::Depends && + Dep->Type != pkgCache::Dep::PreDepends) + continue; + pkgCache::PkgIterator Tar = Dep.TargetPkg(); + if (unlikely(Tar.end() == true)) + continue; + // the package is already marked as manual + if ((Cache[Tar].Flags & pkgCache::Flag::Auto) != pkgCache::Flag::Auto) + continue; + pkgCache::VerIterator TarVer = Tar.CurrentVer(); + for (pkgCache::DepIterator Rep = TarVer.DependsList(); Rep.end() != true; ++Rep) + { + if (Rep->Type != pkgCache::Dep::Replaces) + continue; + if (Pkg != Rep.TargetPkg()) + continue; + // okay, they are strongly connected - transfer manual-bit + if (Debug == true) + std::clog << "transfer manual-bit from disappeared »" << pkgname << "« to »" << Tar.FullName() << "«" << std::endl; + Cache[Tar].Flags &= ~Flag::Auto; + break; + } + } +} + /*}}}*/ // DPkgPM::DoDpkgStatusFd /*{{{*/ // --------------------------------------------------------------------- /* diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index b1459b1f6..9a4478f7c 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -32,6 +32,21 @@ class pkgDPkgPM : public pkgPackageManager FILE *history_out; string dpkg_error; + /** \brief record the disappear action and handle accordingly + + dpkg let packages disappear then they have no files any longer and + nothing depends on them. We need to collect this as dpkg as well as + APT doesn't know beforehand that the package will disappear, so the + only possible option is to tell the user afterwards about it. + To enhance the experience we also try to forward the auto-install + flag so the disappear-causer(s) are not autoremoved next time - + for the transfer to happen the disappeared version needs to depend + on the package the flag should be forwarded to and this package + needs to declare a Replaces on the disappeared package. + \param pkgname Name of the package that disappeared + */ + void handleDisappearAction(string const &pkgname); + protected: // progress reporting diff --git a/debian/changelog b/debian/changelog index ee571a537..9fa04058d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low [ David Kalnischkies ] * apt-pkg/deb/dpkgpm.cc: - write Disappeared also to the history.log + - forward manual-installed bit on package disappearance - -- David Kalnischkies Thu, 27 May 2010 15:12:02 +0200 + -- David Kalnischkies Thu, 27 May 2010 17:34:51 +0200 apt (0.7.26~exp5) experimental; urgency=low -- cgit v1.2.3-70-g09d2 From d34690e1dc76c1e572d9f7ac172dd6b12059f774 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 28 May 2010 14:10:00 +0200 Subject: * apt-pkg/deb/debsystem.cc: - add better config item for extended_states file --- apt-pkg/deb/debsystem.cc | 2 +- apt-pkg/depcache.cc | 4 ++-- debian/changelog | 2 ++ doc/apt-mark.8.xml | 7 +------ doc/apt.ent | 8 ++++++++ doc/examples/configure-index | 3 +-- 6 files changed, 15 insertions(+), 11 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 59f826d96..31c26ab2f 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -158,7 +158,7 @@ bool debSystem::Initialize(Configuration &Cnf) /* These really should be jammed into a generic 'Local Database' engine which is yet to be determined. The functions in pkgcachegen should be the only users of these */ - Cnf.CndSet("Dir::State::userstatus","status.user"); // Defunct + Cnf.CndSet("Dir::State::extended_states", Cnf.FindDir("Dir::State").append("extended_states")); Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status"); Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg"); diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 411ae5f62..bdb89b5ce 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -165,7 +165,7 @@ bool pkgDepCache::Init(OpProgress *Prog) bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ { FileFd state_file; - string const state = _config->FindDir("Dir::State") + "extended_states"; + string const state = _config->FindFile("Dir::State::extended_states"); if(FileExists(state)) { state_file.Open(state, FileFd::ReadOnly); int const file_size = state_file.Size(); @@ -222,7 +222,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/ std::clog << "pkgDepCache::writeStateFile()" << std::endl; FileFd StateFile; - string const state = _config->FindDir("Dir::State") + "extended_states"; + string const state = _config->FindFile("Dir::State::extended_states"); // if it does not exist, create a empty one if(!FileExists(state)) diff --git a/debian/changelog b/debian/changelog index 9fa04058d..028452751 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low * apt-pkg/deb/dpkgpm.cc: - write Disappeared also to the history.log - forward manual-installed bit on package disappearance + * apt-pkg/deb/debsystem.cc: + - add better config item for extended_states file -- David Kalnischkies Thu, 27 May 2010 17:34:51 +0200 diff --git a/doc/apt-mark.8.xml b/doc/apt-mark.8.xml index 3f6cc78f5..8e07cd7d9 100644 --- a/doc/apt-mark.8.xml +++ b/doc/apt-mark.8.xml @@ -121,12 +121,7 @@ Files - /var/lib/apt/extended_states - Status list of auto-installed packages. - Configuration Item: Dir::State - sets the path to the extended_states file. - - + &file-extended_states; diff --git a/doc/apt.ent b/doc/apt.ent index 494c6b02c..0d037c8bb 100644 --- a/doc/apt.ent +++ b/doc/apt.ent @@ -363,6 +363,14 @@ "> +/var/lib/apt/extended_states + Status list of auto-installed packages. + Configuration Item: Dir::State::extended_states. + + +"> + diff --git a/doc/examples/configure-index b/doc/examples/configure-index index d168417d8..487c09acb 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -294,9 +294,8 @@ Dir "/" State "var/lib/apt/" { Lists "lists/"; - xstatus "xstatus"; - userstatus "status.user"; status "/var/lib/dpkg/status"; + extended_states "extended_states"; cdroms "cdroms.list"; }; -- cgit v1.2.3-70-g09d2 From 96db74ce38e9451609fe33f9e25f3f9d42b1fe22 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 2 Jun 2010 16:40:40 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - add missing include * methods/mirror.{cc,h}: - add SelectNextMirror() and InitMirrors() functions - read all mirrors into the AllMirrors vector --- apt-pkg/deb/dpkgpm.cc | 1 + methods/mirror.cc | 30 +++++++++++++++++++++++------- methods/mirror.h | 4 +++- 3 files changed, 27 insertions(+), 8 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 18c731788..7e5171eda 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/methods/mirror.cc b/methods/mirror.cc index b3a956b95..0a0d07e6b 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -162,7 +162,21 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) return res; } -bool MirrorMethod::SelectMirror() +bool MirrorMethod::SelectNextMirror() +{ + if (AllMirrors.size() < 1) + return false; + + Mirror = AllMirrors[0]; + AllMirrors.erase(AllMirrors.begin()); + if(Debug) + cerr << "using mirror: " << Mirror << endl; + + UsedMirror = Mirror; + return true; +} + +bool MirrorMethod::InitMirrors() { // if we do not have a MirrorFile, fallback if(!FileExists(MirrorFile)) @@ -179,11 +193,13 @@ bool MirrorMethod::SelectMirror() // get into sync issues (got indexfiles from mirror A, // but packages from mirror B - one might be out of date etc) ifstream in(MirrorFile.c_str()); - getline(in, Mirror); - if(Debug) - cerr << "Using mirror: " << Mirror << endl; - - UsedMirror = Mirror; + string s; + while (!in.eof()) + { + getline(in, s); + AllMirrors.push_back(s); + } + SelectNextMirror(); return true; } @@ -275,7 +291,7 @@ bool MirrorMethod::Fetch(FetchItem *Itm) } if(Mirror.empty()) { - if(!SelectMirror()) { + if(!InitMirrors()) { // no valid mirror selected, something went wrong downloading // from the master mirror site most likely and there is // no old mirror file availalbe diff --git a/methods/mirror.h b/methods/mirror.h index ed817806b..1b506dc87 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -26,6 +26,7 @@ class MirrorMethod : public HttpMethod // we simply transform between BaseUri and Mirror string BaseUri; // the original mirror://... url string Mirror; // the selected mirror uri (http://...) + vector AllMirrors; // all available mirrors string MirrorFile; // the file that contains the list of mirrors bool DownloadedMirrorFile; // already downloaded this session @@ -34,7 +35,8 @@ class MirrorMethod : public HttpMethod protected: bool DownloadMirrorFile(string uri); string GetMirrorFileName(string uri); - bool SelectMirror(); + bool InitMirrors(); + bool SelectNextMirror(); bool Clean(string dir); // we need to overwrite those to transform the url back -- cgit v1.2.3-70-g09d2 From e2c66de5c5e63d8400efb0522c31fbe1ec225f93 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 3 Jun 2010 09:22:00 +0200 Subject: * apt-pkg/pkgcache.h: - switch {,Install-}Size to unsigned long long * apt-pkg/depcache.cc: - deal with long long, not with int to remove 2GB Limit (LP: #250909) --- apt-pkg/acquire-item.h | 4 ++-- apt-pkg/deb/deblistparser.cc | 5 ++--- apt-pkg/depcache.cc | 14 +++++++------- apt-pkg/pkgcache.h | 4 ++-- apt-pkg/tagfile.cc | 24 ++++++++++++++++++++++++ apt-pkg/tagfile.h | 1 + debian/changelog | 10 ++++++++++ 7 files changed, 48 insertions(+), 14 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index b338b2a41..36fc53b92 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -112,10 +112,10 @@ class pkgAcquire::Item : public WeakPointable string ErrorText; /** \brief The size of the object to fetch. */ - unsigned long FileSize; + unsigned long long FileSize; /** \brief How much of the object was already fetched. */ - unsigned long PartialSize; + unsigned long long PartialSize; /** \brief If not \b NULL, contains the name of a subprocess that * is operating on this object (for instance, "gzip" or "gpgv"). diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 0551a5f7c..83c5b8d2e 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -133,10 +133,9 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) } // Archive Size - Ver->Size = (unsigned)Section.FindI("Size"); - + Ver->Size = Section.FindULL("Size"); // Unpacked Size (in K) - Ver->InstalledSize = (unsigned)Section.FindI("Installed-Size"); + Ver->InstalledSize = Section.FindULL("Installed-Size"); Ver->InstalledSize *= 1024; // Priority diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 411ae5f62..6e0eeab5b 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -422,8 +422,8 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult) // Compute the size data if (P.NewInstall() == true) { - iUsrSize += (signed)(Mult*P.InstVerIter(*this)->InstalledSize); - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); + iUsrSize += (signed long long)(Mult*P.InstVerIter(*this)->InstalledSize); + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); return; } @@ -432,9 +432,9 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult) (P.InstallVer != (Version *)Pkg.CurrentVer() || (P.iFlags & ReInstall) == ReInstall) && P.InstallVer != 0) { - iUsrSize += (signed)(Mult*((signed)P.InstVerIter(*this)->InstalledSize - - (signed)Pkg.CurrentVer()->InstalledSize)); - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); + iUsrSize += (signed long long)(Mult*((signed long long)P.InstVerIter(*this)->InstalledSize - + (signed long long)Pkg.CurrentVer()->InstalledSize)); + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); return; } @@ -442,14 +442,14 @@ void pkgDepCache::AddSizes(const PkgIterator &Pkg,signed long Mult) if (Pkg.State() == pkgCache::PkgIterator::NeedsUnpack && P.Delete() == false) { - iDownloadSize += (signed)(Mult*P.InstVerIter(*this)->Size); + iDownloadSize += (signed long long)(Mult*P.InstVerIter(*this)->Size); return; } // Removing if (Pkg->CurrentVer != 0 && P.InstallVer == 0) { - iUsrSize -= (signed)(Mult*Pkg.CurrentVer()->InstalledSize); + iUsrSize -= (signed long long)(Mult*Pkg.CurrentVer()->InstalledSize); return; } } diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 643f240b0..426bb9f13 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -532,9 +532,9 @@ struct pkgCache::Version /** \brief archive size for this version For Debian this is the size of the .deb file. */ - map_ptrloc Size; // These are the .deb size + unsigned long long Size; // These are the .deb size /** \brief uncompressed size for this version */ - map_ptrloc InstalledSize; + unsigned long long InstalledSize; /** \brief characteristic value representing this version No two packages in existence should have the same VerStr diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 0d4999ee7..1394d7e24 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -365,6 +365,30 @@ signed int pkgTagSection::FindI(const char *Tag,signed long Default) const return Result; } /*}}}*/ +// TagSection::FindULL - Find an unsigned long long integer /*{{{*/ +// --------------------------------------------------------------------- +/* */ +unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const +{ + const char *Start; + const char *Stop; + if (Find(Tag,Start,Stop) == false) + return Default; + + // Copy it into a temp buffer so we can use strtoull + char S[100]; + if ((unsigned)(Stop - Start) >= sizeof(S)) + return Default; + strncpy(S,Start,Stop-Start); + S[Stop - Start] = 0; + + char *End; + unsigned long long Result = strtoull(S,&End,10); + if (S == End) + return Default; + return Result; +} + /*}}}*/ // TagSection::FindFlag - Locate a yes/no type flag /*{{{*/ // --------------------------------------------------------------------- /* The bits marked in Flag are masked on/off in Flags */ diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index f63a51d07..6891c1d81 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -57,6 +57,7 @@ class pkgTagSection bool Find(const char *Tag,unsigned &Pos) const; string FindS(const char *Tag) const; signed int FindI(const char *Tag,signed long Default = 0) const ; + unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const; bool FindFlag(const char *Tag,unsigned long &Flags, unsigned long Flag) const; bool Scan(const char *Start,unsigned long MaxLength); diff --git a/debian/changelog b/debian/changelog index 3771ca415..e153027b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +apt (0.7.26~exp6) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/pkgcache.h: + - switch {,Install-}Size to unsigned long long + * apt-pkg/depcache.cc: + - deal with long long, not with int to remove 2GB Limit (LP: #250909) + + -- David Kalnischkies Thu, 03 Jun 2010 09:19:01 +0200 + apt (0.7.26~exp5) experimental; urgency=low [ David Kalnischkies ] -- cgit v1.2.3-70-g09d2 From 2e5f4e45f593535e2c88181ff7a9e2d32a5e60f9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 4 Jun 2010 14:43:03 +0200 Subject: * apt-pkg/cachefile.{cc,h}: - split Open() into submethods to be able to build only parts - make the OpProgress optional in the Cache buildprocess --- apt-pkg/cachefile.cc | 50 ++++++++++++++++++++++++++++++++------------- apt-pkg/cachefile.h | 15 ++++++++------ apt-pkg/deb/debindexfile.cc | 18 ++++++++-------- apt-pkg/deb/debindexfile.h | 6 +++--- apt-pkg/indexfile.h | 8 ++++++-- apt-pkg/pkgcachegen.cc | 45 +++++++++++++++++++++++++--------------- apt-pkg/pkgcachegen.h | 10 +++++++-- debian/changelog | 3 +++ 8 files changed, 103 insertions(+), 52 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 790312dc8..b0f8bc424 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -46,7 +46,7 @@ pkgCacheFile::~pkgCacheFile() // CacheFile::BuildCaches - Open and build the cache files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock) +bool pkgCacheFile::BuildCaches(OpProgress *Progress, bool WithLock) { const bool ErrorWasEmpty = _error->empty(); if (WithLock == true) @@ -65,8 +65,9 @@ bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock) return _error->Error(_("The list of sources could not be read.")); // Read the caches - bool Res = pkgMakeStatusCache(List,Progress,&Map,!WithLock); - Progress.Done(); + bool Res = pkgCacheGenerator::MakeStatusCache(List,Progress,&Map,!WithLock); + if (Progress != NULL) + Progress->Done(); if (Res == false) return _error->Error(_("The package lists or status file could not be parsed or opened.")); @@ -80,29 +81,50 @@ bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock) return true; } /*}}}*/ -// CacheFile::Open - Open the cache files, creating if necessary /*{{{*/ +// CacheFile::BuildPolicy - Open and build all relevant preferences /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock) +bool pkgCacheFile::BuildPolicy(OpProgress *Progress) { - if (BuildCaches(Progress,WithLock) == false) - return false; - - // The policy engine Policy = new pkgPolicy(Cache); if (_error->PendingError() == true) return false; if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == false) return false; - - // Create the dependency cache + + return true; +} + /*}}}*/ +// CacheFile::BuildDepCache - Open and build the dependency cache /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool pkgCacheFile::BuildDepCache(OpProgress *Progress) +{ DCache = new pkgDepCache(Cache,Policy); if (_error->PendingError() == true) return false; - - DCache->Init(&Progress); - Progress.Done(); + + DCache->Init(Progress); + return true; +} + /*}}}*/ +// CacheFile::Open - Open the cache files, creating if necessary /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock) +{ + if (BuildCaches(Progress,WithLock) == false) + return false; + + if (BuildPolicy(Progress) == false) + return false; + + if (BuildDepCache(Progress) == false) + return false; + + if (Progress != NULL) + Progress->Done(); if (_error->PendingError() == true) return false; diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 3b057951c..b75a7dbe4 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -30,11 +30,10 @@ class pkgCacheFile MMap *Map; pkgCache *Cache; pkgDepCache *DCache; - + pkgPolicy *Policy; + public: - pkgPolicy *Policy; - // We look pretty much exactly like a pointer to a dep cache inline operator pkgCache &() {return *Cache;}; inline operator pkgCache *() {return Cache;}; @@ -45,12 +44,16 @@ class pkgCacheFile inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];}; inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];}; - bool BuildCaches(OpProgress &Progress,bool WithLock = true); - bool Open(OpProgress &Progress,bool WithLock = true); + bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true); + __deprecated bool BuildCaches(OpProgress &Progress,bool const &WithLock = true) { return BuildCaches(&Progress, WithLock); }; + bool BuildPolicy(OpProgress *Progress = NULL); + bool BuildDepCache(OpProgress *Progress = NULL); + bool Open(OpProgress *Progress = NULL, bool WithLock = true); + __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; void Close(); pkgCacheFile(); - ~pkgCacheFile(); + virtual ~pkgCacheFile(); }; #endif diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index b89429d86..6d9e99497 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -262,15 +262,15 @@ unsigned long debPackagesIndex::Size() const // PackagesIndex::Merge - Load the index file into a cache /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const +bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { string PackageFile = IndexFile("Packages"); FileFd Pkg(PackageFile,FileFd::ReadOnly); debListParser Parser(&Pkg, Architecture); if (_error->PendingError() == true) return _error->Error("Problem opening %s",PackageFile.c_str()); - - Prog.SubProgress(0,Info("Packages")); + if (Prog != NULL) + Prog->SubProgress(0,Info("Packages")); ::URI Tmp(URI); if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false) return _error->Error("Problem with SelectFile %s",PackageFile.c_str()); @@ -445,7 +445,7 @@ unsigned long debTranslationsIndex::Size() const // TranslationsIndex::Merge - Load the index file into a cache /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const +bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { // Check the translation file, if in use string TranslationFile = IndexFile(Language); @@ -456,7 +456,8 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const if (_error->PendingError() == true) return false; - Prog.SubProgress(0, Info(TranslationFile.c_str())); + if (Prog != NULL) + Prog->SubProgress(0, Info(TranslationFile.c_str())); if (Gen.SelectFile(TranslationFile,string(),*this) == false) return _error->Error("Problem with SelectFile %s",TranslationFile.c_str()); @@ -529,7 +530,7 @@ unsigned long debStatusIndex::Size() const // StatusIndex::Merge - Load the index file into a cache /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const +bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { FileFd Pkg(File,FileFd::ReadOnly); if (_error->PendingError() == true) @@ -537,8 +538,9 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const debListParser Parser(&Pkg); if (_error->PendingError() == true) return false; - - Prog.SubProgress(0,File); + + if (Prog != NULL) + Prog->SubProgress(0,File); if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false) return _error->Error("Problem with SelectFile %s",File.c_str()); diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 766e8b214..b5085992d 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -35,7 +35,7 @@ class debStatusIndex : public pkgIndexFile virtual bool Exists() const; virtual bool HasPackages() const {return true;}; virtual unsigned long Size() const; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; + virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; debStatusIndex(string File); @@ -67,7 +67,7 @@ class debPackagesIndex : public pkgIndexFile virtual bool Exists() const; virtual bool HasPackages() const {return true;}; virtual unsigned long Size() const; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; + virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; debPackagesIndex(string const &URI, string const &Dist, string const &Section, @@ -99,7 +99,7 @@ class debTranslationsIndex : public pkgIndexFile virtual bool Exists() const; virtual bool HasPackages() const; virtual unsigned long Size() const; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; + virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; debTranslationsIndex(string URI,string Dist,string Section, char const * const Language); diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 3cc501629..2b5ae6342 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -74,8 +74,12 @@ class pkgIndexFile virtual bool Exists() const = 0; virtual bool HasPackages() const = 0; virtual unsigned long Size() const = 0; - virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return false;}; - virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress &/*Prog*/) const {return true;}; + virtual bool Merge(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const { return false; }; + __deprecated virtual bool Merge(pkgCacheGenerator &Gen, OpProgress &Prog) const + { return Merge(Gen, &Prog); }; + virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) const {return true;}; + __deprecated virtual bool MergeFileProvides(pkgCacheGenerator &Gen, OpProgress &Prog) const + {return MergeFileProvides(Gen, &Prog);}; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; static bool TranslationsAvailable(); diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d96d3370f..5649cd6f8 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -526,7 +526,7 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, // CacheGenerator::FinishCache - do various finish operations /*{{{*/ // --------------------------------------------------------------------- /* This prepares the Cache for delivery */ -bool pkgCacheGenerator::FinishCache(OpProgress &Progress) +bool pkgCacheGenerator::FinishCache(OpProgress *Progress) { // FIXME: add progress reporting for this operation // Do we have different architectures in your groups ? @@ -923,7 +923,7 @@ static unsigned long ComputeSize(FileIterator Start,FileIterator End) // --------------------------------------------------------------------- /* */ static bool BuildCache(pkgCacheGenerator &Gen, - OpProgress &Progress, + OpProgress *Progress, unsigned long &CurrentSize,unsigned long TotalSize, FileIterator Start, FileIterator End) { @@ -944,7 +944,8 @@ static bool BuildCache(pkgCacheGenerator &Gen, } unsigned long Size = (*I)->Size(); - Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Reading package lists")); + if (Progress != NULL) + Progress->OverallProgress(CurrentSize,TotalSize,Size,_("Reading package lists")); CurrentSize += Size; if ((*I)->Merge(Gen,Progress) == false) @@ -953,13 +954,15 @@ static bool BuildCache(pkgCacheGenerator &Gen, if (Gen.HasFileDeps() == true) { - Progress.Done(); + if (Progress != NULL) + Progress->Done(); TotalSize = ComputeSize(Start, End); CurrentSize = 0; for (I = Start; I != End; I++) { unsigned long Size = (*I)->Size(); - Progress.OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides")); + if (Progress != NULL) + Progress->OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides")); CurrentSize += Size; if ((*I)->MergeFileProvides(Gen,Progress) == false) return false; @@ -969,7 +972,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, return true; } /*}}}*/ -// MakeStatusCache - Construct the status cache /*{{{*/ +// CacheGenerator::MakeStatusCache - Construct the status cache /*{{{*/ // --------------------------------------------------------------------- /* This makes sure that the status cache (the cache that has all index files from the sources list and all local ones) is ready @@ -977,7 +980,10 @@ static bool BuildCache(pkgCacheGenerator &Gen, the cache will be stored there. This is pretty much mandetory if you are using AllowMem. AllowMem lets the function be run as non-root where it builds the cache 'fast' into a memory buffer. */ -bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, +__deprecated bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, + MMap **OutMap, bool AllowMem) + { return pkgCacheGenerator::MakeStatusCache(List, &Progress, OutMap, AllowMem); } +bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap,bool AllowMem) { bool const Debug = _config->FindB("Debug::pkgCacheGen", false); @@ -1028,13 +1034,15 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, if (Writeable == false && AllowMem == false && CacheFile.empty() == false) return _error->Error(_("Unable to write to %s"),flNotFile(CacheFile).c_str()); - - Progress.OverallProgress(0,1,1,_("Reading package lists")); - + + if (Progress != NULL) + Progress->OverallProgress(0,1,1,_("Reading package lists")); + // Cache is OK, Fin. if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true) { - Progress.OverallProgress(1,1,1,_("Reading package lists")); + if (Progress != NULL) + Progress->OverallProgress(1,1,1,_("Reading package lists")); if (Debug == true) std::clog << "pkgcache.bin is valid - no need to build anything" << std::endl; return true; @@ -1084,7 +1092,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end()); // Build the status cache - pkgCacheGenerator Gen(Map.Get(),&Progress); + pkgCacheGenerator Gen(Map.Get(),Progress); if (_error->PendingError() == true) return false; if (BuildCache(Gen,Progress,CurrentSize,TotalSize, @@ -1101,7 +1109,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, TotalSize = ComputeSize(Files.begin(),Files.end()); // Build the source cache - pkgCacheGenerator Gen(Map.Get(),&Progress); + pkgCacheGenerator Gen(Map.Get(),Progress); if (_error->PendingError() == true) return false; if (BuildCache(Gen,Progress,CurrentSize,TotalSize, @@ -1160,10 +1168,12 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, return true; } /*}}}*/ -// MakeOnlyStatusCache - Build a cache with just the status files /*{{{*/ +// CacheGenerator::MakeOnlyStatusCache - Build only a status files cache/*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) +__deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) + { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); } +bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap) { unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024); vector Files; @@ -1178,8 +1188,9 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end()); // Build the status cache - Progress.OverallProgress(0,1,1,_("Reading package lists")); - pkgCacheGenerator Gen(Map.Get(),&Progress); + if (Progress != NULL) + Progress->OverallProgress(0,1,1,_("Reading package lists")); + pkgCacheGenerator Gen(Map.Get(),Progress); if (_error->PendingError() == true) return false; if (BuildCache(Gen,Progress,CurrentSize,TotalSize, diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 46d0cd893..ff0941e0c 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -76,7 +76,11 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - bool FinishCache(OpProgress &Progress); + bool FinishCache(OpProgress *Progress); + + static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, + MMap **OutMap = 0,bool AllowMem = false); + static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap); pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress); ~pkgCacheGenerator(); @@ -134,10 +138,12 @@ class pkgCacheGenerator::ListParser virtual ~ListParser() {}; }; /*}}}*/ + bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, MMap **OutMap = 0,bool AllowMem = false); bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap); + #ifdef APT_COMPATIBILITY #if APT_COMPATIBILITY != 986 #warning "Using APT_COMPATIBILITY" @@ -145,7 +151,7 @@ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap); MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress) { MMap *Map = 0; - if (pkgMakeStatusCache(List,Progress,&Map,true) == false) + if (pkgCacheGenerator::MakeStatusCache(List,&Progress,&Map,true) == false) return 0; return Map; } diff --git a/debian/changelog b/debian/changelog index 994be2bbc..097916d1e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -32,6 +32,9 @@ apt (0.7.26~exp6) UNRELEASED; urgency=low - get the best matching arch package from a group with FindPreferredPkg * cmdline/apt-cache.cc: - make the search multiarch compatible by using GrpIterator instead + * apt-pkg/cachefile.{cc,h}: + - split Open() into submethods to be able to build only parts + - make the OpProgress optional in the Cache buildprocess -- David Kalnischkies Mon, 31 May 2010 22:36:35 +0200 -- cgit v1.2.3-70-g09d2 From ec7a129eeb1611ec097bc99a148d6d3a3dccf044 Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Wed, 9 Jun 2010 14:09:42 +0200 Subject: * apt-pkg/deb/debindexfile.cc: - If we do not find uncompressed package/source/translation indexes, look for gzip compressed ones. --- apt-pkg/deb/debindexfile.cc | 22 +++++++++++++++++++--- debian/changelog | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 7379ca997..e87c21f13 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -106,8 +106,14 @@ string debSourcesIndex::Info(const char *Type) const /* */ inline string debSourcesIndex::IndexFile(const char *Type) const { - return URItoFileName(IndexURI(Type)); + string s = URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } + string debSourcesIndex::IndexURI(const char *Type) const { string Res; @@ -213,7 +219,12 @@ string debPackagesIndex::Info(const char *Type) const /* */ inline string debPackagesIndex::IndexFile(const char *Type) const { - return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string s =_config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } string debPackagesIndex::IndexURI(const char *Type) const { @@ -340,7 +351,12 @@ debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section /* */ inline string debTranslationsIndex::IndexFile(const char *Type) const { - return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string s =_config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } string debTranslationsIndex::IndexURI(const char *Type) const { diff --git a/debian/changelog b/debian/changelog index 2fba94d7c..80c504b99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,9 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low * apt-pkg/contrib/fileutl.{h,cc}: - Add support for transparent reading of gzipped files. - Link against zlib (in apt-pkg/makefile) and add zlib build dependency. + * apt-pkg/deb/debindexfile.cc: + - If we do not find uncompressed package/source/translation indexes, look + for gzip compressed ones. -- Christian Perrier Tue, 11 May 2010 19:52:00 +0200 -- cgit v1.2.3-70-g09d2 From 94e8c9d4df70d2532e1640dfe2700dd63a094a4f Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Fri, 11 Jun 2010 19:23:08 +0200 Subject: apt-pkg/deb/debindexfile.cc: Fix one more place to check for gzipped indexes, to work with apt-get source as well --- apt-pkg/deb/debindexfile.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index e87c21f13..9832329c0 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -63,9 +63,13 @@ string debSourcesIndex::SourceInfo(pkgSrcRecords::Parser const &Record, /* */ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const { - string SourcesURI = URItoFileName(IndexURI("Sources")); - return new debSrcRecordParser(_config->FindDir("Dir::State::lists") + - SourcesURI,this); + string SourcesURI = _config->FindDir("Dir::State::lists") + + URItoFileName(IndexURI("Sources")); + string SourcesURIgzip = SourcesURI + ".gz"; + if (!FileExists(SourcesURI) && FileExists(SourcesURIgzip)) + SourcesURI = SourcesURIgzip; + + return new debSrcRecordParser(SourcesURI,this); } /*}}}*/ // SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/ -- cgit v1.2.3-70-g09d2 From c4fc2fd7fa0fc63fd8cd6bc9b73492e6baf0222a Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Thu, 24 Jun 2010 21:27:27 +0200 Subject: Switch FileFd to not transparently gunzip, since that breaks code which expects the compressed contents to stay (such as the copy backend, or when using file:// repositories. Instead, introduce a new ReadOnlyGzip mode and use that where needed --- apt-pkg/acquire-item.cc | 4 ++-- apt-pkg/contrib/fileutl.cc | 14 +++++++++----- apt-pkg/contrib/fileutl.h | 2 +- apt-pkg/deb/debindexfile.cc | 6 +++--- apt-pkg/deb/debrecords.cc | 2 +- apt-pkg/deb/debsrcrecords.h | 2 +- cmdline/apt-cache.cc | 2 +- debian/changelog | 10 +++++++--- 8 files changed, 25 insertions(+), 17 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index fe81ee791..9abdb0ad0 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -228,7 +228,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile) /*{{{*/ ss >> ServerSha1 >> size; unsigned long const ServerSize = atol(size.c_str()); - FileFd fd(CurrentPackagesFile, FileFd::ReadOnly); + FileFd fd(CurrentPackagesFile, FileFd::ReadOnlyGzip); SHA1Summation SHA1; SHA1.AddFD(fd.Fd(), fd.Size()); string const local_sha1 = SHA1.Result(); @@ -459,7 +459,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/ string FinalFile = _config->FindDir("Dir::State::lists"); FinalFile += URItoFileName(RealURI); - FileFd fd(FinalFile, FileFd::ReadOnly); + FileFd fd(FinalFile, FileFd::ReadOnlyGzip); SHA1Summation SHA1; SHA1.AddFD(fd.Fd(), fd.Size()); string local_sha1 = string(SHA1.Result()); diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 11a9e7f7b..2b91a46f7 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -604,12 +604,16 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms) { case ReadOnly: iFd = open(FileName.c_str(),O_RDONLY); + break; + + case ReadOnlyGzip: + iFd = open(FileName.c_str(),O_RDONLY); if (iFd > 0 && FileName.compare(FileName.size()-3, 3, ".gz") == 0) { - gz = gzdopen (iFd, "r"); - if (gz == NULL) { - close (iFd); - iFd = -1; - } + gz = gzdopen (iFd, "r"); + if (gz == NULL) { + close (iFd); + iFd = -1; + } } break; diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 9925bbed4..c4b282126 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -41,7 +41,7 @@ class FileFd gzFile gz; public: - enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp}; + enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip}; inline bool Read(void *To,unsigned long Size,bool AllowEof) { diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 9832329c0..7d7bd09fb 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -273,7 +273,7 @@ unsigned long debPackagesIndex::Size() const bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const { string PackageFile = IndexFile("Packages"); - FileFd Pkg(PackageFile,FileFd::ReadOnly); + FileFd Pkg(PackageFile,FileFd::ReadOnlyGzip); debListParser Parser(&Pkg); if (_error->PendingError() == true) return _error->Error("Problem opening %s",PackageFile.c_str()); @@ -464,7 +464,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const string TranslationFile = IndexFile(Language); if (TranslationsAvailable() && FileExists(TranslationFile)) { - FileFd Trans(TranslationFile,FileFd::ReadOnly); + FileFd Trans(TranslationFile,FileFd::ReadOnlyGzip); debListParser TransParser(&Trans); if (_error->PendingError() == true) return false; @@ -544,7 +544,7 @@ unsigned long debStatusIndex::Size() const /* */ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const { - FileFd Pkg(File,FileFd::ReadOnly); + FileFd Pkg(File,FileFd::ReadOnlyGzip); if (_error->PendingError() == true) return false; debListParser Parser(&Pkg); diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 34ef0d8f2..ec9e395ef 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -19,7 +19,7 @@ // --------------------------------------------------------------------- /* */ debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : - File(FileName,FileFd::ReadOnly), + File(FileName,FileFd::ReadOnlyGzip), Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200) { diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index c39d78bae..905264daa 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -48,7 +48,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual bool Files(vector &F); debSrcRecordParser(string const &File,pkgIndexFile const *Index) - : Parser(Index), Fd(File,FileFd::ReadOnly), Tags(&Fd,102400), + : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), Buffer(0), BufSize(0) {} ~debSrcRecordParser(); }; diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 3f68579cc..2b47184f9 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1220,7 +1220,7 @@ bool DisplayRecord(pkgCache::VerIterator V) if (I.IsOk() == false) return _error->Error(_("Package file %s is out of sync."),I.FileName()); - FileFd PkgF(I.FileName(),FileFd::ReadOnly); + FileFd PkgF(I.FileName(),FileFd::ReadOnlyGzip); if (_error->PendingError() == true) return false; diff --git a/debian/changelog b/debian/changelog index e44d7986d..f3f2d3df4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,13 +9,17 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - Make DEB_BUILD_OPTIONS=noopt actually work by passing the right CXXFLAGS. * apt-pkg/contrib/fileutl.{h,cc}: - - Add support for transparent reading of gzipped files. + - Add support for reading of gzipped files with the new "ReadOnlyGzip" + OpenMode. - Link against zlib (in apt-pkg/makefile) and add zlib build dependency. - [ABI BREAK] This adds a new private member to FileFd, but its - initialization is in the public header file. This also changes the - behaviour of FileFd for reading gzipped files. + initialization is in the public header file. * configure.in: - Check for zlib library and headers. + * apt-pkg/acquire-item.cc, apt-pkg/deb/debindexfile.cc, + apt-pkg/deb/debrecords.cc, apt-pkg/deb/debsrcrecords.h, + cmdline/apt-cache.cc: + - Open Packages, Sources, and Translations indexes in "ReadOnlyGzip" mode. * apt-pkg/deb/debindexfile.cc: - If we do not find uncompressed package/source/translation indexes, look for gzip compressed ones. -- cgit v1.2.3-70-g09d2 From d4af23c2d81116b8f7557ee795059bca126ae9f4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 20:56:44 +0200 Subject: * apt-pkg/deb/deblistparser.cc: - Handle architecture wildcards (Closes: #547724). --- apt-pkg/deb/deblistparser.cc | 10 +++++++++- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 83c5b8d2e..ddbd0d31a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -19,6 +19,7 @@ #include #include +#include #include /*}}}*/ @@ -572,8 +573,15 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, I++; } - if (stringcmp(arch,I,End) == 0) + if (stringcmp(arch,I,End) == 0) { Found = true; + } else { + std::string wildcard = SubstVar(string(I, End), "any", "*"); + if (fnmatch(wildcard.c_str(), arch.c_str(), 0) == 0) + Found = true; + else if (fnmatch(wildcard.c_str(), ("linux-" + arch).c_str(), 0) == 0) + Found = true; + } if (*End++ == ']') { I = End; diff --git a/debian/changelog b/debian/changelog index 037dfa7bd..8de7d18e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ apt (0.7.26~exp8) experimental; urgency=low * methods/ftp.h: - Handle different logins are on the same server (Closes: #586904). + * apt-pkg/deb/deblistparser.cc: + - Handle architecture wildcards (Closes: #547724). -- Julian Andres Klode Thu, 24 Jun 2010 10:56:39 +0200 -- cgit v1.2.3-70-g09d2 From 3b20aef1a2b5fd2fcd6f62a819edbdb19631fb98 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 26 Jun 2010 23:01:49 +0200 Subject: apt-pkg/deb/deblistparser.cc: Fix bug in architecture wildcard support. Previously, linux-any was always matched, because the code simply appended linux- to the APT::Architecture value. Now, it does this only if the APT::Architecture value does not contain "-". --- apt-pkg/deb/deblistparser.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index ddbd0d31a..00016679a 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -473,6 +473,14 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) return I; } +/* + * CompleteArch: + * + * The complete architecture, consisting of -. + */ +static string CompleteArch(std::string& arch) { + return (arch.find("-") != string::npos) ? arch : "linux-" + arch; +} /*}}}*/ // ListParser::ParseDepends - Parse a dependency element /*{{{*/ // --------------------------------------------------------------------- @@ -546,6 +554,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, if (ParseArchFlags == true) { string arch = _config->Find("APT::Architecture"); + string completeArch = CompleteArch(arch); // Parse an architecture if (I != Stop && *I == '[') @@ -577,9 +586,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, Found = true; } else { std::string wildcard = SubstVar(string(I, End), "any", "*"); - if (fnmatch(wildcard.c_str(), arch.c_str(), 0) == 0) - Found = true; - else if (fnmatch(wildcard.c_str(), ("linux-" + arch).c_str(), 0) == 0) + if (fnmatch(wildcard.c_str(), completeArch.c_str(), 0) == 0) Found = true; } -- cgit v1.2.3-70-g09d2 From 5143f361005775e3674f4f5871ad574cbe8ef705 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 27 Jun 2010 21:04:53 +0200 Subject: deblistparser: Special-case *-armel, lpia and powerpcspe architectures. --- apt-pkg/deb/deblistparser.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 00016679a..6ede14c4d 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -479,6 +479,12 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) * The complete architecture, consisting of -. */ static string CompleteArch(std::string& arch) { + if (arch == "armel") return "linux-arm"; + if (arch == "lpia") return "linux-i386"; + if (arch == "powerpcspe") return "linux-powerpc"; + if (arch == "uclibc-linux-armel") return "linux-arm"; + if (arch == "uclinux-armel") return "uclinux-arm"; + return (arch.find("-") != string::npos) ? arch : "linux-" + arch; } /*}}}*/ -- cgit v1.2.3-70-g09d2 From dcfa253fa4b3c563b3ed085c40d3336933840d55 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 4 Jul 2010 17:04:07 +0200 Subject: clean deblistparser a bit by get the Architectures at one place instead of distributed in a few methods --- apt-pkg/deb/deblistparser.cc | 23 ++++++++++------------- apt-pkg/deb/deblistparser.h | 4 +++- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 83c5b8d2e..d1931f909 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -38,6 +38,8 @@ debListParser::debListParser(FileFd *File, string const &Arch) : Tags(File), Arch(Arch) { if (Arch == "native") this->Arch = _config->Find("APT::Architecture"); + Architectures = APT::Configuration::getArchitectures(); + MultiArchEnabled = Architectures.size() > 1; } /*}}}*/ // ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/ @@ -155,10 +157,9 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) to a NOP in the download/install step - this package will ensure that it is downloaded only one time and installed only one time -- even if the architecture bound versions coming in and out on regular basis. */ - bool const static multiArch = APT::Configuration::getArchitectures().size() > 1; if (strcmp(Ver.Arch(true),"all") == 0) return true; - else if (multiArch == true) + else if (MultiArchEnabled == true) { // our pseudo packages have no size to not confuse the fetcher Ver->Size = 0; @@ -620,9 +621,6 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, if (Section.Find(Tag,Start,Stop) == false) return true; - static std::vector const archs = APT::Configuration::getArchitectures(); - static bool const multiArch = archs.size() <= 1; - string Package; string const pkgArch = Ver.Arch(true); string Version; @@ -634,13 +632,13 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); - if (multiArch == true && + if (MultiArchEnabled == true && (Type == pkgCache::Dep::Conflicts || Type == pkgCache::Dep::DpkgBreaks || Type == pkgCache::Dep::Replaces)) { - for (std::vector::const_iterator a = archs.begin(); - a != archs.end(); ++a) + for (std::vector::const_iterator a = Architectures.begin(); + a != Architectures.end(); ++a) if (NewDepends(Ver,Package,*a,Version,Op,Type) == false) return false; } @@ -692,14 +690,13 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) if (Ver->MultiArch != pkgCache::Version::Foreign) return true; - std::vector const archs = APT::Configuration::getArchitectures(); - if (archs.size() <= 1) + if (MultiArchEnabled == false) return true; string const Package = Ver.ParentPkg().Name(); string const Version = Ver.VerStr(); - for (std::vector::const_iterator a = archs.begin(); - a != archs.end(); ++a) + for (std::vector::const_iterator a = Architectures.begin(); + a != Architectures.end(); ++a) { if (NewProvides(Ver, Package, *a, Version) == false) return false; @@ -739,7 +736,7 @@ bool debListParser::Step() if (Architecture.empty() == true) return true; - if (Arch.empty() == true) + if (Arch.empty() == true || MultiArchEnabled == false) { if (APT::Configuration::checkArchitecture(Architecture) == true) return true; diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 8da051530..6c81d9fa0 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -32,7 +32,9 @@ class debListParser : public pkgCacheGenerator::ListParser pkgTagSection Section; unsigned long iOffset; string Arch; - + std::vector Architectures; + bool MultiArchEnabled; + unsigned long UniqFindTagWrite(const char *Tag); bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver); bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag, -- cgit v1.2.3-70-g09d2 From 24baab5c477bf1e57a0b169a7bac1d2e9ab0c974 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Jul 2010 16:47:09 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - make the apt/term.log output unbuffered (thanks to Matt Zimmerman) --- apt-pkg/deb/dpkgpm.cc | 3 ++- debian/changelog | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 8abe3f5c6..2bbc7a4ba 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -582,7 +583,7 @@ bool pkgDPkgPM::OpenLog() term_out = fopen(logfile_name.c_str(),"a"); if (term_out == NULL) return _error->WarningE(_("Could not open file '%s'"), logfile_name.c_str()); - + setvbuf(term_out, NULL, _IONBF, 0); chmod(logfile_name.c_str(), 0600); fprintf(term_out, "\nLog started: %s\n", timestr); } diff --git a/debian/changelog b/debian/changelog index f4cdeeec5..27acd33c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,8 @@ apt (0.7.25.4) UNRELEASED; urgency=low - install html doxygen in libapt-pkg-doc as well * methods/http.cc: - code cleanup, add (some) doxygen strings + * apt-pkg/deb/dpkgpm.cc: + - make the apt/term.log output unbuffered (thanks to Matt Zimmerman) [ Robert Collins ] * Change the package index Info methods to allow apt-cache policy to be -- cgit v1.2.3-70-g09d2 From 32b9a14cb4c6bdcddfe84c4451c225ced1a34bb7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 Jul 2010 11:10:46 +0200 Subject: use references instead of copies in the Cache generation methods --- apt-pkg/deb/deblistparser.cc | 16 ++++++++-------- apt-pkg/deb/deblistparser.h | 14 +++++++------- apt-pkg/pkgcachegen.cc | 9 +++++---- apt-pkg/pkgcachegen.h | 12 ++++++------ 4 files changed, 26 insertions(+), 25 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 24df57a5c..2cfeb23e9 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -106,7 +106,7 @@ string debListParser::Version() // ListParser::NewVersion - Fill in the version structure /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debListParser::NewVersion(pkgCache::VerIterator Ver) +bool debListParser::NewVersion(pkgCache::VerIterator &Ver) { // Parse the section Ver->Section = UniqFindTagWrite("Section"); @@ -251,8 +251,8 @@ MD5SumValue debListParser::Description_md5() // --------------------------------------------------------------------- /* This is called to update the package with any new information that might be found in the section */ -bool debListParser::UsePackage(pkgCache::PkgIterator Pkg, - pkgCache::VerIterator Ver) +bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver) { if (Pkg->Section == 0) Pkg->Section = UniqFindTagWrite("Section"); @@ -332,8 +332,8 @@ unsigned short debListParser::VersionHash() Some of the above are obsolete (I think?) flag = hold-* and status = post-inst-failed, removal-failed at least. */ -bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg, - pkgCache::VerIterator Ver) +bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver) { const char *Start; const char *Stop; @@ -634,7 +634,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, // --------------------------------------------------------------------- /* This is the higher level depends parser. It takes a tag and generates a complete depends tree for the given version. */ -bool debListParser::ParseDepends(pkgCache::VerIterator Ver, +bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, const char *Tag,unsigned int Type) { const char *Start; @@ -674,7 +674,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, // ListParser::ParseProvides - Parse the provides list /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debListParser::ParseProvides(pkgCache::VerIterator Ver) +bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) { const char *Start; const char *Stop; @@ -779,7 +779,7 @@ bool debListParser::Step() // ListParser::LoadReleaseInfo - Load the release information /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI, +bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, FileFd &File, string component) { pkgTagFile Tags(&File, File.Size() + 256); // XXX diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 6c81d9fa0..4bc1bd93c 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -36,10 +36,10 @@ class debListParser : public pkgCacheGenerator::ListParser bool MultiArchEnabled; unsigned long UniqFindTagWrite(const char *Tag); - bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver); - bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag, + bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); + bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, unsigned int Type); - bool ParseProvides(pkgCache::VerIterator Ver); + bool ParseProvides(pkgCache::VerIterator &Ver); static bool GrabWord(string Word,WordList *List,unsigned char &Out); public: @@ -51,19 +51,19 @@ class debListParser : public pkgCacheGenerator::ListParser virtual string Architecture(); virtual bool ArchitectureAll(); virtual string Version(); - virtual bool NewVersion(pkgCache::VerIterator Ver); + virtual bool NewVersion(pkgCache::VerIterator &Ver); virtual string Description(); virtual string DescriptionLanguage(); virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); - virtual bool UsePackage(pkgCache::PkgIterator Pkg, - pkgCache::VerIterator Ver); + virtual bool UsePackage(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver); virtual unsigned long Offset() {return iOffset;}; virtual unsigned long Size() {return Section.size();}; virtual bool Step(); - bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File, + bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, string section); static const char *ParseDepends(const char *Start,const char *Stop, diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 6a9da4a92..62e457734 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -157,13 +157,14 @@ bool pkgCacheGenerator::MergeList(ListParser &List, // we first process the package, then the descriptions // (this has the bonus that we get MMap error when we run out // of MMap space) - if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false) + pkgCache::VerIterator Ver(Cache); + if (List.UsePackage(Pkg, Ver) == false) return _error->Error(_("Error occurred while processing %s (UsePackage1)"), PackageName.c_str()); // Find the right version to write the description MD5SumValue CurMd5 = List.Description_md5(); - pkgCache::VerIterator Ver = Pkg.VersionList(); + Ver = Pkg.VersionList(); map_ptrloc *LastVer = &Pkg->VersionList; for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) @@ -668,7 +669,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, // --------------------------------------------------------------------- /* This creates a Group and the Package to link this dependency to if needed and handles also the caching of the old endpoint */ -bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, +bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver, const string &PackageName, const string &Arch, const string &Version, @@ -702,7 +703,7 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver, // ListParser::NewProvides - Create a Provides element /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver, +bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, const string &PkgName, const string &PkgArch, const string &Version) diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index a88c49451..8f7739165 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -109,10 +109,10 @@ class pkgCacheGenerator::ListParser inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; inline unsigned long WriteString(const string &S) {return Owner->WriteStringInMap(S);}; inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);}; - bool NewDepends(pkgCache::VerIterator Ver,const string &Package, const string &Arch, + bool NewDepends(pkgCache::VerIterator &Ver,const string &Package, const string &Arch, const string &Version,unsigned int Op, unsigned int Type); - bool NewProvides(pkgCache::VerIterator Ver,const string &PkgName, + bool NewProvides(pkgCache::VerIterator &Ver,const string &PkgName, const string &PkgArch, const string &Version); public: @@ -122,13 +122,13 @@ class pkgCacheGenerator::ListParser virtual string Architecture() = 0; virtual bool ArchitectureAll() = 0; virtual string Version() = 0; - virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; + virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0; virtual string Description() = 0; virtual string DescriptionLanguage() = 0; virtual MD5SumValue Description_md5() = 0; virtual unsigned short VersionHash() = 0; - virtual bool UsePackage(pkgCache::PkgIterator Pkg, - pkgCache::VerIterator Ver) = 0; + virtual bool UsePackage(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver) = 0; virtual unsigned long Offset() = 0; virtual unsigned long Size() = 0; @@ -136,7 +136,7 @@ class pkgCacheGenerator::ListParser inline bool HasFileDeps() {return FoundFileDeps;}; virtual bool CollectFileProvides(pkgCache &Cache, - pkgCache::VerIterator Ver) {return true;}; + pkgCache::VerIterator &Ver) {return true;}; ListParser() : FoundFileDeps(false) {}; virtual ~ListParser() {}; -- cgit v1.2.3-70-g09d2 From a9fe592842bfa17d91f4904d7fb0e3af3adebb17 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 Jul 2010 15:28:53 +0200 Subject: * apt-pkg/pkgcachegen.{cc,h}: - make the used MMap moveable (and therefore dynamic resizeable) by applying (some) mad pointer magic (Closes: #195018) --- apt-pkg/cacheiterators.h | 6 ++ apt-pkg/contrib/mmap.cc | 27 ++++-- apt-pkg/deb/debindexfile.cc | 1 + apt-pkg/pkgcache.cc | 5 +- apt-pkg/pkgcache.h | 2 +- apt-pkg/pkgcachegen.cc | 229 ++++++++++++++++++++++++++++++++------------ apt-pkg/pkgcachegen.h | 30 ++++-- debian/changelog | 3 + 8 files changed, 226 insertions(+), 77 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index dfe5707e1..eb8dee5e3 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -75,6 +75,12 @@ template class pkgCache::Iterator : inline bool IsGood() const { return S && Owner && ! end();}; inline unsigned long Index() const {return S - OwnerPointer();}; + void ReOwn(pkgCache &newOwner, void const * const oldMap, void const * const newMap) { + if (S == 0) + return; + S += (Str*)(newMap) - (Str*)(oldMap); + } + // Constructors - look out for the variable assigning inline Iterator() : S(0), Owner(0) {}; inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}; diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index d71066243..aa184b130 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -225,22 +225,22 @@ DynamicMMap::DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace, // disable Moveable if we don't grow if (Grow == 0) - Flags &= ~Moveable; + this->Flags &= ~Moveable; #ifndef __linux__ // kfreebsd doesn't have mremap, so we use the fallback - if ((Flags & Moveable) == Moveable) - Flags |= Fallback; + if ((this->Flags & Moveable) == Moveable) + this->Flags |= Fallback; #endif #ifdef _POSIX_MAPPED_FILES - if ((Flags & Fallback) != Fallback) { + if ((this->Flags & Fallback) != Fallback) { // Set the permissions. int Prot = PROT_READ; int Map = MAP_PRIVATE | MAP_ANONYMOUS; - if ((Flags & ReadOnly) != ReadOnly) + if ((this->Flags & ReadOnly) != ReadOnly) Prot |= PROT_WRITE; - if ((Flags & Public) == Public) + if ((this->Flags & Public) == Public) Map = MAP_SHARED | MAP_ANONYMOUS; // use anonymous mmap() to get the memory @@ -314,7 +314,7 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize) // Look for a matching pool entry Pool *I; Pool *Empty = 0; - for (I = Pools; I != Pools + PoolCount; I++) + for (I = Pools; I != Pools + PoolCount; ++I) { if (I->ItemSize == 0) Empty = I; @@ -342,7 +342,11 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize) { const unsigned long size = 20*1024; I->Count = size/ItemSize; + Pool* oldPools = Pools; Result = RawAllocate(size,ItemSize); + if (Pools != oldPools) + I += Pools - oldPools; + // Does the allocation failed ? if (Result == 0 && _error->PendingError()) return 0; @@ -365,7 +369,7 @@ unsigned long DynamicMMap::WriteString(const char *String, if (Len == (unsigned long)-1) Len = strlen(String); - unsigned long Result = RawAllocate(Len+1,0); + unsigned long const Result = RawAllocate(Len+1,0); if (Result == 0 && _error->PendingError()) return 0; @@ -395,16 +399,20 @@ bool DynamicMMap::Grow() { return _error->Error(_("Unable to increase the size of the MMap as the " "limit of %lu bytes is already reached."), Limit); - unsigned long const newSize = WorkSpace + 1024*1024; + unsigned long const newSize = WorkSpace + GrowFactor; if(Fd != 0) { Fd->Seek(newSize - 1); char C = 0; Fd->Write(&C,sizeof(C)); } + + unsigned long const poolOffset = Pools - ((Pool*) Base); + if ((Flags & Fallback) != Fallback) { #if defined(_POSIX_MAPPED_FILES) && defined(__linux__) #ifdef MREMAP_MAYMOVE + if ((Flags & Moveable) == Moveable) Base = mremap(Base, WorkSpace, newSize, MREMAP_MAYMOVE); else @@ -425,6 +433,7 @@ bool DynamicMMap::Grow() { return false; } + Pools =(Pool*) Base + poolOffset; WorkSpace = newSize; return true; } diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 6d9e99497..5e6db3f38 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -277,6 +277,7 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const // Store the IMS information pkgCache::PkgFileIterator File = Gen.GetCurFile(); + pkgCacheGenerator::Dynamic DynFile(File); struct stat St; if (fstat(Pkg.Fd(),&St) != 0) return _error->Errno("fstat","Failed to stat"); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 68aa83d0c..8af8ef7de 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -119,7 +119,7 @@ pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map) // Cache::ReMap - Reopen the cache file /*{{{*/ // --------------------------------------------------------------------- /* If the file is already closed then this will open it open it. */ -bool pkgCache::ReMap() +bool pkgCache::ReMap(bool const &Errorchecks) { // Apply the typecasts. HeaderP = (Header *)Map.Data(); @@ -135,6 +135,9 @@ bool pkgCache::ReMap() StringItemP = (StringItem *)Map.Data(); StrP = (char *)Map.Data(); + if (Errorchecks == false) + return true; + if (Map.Size() == 0 || HeaderP == 0) return _error->Error(_("Empty package cache")); diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 426bb9f13..799521784 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -174,7 +174,7 @@ class pkgCache /*{{{*/ StringItem *StringItemP; char *StrP; - virtual bool ReMap(); + virtual bool ReMap(bool const &Errorchecks = true); inline bool Sync() {return Map.Sync();}; inline MMap &GetMap() {return Map;}; inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 62e457734..18bad6727 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -36,6 +36,7 @@ #include /*}}}*/ typedef vector::iterator FileIterator; +template std::set pkgCacheGenerator::Dynamic::toReMap; // CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/ // --------------------------------------------------------------------- @@ -61,8 +62,12 @@ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) : // Starting header *Cache.HeaderP = pkgCache::Header(); - Cache.HeaderP->VerSysName = WriteStringInMap(_system->VS->Label); - Cache.HeaderP->Architecture = WriteStringInMap(_config->Find("APT::Architecture")); + map_ptrloc const idxVerSysName = WriteStringInMap(_system->VS->Label); + Cache.HeaderP->VerSysName = idxVerSysName; + map_ptrloc const idxArchitecture = WriteStringInMap(_config->Find("APT::Architecture")); + Cache.HeaderP->Architecture = idxArchitecture; + if (unlikely(idxVerSysName == 0 || idxArchitecture == 0)) + return; Cache.ReMap(); } else @@ -96,19 +101,65 @@ pkgCacheGenerator::~pkgCacheGenerator() Map.Sync(0,sizeof(pkgCache::Header)); } /*}}}*/ +void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newMap) {/*{{{*/ + if (oldMap == newMap) + return; + + Cache.ReMap(false); + + CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap; + + for (size_t i = 0; i < _count(UniqHash); ++i) + if (UniqHash[i] != 0) + UniqHash[i] += (pkgCache::StringItem*) newMap - (pkgCache::StringItem*) oldMap; + + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); + for (std::set::const_iterator i = Dynamic::toReMap.begin(); + i != Dynamic::toReMap.end(); ++i) + (*i)->ReOwn(Cache, oldMap, newMap); +} /*}}}*/ // CacheGenerator::WriteStringInMap /*{{{*/ -unsigned long pkgCacheGenerator::WriteStringInMap(const char *String, +map_ptrloc pkgCacheGenerator::WriteStringInMap(const char *String, const unsigned long &Len) { - return Map.WriteString(String, Len); + void const * const oldMap = Map.Data(); + map_ptrloc const index = Map.WriteString(String, Len); + if (index != 0) + ReMap(oldMap, Map.Data()); + return index; } /*}}}*/ // CacheGenerator::WriteStringInMap /*{{{*/ -unsigned long pkgCacheGenerator::WriteStringInMap(const char *String) { - return Map.WriteString(String); +map_ptrloc pkgCacheGenerator::WriteStringInMap(const char *String) { + void const * const oldMap = Map.Data(); + map_ptrloc const index = Map.WriteString(String); + if (index != 0) + ReMap(oldMap, Map.Data()); + return index; } /*}}}*/ -unsigned long pkgCacheGenerator::AllocateInMap(const unsigned long &size) {/*{{{*/ - return Map.Allocate(size); +map_ptrloc pkgCacheGenerator::AllocateInMap(const unsigned long &size) {/*{{{*/ + void const * const oldMap = Map.Data(); + map_ptrloc const index = Map.Allocate(size); + if (index != 0) + ReMap(oldMap, Map.Data()); + return index; } /*}}}*/ // CacheGenerator::MergeList - Merge the package list /*{{{*/ @@ -142,6 +193,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, { // Get a pointer to the package structure pkgCache::PkgIterator Pkg; + Dynamic DynPkg(Pkg); if (NewPackage(Pkg, PackageName, *arch) == false) return _error->Error(_("Error occurred while processing %s (NewPackage)"),PackageName.c_str()); Counter++; @@ -158,6 +210,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, // (this has the bonus that we get MMap error when we run out // of MMap space) pkgCache::VerIterator Ver(Cache); + Dynamic DynVer(Ver); if (List.UsePackage(Pkg, Ver) == false) return _error->Error(_("Error occurred while processing %s (UsePackage1)"), PackageName.c_str()); @@ -165,11 +218,11 @@ bool pkgCacheGenerator::MergeList(ListParser &List, // Find the right version to write the description MD5SumValue CurMd5 = List.Description_md5(); Ver = Pkg.VersionList(); - map_ptrloc *LastVer = &Pkg->VersionList; - for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) + for (; Ver.end() == false; ++Ver) { pkgCache::DescIterator Desc = Ver.DescriptionList(); + Dynamic DynDesc(Desc); map_ptrloc *LastDesc = &Ver->DescriptionList; bool duplicate=false; @@ -189,7 +242,11 @@ bool pkgCacheGenerator::MergeList(ListParser &List, if (MD5SumValue(Desc.md5()) == CurMd5) { // Add new description - *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc); + void const * const oldMap = Map.Data(); + map_ptrloc const descindex = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc); + if (oldMap != Map.Data()) + LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + *LastDesc = descindex; Desc->ParentPkg = Pkg.Index(); if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) @@ -203,7 +260,9 @@ bool pkgCacheGenerator::MergeList(ListParser &List, } pkgCache::VerIterator Ver = Pkg.VersionList(); + Dynamic DynVer(Ver); map_ptrloc *LastVer = &Pkg->VersionList; + void const * oldMap = Map.Data(); int Res = 1; unsigned long const Hash = List.VersionHash(); for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) @@ -242,21 +301,28 @@ bool pkgCacheGenerator::MergeList(ListParser &List, } // Add a new version - *LastVer = NewVersion(Ver,Version,*LastVer); + map_ptrloc const verindex = NewVersion(Ver,Version,*LastVer); + if (verindex == 0 && _error->PendingError()) + return _error->Error(_("Error occurred while processing %s (NewVersion%d)"), + PackageName.c_str(), 1); + + if (oldMap != Map.Data()) + LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + *LastVer = verindex; Ver->ParentPkg = Pkg.Index(); Ver->Hash = Hash; - if ((*LastVer == 0 && _error->PendingError()) || List.NewVersion(Ver) == false) - return _error->Error(_("Error occurred while processing %s (NewVersion1)"), - PackageName.c_str()); + if (List.NewVersion(Ver) == false) + return _error->Error(_("Error occurred while processing %s (NewVersion%d)"), + PackageName.c_str(), 2); if (List.UsePackage(Pkg,Ver) == false) return _error->Error(_("Error occurred while processing %s (UsePackage3)"), PackageName.c_str()); if (NewFileVer(Ver,List) == false) - return _error->Error(_("Error occurred while processing %s (NewVersion2)"), - PackageName.c_str()); + return _error->Error(_("Error occurred while processing %s (NewVersion%d)"), + PackageName.c_str(), 3); // Read only a single record and return if (OutVer != 0) @@ -269,13 +335,18 @@ bool pkgCacheGenerator::MergeList(ListParser &List, /* Record the Description data. Description data always exist in Packages and Translation-* files. */ pkgCache::DescIterator Desc = Ver.DescriptionList(); + Dynamic DynDesc(Desc); map_ptrloc *LastDesc = &Ver->DescriptionList; - + // Skip to the end of description set for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++); // Add new description - *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc); + oldMap = Map.Data(); + map_ptrloc const descindex = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc); + if (oldMap != Map.Data()) + LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + *LastDesc = descindex; Desc->ParentPkg = Pkg.Index(); if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) @@ -322,6 +393,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List) continue; pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName); + Dynamic DynPkg(Pkg); if (Pkg.end() == true) return _error->Error(_("Error occurred while processing %s (FindPkg)"), PackageName.c_str()); @@ -331,6 +403,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List) unsigned long Hash = List.VersionHash(); pkgCache::VerIterator Ver = Pkg.VersionList(); + Dynamic DynVer(Ver); for (; Ver.end() == false; Ver++) { if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr()) @@ -358,14 +431,15 @@ bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name) return true; // Get a structure - unsigned long const Group = AllocateInMap(sizeof(pkgCache::Group)); + map_ptrloc const Group = AllocateInMap(sizeof(pkgCache::Group)); if (unlikely(Group == 0)) return false; Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group); - Grp->Name = WriteStringInMap(Name); - if (unlikely(Grp->Name == 0)) + map_ptrloc const idxName = WriteStringInMap(Name); + if (unlikely(idxName == 0)) return false; + Grp->Name = idxName; // Insert it into the hash table unsigned long const Hash = Cache.Hash(Name); @@ -382,6 +456,7 @@ bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name) bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const string &Arch) { pkgCache::GrpIterator Grp; + Dynamic DynGrp(Grp); if (unlikely(NewGroup(Grp, Name) == false)) return false; @@ -390,7 +465,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name return true; // Get a structure - unsigned long const Package = AllocateInMap(sizeof(pkgCache::Package)); + map_ptrloc const Package = AllocateInMap(sizeof(pkgCache::Package)); if (unlikely(Package == 0)) return false; Pkg = pkgCache::PkgIterator(Cache,Cache.PkgP + Package); @@ -416,9 +491,10 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name // Set the name, arch and the ID Pkg->Name = Grp->Name; Pkg->Group = Grp.Index(); - Pkg->Arch = WriteUniqString(Arch.c_str()); - if (unlikely(Pkg->Arch == 0)) + map_ptrloc const idxArch = WriteUniqString(Arch.c_str()); + if (unlikely(idxArch == 0)) return false; + Pkg->Arch = idxArch; Pkg->ID = Cache.HeaderP->PackageCount++; return true; @@ -434,7 +510,7 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver, return true; // Get a structure - unsigned long VerFile = AllocateInMap(sizeof(pkgCache::VerFile)); + map_ptrloc const VerFile = AllocateInMap(sizeof(pkgCache::VerFile)); if (VerFile == 0) return 0; @@ -465,7 +541,7 @@ unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver, unsigned long Next) { // Get a structure - unsigned long Version = AllocateInMap(sizeof(pkgCache::Version)); + map_ptrloc const Version = AllocateInMap(sizeof(pkgCache::Version)); if (Version == 0) return 0; @@ -473,9 +549,10 @@ unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver, Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version); Ver->NextVer = Next; Ver->ID = Cache.HeaderP->VersionCount++; - Ver->VerStr = WriteStringInMap(VerStr); - if (Ver->VerStr == 0) + map_ptrloc const idxVerStr = WriteStringInMap(VerStr); + if (unlikely(idxVerStr == 0)) return 0; + Ver->VerStr = idxVerStr; return Version; } @@ -490,7 +567,7 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc, return true; // Get a structure - unsigned long DescFile = AllocateInMap(sizeof(pkgCache::DescFile)); + map_ptrloc const DescFile = AllocateInMap(sizeof(pkgCache::DescFile)); if (DescFile == 0) return false; @@ -523,7 +600,7 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, map_ptrloc Next) { // Get a structure - map_ptrloc Description = AllocateInMap(sizeof(pkgCache::Description)); + map_ptrloc const Description = AllocateInMap(sizeof(pkgCache::Description)); if (Description == 0) return 0; @@ -531,10 +608,12 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, Desc = pkgCache::DescIterator(Cache,Cache.DescP + Description); Desc->NextDesc = Next; Desc->ID = Cache.HeaderP->DescriptionCount++; - Desc->language_code = WriteStringInMap(Lang); - Desc->md5sum = WriteStringInMap(md5sum.Value()); - if (Desc->language_code == 0 || Desc->md5sum == 0) + map_ptrloc const idxlanguage_code = WriteStringInMap(Lang); + map_ptrloc const idxmd5sum = WriteStringInMap(md5sum.Value()); + if (unlikely(idxlanguage_code == 0 || idxmd5sum == 0)) return 0; + Desc->language_code = idxlanguage_code; + Desc->md5sum = idxmd5sum; return Description; } @@ -550,15 +629,22 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) if (archs.size() > 1) { // Create Conflicts in between the group - for (pkgCache::GrpIterator G = GetCache().GrpBegin(); G.end() != true; G++) + pkgCache::GrpIterator G = GetCache().GrpBegin(); + Dynamic DynG(G); + for (; G.end() != true; G++) { string const PkgName = G.Name(); - for (pkgCache::PkgIterator P = G.PackageList(); P.end() != true; P = G.NextPkg(P)) + pkgCache::PkgIterator P = G.PackageList(); + Dynamic DynP(P); + for (; 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++) + Dynamic DynallPkg(allPkg); + pkgCache::VerIterator V = P.VersionList(); + Dynamic DynV(V); + for (; V.end() != true; V++) { string const Arch = V.Arch(true); map_ptrloc *OldDepLast = NULL; @@ -578,6 +664,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) per group, therefore each group member conflicts with all other group members */ pkgCache::PkgIterator D = G.FindPkg(*A); + Dynamic DynD(D); if (D.end() == true) continue; if (coInstall == true) @@ -622,13 +709,15 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, unsigned int const &Type, map_ptrloc *OldDepLast) { + void const * const oldMap = Map.Data(); // Get a structure - unsigned long const Dependency = AllocateInMap(sizeof(pkgCache::Dependency)); + map_ptrloc const Dependency = AllocateInMap(sizeof(pkgCache::Dependency)); if (unlikely(Dependency == 0)) return false; // Fill it in pkgCache::DepIterator Dep(Cache,Cache.DepP + Dependency); + Dynamic DynDep(Dep); Dep->ParentVer = Ver.Index(); Dep->Type = Type; Dep->CompareOp = Op; @@ -640,9 +729,12 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, /* for (pkgCache::DepIterator I = Pkg.RevDependsList(); I.end() == false; I++) if (I->Version != 0 && I.TargetVer() == Version) Dep->Version = I->Version;*/ - if (Dep->Version == 0) - if (unlikely((Dep->Version = WriteStringInMap(Version)) == 0)) + if (Dep->Version == 0) { + map_ptrloc const index = WriteStringInMap(Version); + if (unlikely(index == 0)) return false; + Dep->Version = index; + } } // Link it to the package @@ -656,7 +748,8 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg, OldDepLast = &Ver->DependsList; for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++) OldDepLast = &D->NextDepends; - } + } else if (oldMap != Map.Data()) + OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; Dep->NextDepends = *OldDepLast; *OldDepLast = Dep.Index(); @@ -677,11 +770,13 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver, unsigned int Type) { pkgCache::GrpIterator Grp; + Dynamic DynGrp(Grp); if (unlikely(Owner->NewGroup(Grp, PackageName) == false)) return false; // Locate the target package pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch); + Dynamic DynPkg(Pkg); if (Pkg.end() == true) { if (unlikely(Owner->NewPackage(Pkg, PackageName, Arch) == false)) return false; @@ -715,13 +810,14 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, return true; // Get a structure - unsigned long const Provides = Owner->AllocateInMap(sizeof(pkgCache::Provides)); + map_ptrloc const Provides = Owner->AllocateInMap(sizeof(pkgCache::Provides)); if (unlikely(Provides == 0)) return false; Cache.HeaderP->ProvidesCount++; // Fill it in pkgCache::PrvIterator Prv(Cache,Cache.ProvideP + Provides,Cache.PkgP); + Dynamic DynPrv(Prv); Prv->Version = Ver.Index(); Prv->NextPkgProv = Ver->ProvidesList; Ver->ProvidesList = Prv.Index(); @@ -730,6 +826,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, // Locate the target package pkgCache::PkgIterator Pkg; + Dynamic DynPkg(Pkg); if (unlikely(Owner->NewPackage(Pkg,PkgName, PkgArch) == false)) return false; @@ -750,24 +847,29 @@ bool pkgCacheGenerator::SelectFile(const string &File,const string &Site, unsigned long Flags) { // Get some space for the structure - CurrentFile = Cache.PkgFileP + AllocateInMap(sizeof(*CurrentFile)); - if (CurrentFile == Cache.PkgFileP) + map_ptrloc const idxFile = AllocateInMap(sizeof(*CurrentFile)); + if (unlikely(idxFile == 0)) return false; - + CurrentFile = Cache.PkgFileP + idxFile; + // Fill it in - CurrentFile->FileName = WriteStringInMap(File); - CurrentFile->Site = WriteUniqString(Site); + map_ptrloc const idxFileName = WriteStringInMap(File); + map_ptrloc const idxSite = WriteUniqString(Site); + if (unlikely(idxFileName == 0 || idxSite == 0)) + return false; + CurrentFile->FileName = idxFileName; + CurrentFile->Site = idxSite; CurrentFile->NextFile = Cache.HeaderP->FileList; CurrentFile->Flags = Flags; CurrentFile->ID = Cache.HeaderP->PackageFileCount; - CurrentFile->IndexType = WriteUniqString(Index.GetType()->Label); + map_ptrloc const idxIndexType = WriteUniqString(Index.GetType()->Label); + if (unlikely(idxIndexType == 0)) + return false; + CurrentFile->IndexType = idxIndexType; PkgFileName = File; Cache.HeaderP->FileList = CurrentFile - Cache.PkgFileP; Cache.HeaderP->PackageFileCount++; - if (CurrentFile->FileName == 0) - return false; - if (Progress != 0) Progress->SubProgress(Index.Size()); return true; @@ -807,18 +909,25 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S, } // Get a structure - unsigned long Item = AllocateInMap(sizeof(pkgCache::StringItem)); + void const * const oldMap = Map.Data(); + map_ptrloc const Item = AllocateInMap(sizeof(pkgCache::StringItem)); if (Item == 0) return 0; + map_ptrloc const idxString = WriteStringInMap(S,Size); + if (unlikely(idxString == 0)) + return 0; + if (oldMap != Map.Data()) { + Last += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap; + I += (pkgCache::StringItem*) Map.Data() - (pkgCache::StringItem*) oldMap; + } + *Last = Item; + // Fill in the structure pkgCache::StringItem *ItemP = Cache.StringItemP + Item; ItemP->NextItem = I - Cache.StringItemP; - *Last = Item; - ItemP->String = WriteStringInMap(S,Size); - if (ItemP->String == 0) - return 0; - + ItemP->String = idxString; + Bucket = ItemP; return ItemP->String; } @@ -1072,7 +1181,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress unlink(CacheFile.c_str()); CacheF = new FileFd(CacheFile,FileFd::WriteEmpty); fchmod(CacheF->Fd(),0644); - Map = new DynamicMMap(*CacheF,MMap::Public,MapSize); + Map = new DynamicMMap(*CacheF,MMap::Public | MMap::Moveable, MapSize); if (_error->PendingError() == true) return false; if (Debug == true) @@ -1081,7 +1190,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress else { // Just build it in memory.. - Map = new DynamicMMap(0,MapSize); + Map = new DynamicMMap(MMap::Moveable, MapSize); if (Debug == true) std::clog << "Open memory Map (not filebased)" << std::endl; } @@ -1194,7 +1303,7 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O if (_system->AddStatusFiles(Files) == false) return false; - SPtr Map = new DynamicMMap(0,MapSize); + SPtr Map = new DynamicMMap(MMap::Moveable, MapSize); unsigned long CurrentSize = 0; unsigned long TotalSize = 0; diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 8f7739165..3bee1f958 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -23,6 +23,8 @@ #include #include +#include + class pkgSourceList; class OpProgress; class MMap; @@ -33,18 +35,32 @@ class pkgCacheGenerator /*{{{*/ private: pkgCache::StringItem *UniqHash[26]; - unsigned long WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; - unsigned long WriteStringInMap(const char *String); - unsigned long WriteStringInMap(const char *String, const unsigned long &Len); - unsigned long AllocateInMap(const unsigned long &size); + map_ptrloc WriteStringInMap(std::string const &String) { return WriteStringInMap(String.c_str()); }; + map_ptrloc WriteStringInMap(const char *String); + map_ptrloc WriteStringInMap(const char *String, const unsigned long &Len); + map_ptrloc AllocateInMap(const unsigned long &size); public: class ListParser; friend class ListParser; - + + template class Dynamic { + Iter *I; + + public: + static std::set toReMap; + Dynamic(Iter &It) : I(&It) { + toReMap.insert(I); + } + + ~Dynamic() { + toReMap.erase(I); + } + }; + protected: - + DynamicMMap ⤅ pkgCache Cache; OpProgress *Progress; @@ -86,6 +102,8 @@ class pkgCacheGenerator /*{{{*/ MMap **OutMap = 0,bool AllowMem = false); static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap); + void ReMap(void const * const oldMap, void const * const newMap); + pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress); ~pkgCacheGenerator(); }; diff --git a/debian/changelog b/debian/changelog index 878d5238a..dab703c6b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -37,6 +37,9 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low * apt-pkg/policy.h: - add another round of const& madness as the previous round accidentally NOT overrides the virtual GetCandidateVer() method (Closes: #587725) + * apt-pkg/pkgcachegen.{cc,h}: + - make the used MMap moveable (and therefore dynamic resizeable) by + applying (some) mad pointer magic (Closes: #195018) [ Julian Andres Klode ] * methods/ftp.h: -- cgit v1.2.3-70-g09d2 From dd13742ef11a6a601a2e85afd9d80be92ed7513a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 11 Jul 2010 18:50:41 +0200 Subject: * apt-pkg/deb/debmetaindex.cc: - do not query each architecture for flat file archives --- apt-pkg/deb/debindexfile.cc | 8 ++++---- apt-pkg/deb/deblistparser.cc | 2 +- apt-pkg/deb/debmetaindex.cc | 14 ++++++++++++-- apt-pkg/pkgcachegen.cc | 2 ++ debian/changelog | 2 ++ 5 files changed, 21 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 7e9a973a4..ba5b3f266 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -184,8 +184,8 @@ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const Res += " "; Res += Ver.ParentPkg().Name(); Res += " "; - Res += Ver.Arch(); - Res += " "; + if (Dist[Dist.size() - 1] != '/') + Res.append(Ver.Arch()).append(" "); Res += Ver.VerStr(); return Res; } @@ -219,8 +219,8 @@ string debPackagesIndex::Info(const char *Type) const else Info += Dist + '/' + Section; Info += " "; - Info += Architecture; - Info += " "; + if (Dist[Dist.size() - 1] != '/') + Info += Architecture + " "; Info += Type; return Info; } diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 2cfeb23e9..5fb737970 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -757,7 +757,7 @@ bool debListParser::Step() if (Architecture.empty() == true) return true; - if (Arch.empty() == true || MultiArchEnabled == false) + if (Arch.empty() == true || Arch == "any" || MultiArchEnabled == false) { if (APT::Configuration::checkArchitecture(Architecture) == true) return true; diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 8df3ed18d..7366bd624 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -332,7 +332,12 @@ class debSLTypeDebian : public pkgSourceList::Type if (IsSrc == true) Deb->PushSectionEntry("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); else - Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + { + if (Dist[Dist.size() - 1] == '/') + Deb->PushSectionEntry("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + } return true; } } @@ -342,7 +347,12 @@ class debSLTypeDebian : public pkgSourceList::Type if (IsSrc == true) Deb->PushSectionEntry ("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); else - Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + { + if (Dist[Dist.size() - 1] == '/') + Deb->PushSectionEntry ("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + } List.push_back(Deb); return true; } diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 1175d5129..38f2d6a2a 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1094,6 +1094,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, return true; } /*}}}*/ +// CacheGenerator::CreateDynamicMMap - load an mmap with configuration options /*{{{*/ DynamicMMap* pkgCacheGenerator::CreateDynamicMMap(FileFd *CacheF, unsigned long Flags) { unsigned long const MapStart = _config->FindI("APT::Cache-Start", 24*1024*1024); unsigned long const MapGrow = _config->FindI("APT::Cache-Grow", 1*1024*1024); @@ -1106,6 +1107,7 @@ DynamicMMap* pkgCacheGenerator::CreateDynamicMMap(FileFd *CacheF, unsigned long else return new DynamicMMap(Flags, MapStart, MapGrow, MapLimit); } + /*}}}*/ // CacheGenerator::MakeStatusCache - Construct the status cache /*{{{*/ // --------------------------------------------------------------------- /* This makes sure that the status cache (the cache that has all diff --git a/debian/changelog b/debian/changelog index bc35468c3..b506fa433 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ apt (0.7.26~exp10) UNRELEASED; urgency=low * apt-pkg/contrib/error.{cc,h}: - remove constness of va_list parameter to fix build on amd64 and co Thanks Eric Valette! (Closes: #588610) + * apt-pkg/deb/debmetaindex.cc: + - do not query each architecture for flat file archives [ Martin Pitt ] * debian/rules: -- cgit v1.2.3-70-g09d2 From ff1ad6fdb01ad8d477ab711e4f6fe006d622f3bc Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 11 Jul 2010 18:58:54 +0200 Subject: fix typo preventing display of architecture in Info() --- apt-pkg/deb/debmetaindex.cc | 2 +- debian/changelog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 7366bd624..717d0bcde 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -23,7 +23,7 @@ string debReleaseIndex::Info(const char *Type, string const &Section, string con else { Info += Dist + '/' + Section; - if (Arch.empty() == true) + if (Arch.empty() != true) Info += " " + Arch; } Info += " "; diff --git a/debian/changelog b/debian/changelog index b506fa433..b0efc72e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ apt (0.7.26~exp10) UNRELEASED; urgency=low Thanks Eric Valette! (Closes: #588610) * apt-pkg/deb/debmetaindex.cc: - do not query each architecture for flat file archives + - fix typo preventing display of architecture in Info() [ Martin Pitt ] * debian/rules: -- cgit v1.2.3-70-g09d2 From 621e918e5e57675580ee5cb9bb4775d106814be4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 21 Jul 2010 17:14:53 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - Write architecture information to history file. --- apt-pkg/deb/dpkgpm.cc | 10 +++++----- debian/changelog | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 67291063c..2945e9750 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -675,17 +675,17 @@ bool pkgDPkgPM::OpenLog() for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { if (Cache[I].NewInstall()) - install += I.Name() + string(" (") + Cache[I].CandVersion + string("), "); + install += I.FullName(false) + string(" (") + Cache[I].CandVersion + string("), "); else if (Cache[I].Upgrade()) - upgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); else if (Cache[I].Downgrade()) - downgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); + downgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); else if (Cache[I].Delete()) { if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) - purge += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); + purge += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); else - remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), "); + remove += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), "); } } if (_config->Exists("Commandline::AsString") == true) diff --git a/debian/changelog b/debian/changelog index 0f87ce60f..efd98de73 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +apt (0.7.26~exp11) experimental; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - Write architecture information to history file. + + -- Julian Andres Klode Wed, 21 Jul 2010 17:09:11 +0200 + apt (0.7.26~exp10) experimental; urgency=low [ David Kalnischkies ] -- cgit v1.2.3-70-g09d2 From 6bf8f0d198f00dcbb46dba97840681fa2227177a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 21 Jul 2010 17:19:16 +0200 Subject: Add to history whether a change was automatic or not. --- apt-pkg/deb/dpkgpm.cc | 7 ++++++- debian/changelog | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2945e9750..aa0b04bd5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -675,7 +675,12 @@ bool pkgDPkgPM::OpenLog() for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++) { if (Cache[I].NewInstall()) - install += I.FullName(false) + string(" (") + Cache[I].CandVersion + string("), "); + { + install += I.FullName(false) + string(" (") + Cache[I].CandVersion; + if (Cache[I].Flags & pkgCache::Flag::Auto) + install+= ", automatic"; + install += string("), "); + } else if (Cache[I].Upgrade()) upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), "); else if (Cache[I].Downgrade()) diff --git a/debian/changelog b/debian/changelog index efd98de73..311833192 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ apt (0.7.26~exp11) experimental; urgency=low * apt-pkg/deb/dpkgpm.cc: - Write architecture information to history file. + - Add to history whether a change was automatic or not. -- Julian Andres Klode Wed, 21 Jul 2010 17:09:11 +0200 -- cgit v1.2.3-70-g09d2