From d4b4e5ea2ceb02699e746d52256b3a8ac2d9bda2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 30 Aug 2012 12:21:32 +0200 Subject: * apt-pkg/packagemanager.cc: - unpack versions in case a different version from the package is currently in unpack state to recover from broken system states (like different file in M-A:same package and other dpkg errors) --- apt-pkg/packagemanager.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index b93bf6ab9..d2d2753a8 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -882,7 +882,9 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c } } // packages which are already unpacked don't need to be unpacked again - else if (Pkg.State() != pkgCache::PkgIterator::NeedsConfigure && Install(Pkg,FileNames[Pkg->ID]) == false) + else if ((instVer != Pkg.CurrentVer() || + ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) && + Install(Pkg,FileNames[Pkg->ID]) == false) return false; if (Immediate == true) { -- cgit v1.2.3 From d29a5330af408747363c944767f1af2212658bd1 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 2 Sep 2012 18:31:07 +0200 Subject: * apt-pkg/indexcopy.cc: - do not create duplicated flat-archive cdrom sources for foreign architectures on multi-arch cdroms --- apt-pkg/indexcopy.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index c97445326..24defd82c 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -350,9 +350,6 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File) */ void IndexCopy::ConvertToSourceList(string CD,string &Path) { - char S[300]; - snprintf(S,sizeof(S),"binary-%s",_config->Find("Apt::Architecture").c_str()); - // Strip the cdrom base path Path = string(Path,CD.length()); if (Path.empty() == true) @@ -388,7 +385,13 @@ void IndexCopy::ConvertToSourceList(string CD,string &Path) return; string Binary = string(Path,Slash+1,BinSlash - Slash-1); - if (Binary != S && Binary != "source") + if (strncmp(Binary.c_str(), "binary-", strlen("binary-")) == 0) + { + Binary.erase(0, strlen("binary-")); + if (APT::Configuration::checkArchitecture(Binary) == false) + continue; + } + else if (Binary != "source") continue; Path = Dist + ' ' + Comp; -- cgit v1.2.3 From 8628c2f7a6a8769a6250280d62791a8429aa71ba Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 2 Sep 2012 21:32:40 +0200 Subject: * apt-pkg/cdrom.cc: - handle Components in the reduction for the source.list as multi-arch cds otherwise create duplicated source entries (e.g. "wheezy main main") --- apt-pkg/cdrom.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 699f66fb3..8e746ee30 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -363,6 +363,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector &List) string Word1 = string(*I,Space,SSpace-Space); string Prefix = string(*I,0,Space); + string Component = string(*I,SSpace); for (vector::iterator J = List.begin(); J != I; ++J) { // Find a space.. @@ -377,9 +378,11 @@ void pkgCdrom::ReduceSourcelist(string CD,vector &List) continue; if (string(*J,Space2,SSpace2-Space2) != Word1) continue; - - *J += string(*I,SSpace); - *I = string(); + + string Component2 = string(*J, SSpace2) + " "; + if (Component2.find(Component + " ") == std::string::npos) + *J += Component; + I->clear(); } } -- cgit v1.2.3 From 12c7078f5098d7f26599a3761af9e24b392d9c1d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Sep 2012 12:26:34 +0200 Subject: - do not create duplicated flat-archive CD-ROM sources for foreign architectures on multi-arch CD-ROMs - do not warn about files which have a record in the Release file, but are not present on the CD to mirror the behavior of the other methods and to allow uncompressed indexes to be dropped without scaring users - handle Components in the reduction for the source.list as multi-arch CDs --- apt-pkg/indexcopy.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 24defd82c..aa1f01a4a 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -497,17 +497,20 @@ bool SourceCopy::RewriteEntry(FILE *Target,string File) bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex) { const indexRecords::checkSum *Record = MetaIndex->Lookup(file); + bool const Debug = _config->FindB("Debug::aptcdrom",false); - // we skip non-existing files in the verifcation to support a cdrom - // with no Packages file (just a Package.gz), see LP: #255545 - // (non-existing files are not considered a error) + // we skip non-existing files in the verifcation of the Release file + // as non-existing files do not harm, but a warning scares people and + // makes it hard to strip unneeded files from an ISO like uncompressed + // indexes as it is done on the mirrors (see also LP: #255545 ) if(!RealFileExists(prefix+file)) { - _error->Warning(_("Skipping nonexistent file %s"), string(prefix+file).c_str()); + if (Debug == true) + cout << "Skipping nonexistent in " << prefix << " file " << file << std::endl; return true; } - if (!Record) + if (!Record) { _error->Warning(_("Can't find authentication record for: %s"), file.c_str()); return false; @@ -519,7 +522,7 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex) return false; } - if(_config->FindB("Debug::aptcdrom",false)) + if(Debug == true) { cout << "File: " << prefix+file << endl; cout << "Expected Hash " << Record->Hash.toStr() << endl; -- cgit v1.2.3 From c45233eaf6d08bb6bb6e2dbb57c90a1d52ca9a43 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Sep 2012 12:28:19 +0200 Subject: * apt-pkg/cdrom.cc: - copy only configured translation files from a CD-ROM and not all available translation files preventing new installs with d-i from being initialized with all translations (Closes: #678227) - handle Components in the reduction for the source.list as multi-arch CDs otherwise create duplicated source entries (e.g. "wheezy main main") --- apt-pkg/aptconfiguration.cc | 11 +++++++++++ apt-pkg/aptconfiguration.h | 8 ++++++++ apt-pkg/cdrom.cc | 25 +++++++++++++++++++++++++ apt-pkg/cdrom.h | 1 + 4 files changed, 45 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index d31ccb642..653775688 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -319,6 +319,17 @@ std::vector const Configuration::getLanguages(bool const &All, return codes; } /*}}}*/ +// checkLanguage - are we interested in the given Language? /*{{{*/ +bool const Configuration::checkLanguage(std::string Lang, bool const All) { + // the empty Language is always interesting as it is the original + if (Lang.empty() == true) + return true; + // filenames are encoded, so undo this + Lang = SubstVar(Lang, "%5f", "_"); + std::vector const langs = getLanguages(All, true); + return (std::find(langs.begin(), langs.end(), Lang) != langs.end()); +} + /*}}}*/ // getArchitectures - Return Vector of prefered Architectures /*{{{*/ std::vector const Configuration::getArchitectures(bool const &Cached) { using std::string; diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index e098d0fd6..516f451d9 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -67,6 +67,14 @@ public: /*{{{*/ std::vector static const getLanguages(bool const &All = false, bool const &Cached = true, char const ** const Locale = 0); + /** \brief Are we interested in the given Language? + * + * \param Lang is the language we want to check + * \param All defines if we check against all codes or only against used codes + * \return true if we are interested, false otherwise + */ + bool static const Configuration::checkLanguage(std::string Lang, bool const All = false); + /** \brief Returns a vector of Architectures we support * * \param Cached saves the result so we need to calculated it only once diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 8e746ee30..9a9a854bf 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -269,6 +269,29 @@ bool pkgCdrom::DropBinaryArch(vector &List) --I; // the next entry is at the same index after the erase } + return true; +} + /*}}}*/ +// DropTranslation - Dump unwanted Translation- files /*{{{*/ +// --------------------------------------------------------------------- +/* Here we drop everything that is not configured in Acquire::Languages */ +bool pkgCdrom::DropTranslation(vector &List) +{ + for (unsigned int I = 0; I < List.size(); I++) + { + const char *Start; + if ((Start = strstr(List[I].c_str(), "/Translation-")) == NULL) + continue; + Start += strlen("/Translation-"); + + if (APT::Configuration::checkLanguage(Start, true) == true) + continue; + + // not accepted -> Erase it + List.erase(List.begin() + I); + --I; // the next entry is at the same index after the erase + } + return true; } /*}}}*/ @@ -714,6 +737,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/ DropRepeats(SigList,"InRelease"); _error->RevertToStack(); DropRepeats(TransList,""); + if (_config->FindB("APT::CDROM::DropTranslation", true) == true) + DropTranslation(TransList); if(log != NULL) { msg.str(""); ioprintf(msg, _("Found %zu package indexes, %zu source indexes, " diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index cedfccff7..4fc3d3928 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -60,6 +60,7 @@ class pkgCdrom /*{{{*/ unsigned int Depth = 0); bool DropBinaryArch(std::vector &List); bool DropRepeats(std::vector &List,const char *Name); + bool DropTranslation(std::vector &List); void ReduceSourcelist(std::string CD,std::vector &List); bool WriteDatabase(Configuration &Cnf); bool WriteSourceList(std::string Name,std::vector &List,bool Source); -- cgit v1.2.3 From 3663572002ef82c146c125afea8942fe842f25c4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Sep 2012 12:42:22 +0200 Subject: unpack versions only in case a different version from the package and avoid re-unpack otherwise (Closes: #670900) --- apt-pkg/packagemanager.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index d2d2753a8..9ca6098fd 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -856,7 +856,10 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c This way we avoid that M-A: enabled packages are installed before their older non-M-A enabled packages are replaced by newer versions */ bool const installed = Pkg->CurrentVer != 0; - if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false) + if (installed == true && + (instVer != Pkg.CurrentVer() || + ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) && + Install(Pkg,FileNames[Pkg->ID]) == false) return false; for (PkgIterator P = Pkg.Group().PackageList(); P.end() == false; P = Pkg.Group().NextPkg(P)) -- cgit v1.2.3 From 92f212774bebbff6aabd3081910f570a77180911 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 3 Sep 2012 13:03:02 +0200 Subject: report the package name with architecture in the "no file" error message --- apt-pkg/deb/dpkgpm.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 296426c80..ae9143e0d 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -187,7 +187,7 @@ pkgDPkgPM::~pkgDPkgPM() 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()); + return _error->Error("Internal Error, No file name for %s",Pkg.FullName().c_str()); // If the filename string begins with DPkg::Chroot-Directory, return the // substr that is within the chroot so dpkg can access it. -- cgit v1.2.3