summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-09-04 14:56:01 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2012-09-04 14:56:01 +0200
commit85909fca550d03b0e215d16cdd701190b43ff63c (patch)
treeb6767be7b1898830499b0a5fb8153460223b5649 /apt-pkg
parentac5b5e826ab405935dc257c0a0984ae39b02bc23 (diff)
parent89e95aee05c7f2fde7eb11261df9697a4896b49b (diff)
merged sftp://bzr.debian.org/bzr/apt/apt/debian-sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/aptconfiguration.cc11
-rw-r--r--apt-pkg/aptconfiguration.h8
-rw-r--r--apt-pkg/cdrom.cc34
-rw-r--r--apt-pkg/cdrom.h1
-rw-r--r--apt-pkg/deb/dpkgpm.cc2
-rw-r--r--apt-pkg/indexcopy.cc26
-rw-r--r--apt-pkg/packagemanager.cc9
7 files changed, 75 insertions, 16 deletions
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<std::string> 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<std::string> const langs = getLanguages(All, true);
+ return (std::find(langs.begin(), langs.end(), Lang) != langs.end());
+}
+ /*}}}*/
// getArchitectures - Return Vector of prefered Architectures /*{{{*/
std::vector<std::string> 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<std::string> 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 699f66fb3..9a9a854bf 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -272,6 +272,29 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
return true;
}
/*}}}*/
+// DropTranslation - Dump unwanted Translation-<lang> files /*{{{*/
+// ---------------------------------------------------------------------
+/* Here we drop everything that is not configured in Acquire::Languages */
+bool pkgCdrom::DropTranslation(vector<string> &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;
+}
+ /*}}}*/
// DropRepeats - Drop repeated files resulting from symlinks /*{{{*/
// ---------------------------------------------------------------------
/* Here we go and stat every file that we found and strip dup inodes. */
@@ -363,6 +386,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List)
string Word1 = string(*I,Space,SSpace-Space);
string Prefix = string(*I,0,Space);
+ string Component = string(*I,SSpace);
for (vector<string>::iterator J = List.begin(); J != I; ++J)
{
// Find a space..
@@ -377,9 +401,11 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &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();
}
}
@@ -711,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<std::string> &List);
bool DropRepeats(std::vector<std::string> &List,const char *Name);
+ bool DropTranslation(std::vector<std::string> &List);
void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
bool WriteDatabase(Configuration &Cnf);
bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 7e937a85b..4f0957b8e 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -186,7 +186,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.
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index 16f2fee96..c0a085316 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;
@@ -494,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;
@@ -516,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;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 97a3c8c88..ed817934b 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))
@@ -882,7 +885,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) {