From fbd64f76a595b61d2aaa9c0615903d9b68786930 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:23:28 +0100 Subject: * apt-pkg/algorithms.cc: - mark pseudo packages of installed all packages as configured in the simulation as we don't call configure for these packages --- apt-pkg/algorithms.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 0fbce3c2a..0d26f8f66 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -162,7 +162,28 @@ bool pkgSimulate::Configure(PkgIterator iPkg) } } -// Sim.MarkInstall(Pkg,false); + if (Sim[Pkg].InstBroken() == true) + { + /* We don't call Configure for Pseudo packages and if the 'all' is already installed + the simulation will think the pseudo package is not installed, so if something is + broken we walk over the dependencies and search for not installed pseudo packages */ + for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++) + { + if (Sim.IsImportantDep(D) == false || + (Sim[D] & pkgDepCache::DepInstall) != 0) + continue; + pkgCache::PkgIterator T = D.TargetPkg(); + if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0) + continue; + pkgCache::PkgIterator A = T.Group().FindPkg("all"); + if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 || + Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false) + continue; + Sim.MarkInstall(T, false); + Flags[T->ID] = 2; + } + } + if (Sim[Pkg].InstBroken() == true) { cout << "Conf " << Pkg.FullName(false) << " broken" << endl; -- cgit v1.2.3 From 6a910c9db4d450241a57f61b2d3d3e302bb9c11c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:32:55 +0100 Subject: allow conflicts in the same group again (Closes: #612099) --- apt-pkg/depcache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 5f59b6d49..7c09d3a38 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -339,7 +339,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res) /* Check simple depends. A depends -should- never self match but we allow it anyhow because dpkg does. Technically it is a packaging bug. Conflicts may never self match */ - if (Dep.TargetPkg()->Group != Dep.ParentPkg()->Group || + if (Dep.TargetPkg() != Dep.ParentPkg() || (Dep->Type != Dep::Conflicts && Dep->Type != Dep::DpkgBreaks && Dep->Type != Dep::Obsoletes)) { PkgIterator Pkg = Dep.TargetPkg(); -- cgit v1.2.3 From a1ac2ca85ae4d7c8b3ab3c4e2f3ba6c26202c363 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 11:45:06 +0100 Subject: * apt-pkg/pkgcachegen.cc: - in multiarch, let :all packages conflict with :any packages with a different version to be sure --- apt-pkg/pkgcachegen.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index ed35174bb..5b943cca1 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -638,21 +638,19 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) Dynamic DynP(P); for (; P.end() != true; P = G.NextPkg(P)) { - if (strcmp(P.Arch(),"all") == 0) - continue; pkgCache::PkgIterator allPkg; Dynamic DynallPkg(allPkg); pkgCache::VerIterator V = P.VersionList(); Dynamic DynV(V); for (; V.end() != true; V++) { - string const Arch = V.Arch(true); + char const * const Arch = P.Arch(); 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 || + bool const coInstall = ((V->MultiArch == pkgCache::Version::All && strcmp(Arch, "all") != 0) || V->MultiArch == pkgCache::Version::Same); if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true) allPkg = G.FindPkg("all"); @@ -686,9 +684,15 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) } } else { // Conflicts: ${self}:other - NewDepends(D, V, "", - pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, - OldDepLast); + if (strcmp(Arch, "all") == 0) { + NewDepends(D, V, V.VerStr(), + pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts, + OldDepLast); + } else { + NewDepends(D, V, "", + pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, + OldDepLast); + } } } } -- cgit v1.2.3 From 8f3853baea6191788da6befb437e92ba246c86a3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 21:42:36 +0100 Subject: * apt-pkg/contrib/error.cc: - remove 400 char size limit of error messages (LP: #365611) --- apt-pkg/contrib/error.cc | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index e2e8d6e57..7dad11689 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -103,10 +104,21 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function, // GlobalError::InsertErrno - formats an error message with the errno /*{{{*/ bool GlobalError::InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args) { - char S[400]; - snprintf(S, sizeof(S), "%s - %s (%i: %s)", Description, - Function, errno, strerror(errno)); - return Insert(type, S, args); + int const errsv = errno; + char* S = (char*) malloc(400); + size_t const Ssize = snprintf(S, 400, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + snprintf(S, Ssize, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)); + } + + bool const geins = Insert(type, S, args); + free(S); + return geins; } /*}}}*/ // GlobalError::Fatal - Add a fatal error to the list /*{{{*/ @@ -157,8 +169,14 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...) // GlobalError::Insert - Insert a new item at the end /*{{{*/ bool GlobalError::Insert(MsgType type, const char* Description, va_list &args) { - char S[400]; - vsnprintf(S,sizeof(S),Description,args); + char* S = (char*) malloc(400); + size_t const Ssize = vsnprintf(S, 400, Description, args) + 1; + + if (Ssize > 400) { + free(S); + S = (char*) malloc(Ssize); + vsnprintf(S, Ssize, Description, args); + } Item const m(S, type); Messages.push_back(m); @@ -169,6 +187,7 @@ bool GlobalError::Insert(MsgType type, const char* Description, if (type == FATAL || type == DEBUG) std::clog << m << std::endl; + free(S); return false; } /*}}}*/ -- cgit v1.2.3 From fdbe726599ae4dd3d808858356cf3464de94f1e4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 11 Feb 2011 17:47:50 +0100 Subject: * apt-pkg/depcache.cc: - mark a package which was requested to be installed on commandline always as manual regardless if it is already marked or not as the marker could be lost later by the removal of rdepends (Closes: #612557) --- apt-pkg/depcache.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7c09d3a38..0c5b77732 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1257,9 +1257,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if(FromUser) { - // Set it to manual if it's a new install or cancelling the - // removal of a garbage package. - if(P.Status == 2 || (!Pkg.CurrentVer().end() && !P.Marked)) + // Set it to manual if it's a new install or already installed + if(P.Status == 2 || Pkg->CurrentVer != 0) P.Flags &= ~Flag::Auto; } else -- cgit v1.2.3 From 26b37f959350860a0c1d5ef9651efa0bf3640cb5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 12 Feb 2011 19:40:47 +0100 Subject: * apt-pkg/contrib/mmap.cc: - do not try to free the mapping if its is unset --- apt-pkg/contrib/mmap.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 69fb61fca..4978446d2 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -266,6 +266,8 @@ DynamicMMap::~DynamicMMap() { if (Fd == 0) { + if (Base == 0) + return; #ifdef _POSIX_MAPPED_FILES munmap(Base, WorkSpace); #else -- cgit v1.2.3 From 005428387832e79e314bb8f2605f7e6c69708d14 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 11:37:22 +0100 Subject: update size of dynamic MMap as we write in from the outside --- apt-pkg/contrib/mmap.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index 5ca951204..e9baa9339 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -61,6 +61,7 @@ class MMap inline operator void *() {return Base;}; inline void *Data() {return Base;}; inline unsigned long Size() {return iSize;}; + inline void AddSize(unsigned long const size) {iSize += size;}; // File manipulators bool Sync(); -- cgit v1.2.3 From f330c0f347619f72766069acdc24616ec5fe7147 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 13:06:03 +0100 Subject: =?UTF-8?q?*=20apt-pkg/contrib/fileutl.cc:=20=20=20-=20reorder=20t?= =?UTF-8?q?he=20loaded=20filesize=20bytes=20for=20big=20endian=20(Closes:?= =?UTF-8?q?=20#612986)=20=20=20=20=20Thanks=20to=20J=C3=B6rg=20Sommer=20fo?= =?UTF-8?q?r=20the=20detailed=20analyse!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/contrib/fileutl.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52f517ee0..6a621e2a9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -962,9 +962,14 @@ unsigned long FileFd::Size() 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"); + size = 0L; if (read(iFd, &size, 4) != 4) return _error->Errno("read","Unable to read original size of gzipped file"); - size &= 0xFFFFFFFF; + +#ifdef WORDS_BIGENDIAN + unsigned char const * const p = (unsigned char *) &size; + size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; +#endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) return _error->Errno("lseek","Unable to seek in gzipped file"); -- cgit v1.2.3 From 2cae0ccb49efbeebe33f364b61e639ebf2639bdd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 14 Feb 2011 11:20:48 +0100 Subject: use inttypes to avoid suprises with different type sizes --- apt-pkg/contrib/fileutl.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 6a621e2a9..24e3f08d9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -42,6 +42,10 @@ #include #include #include + +#ifndef WORDS_BIGENDIAN +#include +#endif /*}}}*/ using namespace std; @@ -967,8 +971,10 @@ unsigned long FileFd::Size() return _error->Errno("read","Unable to read original size of gzipped file"); #ifdef WORDS_BIGENDIAN - unsigned char const * const p = (unsigned char *) &size; - size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + uint32_t tmp_size = size; + uint8_t const * const p = (uint8_t const * const) &tmp_size; + tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + size = tmp_size; #endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) -- cgit v1.2.3 From 2a79d5b560398427f5538865099b6777128d8bed Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 14 Feb 2011 17:03:35 +0100 Subject: * apt-pkg/contrib/fileutl.cc: - really detect bigendian machines by including config.h, so we can really (Closes: #612986) * apt-pkg/contrib/mmap.cc: - Base has as 'valid' failure states 0 and -1 so add a simple validData method to check for failure states --- apt-pkg/contrib/fileutl.cc | 3 ++- apt-pkg/contrib/mmap.cc | 4 ++-- apt-pkg/contrib/mmap.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 24e3f08d9..767951daf 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -43,7 +43,8 @@ #include #include -#ifndef WORDS_BIGENDIAN +#include +#ifdef WORDS_BIGENDIAN #include #endif /*}}}*/ diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 4978446d2..9945b1606 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -106,7 +106,7 @@ bool MMap::Map(FileFd &Fd) /* */ bool MMap::Close(bool DoSync) { - if ((Flags & UnMapped) == UnMapped || Base == 0 || iSize == 0) + if ((Flags & UnMapped) == UnMapped || validData() == false || iSize == 0) return true; if (DoSync == true) @@ -266,7 +266,7 @@ DynamicMMap::~DynamicMMap() { if (Fd == 0) { - if (Base == 0) + if (validData() == false) return; #ifdef _POSIX_MAPPED_FILES munmap(Base, WorkSpace); diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index e9baa9339..2bf2c1540 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -62,6 +62,7 @@ class MMap inline void *Data() {return Base;}; inline unsigned long Size() {return iSize;}; inline void AddSize(unsigned long const size) {iSize += size;}; + inline bool validData() const { return Base != (void *)-1 && Base != 0; }; // File manipulators bool Sync(); -- cgit v1.2.3 From 38f297033faa099a0705c8f66964d8c5d7927c8d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 15 Feb 2011 14:04:06 +0100 Subject: * apt-pkg/contrib/error.cc: - ensure that va_list is not invalid in second try --- apt-pkg/contrib/error.cc | 169 +++++++++++++++++++++-------------------------- apt-pkg/contrib/error.h | 5 +- 2 files changed, 80 insertions(+), 94 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 7dad11689..fe50e606b 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -58,124 +58,109 @@ // GlobalError::GlobalError - Constructor /*{{{*/ GlobalError::GlobalError() : PendingFlag(false) {} /*}}}*/ -// GlobalError::FatalE - Get part of the error string from errno /*{{{*/ -bool GlobalError::FatalE(const char *Function,const char *Description,...) { - va_list args; - va_start(args,Description); - return InsertErrno(FATAL, Function, Description, args); -} - /*}}}*/ -// GlobalError::Errno - Get part of the error string from errno /*{{{*/ -bool GlobalError::Errno(const char *Function,const char *Description,...) { - va_list args; - va_start(args,Description); - return InsertErrno(ERROR, Function, Description, args); -} - /*}}}*/ -// GlobalError::WarningE - Get part of the warning string from errno /*{{{*/ -bool GlobalError::WarningE(const char *Function,const char *Description,...) { - va_list args; - va_start(args,Description); - return InsertErrno(WARNING, Function, Description, args); -} - /*}}}*/ -// GlobalError::NoticeE - Get part of the notice string from errno /*{{{*/ -bool GlobalError::NoticeE(const char *Function,const char *Description,...) { - va_list args; - va_start(args,Description); - return InsertErrno(NOTICE, Function, Description, args); -} - /*}}}*/ -// GlobalError::DebugE - Get part of the debug string from errno /*{{{*/ -bool GlobalError::DebugE(const char *Function,const char *Description,...) { - va_list args; - va_start(args,Description); - return InsertErrno(DEBUG, Function, Description, args); +// GlobalError::FatalE, Errno, WarningE, NoticeE and DebugE - Add to the list/*{{{*/ +#define GEMessage(NAME, TYPE) \ +bool GlobalError::NAME (const char *Function, const char *Description,...) { \ + va_list args; \ + size_t msgSize = 400; \ + int const errsv = errno; \ + while (true) { \ + va_start(args,Description); \ + if (InsertErrno(TYPE, Function, Description, args, errsv, msgSize) == false) \ + break; \ + va_end(args); \ + } \ + return false; \ } +GEMessage(FatalE, FATAL) +GEMessage(Errno, ERROR) +GEMessage(WarningE, WARNING) +GEMessage(NoticeE, NOTICE) +GEMessage(DebugE, DEBUG) +#undef GEMessage /*}}}*/ // GlobalError::InsertErrno - Get part of the errortype string from errno/*{{{*/ bool GlobalError::InsertErrno(MsgType const &type, const char *Function, const char *Description,...) { va_list args; - va_start(args,Description); - return InsertErrno(type, Function, Description, args); + size_t msgSize = 400; + int const errsv = errno; + while (true) { + va_start(args,Description); + if (InsertErrno(type, Function, Description, args, errsv, msgSize) == false) + break; + va_end(args); + } + return false; } /*}}}*/ // GlobalError::InsertErrno - formats an error message with the errno /*{{{*/ bool GlobalError::InsertErrno(MsgType type, const char* Function, - const char* Description, va_list &args) { - int const errsv = errno; - char* S = (char*) malloc(400); - size_t const Ssize = snprintf(S, 400, "%s - %s (%i: %s)", Description, - Function, errsv, strerror(errsv)) + 1; - - if (Ssize > 400) { - free(S); - S = (char*) malloc(Ssize); - snprintf(S, Ssize, "%s - %s (%i: %s)", Description, - Function, errsv, strerror(errsv)); + const char* Description, va_list &args, + int const errsv, size_t &msgSize) { + char* S = (char*) malloc(msgSize); + int const n = snprintf(S, msgSize, "%s - %s (%i: %s)", Description, + Function, errsv, strerror(errsv)); + if (n > -1 && ((unsigned int) n) < msgSize); + else { + if (n > -1) + msgSize = n + 1; + else + msgSize *= 2; + return true; } - bool const geins = Insert(type, S, args); + bool const geins = Insert(type, S, args, msgSize); free(S); return geins; } /*}}}*/ -// GlobalError::Fatal - Add a fatal error to the list /*{{{*/ -bool GlobalError::Fatal(const char *Description,...) { - va_list args; - va_start(args,Description); - return Insert(FATAL, Description, args); -} - /*}}}*/ -// GlobalError::Error - Add an error to the list /*{{{*/ -bool GlobalError::Error(const char *Description,...) { - va_list args; - va_start(args,Description); - return Insert(ERROR, Description, args); -} - /*}}}*/ -// GlobalError::Warning - Add a warning to the list /*{{{*/ -bool GlobalError::Warning(const char *Description,...) { - va_list args; - va_start(args,Description); - return Insert(WARNING, Description, args); -} - /*}}}*/ -// GlobalError::Notice - Add a notice to the list /*{{{*/ -bool GlobalError::Notice(const char *Description,...) -{ - va_list args; - va_start(args,Description); - return Insert(NOTICE, Description, args); -} - /*}}}*/ -// GlobalError::Debug - Add a debug to the list /*{{{*/ -bool GlobalError::Debug(const char *Description,...) -{ - va_list args; - va_start(args,Description); - return Insert(DEBUG, Description, args); +// GlobalError::Fatal, Error, Warning, Notice and Debug - Add to the list/*{{{*/ +#define GEMessage(NAME, TYPE) \ +bool GlobalError::NAME (const char *Description,...) { \ + va_list args; \ + size_t msgSize = 400; \ + while (true) { \ + va_start(args,Description); \ + if (Insert(TYPE, Description, args, msgSize) == false) \ + break; \ + va_end(args); \ + } \ + return false; \ } +GEMessage(Fatal, FATAL) +GEMessage(Error, ERROR) +GEMessage(Warning, WARNING) +GEMessage(Notice, NOTICE) +GEMessage(Debug, DEBUG) +#undef GEMessage /*}}}*/ // GlobalError::Insert - Add a errotype message to the list /*{{{*/ bool GlobalError::Insert(MsgType const &type, const char *Description,...) { va_list args; - va_start(args,Description); - return Insert(type, Description, args); + size_t msgSize = 400; + while (true) { + va_start(args,Description); + if (Insert(type, Description, args, msgSize) == false) + break; + va_end(args); + } + return false; } /*}}}*/ // GlobalError::Insert - Insert a new item at the end /*{{{*/ bool GlobalError::Insert(MsgType type, const char* Description, - va_list &args) { - char* S = (char*) malloc(400); - size_t const Ssize = vsnprintf(S, 400, Description, args) + 1; - - if (Ssize > 400) { - free(S); - S = (char*) malloc(Ssize); - vsnprintf(S, Ssize, Description, args); + va_list &args, size_t &msgSize) { + char* S = (char*) malloc(msgSize); + int const n = vsnprintf(S, msgSize, Description, args); + if (n > -1 && ((unsigned int) n) < msgSize); + else { + if (n > -1) + msgSize = n + 1; + else + msgSize *= 2; + return true; } Item const m(S, type); diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index ae756dbc4..21c51c1be 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -307,9 +307,10 @@ private: /*{{{*/ std::list Stacks; bool InsertErrno(MsgType type, const char* Function, - const char* Description, va_list &args); + const char* Description, va_list &args, + int const errsv, size_t &msgSize); bool Insert(MsgType type, const char* Description, - va_list &args); + va_list &args, size_t &msgSize); /*}}}*/ }; /*}}}*/ -- cgit v1.2.3 From e26a777c3219388605445ab9a1ffffc154799248 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 17 Feb 2011 15:23:50 +0100 Subject: * apt-pkg/depcache.cc: - party revert fix in 0.8.11.2 which marked all packages as manual installed if the FromUser bit is set in the MarkInstall call. The default for this bit is true and aptitude depends on the old behavior so the package is only marked as manual if its not marked ("old" behavior) or if automatic installation is enabled - which aptitude disables always (see also #613775) --- apt-pkg/depcache.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 0c5b77732..ddbd37699 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1257,8 +1257,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if(FromUser) { - // Set it to manual if it's a new install or already installed - if(P.Status == 2 || Pkg->CurrentVer != 0) + // Set it to manual if it's a new install or already installed, + // but only if its not marked by the autoremover (aptitude depend on this behavior) + // or if we do automatic installation (aptitude never does it) + if(P.Status == 2 || (Pkg->CurrentVer != 0 && (AutoInst == true || P.Marked == false))) P.Flags &= ~Flag::Auto; } else -- cgit v1.2.3 From 0ff1a4556c0a0fb76ce48e88031eff2b4d613c5e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 22 Feb 2011 11:26:47 +0100 Subject: =?UTF-8?q?*=20apt-pkg/contrib/fileutl.cc:=20=20=20-=20reorder=20t?= =?UTF-8?q?he=20loaded=20filesize=20bytes=20for=20big=20endian=20(Closes:?= =?UTF-8?q?=20#612986)=20=20=20=20=20Thanks=20to=20J=C3=B6rg=20Sommer=20fo?= =?UTF-8?q?r=20the=20detailed=20analyse!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/contrib/fileutl.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index f4ab066d7..266d480a4 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -42,6 +42,11 @@ #include #include #include + +#include +#ifdef WORDS_BIGENDIAN +#include +#endif /*}}}*/ using namespace std; @@ -940,9 +945,16 @@ unsigned long FileFd::Size() 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"); + size = 0L; if (read(iFd, &size, 4) != 4) return _error->Errno("read","Unable to read original size of gzipped file"); - size &= 0xFFFFFFFF; + +#ifdef WORDS_BIGENDIAN + uint32_t tmp_size = size; + uint8_t const * const p = (uint8_t const * const) &tmp_size; + tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + size = tmp_size; +#endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) return _error->Errno("lseek","Unable to seek in gzipped file"); -- cgit v1.2.3 From b2430e6d1713e26d461f08873ac872918eb28283 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 22 Feb 2011 18:11:10 +0100 Subject: * apt-pkg/aptconfiguration.cc: - support download of xz-compressed indexes files --- apt-pkg/aptconfiguration.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 3cf4d2429..9ded431e8 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -38,11 +38,13 @@ const Configuration::getCompressionTypes(bool const &Cached) { // setup the defaults for the compressiontypes => method mapping _config->CndSet("Acquire::CompressionTypes::bz2","bzip2"); + _config->CndSet("Acquire::CompressionTypes::xz","xz"); _config->CndSet("Acquire::CompressionTypes::lzma","lzma"); _config->CndSet("Acquire::CompressionTypes::gz","gzip"); // Set default application paths to check for optional compression types _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); + _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); // accept non-list order as override setting for config settings on commandline -- cgit v1.2.3 From 255bfa26bb3f4ffcf372e4b2b9c95113083c7cd6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 22 Feb 2011 18:13:20 +0100 Subject: * apt-pkg/deb/debsrcrecords.cc: - support xz-compressed source v3 debian.tar files --- apt-pkg/deb/debsrcrecords.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 21336e1af..3809ee74f 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -144,7 +144,8 @@ bool debSrcRecordParser::Files(vector &List) } F.Type = string(F.Path,Tmp+1,Pos-Tmp); - if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma" || F.Type == "tar") + if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma" || + F.Type == "xz" || F.Type == "tar") { Pos = Tmp-1; continue; -- cgit v1.2.3 From 31273d9ff4fa1a6e073168e9cbaa91d1f53be853 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Feb 2011 14:30:50 +0100 Subject: d'uh! implement and not only declare the string wrapper for FindVector --- apt-pkg/contrib/configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 175c1bef3..71e5a0e47 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -72,8 +72,8 @@ class Configuration string Find(string const &Name, string const &Default) const {return Find(Name.c_str(),Default.c_str());}; string FindFile(const char *Name,const char *Default = 0) const; string FindDir(const char *Name,const char *Default = 0) const; - std::vector FindVector(string const &Name) const; std::vector FindVector(const char *Name) const; + std::vector FindVector(string const &Name) const { return FindVector(Name.c_str()); }; int FindI(const char *Name,int const &Default = 0) const; int FindI(string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);}; bool FindB(const char *Name,bool const &Default = false) const; -- cgit v1.2.3 From 03bef78461c6f443187b60799402624326843396 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Feb 2011 23:01:40 +0100 Subject: - load the supported compressors from configuration - support adding new compressors by configuration --- apt-pkg/aptconfiguration.cc | 74 ++++++++++++++++++++++++++++++++++++++++++--- apt-pkg/aptconfiguration.h | 26 ++++++++++++++++ 2 files changed, 96 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 9ded431e8..2a441fce7 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -42,10 +42,7 @@ const Configuration::getCompressionTypes(bool const &Cached) { _config->CndSet("Acquire::CompressionTypes::lzma","lzma"); _config->CndSet("Acquire::CompressionTypes::gz","gzip"); - // Set default application paths to check for optional compression types - _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); - _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); - _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); + setDefaultConfigurationForCompressors(); // accept non-list order as override setting for config settings on commandline std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order",""); @@ -346,4 +343,73 @@ bool const Configuration::checkArchitecture(std::string const &Arch) { return (std::find(archs.begin(), archs.end(), Arch) != archs.end()); } /*}}}*/ +// setDefaultConfigurationForCompressors /*{{{*/ +void Configuration::setDefaultConfigurationForCompressors() { + // Set default application paths to check for optional compression types + _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); + _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); + _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); +} + /*}}}*/ +// getCompressors - Return Vector of usbale compressors /*{{{*/ +// --------------------------------------------------------------------- +/* return a vector of compressors used by apt-ftparchive in the + multicompress functionality or to detect data.tar files */ +std::vector +const Configuration::getCompressors(bool const Cached) { + static std::vector compressors; + if (compressors.empty() == false) { + if (Cached == true) + return compressors; + else + compressors.clear(); + } + + setDefaultConfigurationForCompressors(); + + compressors.push_back(Compressor(".", "", "", "", "", 1)); + if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->FindFile("Dir::Bin::gzip")) == true) + compressors.push_back(Compressor("gzip",".gz","gzip","-9n","-d",2)); + if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true) + compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",3)); + if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true) + compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",4)); + if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true) + compressors.push_back(Compressor("xz",".xz","xz","-6","-d",5)); + + std::vector const comp = _config->FindVector("APT::Compressor"); + for (std::vector::const_iterator c = comp.begin(); + c != comp.end(); ++c) { + if (*c == "." || *c == "gzip" || *c == "bzip2" || *c == "lzma" || *c == "xz") + continue; + compressors.push_back(Compressor(c->c_str(), std::string(".").append(*c).c_str(), c->c_str(), "-9", "-d", 100)); + } + + return compressors; +} + /*}}}*/ +// Compressor constructor /*{{{*/ +// --------------------------------------------------------------------- +/* */ +Configuration::Compressor::Compressor(char const *name, char const *extension, + char const *binary, + char const *compressArg, char const *uncompressArg, + unsigned short const cost) { + std::string const config = string("APT:Compressor::").append(name).append("::"); + Name = _config->Find(std::string(config).append("Name"), name); + Extension = _config->Find(std::string(config).append("Extension"), extension); + Binary = _config->Find(std::string(config).append("Binary"), binary); + Cost = _config->FindI(std::string(config).append("Cost"), cost); + std::string const compConf = std::string(config).append("CompressArg"); + if (_config->Exists(compConf) == true) + CompressArgs = _config->FindVector(compConf); + else if (compressArg != NULL) + CompressArgs.push_back(compressArg); + std::string const uncompConf = std::string(config).append("UncompressArg"); + if (_config->Exists(uncompConf) == true) + UncompressArgs = _config->FindVector(uncompConf); + else if (uncompressArg != NULL) + UncompressArgs.push_back(uncompressArg); +} + /*}}}*/ } diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index dd339d841..e4bc5e683 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -82,6 +82,32 @@ public: /*{{{*/ */ bool static const checkArchitecture(std::string const &Arch); + /** \brief Representation of supported compressors */ + struct Compressor { + std::string Name; + std::string Extension; + std::string Binary; + std::vector CompressArgs; + std::vector UncompressArgs; + unsigned short Cost; + + Compressor(char const *name, char const *extension, char const *binary, + char const *compressArg, char const *uncompressArg, + unsigned short const cost); + Compressor() {}; + }; + + /** \brief Return a vector of Compressors supported for data.tar's + * + * \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 Compressors + */ + std::vector static const getCompressors(bool const Cached = true); + /*}}}*/ + private: /*{{{*/ + void static setDefaultConfigurationForCompressors(); /*}}}*/ }; /*}}}*/ -- cgit v1.2.3 From b0e1a43f95a3a6817dff6aed303a9823827ea0cf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Feb 2011 23:31:25 +0100 Subject: support every compression we have a compressor configured --- apt-pkg/aptconfiguration.cc | 13 +++++++++++++ apt-pkg/aptconfiguration.h | 3 +++ apt-pkg/deb/debsrcrecords.cc | 9 ++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 2a441fce7..b23e12acb 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -388,6 +388,19 @@ const Configuration::getCompressors(bool const Cached) { return compressors; } /*}}}*/ +// getCompressorExtensions - supported data.tar extensions /*{{{*/ +// --------------------------------------------------------------------- +/* */ +std::vector const Configuration::getCompressorExtensions() { + std::vector const compressors = getCompressors(); + std::vector ext; + for (std::vector::const_iterator c = compressors.begin(); + c != compressors.end(); ++c) + if (c->Extension.empty() == false && c->Extension != ".") + ext.push_back(c->Extension); + return ext; +} + /*}}}*/ // Compressor constructor /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index e4bc5e683..815db6cae 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -105,6 +105,9 @@ public: /*{{{*/ * \return a vector of Compressors */ std::vector static const getCompressors(bool const Cached = true); + + /** \brief Return a vector of extensions supported for data.tar's */ + std::vector static const getCompressorExtensions(); /*}}}*/ private: /*{{{*/ void static setDefaultConfigurationForCompressors(); diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 3809ee74f..749305005 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -14,6 +14,7 @@ #include #include #include +#include using std::max; /*}}}*/ @@ -111,7 +112,9 @@ bool debSrcRecordParser::Files(vector &List) string Base = Sect.FindS("Directory"); if (Base.empty() == false && Base[Base.length()-1] != '/') Base += '/'; - + + std::vector const compExts = APT::Configuration::getCompressorExtensions(); + // Iterate over the entire list grabbing each triplet const char *C = Files.c_str(); while (*C != 0) @@ -144,8 +147,8 @@ bool debSrcRecordParser::Files(vector &List) } F.Type = string(F.Path,Tmp+1,Pos-Tmp); - if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma" || - F.Type == "xz" || F.Type == "tar") + if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() || + F.Type == "tar") { Pos = Tmp-1; continue; -- cgit v1.2.3 From 8e11253db6070bede2ecba01dbd3fde6019c8260 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Mon, 7 Mar 2011 22:57:52 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - make sure that for multiarch packages, we are passing the full qualified package name to dpkg for removals. (Closes: #614298) --- apt-pkg/deb/dpkgpm.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 7d0d34a46..84443447f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -881,7 +881,10 @@ bool pkgDPkgPM::Go(int OutStatusFd) // Generate the argument list const char *Args[MaxArgs + 50]; - + // keep track of allocated strings for multiarch package names + char *Packages[MaxArgs + 50]; + unsigned int pkgcount = 0; + // Now check if we are within the MaxArgs limit // // this code below is problematic, because it may happen that @@ -989,13 +992,22 @@ bool pkgDPkgPM::Go(int OutStatusFd) } else { + string const nativeArch = _config->Find("APT::Architecture"); for (;I != J && Size < MaxArgBytes; I++) { if((*I).Pkg.end() == true) continue; if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end()) continue; - Args[n++] = I->Pkg.Name(); + if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all")) + Args[n++] = I->Pkg.Name(); + else + { + string const PkgDesc = I->Pkg.Name() + string(":") + string(I->Pkg.Arch()); + Packages[pkgcount] = new char[PkgDesc.size()+1]; + strncpy(Packages[pkgcount++],PkgDesc.c_str(),PkgDesc.size()+1); + Args[n++] = Packages[pkgcount-1]; + } Size += strlen(Args[n-1]); } } @@ -1145,6 +1157,11 @@ bool pkgDPkgPM::Go(int OutStatusFd) sigemptyset(&sigmask); sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); + /* clean up the temporary allocation for multiarch package names in + the parent, so we don't leak memory when we return. */ + for (unsigned int i = 0; i < pkgcount; i++) + delete [] Packages[i]; + // the result of the waitpid call int res; int select_ret; -- cgit v1.2.3 From 69f76a34330bfcbc746f1aa25509907490514a1d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Mar 2011 23:06:36 +0100 Subject: use FullName and strdup instead of handmade and new[] --- apt-pkg/deb/dpkgpm.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 84443447f..7b0955b96 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1003,10 +1003,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) Args[n++] = I->Pkg.Name(); else { - string const PkgDesc = I->Pkg.Name() + string(":") + string(I->Pkg.Arch()); - Packages[pkgcount] = new char[PkgDesc.size()+1]; - strncpy(Packages[pkgcount++],PkgDesc.c_str(),PkgDesc.size()+1); - Args[n++] = Packages[pkgcount-1]; + Packages[pkgcount] = strdup(I->Pkg.FullName(false).c_str()); + Args[n++] = Packages[pkgcount++]; } Size += strlen(Args[n-1]); } @@ -1160,7 +1158,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) /* clean up the temporary allocation for multiarch package names in the parent, so we don't leak memory when we return. */ for (unsigned int i = 0; i < pkgcount; i++) - delete [] Packages[i]; + free(Packages[i]); // the result of the waitpid call int res; -- cgit v1.2.3 From 28166356f30ad13729f7f952e6f1fc6131036591 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 8 Mar 2011 19:32:35 +0100 Subject: Remove the "pseudopackage" handling of Architecture: all packages for Multi-Arch; instead, Arch: all packages only satisfy dependencies for the native arch, except where the Arch: all package is declared Multi-Arch: foreign. (Closes: #613584) This has the sideeffect that arch:all packages internally show up as coming from the native arch - so packages with the architecture "all" doesn't exist any longer in the pkgcache --- apt-pkg/algorithms.cc | 64 --------- apt-pkg/cacheiterators.h | 8 +- apt-pkg/cacheset.h | 4 +- apt-pkg/deb/deblistparser.cc | 84 +++++------- apt-pkg/depcache.cc | 304 +------------------------------------------ apt-pkg/depcache.h | 8 +- apt-pkg/orderlist.cc | 4 - apt-pkg/packagemanager.cc | 35 +---- apt-pkg/pkgcache.cc | 18 +-- apt-pkg/pkgcache.h | 4 +- apt-pkg/pkgcachegen.cc | 49 ++----- apt-pkg/policy.cc | 7 - 12 files changed, 62 insertions(+), 527 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 66c182b23..0b4366e5e 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -90,21 +90,6 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) 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++) { @@ -150,40 +135,6 @@ bool pkgSimulate::Configure(PkgIterator iPkg) 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; - } - } - - if (Sim[Pkg].InstBroken() == true) - { - /* We don't call Configure for Pseudo packages and if the 'all' is already installed - the simulation will think the pseudo package is not installed, so if something is - broken we walk over the dependencies and search for not installed pseudo packages */ - for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++) - { - if (Sim.IsImportantDep(D) == false || - (Sim[D] & pkgDepCache::DepInstall) != 0) - continue; - pkgCache::PkgIterator T = D.TargetPkg(); - if (T.end() == true || T->CurrentVer != 0 || Flags[T->ID] != 0) - continue; - pkgCache::PkgIterator A = T.Group().FindPkg("all"); - if (A.end() == true || A->VersionList == 0 || A->CurrentVer == 0 || - Cache.VS().CheckDep(A.CurVersion(), pkgCache::Dep::Equals, T.CandVersion()) == false) - continue; - Sim.MarkInstall(T, false); - Flags[T->ID] = 2; - } - } - if (Sim[Pkg].InstBroken() == true) { cout << "Conf " << Pkg.FullName(false) << " broken" << endl; @@ -235,21 +186,6 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge) 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 449d4b441..31b3aced3 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -206,13 +206,9 @@ class pkgCache::VerIterator : public Iterator { 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 { - if(S->MultiArch == pkgCache::Version::All) - return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; - inline const char *Arch(bool const pseudo) const { - if(pseudo == false) - return Arch(); + __deprecated inline const char *Arch(bool const pseudo) const { return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; @@ -227,7 +223,7 @@ class pkgCache::VerIterator : public Iterator { string RelStr() const; bool Automatic() const; - bool Pseudo() const; + __deprecated bool Pseudo() const; VerFileIterator NewestFile() const; inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator(Owner, Trg) { diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 3f4f0066b..e690d660c 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -257,7 +257,7 @@ public: /*{{{*/ inline const char *VerStr() const { return (**this).VerStr(); }; inline const char *Section() const { return (**this).Section(); }; inline const char *Arch() const { return (**this).Arch(); }; - inline const char *Arch(bool const pseudo) const { return (**this).Arch(pseudo); }; + __deprecated inline const char *Arch(bool const pseudo) const { return (**this).Arch(); }; inline pkgCache::PkgIterator ParentPkg() const { return (**this).ParentPkg(); }; inline pkgCache::DescIterator DescriptionList() const { return (**this).DescriptionList(); }; inline pkgCache::DescIterator TranslatedDescription() const { return (**this).TranslatedDescription(); }; @@ -268,7 +268,7 @@ public: /*{{{*/ inline const char *PriorityType() const { return (**this).PriorityType(); }; inline string RelStr() const { return (**this).RelStr(); }; inline bool Automatic() const { return (**this).Automatic(); }; - inline bool Pseudo() const { return (**this).Pseudo(); }; + __deprecated inline bool Pseudo() const { return false; }; inline pkgCache::VerFileIterator NewestFile() const { return (**this).NewestFile(); }; }; /*}}}*/ diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 9201e6a54..edc001abb 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -67,23 +67,12 @@ string debListParser::Package() { /*}}}*/ // 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. */ +/* This will return the Architecture of the package this section describes */ 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; + std::string const Arch = Section.FindS("Architecture"); + if (Arch.empty() == true) + return _config->Find("APT::Architecture"); + return Arch; } /*}}}*/ // ListParser::ArchitectureAll /*{{{*/ @@ -112,27 +101,30 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) Ver->Section = UniqFindTagWrite("Section"); // 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 + string const MultiArch = Section.FindS("Multi-Arch"); + if (MultiArch.empty() == true) + Ver->MultiArch = pkgCache::Version::None; + else if (MultiArch == "same") { + // Parse multi-arch + if (Section.FindS("Architecture") == "all") { - _error->Warning("Unknown Multi-Arch type »%s« for package »%s«", - MultiArch.c_str(), Section.FindS("Package").c_str()); + /* Arch all packages can't be Multi-Arch: same */ + _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", + Section.FindS("Package").c_str()); Ver->MultiArch = pkgCache::Version::None; } + else + 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 @@ -150,24 +142,6 @@ 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 if (MultiArchEnabled == true) - { - // 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) @@ -644,7 +618,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, return true; string Package; - string const pkgArch = Ver.Arch(true); + string const pkgArch = Ver.Arch(); string Version; unsigned int Op; @@ -683,7 +657,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) { string Package; string Version; - string const Arch = Ver.Arch(true); + string const Arch = Ver.Arch(); unsigned int Op; while (1) @@ -768,7 +742,7 @@ bool debListParser::Step() if (Architecture == Arch) return true; - if (Architecture == "all") + if (Architecture == "all" && Arch == _config->Find("APT::Architecture")) return true; } diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index ddbd37699..fba6ad054 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -705,107 +705,6 @@ void pkgDepCache::UpdateVerState(PkgIterator Pkg) } } /*}}}*/ -// DepCache::RemovePseudoInstalledPkg - MultiArch helper for Update() /*{{{*/ -// --------------------------------------------------------------------- -/* We "install" arch all packages for all archs if it is installed. Many - of these will be broken. This method will look at these broken Pkg and - "remove" it. */ -bool pkgDepCache::RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set &recheck) { - if (unlikely(Pkg->CurrentVer == 0)) - return false; - - VerIterator V = Pkg.CurrentVer(); - if (V->MultiArch != Version::All) - return false; - - // Never ever kill an "all" package - they have no dependency so they can't be broken - if (strcmp(Pkg.Arch(),"all") == 0) - return false; - - unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); - if ((CurDepState & DepInstMin) == DepInstMin) { - // okay, the package isn't broken, but is the package also required? - // If it has no real dependencies, no installed rdepends and doesn't - // provide something of value, we will kill it as not required. - // These pseudopackages have otherwise interesting effects if they get - // a new dependency in a newer version… - for (pkgCache::DepIterator D = V.DependsList(); - D.end() != true; ++D) - if (D.IsCritical() == true && D.ParentPkg()->Group != Pkg->Group) - return false; - for (DepIterator D = Pkg.RevDependsList(); D.end() != true; ++D) - { - if (D.IsCritical() == false) - continue; - PkgIterator const P = D.ParentPkg(); - if (P->Group == Pkg->Group) - continue; - if (P->CurrentVer != 0) - return false; - } - for (PrvIterator Prv = V.ProvidesList(); Prv.end() != true; Prv++) - for (DepIterator d = Prv.ParentPkg().RevDependsList(); - d.end() != true; ++d) - { - PkgIterator const P = d.ParentPkg(); - if (P->CurrentVer != 0 && - P->Group != Pkg->Group) - return false; - } - } - - // Dependencies for this arch all package are not statisfied - // so we installed it only for our convenience: get right of it now. - RemoveSizes(Pkg); - RemoveStates(Pkg); - - Pkg->CurrentVer = 0; - PkgState[Pkg->ID].InstallVer = 0; - - AddStates(Pkg); - Update(Pkg); - AddSizes(Pkg); - - // After the remove previously satisfied pseudo pkg could be now - // no longer satisfied, so we need to recheck the reverse dependencies - for (DepIterator d = Pkg.RevDependsList(); d.end() != true; ++d) - { - PkgIterator const P = d.ParentPkg(); - if (P->CurrentVer != 0) - recheck.insert(P.Index()); - } - - for (DepIterator d = V.DependsList(); d.end() != true; ++d) - { - PkgIterator const P = d.TargetPkg(); - for (PrvIterator Prv = P.ProvidesList(); Prv.end() != true; ++Prv) - { - PkgIterator const O = Prv.OwnerPkg(); - if (O->CurrentVer != 0) - recheck.insert(O.Index()); - } - - if (P->CurrentVer != 0) - recheck.insert(P.Index()); - } - - for (PrvIterator Prv = V.ProvidesList(); Prv.end() != true; Prv++) - { - for (DepIterator d = Prv.ParentPkg().RevDependsList(); - d.end() != true; ++d) - { - PkgIterator const P = d.ParentPkg(); - if (P->CurrentVer == 0) - continue; - - recheck.insert(P.Index()); - } - } - - - return true; -} - /*}}}*/ // DepCache::Update - Figure out all the state information /*{{{*/ // --------------------------------------------------------------------- /* This will figure out the state of all the packages and all the @@ -820,12 +719,8 @@ void pkgDepCache::Update(OpProgress *Prog) iBrokenCount = 0; iBadCount = 0; - std::set recheck; - // Perform the depends pass int Done = 0; - bool const checkMultiArch = APT::Configuration::getArchitectures().size() > 1; - unsigned long killed = 0; for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++) { if (Prog != 0 && Done%20 == 0) @@ -858,69 +753,6 @@ void pkgDepCache::Update(OpProgress *Prog) AddSizes(I); UpdateVerState(I); AddStates(I); - - if (checkMultiArch != true || I->CurrentVer == 0) - continue; - - VerIterator const V = I.CurrentVer(); - if (V->MultiArch != Version::All) - continue; - - recheck.insert(I.Index()); - --Done; // no progress if we need to recheck the package - } - - if (checkMultiArch == true) { - /* FIXME: recheck breaks proper progress reporting as we don't know - how many packages we need to recheck. To lower the effect - a bit we increase with a kill, but we should do something more clever… */ - while(recheck.empty() == false) - for (std::set::const_iterator p = recheck.begin(); - p != recheck.end();) { - if (Prog != 0 && Done%20 == 0) - Prog->Progress(Done); - PkgIterator P = PkgIterator(*Cache, Cache->PkgP + *p); - if (RemovePseudoInstalledPkg(P, recheck) == true) { - ++killed; - ++Done; - } - recheck.erase(p++); - } - - /* Okay, we have killed a great amount of pseudopackages - - we have killed so many that we have now arch "all" packages - without an installed pseudo package, but we NEED an installed - pseudo package, so we will search now for a pseudo package - we can install without breaking everything. */ - for (GrpIterator G = Cache->GrpBegin(); G.end() != true; ++G) - { - PkgIterator P = G.FindPkg("all"); - if (P.end() == true) - continue; - if (P->CurrentVer == 0) - continue; - bool installed = false; - for (P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P)) - { - if (strcmp(P.Arch(), "all") == 0) - continue; - if (P->CurrentVer == 0) - continue; - installed = true; - break; - } - if (installed == false) - recheck.insert(G.Index()); - } - - while (recheck.empty() != true) - { - std::set::const_iterator g = recheck.begin(); - unsigned long const G = *g; - recheck.erase(g); - if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) - _error->Warning(_("Internal error, group '%s' has no installable pseudo package"), GrpIterator(*Cache, Cache->GrpP + G).Name()); - } } if (Prog != 0) @@ -929,80 +761,6 @@ void pkgDepCache::Update(OpProgress *Prog) readStateFile(Prog); } /*}}}*/ -// DepCache::ReInstallPseudoForGroup - MultiArch helper for Update() /*{{{*/ -// --------------------------------------------------------------------- -/* RemovePseudoInstalledPkg() is very successful. It even kills packages - to an amount that no pseudo package is left, but we need a pseudo package - for upgrading senarios so we need to reinstall one pseudopackage which - doesn't break everything. Thankfully we can't have architecture depending - negative dependencies so this problem is already eliminated */ -bool pkgDepCache::ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set &recheck) -{ - if (P->CurrentVer != 0) - return true; - // recursive call for packages which provide this package - for (pkgCache::PrvIterator Prv = P.ProvidesList(); Prv.end() != true; ++Prv) - ReInstallPseudoForGroup(Prv.OwnerPkg(), recheck); - // check if we actually need to look at this group - unsigned long const G = P->Group; - std::set::const_iterator Pi = recheck.find(G); - if (Pi == recheck.end()) - return true; - recheck.erase(Pi); // remove here, so we can't fall into an endless loop - if (unlikely(ReInstallPseudoForGroup(G, recheck) == false)) - { - recheck.insert(G); - return false; - } - return true; -} -bool pkgDepCache::ReInstallPseudoForGroup(unsigned long const &G, std::set &recheck) -{ - std::vector static const Archs = APT::Configuration::getArchitectures(); - pkgCache::GrpIterator Grp(*Cache, Cache->GrpP + G); - if (unlikely(Grp.end() == true)) - return false; - for (std::vector::const_iterator a = Archs.begin(); - a != Archs.end(); ++a) - { - pkgCache::PkgIterator P = Grp.FindPkg(*a); - if (P.end() == true) - continue; - pkgCache::VerIterator allV = Grp.FindPkg("all").CurrentVer(); - for (VerIterator V = P.VersionList(); V.end() != true; ++V) - { - // search for the same version as the all package - if (allV->Hash != V->Hash || strcmp(allV.VerStr(),V.VerStr()) != 0) - continue; - unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); - // If it is broken, try to install dependencies first before retry - if ((CurDepState & DepInstMin) != DepInstMin) - { - for (pkgCache::DepIterator D = V.DependsList(); D.end() != true; ++D) - { - if (D->Type != pkgCache::Dep::PreDepends && D->Type != pkgCache::Dep::Depends) - continue; - ReInstallPseudoForGroup(D.TargetPkg(), recheck); - } - unsigned char const CurDepState = VersionState(V.DependsList(),DepInstall,DepInstMin,DepInstPolicy); - // if package ist still broken… try another arch - if ((CurDepState & DepInstMin) != DepInstMin) - break; - } - // dependencies satisfied: reinstall the package - RemoveSizes(P); - RemoveStates(P); - P->CurrentVer = V.Index(); - PkgState[P->ID].InstallVer = V; - AddStates(P); - Update(P); - AddSizes(P); - return true; - } - } - return false; -} - /*}}}*/ // DepCache::Update - Update the deps list of a package /*{{{*/ // --------------------------------------------------------------------- /* This is a helper for update that only does the dep portion of the scan. @@ -1165,18 +923,6 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, 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); - else if (rPurge == true && Pkg->CurrentVer == 0 && - Pkg->CurrentState != pkgCache::State::NotInstalled && - strcmp(Pkg.Arch(), "all") != 0) - { - PkgIterator const allPkg = Pkg.Group().FindPkg("all"); - if (allPkg.end() == false && allPkg->CurrentVer == 0 && - allPkg->CurrentState != pkgCache::State::NotInstalled) - MarkDelete(allPkg, rPurge, Depth+1, FromUser); - } } /*}}}*/ // DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/ @@ -1276,10 +1022,6 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, Update(Pkg); AddSizes(Pkg); - // always trigger the install of the all package for a pseudo package - if (P.CandidateVerIter(*Cache).Pseudo() == true) - MarkInstall(Pkg.Group().FindPkg("all"), AutoInst, Depth, FromUser, ForceImportantDeps); - if (AutoInst == false) return; @@ -1499,7 +1241,7 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To) AddStates(Pkg); AddSizes(Pkg); - if (unlikely(Pkg.CurrentVer().end() == true) || Pkg.CurrentVer().Pseudo() == false) + if (unlikely(Pkg.CurrentVer().end() == true)) return; SetReInstall(Pkg.Group().FindPkg("all"), To); @@ -1510,7 +1252,6 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To) /* */ void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo) { - pkgCache::PkgIterator Pkg = TargetVer.ParentPkg(); StateCache &P = PkgState[Pkg->ID]; @@ -1531,27 +1272,6 @@ void pkgDepCache::SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo) Update(Pkg); AddSizes(Pkg); - if (TargetVer.Pseudo() == false || Pseudo == false) - return; - - // the version was pseudo: set all other pseudos also - pkgCache::GrpIterator Grp = Pkg.Group(); - for (Pkg = Grp.FindPkg("any"); Pkg.end() == false; ++Pkg) - { - StateCache &P = PkgState[Pkg->ID]; - if (TargetVer.SimilarVer(P.CandidateVerIter(*this)) == true || - (P.CandidateVerIter(*this).Pseudo() == false && - strcmp(Pkg.Arch(), "all") != 0)) - continue; - - for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver) - { - if (TargetVer.SimilarVer(Ver) == false) - continue; - SetCandidateVersion(Ver, false); - break; - } - } } /*}}}*/ // DepCache::SetCandidateRelease - Change the candidate version /*{{{*/ @@ -1967,28 +1687,6 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, if(ver.end() == true) return; - // If the version belongs to a Multi-Arch all package - // we will mark all others in this Group with this version also - if (ver->MultiArch == pkgCache::Version::All && - strcmp(ver.Arch(true), "all") == 0) - { - GrpIterator G = pkg.Group(); - const char* const VerStr = ver.VerStr(); - for (PkgIterator P = G.FindPkg("any"); - P.end() != true; P = G.NextPkg(P)) - { - for (VerIterator V = P.VersionList(); - V.end() != true; ++V) - { - if (ver->Hash != V->Hash || - strcmp(VerStr, V.VerStr()) != 0) - continue; - MarkPackage(P, V, follow_recommends, follow_suggests); - break; - } - } - } - for(DepIterator d = ver.DependsList(); !d.end(); ++d) { if(d->Type == Dep::Depends || diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index dba3e22dc..b95681118 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -395,6 +395,7 @@ class pkgDepCache : protected pkgCache::Namespace bool ForceImportantDeps = false); void SetReInstall(PkgIterator const &Pkg,bool To); + // FIXME: Remove the unused boolean parameter on abi break void SetCandidateVersion(VerIterator TargetVer, bool const &Pseudo = true); bool SetCandidateRelease(pkgCache::VerIterator TargetVer, std::string const &TargetRel); @@ -481,9 +482,10 @@ class pkgDepCache : protected pkgCache::Namespace private: // Helper for Update(OpProgress) to remove pseudoinstalled arch all packages - bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set &recheck); - bool ReInstallPseudoForGroup(unsigned long const &Grp, std::set &recheck); - bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set &recheck); + // FIXME: they are private so shouldn't affect abi, but just in case… + __deprecated bool RemovePseudoInstalledPkg(PkgIterator &Pkg, std::set &recheck) { return true; }; + __deprecated bool ReInstallPseudoForGroup(unsigned long const &Grp, std::set &recheck) { return true; }; + __deprecated bool ReInstallPseudoForGroup(pkgCache::PkgIterator const &P, std::set &recheck) { return true; }; }; #endif diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index a53854a26..d5bd19581 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -128,10 +128,6 @@ bool pkgOrderList::IsMissing(PkgIterator Pkg) if (FileList[Pkg->ID].empty() == false) return false; - // Missing Pseudo packages are missing if the real package is missing - if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == true) - return IsMissing(Pkg.Group().FindPkg("all")); - return true; } /*}}}*/ diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index cff34058c..4c655cb7b 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -81,9 +81,6 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, 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]); } @@ -281,9 +278,7 @@ bool pkgPackageManager::ConfigureAll() { PkgIterator Pkg(Cache,*I); - if (ConfigurePkgs == true && - pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false && - Configure(Pkg) == false) + if (ConfigurePkgs == true && Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -318,9 +313,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) { PkgIterator Pkg(Cache,*I); - if (ConfigurePkgs == true && - pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false && - Configure(Pkg) == false) + if (ConfigurePkgs == true && Configure(Pkg) == false) return false; List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); @@ -473,10 +466,7 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg) List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); - if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false) - return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); - else - return SmartRemove(Pkg.Group().FindPkg("all")); + return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge); return true; } /*}}}*/ @@ -592,22 +582,9 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) P.end() == false; P++) CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); - if (pkgCache::VerIterator(Cache, Cache[Pkg].CandidateVer).Pseudo() == false) - { - if(Install(Pkg,FileNames[Pkg->ID]) == false) - return false; - } else { - // Pseudo packages will not be unpacked - instead we will do this - // for the "real" package, but only once and if it is already - // configured we don't need to unpack it again… - PkgIterator const P = Pkg.Group().FindPkg("all"); - if (List->IsFlag(P,pkgOrderList::UnPacked) != true && - List->IsFlag(P,pkgOrderList::Configured) != true && - P.State() != pkgCache::PkgIterator::NeedsNothing) { - if (SmartUnPack(P) == false) - return false; - } - } + if(Install(Pkg,FileNames[Pkg->ID]) == false) + return false; + List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); // Perform immedate configuration of the package. diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 616d400a2..7014aee22 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -737,22 +737,8 @@ 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 -{ - if (S->MultiArch == pkgCache::Version::All && - strcmp(Arch(true),"all") != 0) - { - GrpIterator const Grp = ParentPkg().Group(); - return (Grp->LastPackage != Grp->FirstPackage); - } - return false; -} +// VerIterator::Pseudo - deprecated no-op method /*{{{*/ +bool pkgCache::VerIterator::Pseudo() const { return false; } /*}}}*/ // VerIterator::NewestFile - Return the newest file version relation /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 82a69b2ca..89a296ce9 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -505,8 +505,8 @@ struct pkgCache::Version Foreign means that this version can fulfill dependencies even if it is built for another architecture as the requester. Same indicates that builds for different architectures can - be co-installed on the system and All is the marker for a - version with the Architecture: all. */ + be co-installed on the system */ + // FIXME: remove All on abi break enum {None, All, Foreign, Same, Allowed} MultiArch; /** \brief references all the PackageFile's that this version came from diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 5b943cca1..d44dbf3a9 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -178,23 +178,17 @@ bool pkgCacheGenerator::MergeList(ListParser &List, if (PackageName.empty() == true) return false; - /* 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) { - genArch = APT::Configuration::getArchitectures(); - if (genArch.size() != 1) - genArch.push_back("all"); - } else - genArch.push_back(List.Architecture()); - - for (std::vector::const_iterator arch = genArch.begin(); - arch != genArch.end(); ++arch) - { + /* Treat Arch all packages as the same as the native arch. */ + string Arch; + if (List.ArchitectureAll() == true) + Arch = _config->Find("APT::Architecture"); + else + Arch = List.Architecture(); + // Get a pointer to the package structure pkgCache::PkgIterator Pkg; Dynamic DynPkg(Pkg); - if (NewPackage(Pkg, PackageName, *arch) == false) + if (NewPackage(Pkg, PackageName, Arch) == false) return _error->Error(_("Error occurred while processing %s (NewPackage)"),PackageName.c_str()); Counter++; if (Counter % 100 == 0 && Progress != 0) @@ -351,7 +345,6 @@ bool pkgCacheGenerator::MergeList(ListParser &List, if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),PackageName.c_str()); - } } FoundFileDeps |= List.HasFileDeps(); @@ -650,10 +643,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) - 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 && strcmp(Arch, "all") != 0) || - V->MultiArch == pkgCache::Version::Same); - if (V->MultiArch == pkgCache::Version::All && allPkg.end() == true) - allPkg = G.FindPkg("all"); + bool const coInstall = (V->MultiArch == pkgCache::Version::Same); for (vector::const_iterator A = archs.begin(); A != archs.end(); ++A) { if (*A == Arch) @@ -675,24 +665,11 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) NewDepends(D, V, V.VerStr(), pkgCache::Dep::NotEquals, 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 - if (strcmp(Arch, "all") == 0) { - NewDepends(D, V, V.VerStr(), - pkgCache::Dep::NotEquals, pkgCache::Dep::Conflicts, - OldDepLast); - } else { - NewDepends(D, V, "", - pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, - OldDepLast); - } + NewDepends(D, V, "", + pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts, + OldDepLast); } } } @@ -810,7 +787,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(true)) + if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch()) return true; // Get a structure diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 5427271b6..94c7fd4af 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -152,13 +152,6 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator const &Pk { /* Lets see if this version is the installed version */ bool instVer = (Pkg.CurrentVer() == Ver); - if (Ver.Pseudo() == true && instVer == false) - { - pkgCache::PkgIterator const allPkg = Ver.ParentPkg().Group().FindPkg("all"); - if (allPkg->CurrentVer != 0 && allPkg.CurrentVer()->Hash == Ver->Hash && - strcmp(allPkg.CurVersion(), Ver.VerStr()) == 0) - instVer = true; - } for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++) { -- cgit v1.2.3 From e344ad65a4dc36f7fd502193077ae2a3b189eb29 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 10 Mar 2011 14:42:34 +0100 Subject: apt-pkg/cdrom.{cc,h}: add (ugly) workaround to ensure the ABI is not broken (also in this case its probably not needed because pkgUDevCDrom is not used outside libapt itself, still its better to be on the save side) --- apt-pkg/cdrom.cc | 9 ++++++++- apt-pkg/cdrom.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 55600fe57..36a1d7f12 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -854,7 +854,9 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ libudev_handle = h; udev_new = (udev* (*)(void)) dlsym(h, "udev_new"); udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property"); +#if 0 // FIXME: uncomment on next ABI break udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_sysattr"); +#endif udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices"); udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry"); udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath"); @@ -895,8 +897,13 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly) enumerate = udev_enumerate_new (udev_ctx); if (CdromOnly) udev_enumerate_add_match_property(enumerate, "ID_CDROM", "1"); - else + else { +#if 1 // FIXME: remove the next two lines on the next ABI break + int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value); + udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(libudev_handle, "udev_enumerate_add_match_sysattr"); +#endif udev_enumerate_add_match_sysattr(enumerate, "removable", "1"); + } udev_enumerate_scan_devices (enumerate); devices = udev_enumerate_get_list_entry (enumerate); diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h index 032fae755..e83c38582 100644 --- a/apt-pkg/cdrom.h +++ b/apt-pkg/cdrom.h @@ -92,7 +92,9 @@ class pkgUdevCdromDevices /*{{{*/ struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev); struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *list_entry); const char* (*udev_device_get_property_value)(struct udev_device *udev_device, const char *key); +#if 0 // FIXME: uncomment on next ABI break int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value); +#endif // end libudev dlopen public: -- cgit v1.2.3