summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc1
-rw-r--r--apt-pkg/aptconfiguration.cc81
-rw-r--r--apt-pkg/contrib/fileutl.cc18
-rw-r--r--apt-pkg/contrib/fileutl.h1
-rw-r--r--apt-pkg/deb/debindexfile.cc44
-rw-r--r--apt-pkg/deb/deblistparser.cc1
-rw-r--r--apt-pkg/depcache.cc7
-rw-r--r--apt-pkg/orderlist.cc34
-rw-r--r--apt-pkg/pkgcache.cc15
9 files changed, 132 insertions, 70 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 961f5c2fa..9abb7a947 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1062,6 +1062,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
else if (TryFixByInstall == true &&
Start.TargetPkg()->CurrentVer == 0 &&
Cache[Start.TargetPkg()].Delete() == false &&
+ (Flags[Start.TargetPkg()->ID] & ToRemove) != ToRemove &&
Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
{
/* Before removing or keeping the package with the broken dependency
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 44f1f318a..52f54073c 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -166,17 +166,6 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
string const envShort = envLong.substr(0,lenShort);
bool envLongIncluded = true;
- // first cornercase: LANG=C, so we use only "en" Translation
- if (envLong == "C") {
- codes.push_back("en");
- allCodes = 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
// for languages it is realistic to have a long code translation fileā€¦
// TODO: Improve translation acquire system to drop them dynamic
@@ -217,37 +206,41 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
// It is very likely we will need to environment codes later,
// so let us generate them now from LC_MESSAGES and LANGUAGE
std::vector<string> environment;
- // take care of LC_MESSAGES
- if (envLongIncluded == false)
- environment.push_back(envLong);
- environment.push_back(envShort);
- // take care of LANGUAGE
- const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE");
- string envLang = Locale == 0 ? language_env : *(Locale+1);
- if (envLang.empty() == false) {
- std::vector<string> env = VectorizeString(envLang,':');
- short addedLangs = 0; // add a maximum of 3 fallbacks from the environment
- for (std::vector<string>::const_iterator e = env.begin();
- e != env.end() && addedLangs < 3; ++e) {
- if (unlikely(e->empty() == true) || *e == "en")
- continue;
- if (*e == envLong || *e == envShort)
- continue;
- if (std::find(environment.begin(), environment.end(), *e) != environment.end())
- continue;
- if (e->find('_') != string::npos) {
- // Drop LongCodes here - ShortCodes are also included
- string const shorty = e->substr(0, e->find('_'));
- char const **n = needLong;
- for (; *n != NULL; ++n)
- if (shorty == *n)
- break;
- if (*n == NULL)
+ if (envShort != "C") {
+ // take care of LC_MESSAGES
+ if (envLongIncluded == false)
+ environment.push_back(envLong);
+ environment.push_back(envShort);
+ // take care of LANGUAGE
+ const char *language_env = getenv("LANGUAGE") == 0 ? "" : getenv("LANGUAGE");
+ string envLang = Locale == 0 ? language_env : *(Locale+1);
+ if (envLang.empty() == false) {
+ std::vector<string> env = VectorizeString(envLang,':');
+ short addedLangs = 0; // add a maximum of 3 fallbacks from the environment
+ for (std::vector<string>::const_iterator e = env.begin();
+ e != env.end() && addedLangs < 3; ++e) {
+ if (unlikely(e->empty() == true) || *e == "en")
+ continue;
+ if (*e == envLong || *e == envShort)
+ continue;
+ if (std::find(environment.begin(), environment.end(), *e) != environment.end())
continue;
+ if (e->find('_') != string::npos) {
+ // Drop LongCodes here - ShortCodes are also included
+ string const shorty = e->substr(0, e->find('_'));
+ char const **n = needLong;
+ for (; *n != NULL; ++n)
+ if (shorty == *n)
+ break;
+ if (*n == NULL)
+ continue;
+ }
+ ++addedLangs;
+ environment.push_back(*e);
}
- ++addedLangs;
- environment.push_back(*e);
}
+ } else {
+ environment.push_back("en");
}
// Support settings like Acquire::Translation=none on the command line to
@@ -269,6 +262,16 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
return codes;
}
+ // cornercase: LANG=C, so we use only "en" Translation
+ if (envShort == "C") {
+ allCodes = codes = environment;
+ allCodes.insert(allCodes.end(), builtin.begin(), builtin.end());
+ if (All == true)
+ return allCodes;
+ else
+ return codes;
+ }
+
std::vector<string> const lang = _config->FindVector("Acquire::Languages");
// the default setting -> "environment, en"
if (lang.empty() == true) {
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index cbf1d64a9..f4ab066d7 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -910,18 +910,24 @@ unsigned long FileFd::Tell()
return Res;
}
/*}}}*/
-// FileFd::Size - Return the size of the file /*{{{*/
+// FileFd::FileSize - Return the size of the file /*{{{*/
// ---------------------------------------------------------------------
/* */
-unsigned long FileFd::Size()
+unsigned long FileFd::FileSize()
{
struct stat Buf;
- unsigned long size;
- off_t orig_pos;
if (fstat(iFd,&Buf) != 0)
return _error->Errno("fstat","Unable to determine the file size");
- size = Buf.st_size;
+ return Buf.st_size;
+}
+ /*}}}*/
+// FileFd::Size - Return the size of the content in the file /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned long FileFd::Size()
+{
+ unsigned long size = FileSize();
// only check gzsize if we are actually a gzip file, just checking for
// "gz" is not sufficient as uncompressed files will be opened with
@@ -931,7 +937,7 @@ unsigned long FileFd::Size()
/* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
* this ourselves; the original (uncompressed) file size is the last 32
* bits of the file */
- orig_pos = lseek(iFd, 0, SEEK_CUR);
+ off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
if (lseek(iFd, -4, SEEK_END) < 0)
return _error->Errno("lseek","Unable to seek to end of gzipped file");
if (read(iFd, &size, 4) != 4)
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 419506273..1380f06b4 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -63,6 +63,7 @@ class FileFd
bool Truncate(unsigned long To);
unsigned long Tell();
unsigned long Size();
+ unsigned long FileSize();
bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
bool Close();
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index a89a2574f..af1209ccb 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -149,11 +149,20 @@ bool debSourcesIndex::Exists() const
/* */
unsigned long debSourcesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
@@ -269,11 +278,20 @@ bool debPackagesIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debPackagesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
// PackagesIndex::Merge - Load the index file into a cache /*{{{*/
@@ -460,12 +478,20 @@ bool debTranslationsIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debTranslationsIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
- return f.Size();
+ return size;
}
/*}}}*/
// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index da8b0271b..1b3bfd6ae 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -481,6 +481,7 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
*/
static string CompleteArch(std::string& arch) {
if (arch == "armel") return "linux-arm";
+ if (arch == "armhf") return "linux-arm";
if (arch == "lpia") return "linux-i386";
if (arch == "powerpcspe") return "linux-powerpc";
if (arch == "uclibc-linux-armel") return "linux-arm";
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 0b5d6d8e6..23abc76c1 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1444,8 +1444,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
VerIterator Ver(*this,*I);
PkgIterator Pkg = Ver.ParentPkg();
-
-
+ /* The List includes all packages providing this dependency,
+ even providers which are not installed, so skip them. */
+ if (PkgState[Pkg->ID].InstallVer == 0)
+ continue;
+
if (PkgState[Pkg->ID].CandidateVer != *I &&
Start->Type == Dep::DpkgBreaks)
MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index 602b63d3b..a53854a26 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -967,13 +967,33 @@ bool pkgOrderList::DepRemove(DepIterator D)
// start again in the or group and find something which will serve as replacement
for (; F.end() == false && F != S; ++F)
{
- if (F.TargetPkg() == D.TargetPkg() ||
- IsFlag(F.TargetPkg(), InList) == false ||
- VisitNode(F.TargetPkg()) == false)
- continue;
- Flag(F.TargetPkg(), Immediate);
- tryFixDeps = false;
- break;
+ if (IsFlag(F.TargetPkg(), InList) == true &&
+ IsFlag(F.TargetPkg(), AddPending) == false &&
+ Cache[F.TargetPkg()].InstallVer != 0 &&
+ VisitNode(F.TargetPkg()) == true)
+ {
+ Flag(F.TargetPkg(), Immediate);
+ tryFixDeps = false;
+ break;
+ }
+ else if (F.TargetPkg()->ProvidesList != 0)
+ {
+ pkgCache::PrvIterator Prv = F.TargetPkg().ProvidesList();
+ for (; Prv.end() == false; ++Prv)
+ {
+ if (IsFlag(Prv.OwnerPkg(), InList) == true &&
+ IsFlag(Prv.OwnerPkg(), AddPending) == false &&
+ Cache[Prv.OwnerPkg()].InstallVer != 0 &&
+ VisitNode(Prv.OwnerPkg()) == true)
+ {
+ Flag(Prv.OwnerPkg(), Immediate);
+ tryFixDeps = false;
+ break;
+ }
+ }
+ if (Prv.end() == false)
+ break;
+ }
}
if (tryFixDeps == false)
break;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 324445fa7..616d400a2 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -891,18 +891,19 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
for (std::vector<string>::const_iterator l = lang.begin();
l != lang.end(); l++)
{
- pkgCache::DescIterator DescDefault = DescriptionList();
- pkgCache::DescIterator Desc = DescDefault;
-
- for (; Desc.end() == false; Desc++)
+ pkgCache::DescIterator Desc = DescriptionList();
+ for (; Desc.end() == false; ++Desc)
if (*l == Desc.LanguageCode() ||
(*l == "en" && strcmp(Desc.LanguageCode(),"") == 0))
break;
- if (Desc.end() == true)
- Desc = DescDefault;
+ if (Desc.end() == true)
+ continue;
return Desc;
}
-
+ for (pkgCache::DescIterator Desc = DescriptionList();
+ Desc.end() == false; ++Desc)
+ if (strcmp(Desc.LanguageCode(), "") == 0)
+ return Desc;
return DescriptionList();
};