From 84aa13f4e620c460c98b351a6ef12027d8d6da9c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 16 Mar 2011 18:18:32 +0100 Subject: enable buildsimplenativepackage to build packages for multiple architectures in a row as it is needed for Multi-Arch:same that the shared files are the same --- test/integration/framework | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index 71e7e476c..4b1b98c4e 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -261,18 +261,22 @@ Package: $NAME" > ${BUILDDIR}/debian/control fi echo '3.0 (native)' > ${BUILDDIR}/debian/source/format local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" - - mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin - cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} - cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin - (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH) - (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) - - dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null - echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist for SRC in $SRCS; do echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist done + + for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do + rm -rf ${BUILDDIR}/debian/tmp + mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin + cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} + cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch} + (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch) + (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) + + dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null + echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist + done + mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog -- cgit v1.2.3 From 6f31b247bae228250899b62b9dab6b13dc4ff170 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 16 Mar 2011 18:39:11 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - skip --configure if all packages disappeared --- apt-pkg/deb/dpkgpm.cc | 8 ++++++-- debian/changelog | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index eb9abe909..01808be24 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1002,6 +1002,7 @@ bool pkgDPkgPM::Go(int OutStatusFd) else { string const nativeArch = _config->Find("APT::Architecture"); + unsigned long const oldSize = I->Op == Item::Configure ? Size : 0; for (;I != J && Size < MaxArgBytes; I++) { if((*I).Pkg.end() == true) @@ -1016,8 +1017,11 @@ bool pkgDPkgPM::Go(int OutStatusFd) Args[n++] = Packages[pkgcount++]; } Size += strlen(Args[n-1]); - } - } + } + // skip configure action if all sheduled packages disappeared + if (oldSize == Size) + continue; + } Args[n] = 0; J = I; diff --git a/debian/changelog b/debian/changelog index c7bb429ff..9f1944b62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.8.13.1) UNRELEASED; urgency=low + + [ David Kalnischkies ] + * apt-pkg/deb/dpkgpm.cc: + - skip --configure if all packages disappeared + + -- David Kalnischkies Wed, 16 Mar 2011 18:37:53 +0100 + apt (0.8.13) unstable; urgency=low [ Thorsten Spindler ] -- cgit v1.2.3 From 82b6682ac686fa07b02622aa4746b67eccb77e61 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 16 Mar 2011 21:26:54 +0100 Subject: * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc: - mark them as deprecated as they are unused --- apt-pkg/acquire-item.cc | 24 ------------------------ apt-pkg/vendor.h | 3 ++- apt-pkg/vendorlist.cc | 11 ++++++++++- apt-pkg/vendorlist.h | 3 ++- debian/changelog | 4 +++- 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 2ecb8ed6e..cf88ded7b 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -1390,29 +1389,6 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ /*}}}*/ bool pkgAcqMetaIndex::VerifyVendor(string Message) /*{{{*/ { -// // Maybe this should be made available from above so we don't have -// // to read and parse it every time? -// pkgVendorList List; -// List.ReadMainList(); - -// const Vendor* Vndr = NULL; -// for (std::vector::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++) -// { -// string::size_type pos = (*I).find("VALIDSIG "); -// if (_config->FindB("Debug::Vendor", false)) -// std::cerr << "Looking for VALIDSIG in \"" << (*I) << "\": pos " << pos -// << std::endl; -// if (pos != std::string::npos) -// { -// string Fingerprint = (*I).substr(pos+sizeof("VALIDSIG")); -// if (_config->FindB("Debug::Vendor", false)) -// std::cerr << "Looking for \"" << Fingerprint << "\" in vendor..." << -// std::endl; -// Vndr = List.FindVendor(Fingerprint) != ""; -// if (Vndr != NULL); -// break; -// } -// } string::size_type pos; // check for missing sigs (that where not fatal because otherwise we had diff --git a/apt-pkg/vendor.h b/apt-pkg/vendor.h index 2d39fd15f..df229737a 100644 --- a/apt-pkg/vendor.h +++ b/apt-pkg/vendor.h @@ -4,11 +4,12 @@ #include #include +#include using std::string; // A class representing a particular software provider. -class Vendor +class __deprecated Vendor { public: struct Fingerprint diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc index 92ff38894..48ac12cee 100644 --- a/apt-pkg/vendorlist.cc +++ b/apt-pkg/vendorlist.cc @@ -1,8 +1,13 @@ -#include #include #include #include +#if __GNUC__ >= 4 + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +#include + pkgVendorList::~pkgVendorList() { for (vector::const_iterator I = VendorList.begin(); @@ -143,3 +148,7 @@ const Vendor* pkgVendorList::FindVendor(const std::vector GPGVOutput) /* return NULL; } /*}}}*/ + +#if __GNUC__ >= 4 + #pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif diff --git a/apt-pkg/vendorlist.h b/apt-pkg/vendorlist.h index ff2f4ed5d..eaeecb173 100644 --- a/apt-pkg/vendorlist.h +++ b/apt-pkg/vendorlist.h @@ -17,12 +17,13 @@ #include #include #include +#include using std::string; using std::vector; -class pkgVendorList +class __deprecated pkgVendorList { protected: vector VendorList; diff --git a/debian/changelog b/debian/changelog index 9f1944b62..c6df16bb9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low [ David Kalnischkies ] * apt-pkg/deb/dpkgpm.cc: - skip --configure if all packages disappeared + * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc: + - mark them as deprecated as they are unused - -- David Kalnischkies Wed, 16 Mar 2011 18:37:53 +0100 + -- David Kalnischkies Wed, 16 Mar 2011 21:23:32 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From dde0c674e423e5f06d1e319e3a096054607a5f72 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 20 Mar 2011 19:52:53 +0100 Subject: reorganize the marker methods a bit by moving the common part to a seperate IsModeChangeOk which checks sanity and dpkg holds --- apt-pkg/depcache.cc | 130 +++++++++++---------- apt-pkg/depcache.h | 4 + debian/changelog | 2 +- ...est-bug-549968-install-depends-of-not-installed | 2 +- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index fba6ad054..46fbc9e58 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -819,8 +819,7 @@ void pkgDepCache::Update(PkgIterator const &Pkg) void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, unsigned long Depth) { - // Simplifies other routines. - if (Pkg.end() == true) + if (IsModeChangeOk(ModeKeep, Pkg, Depth, FromUser) == false) return; /* Reject an attempt to keep a non-source broken installed package, those @@ -828,25 +827,22 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, if (Pkg.State() == PkgIterator::NeedsUnpack && Pkg.CurrentVer().Downloadable() == false) return; - - /** \todo Can this be moved later in the method? */ - ActionGroup group(*this); /* We changed the soft state all the time so the UI is a bit nicer to use */ StateCache &P = PkgState[Pkg->ID]; + + // Check that it is not already kept + if (P.Mode == ModeKeep) + return; + if (Soft == true) P.iFlags |= AutoKept; else P.iFlags &= ~AutoKept; - - // Check that it is not already kept - if (P.Mode == ModeKeep) - return; - // We dont even try to keep virtual packages.. - if (Pkg->VersionList == 0) - return; + ActionGroup group(*this); + #if 0 // reseting the autoflag here means we lose the // auto-mark information if a user selects a package for removal // but changes his mind then and sets it for keep again @@ -883,30 +879,26 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, unsigned long Depth, bool FromUser) { - // Simplifies other routines. - if (Pkg.end() == true) + if (IsModeChangeOk(ModeDelete, Pkg, Depth, FromUser) == false) return; - ActionGroup group(*this); + StateCache &P = PkgState[Pkg->ID]; // Check that it is not already marked for delete - StateCache &P = PkgState[Pkg->ID]; - P.iFlags &= ~(AutoKept | Purge); - if (rPurge == true) - P.iFlags |= Purge; - if ((P.Mode == ModeDelete || P.InstallVer == 0) && (Pkg.Purge() == true || rPurge == false)) return; - - // We dont even try to delete virtual packages.. - if (Pkg->VersionList == 0) - return; - // check if we are allowed to install the package + // check if we are allowed to remove the package if (IsDeleteOk(Pkg,rPurge,Depth,FromUser) == false) return; + P.iFlags &= ~(AutoKept | Purge); + if (rPurge == true) + P.iFlags |= Purge; + + ActionGroup group(*this); + if (DebugMarker == true) std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl; @@ -927,19 +919,12 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, /*}}}*/ // DepCache::IsDeleteOk - check if it is ok to remove this package /*{{{*/ // --------------------------------------------------------------------- -/* The default implementation just honors dpkg hold - But an application using this library can override this method - to control the MarkDelete behaviour */ +/* The default implementation tries to prevent deletion of install requests. + dpkg holds are enforced by the private IsModeChangeOk */ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, unsigned long Depth, bool FromUser) { - if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false) - { - if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl; - return false; - } - else if (FromUser == false && Pkg->CurrentVer == 0) + if (FromUser == false && Pkg->CurrentVer == 0) { StateCache &P = PkgState[Pkg->ID]; if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto) @@ -949,6 +934,46 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, return false; } } + return true; +} + /*}}}*/ +// DepCache::IsModeChangeOk - check if it is ok to change the mode /*{{{*/ +// --------------------------------------------------------------------- +/* this is used by all Mark methods on the very first line to check sanity + and prevents mode changes for packages on hold for example. + If you want to check Mode specific stuff you can use the virtual public + IsOk methods instead */ +char const* PrintMode(char const mode) +{ + switch (mode) + { + case pkgDepCache::ModeInstall: return "Install"; + case pkgDepCache::ModeKeep: return "Keep"; + case pkgDepCache::ModeDelete: return "Delete"; + default: return "UNKNOWN"; + } +} +bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, + unsigned long const Depth, bool const FromUser) +{ + // we are not trying to hard… + if (unlikely(Depth > 100)) + return false; + + // general sanity + if (unlikely(Pkg.end() == true || Pkg->VersionList == 0)) + return false; + + // enforce dpkg holds + if (FromUser == false && mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold && + _config->FindB("APT::Ignore-Hold",false) == false) + { + if (unlikely(DebugMarker == true) && PkgState[Pkg->ID].Mode != mode) + std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode) + << " of " << Pkg << std::endl; + return false; + } + return true; } /*}}}*/ @@ -959,19 +984,17 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser, bool ForceImportantDeps) { - if (Depth > 100) + if (IsModeChangeOk(ModeInstall, Pkg, Depth, FromUser) == false) return; - - // Simplifies other routines. - if (Pkg.end() == true) + + StateCache &P = PkgState[Pkg->ID]; + + // See if there is even any possible instalation candidate + if (P.CandidateVer == 0) return; - - ActionGroup group(*this); /* Check that it is not already marked for install and that it can be installed */ - StateCache &P = PkgState[Pkg->ID]; - P.iFlags &= ~AutoKept; if ((P.InstPolicyBroken() == false && P.InstBroken() == false) && (P.Mode == ModeInstall || P.CandidateVer == (Version *)Pkg.CurrentVer())) @@ -981,17 +1004,13 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, return; } - // See if there is even any possible instalation candidate - if (P.CandidateVer == 0) - return; - // We dont even try to install virtual packages.. - if (Pkg->VersionList == 0) - return; - // check if we are allowed to install the package if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false) return; + ActionGroup group(*this); + P.iFlags &= ~AutoKept; + /* Target the candidate version and remove the autoflag. We reset the autoflag below if this was called recursively. Otherwise the user should have the ability to de-auto a package by changing its state */ @@ -1204,18 +1223,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, /*}}}*/ // DepCache::IsInstallOk - check if it is ok to install this package /*{{{*/ // --------------------------------------------------------------------- -/* The default implementation just honors dpkg hold - But an application using this library can override this method - to control the MarkInstall behaviour */ +/* The default implementation does nothing. + dpkg holds are enforced by the private IsModeChangeOk */ bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser) { - if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false) - { - if (DebugMarker == true) - std::clog << OutputInDepth(Depth) << "Hold prevents MarkInstall of " << Pkg << " FU=" << FromUser << std::endl; - return false; - } return true; } /*}}}*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index b95681118..8cf7db80a 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -486,6 +486,10 @@ class pkgDepCache : protected pkgCache::Namespace __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; }; + + + bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, + unsigned long const Depth, bool const FromUser); }; #endif diff --git a/debian/changelog b/debian/changelog index c6df16bb9..b691a1938 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ apt (0.8.13.1) UNRELEASED; urgency=low * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc: - mark them as deprecated as they are unused - -- David Kalnischkies Wed, 16 Mar 2011 21:23:32 +0100 + -- David Kalnischkies Sun, 20 Mar 2011 19:51:41 +0100 apt (0.8.13) unstable; urgency=low diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index 871d236b9..d5eae1ae6 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -17,7 +17,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 - Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0 + Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) Package extracoolstuff is not installed, so not removed The following NEW packages will be installed: coolstuff -- cgit v1.2.3 From dfc2b1be9e4e4b500b87df16c21ba85f59d8a587 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Mar 2011 01:50:32 +0100 Subject: add a method to insert packages into dpkg's status file --- test/integration/framework | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/integration/framework b/test/integration/framework index 4b1b98c4e..013a71ec0 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -422,6 +422,29 @@ Filename: pool/main/${NAME}/${NAME}_${VERSION}_${ARCH}.deb" >> $FILE done } +insertinstalledpackage() { + local NAME="$1" + local ARCH="$2" + local VERSION="$3" + local DEPENDENCIES="$4" + local FILE="rootdir/var/lib/dpkg/status" + echo "Package: $NAME +Status: install ok installed +Priority: optional +Section: other +Installed-Size: 42 +Maintainer: Joe Sixpack +Architecture: $ARCH +Version: $VERSION" >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + If you find such a package installed on your system, + YOU did something horribly wrong! They are autogenerated + und used only by testcases for APT and surf no other propose… +" >> $FILE +} + + buildaptarchivefromincoming() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…" cd aptarchive -- cgit v1.2.3 From 889c669b8819d62c91528440300613d31167c915 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Mar 2011 01:54:52 +0100 Subject: * apt-pkg/deb/deblistparser.h: - enable StripMultiArch by default for ParseDepends --- apt-pkg/deb/deblistparser.h | 2 +- debian/changelog | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 4bc1bd93c..06ea73291 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -69,7 +69,7 @@ class debListParser : public pkgCacheGenerator::ListParser static const char *ParseDepends(const char *Start,const char *Stop, string &Package,string &Ver,unsigned int &Op, bool const &ParseArchFlags = false, - bool const &StripMultiArch = false); + bool const &StripMultiArch = true); static const char *ConvertRelation(const char *I,unsigned int &Op); debListParser(FileFd *File, string const &Arch = ""); diff --git a/debian/changelog b/debian/changelog index b691a1938..fc246451b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low - skip --configure if all packages disappeared * apt-pkg/vendor.cc, apt-pkg/vendorlist.cc: - mark them as deprecated as they are unused + * apt-pkg/deb/deblistparser.h: + - enable StripMultiArch by default for ParseDepends - -- David Kalnischkies Sun, 20 Mar 2011 19:51:41 +0100 + -- David Kalnischkies Wed, 23 Mar 2011 01:53:27 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From f9dce803b3774dff1a818abe9a30e3c4216f52e2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Mar 2011 02:06:28 +0100 Subject: * debian/apt.conf.autoremove: - adapt to new gnumach kernel package naming (Closes: #619337) --- debian/apt.conf.autoremove | 1 + debian/changelog | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove index ebe49c7cd..c7ad51e66 100644 --- a/debian/apt.conf.autoremove +++ b/debian/apt.conf.autoremove @@ -9,6 +9,7 @@ APT "^linux-restricted-modules.*"; "^linux-ubuntu-modules-.*"; "^gnumach$"; + "^gnumach-image.*"; }; Never-MarkAuto-Sections diff --git a/debian/changelog b/debian/changelog index fc246451b..debc374bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low - mark them as deprecated as they are unused * apt-pkg/deb/deblistparser.h: - enable StripMultiArch by default for ParseDepends + * debian/apt.conf.autoremove: + - adapt to new gnumach kernel package naming (Closes: #619337) - -- David Kalnischkies Wed, 23 Mar 2011 01:53:27 +0100 + -- David Kalnischkies Wed, 23 Mar 2011 02:03:24 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From a0a1ce6df590187fff6e0e1c8c2783c49d910683 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Mar 2011 02:09:14 +0100 Subject: * doc/apt_preferences.5.xml: - correct typo spotted by Charles Plessy (Closes: #619088) --- debian/changelog | 4 +++- doc/apt_preferences.5.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index debc374bd..1a8b746c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low - enable StripMultiArch by default for ParseDepends * debian/apt.conf.autoremove: - adapt to new gnumach kernel package naming (Closes: #619337) + * doc/apt_preferences.5.xml: + - correct typo spotted by Charles Plessy (Closes: #619088) - -- David Kalnischkies Wed, 23 Mar 2011 02:03:24 +0100 + -- David Kalnischkies Wed, 23 Mar 2011 02:08:23 +0100 apt (0.8.13) unstable; urgency=low diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 0d22d0413..903d27da2 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -127,7 +127,7 @@ files are marked as "NotAutomatic: yes" like the debian experimental archive.If the target release has not been specified then APT simply assigns priority 100 to all installed package versions and priority 500 to all -uninstalled package versions, expect versions coming from archives which +uninstalled package versions, except versions coming from archives which in their Release files are marked as "NotAutomatic: yes" - these versions get the priority 1. -- cgit v1.2.3 From fcaf14fe20f743549ce968bdd2f511684ceb2394 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Mar 2011 02:21:58 +0100 Subject: document ButAutomaticUpgrades together with NotAutomatic as suggested by Charles Plessy (Closes: #619083) --- debian/changelog | 4 +++- doc/apt_preferences.5.xml | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1a8b746c2..01498a939 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low - adapt to new gnumach kernel package naming (Closes: #619337) * doc/apt_preferences.5.xml: - correct typo spotted by Charles Plessy (Closes: #619088) + - document ButAutomaticUpgrades together with NotAutomatic + as suggested by Charles Plessy (Closes: #619083) - -- David Kalnischkies Wed, 23 Mar 2011 02:08:23 +0100 + -- David Kalnischkies Wed, 23 Mar 2011 02:19:33 +0100 apt (0.8.13) unstable; urgency=low diff --git a/doc/apt_preferences.5.xml b/doc/apt_preferences.5.xml index 903d27da2..219da7cd1 100644 --- a/doc/apt_preferences.5.xml +++ b/doc/apt_preferences.5.xml @@ -105,12 +105,16 @@ algorithm to set the priorities of the versions of a package. Assign: priority 1 to the versions coming from archives which in their Release -files are marked as "NotAutomatic: yes" like the debian experimental archive. +files are marked as "NotAutomatic: yes" but not as "ButAutomaticUpgrades: yes" +like the debian experimental archive. priority 100 -to the version that is already installed (if any). +to the version that is already installed (if any) and to the versions coming +from archives which in their Release files are marked as "NotAutomatic: yes" and +"ButAutomaticUpgrades: yes" like the debian backports archive since squeeze-backports. + @@ -129,7 +133,8 @@ files are marked as "NotAutomatic: yes" like the debian experimental archive.Release files are marked as "NotAutomatic: yes" - -these versions get the priority 1. +these versions get the priority 1 or priority 100 if it is additionally marked +as "ButAutomaticUpgrades: yes". APT then applies the following rules, listed in order of precedence, to determine which version of a package to install. -- cgit v1.2.3 From e548ae1c69c101f2a0b610fd2bf7b337f22fb09e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 25 Mar 2011 20:06:40 +0100 Subject: * apt-pkg/depcache.cc: - remove pseudo handling leftover from SetReInstall --- apt-pkg/depcache.cc | 5 ----- debian/changelog | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 46fbc9e58..1c89bd32f 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1252,11 +1252,6 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To) AddStates(Pkg); AddSizes(Pkg); - - if (unlikely(Pkg.CurrentVer().end() == true)) - return; - - SetReInstall(Pkg.Group().FindPkg("all"), To); } /*}}}*/ // DepCache::SetCandidateVersion - Change the candidate version /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 01498a939..90a56968c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,8 +13,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low - correct typo spotted by Charles Plessy (Closes: #619088) - document ButAutomaticUpgrades together with NotAutomatic as suggested by Charles Plessy (Closes: #619083) + * apt-pkg/depcache.cc: + - remove pseudo handling leftover from SetReInstall - -- David Kalnischkies Wed, 23 Mar 2011 02:19:33 +0100 + -- David Kalnischkies Fri, 25 Mar 2011 20:06:03 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From 566046f403acb3f50df78be93ea3b68b9f2c3e7b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 25 Mar 2011 20:17:32 +0100 Subject: * apt-pkg/pkgcachegen.cc: - make "all"->"native" an implementation detail of NewPackage rather than rewrite it in higher methods --- apt-pkg/pkgcache.cc | 2 +- apt-pkg/pkgcachegen.cc | 12 ++++-------- debian/changelog | 5 ++++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 7014aee22..dbcbd9c26 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -321,7 +321,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { /* Most of the time the package for our native architecture is the one we add at first to the cache, but this would be the last one we check, so we do it now. */ - if (Arch == "native" || Arch == myArch) { + if (Arch == "native" || Arch == myArch || Arch == "all") { Arch = myArch; pkgCache::Package *Pkg = Owner->PkgP + S->LastPackage; if (stringcasecmp(Arch, Owner->StrP + Pkg->Arch) == 0) diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d44dbf3a9..ae031fee4 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -178,12 +178,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, if (PackageName.empty() == true) return false; - /* 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(); + string const Arch = List.Architecture(); // Get a pointer to the package structure pkgCache::PkgIterator Pkg; @@ -484,7 +479,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name // Set the name, arch and the ID Pkg->Name = Grp->Name; Pkg->Group = Grp.Index(); - map_ptrloc const idxArch = WriteUniqString(Arch.c_str()); + map_ptrloc const idxArch = WriteUniqString((Arch == "all") ? _config->Find("APT::Architecture") : Arch.c_str()); if (unlikely(idxArch == 0)) return false; Pkg->Arch = idxArch; @@ -787,7 +782,8 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, pkgCache &Cache = Owner->Cache; // We do not add self referencing provides - if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch()) + if (Ver.ParentPkg().Name() == PkgName && (PkgArch == Ver.ParentPkg().Arch() || + (PkgArch == "all" && _config->Find("APT::Architecture") == Ver.ParentPkg().Arch()))) return true; // Get a structure diff --git a/debian/changelog b/debian/changelog index 90a56968c..e46c69ca4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,8 +15,11 @@ apt (0.8.13.1) UNRELEASED; urgency=low as suggested by Charles Plessy (Closes: #619083) * apt-pkg/depcache.cc: - remove pseudo handling leftover from SetReInstall + * apt-pkg/pkgcachegen.cc: + - make "all"->"native" an implementation detail of NewPackage + rather than rewrite it in higher methods - -- David Kalnischkies Fri, 25 Mar 2011 20:06:03 +0100 + -- David Kalnischkies Fri, 25 Mar 2011 20:15:18 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From ca238ede0446483c107ace331324cbee0f096361 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 25 Mar 2011 22:12:29 +0100 Subject: * apt-pkg/cacheiterator.h: - return "all" instead of native architecture without breaking the abi (too much) by extending enum instead of using bitflags (LP: #733741) With the next abi break that enum should be a char bitflag instead --- apt-pkg/cacheiterators.h | 4 +++ apt-pkg/deb/deblistparser.cc | 14 +++++++--- apt-pkg/pkgcache.h | 4 +-- apt-pkg/pkgcachegen.cc | 2 +- debian/changelog | 5 +++- ...est-bug-549968-install-depends-of-not-installed | 4 +-- ...g-590438-broken-provides-thanks-to-remove-order | 8 +++--- .../integration/test-bug-593360-modifiers-in-names | 16 ++++++------ .../test-bug-612099-multiarch-conflicts | 12 ++++----- test/integration/test-release-candidate-switching | 30 +++++++++++----------- 10 files changed, 57 insertions(+), 42 deletions(-) diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 31b3aced3..8f9f811da 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -206,6 +206,10 @@ 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 || + S->MultiArch == pkgCache::Version::AllForeign || + S->MultiArch == pkgCache::Version::AllAllowed) + return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; __deprecated inline const char *Arch(bool const pseudo) const { diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index edc001abb..b79cef41c 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -106,7 +106,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) Ver->MultiArch = pkgCache::Version::None; else if (MultiArch == "same") { // Parse multi-arch - if (Section.FindS("Architecture") == "all") + if (ArchitectureAll() == true) { /* Arch all packages can't be Multi-Arch: same */ _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", @@ -127,6 +127,14 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) Ver->MultiArch = pkgCache::Version::None; } + if (ArchitectureAll() == true) + switch (Ver->MultiArch) + { + case pkgCache::Version::Foreign: Ver->MultiArch = pkgCache::Version::AllForeign; break; + case pkgCache::Version::Allowed: Ver->MultiArch = pkgCache::Version::AllAllowed; break; + default: Ver->MultiArch = pkgCache::Version::All; + } + // Archive Size Ver->Size = Section.FindULL("Size"); // Unpacked Size (in K) @@ -677,13 +685,13 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } } - if (Ver->MultiArch == pkgCache::Version::Allowed) + if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) { string const Package = string(Ver.ParentPkg().Name()).append(":").append("any"); NewProvides(Ver, Package, "any", Ver.VerStr()); } - if (Ver->MultiArch != pkgCache::Version::Foreign) + if (Ver->MultiArch != pkgCache::Version::Foreign && Ver->MultiArch != pkgCache::Version::AllForeign) return true; if (MultiArchEnabled == false) diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 89a296ce9..d654a2976 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -506,8 +506,8 @@ struct pkgCache::Version if it is built for another architecture as the requester. Same indicates that builds for different architectures can be co-installed on the system */ - // FIXME: remove All on abi break - enum {None, All, Foreign, Same, Allowed} MultiArch; + /* FIXME: A bitflag would be better with the next abibreak… */ + enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} 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 ae031fee4..b0ee04554 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -638,7 +638,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::Same); + bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same); for (vector::const_iterator A = archs.begin(); A != archs.end(); ++A) { if (*A == Arch) diff --git a/debian/changelog b/debian/changelog index e46c69ca4..b0bec1ba2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,8 +18,11 @@ apt (0.8.13.1) UNRELEASED; urgency=low * apt-pkg/pkgcachegen.cc: - make "all"->"native" an implementation detail of NewPackage rather than rewrite it in higher methods + * apt-pkg/cacheiterator.h: + - return "all" instead of native architecture without breaking the abi + (too much) by extending enum instead of using bitflags (LP: #733741) - -- David Kalnischkies Fri, 25 Mar 2011 20:15:18 +0100 + -- David Kalnischkies Fri, 25 Mar 2011 22:07:59 +0100 apt (0.8.13) unstable; urgency=low diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index d5eae1ae6..7b4b4b71c 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -22,5 +22,5 @@ Package extracoolstuff is not installed, so not removed The following NEW packages will be installed: coolstuff 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst coolstuff (1.0 unstable [i386]) -Conf coolstuff (1.0 unstable [i386])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s +Inst coolstuff (1.0 unstable [all]) +Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order index 72de6eacb..0f6493948 100755 --- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order +++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order @@ -62,13 +62,13 @@ predependsgawk2() { echo "$pkgbasefile Pre-Depends: $1 " >> rootdir/var/lib/dpkg/status - testequalor2 "Inst coolstuff (1-1 localhost [i386]) -Conf coolstuff (1-1 localhost [i386]) + testequalor2 "Inst coolstuff (1-1 localhost [all]) +Conf coolstuff (1-1 localhost [all]) Inst gawk2 (1:3.1.7.dfsg-5 localhost [i386]) Conf gawk2 (1:3.1.7.dfsg-5 localhost [i386]) -Remv mawk [1.3.3-15]" "Inst coolstuff (1-1 localhost [i386]) +Remv mawk [1.3.3-15]" "Inst coolstuff (1-1 localhost [all]) Inst gawk2 (1:3.1.7.dfsg-5 localhost [i386]) -Conf coolstuff (1-1 localhost [i386]) +Conf coolstuff (1-1 localhost [all]) Conf gawk2 (1:3.1.7.dfsg-5 localhost [i386]) Remv mawk [1.3.3-15]" aptget install gawk2 mawk- -sqq -o PreDepends=$(echo "$1" | sed 's/ //g') } diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names index c34b499b0..83a3cfabf 100755 --- a/test/integration/test-bug-593360-modifiers-in-names +++ b/test/integration/test-bug-593360-modifiers-in-names @@ -36,29 +36,29 @@ Building dependency tree... The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst apt (0.8.8 localhost [i386]) -Conf apt (0.8.8 localhost [i386])' aptget install apt -s +Inst apt (0.8.8 localhost [all]) +Conf apt (0.8.8 localhost [all])' aptget install apt -s testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst apt+ (0.8.8 localhost [i386]) -Conf apt+ (0.8.8 localhost [i386])' aptget install apt+ -s +Inst apt+ (0.8.8 localhost [all]) +Conf apt+ (0.8.8 localhost [all])' aptget install apt+ -s testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst apt+ (0.8.8 localhost [i386]) -Conf apt+ (0.8.8 localhost [i386])' aptget install apt++ -s +Inst apt+ (0.8.8 localhost [all]) +Conf apt+ (0.8.8 localhost [all])' aptget install apt++ -s testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: apt+ 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst apt+ (0.8.8 localhost [i386]) -Conf apt+ (0.8.8 localhost [i386])' aptget purge apt++ -s +Inst apt+ (0.8.8 localhost [all]) +Conf apt+ (0.8.8 localhost [all])' aptget purge apt++ -s diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index 6d09a4fa1..b8cfe59e2 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -67,9 +67,9 @@ The following NEW packages will be installed: The following packages will be upgraded: libc6 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. -Inst libc6 [1.0] (2.0 testing [i386]) +Inst libc6 [1.0] (2.0 testing [all]) Inst foobar (1.0 stable [i386]) -Conf libc6 (2.0 testing [i386]) +Conf libc6 (2.0 testing [all]) Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing testequal 'Reading package lists... @@ -78,8 +78,8 @@ Reading state information... The following packages will be upgraded: libc6 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -Inst libc6 [1.0] (2.0 testing [i386]) -Conf libc6 (2.0 testing [i386])' aptget upgrade -t testing -s +Inst libc6 [1.0] (2.0 testing [all]) +Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s aptget upgrade -y -qq 2>&1 > /dev/null testdpkginstalled libc6 @@ -171,8 +171,8 @@ Reading state information... The following packages will be upgraded: libc6-same 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -Inst libc6-same [1.0] (2.0 testing [i386]) -Conf libc6-same (2.0 testing [i386])' aptget upgrade -t testing -s +Inst libc6-same [1.0] (2.0 testing [all]) +Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s aptget upgrade -y -qq 2>&1 > /dev/null testdpkginstalled libc6-same diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index b79828a9e..b6dbe99db 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -95,7 +95,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok' The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -117,7 +117,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-null' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null' The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -140,7 +140,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' The following extra packages will be installed: @@ -170,7 +170,7 @@ Building dependency tree... Selected version '2.3.2-2+exp' (experimental2 [i386]) for 'amarok-less' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-less' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-higher' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-higher' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-higher' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-higher' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-higher' The following extra packages will be installed: @@ -195,7 +195,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null2' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-null2' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null2' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-null2' The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -218,7 +218,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-xine' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine' The following extra packages will be installed: @@ -242,7 +242,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine2' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine2' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine2' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine2' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine2' The following extra packages will be installed: @@ -266,9 +266,9 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine3' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine3' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine3' Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine3' because of 'amarok-xine3' -Selected version '2.0' (experimental [i386]) for 'intermediatepkg' because of 'phonon-backend-xine3' +Selected version '2.0' (experimental [all]) for 'intermediatepkg' because of 'phonon-backend-xine3' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine3' The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -293,7 +293,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine4' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-xine4' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine4' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-xine4' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-xine4' The following extra packages will be installed: @@ -317,7 +317,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-broken' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-broken' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-broken' Selected version '5:4.20.0+exp' (experimental [i386]) for 'phonon-backend-null' because of 'amarok-broken' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-broken' The following extra packages will be installed: @@ -341,7 +341,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-utils' because of 'amarok-recommends' The following extra packages will be installed: amarok-common (2.3.2-2+exp) @@ -364,7 +364,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends' The following extra packages will be installed: amarok-common (2.3.2-2+exp) Recommended packages: @@ -385,7 +385,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a testequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends2' -Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-common' because of 'amarok-recommends2' +Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends2' The following extra packages will be installed: amarok-common (2.3.2-2+exp) libc6 (2.11.2-7+sid) @@ -406,7 +406,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a # if one depends doesn't work, we don't need to look deeper… testequal "Reading package lists... Building dependency tree... -Selected version '1.0' (experimental [i386]) for 'uninstallablepkg' +Selected version '1.0' (experimental [all]) for 'uninstallablepkg' Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created -- cgit v1.2.3 From 8aec002f1d3eb70423c760a68a9825a92bba7b2a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 26 Mar 2011 01:31:32 +0100 Subject: * apt-pkg/aptconfiguration.cc: - use dpkg --print-foreign-architectures to get multiarch configuration if non is specified with APT::Architectures (Closes: #612958) --- apt-pkg/aptconfiguration.cc | 33 +++++++++++- debian/changelog | 5 +- .../test-bug-612958-use-dpkg-multiarch-config | 59 ++++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100755 test/integration/test-bug-612958-use-dpkg-multiarch-config diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index b23e12acb..14ee09e0d 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -314,11 +315,41 @@ std::vector const Configuration::getArchitectures(bool const &Cache if (likely(Cached == true) && archs.empty() == false) return archs; - archs = _config->FindVector("APT::Architectures"); string const arch = _config->Find("APT::Architecture"); + archs = _config->FindVector("APT::Architectures"); + if (unlikely(arch.empty() == true)) return archs; + // FIXME: It is a bit unclean to have debian specific code here… + if (archs.empty() == true) { + archs.push_back(arch); + string dpkgcall = _config->Find("Dir::Bin::dpkg", "dpkg"); + std::vector const dpkgoptions = _config->FindVector("DPkg::options"); + for (std::vector::const_iterator o = dpkgoptions.begin(); + o != dpkgoptions.end(); ++o) + dpkgcall.append(" ").append(*o); + dpkgcall.append(" --print-foreign-architectures 2> /dev/null"); + FILE *dpkg = popen(dpkgcall.c_str(), "r"); + char buf[1024]; + if(dpkg != NULL) { + if (fgets(buf, sizeof(buf), dpkg) != NULL) { + char* arch = strtok(buf, " "); + while (arch != NULL) { + for (; isspace(*arch) != 0; ++arch); + if (arch != '\0') { + char const* archend = arch; + for (; isspace(*archend) == 0 && *archend != '\0'; ++archend); + archs.push_back(string(arch, (archend - arch))); + } + arch = strtok(NULL, " "); + } + } + pclose(dpkg); + } + return archs; + } + if (archs.empty() == true || std::find(archs.begin(), archs.end(), arch) == archs.end()) archs.push_back(arch); diff --git a/debian/changelog b/debian/changelog index b0bec1ba2..1c2cd9da7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,8 +21,11 @@ apt (0.8.13.1) UNRELEASED; urgency=low * apt-pkg/cacheiterator.h: - return "all" instead of native architecture without breaking the abi (too much) by extending enum instead of using bitflags (LP: #733741) + * apt-pkg/aptconfiguration.cc: + - use dpkg --print-foreign-architectures to get multiarch configuration + if non is specified with APT::Architectures (Closes: #612958) - -- David Kalnischkies Fri, 25 Mar 2011 22:07:59 +0100 + -- David Kalnischkies Sat, 26 Mar 2011 01:28:38 +0100 apt (0.8.13) unstable; urgency=low diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config new file mode 100755 index 000000000..4f31c3953 --- /dev/null +++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config @@ -0,0 +1,59 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' +setupaptarchive + +insertinstalledpackage 'libapt' 'i386' '1.0' +insertinstalledpackage 'libapt' 'amd64' '1.0' +insertinstalledpackage 'libapt' 'armel' '1.0' + +testpass() { + rm rootdir/var/cache/apt/*.bin + msgtest 'Test architecture handling' "$1 with $2" + aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail +} + +testfail() { + rm rootdir/var/cache/apt/*.bin + msgtest 'Test architecture handling' "$1 with $2" + aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass +} + +testpass 'no config' 'i386' +testfail 'no config' 'amd64' +testfail 'no config' 'armel' + +CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch +echo '#clear APT::Architectures;' >> $CONFFILE +echo 'APT::Architectures:: "i386";' >> $CONFFILE +echo 'APT::Architectures:: "amd64";' >> $CONFFILE + +testpass 'apt config' 'i386' +testpass 'apt config' 'amd64' +testfail 'apt config' 'armel' + +echo 'APT::Architectures:: "armel";' >> $CONFFILE + +testpass 'apt config' 'armel' + +rm $CONFFILE + +echo '#clear APT::Architectures;' >> $CONFFILE +echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE + +echo '#! /bin/sh +echo "amd64"' > ./dpkg-printer +chmod +x ./dpkg-printer + +testpass 'dpkg config' 'i386' +testpass 'dpkg config' 'amd64' +testfail 'dpkg config' 'armel' + +echo '#! /bin/sh +echo "amd64 armel"' > ./dpkg-printer + +testpass 'dpkg config' 'armel' -- cgit v1.2.3 From cc26da01ef43686d67959ef080e5492410d20e4e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 26 Mar 2011 12:41:51 +0100 Subject: do not change protected packages in autoinstall (Closes: #618848) --- apt-pkg/algorithms.h | 2 +- apt-pkg/depcache.cc | 19 +++++++++++-- apt-pkg/depcache.h | 3 +- debian/changelog | 3 +- ...est-bug-549968-install-depends-of-not-installed | 2 +- .../test-bug-618848-always-respect-user-requests | 32 ++++++++++++++++++++++ 6 files changed, 55 insertions(+), 6 deletions(-) create mode 100755 test/integration/test-bug-618848-always-respect-user-requests diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index cf4a98c4f..ebe31cc10 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -108,7 +108,7 @@ class pkgProblemResolver /*{{{*/ public: - inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected;}; + inline void Protect(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= Protected; Cache.MarkProtected(Pkg);}; inline void Remove(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] |= ToRemove;}; inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);}; diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 1c89bd32f..07803d7bf 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -964,11 +964,26 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, if (unlikely(Pkg.end() == true || Pkg->VersionList == 0)) return false; + // the user is always right + if (FromUser == true) + return true; + + StateCache &P = PkgState[Pkg->ID]; + + // if previous state was set by user only user can reset it + if ((P.iFlags & Protected) == Protected) + { + if (unlikely(DebugMarker == true) && P.Mode != mode) + std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode) + << " of " << Pkg << " as its mode (" << PrintMode(P.Mode) + << ") is protected" << std::endl; + return false; + } // enforce dpkg holds - if (FromUser == false && mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold && + else if (mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false) { - if (unlikely(DebugMarker == true) && PkgState[Pkg->ID].Mode != mode) + if (unlikely(DebugMarker == true) && P.Mode != mode) std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode) << " of " << Pkg << std::endl; return false; diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 8cf7db80a..750da3d6f 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -119,7 +119,7 @@ class pkgDepCache : protected pkgCache::Namespace DepCandPolicy = (1 << 4), DepCandMin = (1 << 5)}; // These flags are used in StateCache::iFlags - enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2)}; + enum InternalFlags {AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2), Protected = (1 << 3)}; enum VersionTypes {NowVersion, InstallVersion, CandidateVersion}; enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2}; @@ -393,6 +393,7 @@ class pkgDepCache : protected pkgCache::Namespace void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true, unsigned long Depth = 0, bool FromUser = true, bool ForceImportantDeps = false); + void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; }; void SetReInstall(PkgIterator const &Pkg,bool To); // FIXME: Remove the unused boolean parameter on abi break diff --git a/debian/changelog b/debian/changelog index 1c2cd9da7..2af2517e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ apt (0.8.13.1) UNRELEASED; urgency=low as suggested by Charles Plessy (Closes: #619083) * apt-pkg/depcache.cc: - remove pseudo handling leftover from SetReInstall + - do not change protected packages in autoinstall (Closes: #618848) * apt-pkg/pkgcachegen.cc: - make "all"->"native" an implementation detail of NewPackage rather than rewrite it in higher methods @@ -25,7 +26,7 @@ apt (0.8.13.1) UNRELEASED; urgency=low - use dpkg --print-foreign-architectures to get multiarch configuration if non is specified with APT::Architectures (Closes: #612958) - -- David Kalnischkies Sat, 26 Mar 2011 01:28:38 +0100 + -- David Kalnischkies Sat, 26 Mar 2011 12:26:32 +0100 apt (0.8.13) unstable; urgency=low diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index 7b4b4b71c..78c0801f2 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -17,7 +17,7 @@ setupaptarchive testequal 'Reading package lists... Building dependency tree... MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 - Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) + Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected Package extracoolstuff is not installed, so not removed The following NEW packages will be installed: coolstuff diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests new file mode 100755 index 000000000..5148be640 --- /dev/null +++ b/test/integration/test-bug-618848-always-respect-user-requests @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +insertinstalledpackage 'libdb4.8' 'all' '1.0' +insertinstalledpackage 'exim4' 'all' '1.0' 'Depends: exim4-daemon-light | exim4-daemon-heavy' +insertinstalledpackage 'exim4-daemon-light' 'all' '1.0' 'Depends: libdb4.8' +insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... + MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1 + MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1 + MarkInstall exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0 + Ignore MarkInstall of libdb4.8 [ i386 ] < 1.0 > ( other ) as its mode (Delete) is protected + MarkDelete exim4-daemon-heavy [ i386 ] < none -> 1.0 > ( other ) FU=0 + MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1 +The following packages will be REMOVED: + exim4 exim4-daemon-light libdb4.8 + MarkDelete exim4 [ i386 ] < 1.0 > ( other ) FU=1 +0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. +Remv exim4 [1.0] + MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=1 +Remv exim4-daemon-light [1.0] + MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1 +Remv libdb4.8 [1.0]' aptget remove libdb4.8 -s -o Debug::pkgDepCache::Marker=1 -- cgit v1.2.3 From ede85dc09f55a50d61b96186e1f98a4f13eb57ff Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 26 Mar 2011 12:53:51 +0100 Subject: * cmdline/apt-get.cc: - do not show simulation notice for non-root commands (Closes: #619072) --- cmdline/apt-get.cc | 5 ++++- debian/changelog | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6a30c5a50..c793b67a5 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -3278,7 +3278,10 @@ int main(int argc,const char *argv[]) /*{{{*/ } // simulate user-friendly if apt-get has no root privileges - if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true) + if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true && + (CmdL.FileSize() == 0 || + (strcmp(CmdL.FileList[0], "source") != 0 && strcmp(CmdL.FileList[0], "download") != 0 && + strcmp(CmdL.FileList[0], "changelog") != 0))) { if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true) cout << _("NOTE: This is only a simulation!\n" diff --git a/debian/changelog b/debian/changelog index 2af2517e1..8e15a8060 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,8 +25,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low * apt-pkg/aptconfiguration.cc: - use dpkg --print-foreign-architectures to get multiarch configuration if non is specified with APT::Architectures (Closes: #612958) + * cmdline/apt-get.cc: + - do not show simulation notice for non-root commands (Closes: #619072) - -- David Kalnischkies Sat, 26 Mar 2011 12:26:32 +0100 + -- David Kalnischkies Sat, 26 Mar 2011 12:53:00 +0100 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From 60dcec6d513859698177c10dabfc9db184363064 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 28 Mar 2011 12:29:38 +0200 Subject: * apt-pkg/deb/deblistparser.cc: - create foo:any provides for all architectures for an allowed package --- apt-pkg/deb/deblistparser.cc | 25 +++++++++++++------------ apt-pkg/deb/deblistparser.h | 1 + apt-pkg/pkgcache.cc | 10 +++++----- debian/changelog | 4 +++- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b79cef41c..4be626741 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -632,7 +632,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, while (1) { - Start = ParseDepends(Start,Stop,Package,Version,Op); + Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); @@ -685,27 +685,28 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } } - if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) + if (MultiArchEnabled == false) + return true; + else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) { string const Package = string(Ver.ParentPkg().Name()).append(":").append("any"); - NewProvides(Ver, Package, "any", Ver.VerStr()); + return NewProvidesAllArch(Ver, Package, Ver.VerStr()); } + else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign) + return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr()); - if (Ver->MultiArch != pkgCache::Version::Foreign && Ver->MultiArch != pkgCache::Version::AllForeign) - return true; - - if (MultiArchEnabled == false) - return true; - - string const Package = Ver.ParentPkg().Name(); - string const Version = Ver.VerStr(); + return true; +} + /*}}}*/ +// ListParser::NewProvides - add provides for all architectures /*{{{*/ +bool debListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, + string const &Version) { for (std::vector::const_iterator a = Architectures.begin(); a != Architectures.end(); ++a) { if (NewProvides(Ver, Package, *a, Version) == false) return false; } - return true; } /*}}}*/ diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 06ea73291..d62ce641c 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -40,6 +40,7 @@ class debListParser : public pkgCacheGenerator::ListParser bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, unsigned int Type); bool ParseProvides(pkgCache::VerIterator &Ver); + bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version); static bool GrabWord(string Word,WordList *List,unsigned char &Out); public: diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index dbcbd9c26..c6326abf1 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -317,6 +317,11 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { if (unlikely(IsGood() == false || S->FirstPackage == 0)) return PkgIterator(*Owner, 0); + /* If we accept any package we simply return the "first" + package in this group (the last one added). */ + if (Arch == "any") + return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage); + static string const myArch = _config->Find("APT::Architecture"); /* Most of the time the package for our native architecture is the one we add at first to the cache, but this would be the @@ -328,11 +333,6 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { return PkgIterator(*Owner, Pkg); } - /* If we accept any package we simply return the "first" - package in this group (the last one added). */ - if (Arch == "any") - return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage); - /* Iterate over the list to find the matching arch unfortunately this list includes "package noise" (= different packages with same calculated hash), diff --git a/debian/changelog b/debian/changelog index 8e15a8060..774975050 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,8 +27,10 @@ apt (0.8.13.1) UNRELEASED; urgency=low if non is specified with APT::Architectures (Closes: #612958) * cmdline/apt-get.cc: - do not show simulation notice for non-root commands (Closes: #619072) + * apt-pkg/deb/deblistparser.cc: + - create foo:any provides for all architectures for an allowed package - -- David Kalnischkies Sat, 26 Mar 2011 12:53:00 +0100 + -- David Kalnischkies Mon, 28 Mar 2011 12:28:21 +0200 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From 71d73928ae58d6faf81e7405830881e47281f423 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 28 Mar 2011 14:10:49 +0200 Subject: be able to disable resolver with APT::Get::AutoSolving --- cmdline/apt-get.cc | 66 +++++++++++++++++++++++++++++++++++++----------------- debian/changelog | 3 ++- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index c793b67a5..d71b6fba7 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -764,7 +764,7 @@ struct TryToInstall { unsigned long AutoMarkChanged; APT::PackageSet doAutoInstallLater; - TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM), + TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const &FixBroken) : Cache(&Cache), Fix(PM), FixBroken(FixBroken), AutoMarkChanged(0) {}; void operator() (pkgCache::VerIterator const &Ver) { @@ -782,8 +782,10 @@ struct TryToInstall { ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"), Pkg.FullName(true).c_str()); else { - Fix->Clear(Pkg); - Fix->Protect(Pkg); + if (Fix != NULL) { + Fix->Clear(Pkg); + Fix->Protect(Pkg); + } Cache->GetDepCache()->MarkInstall(Pkg,false); if (State.Install() == false) { @@ -871,16 +873,19 @@ struct TryToRemove { bool PurgePkgs; unsigned long AutoMarkChanged; - TryToRemove(pkgCacheFile &Cache, pkgProblemResolver &PM) : Cache(&Cache), Fix(&PM), + TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM), PurgePkgs(_config->FindB("APT::Get::Purge", false)) {}; void operator() (pkgCache::VerIterator const &Ver) { pkgCache::PkgIterator Pkg = Ver.ParentPkg(); - Fix->Clear(Pkg); - Fix->Protect(Pkg); - Fix->Remove(Pkg); + if (Fix != NULL) + { + Fix->Clear(Pkg); + Fix->Protect(Pkg); + Fix->Remove(Pkg); + } if ((Pkg->CurrentVer == 0 && PurgePkgs == false) || (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled)) @@ -1385,10 +1390,10 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, if (Remove == true) { - TryToRemove RemoveAction(Cache, Fix); + TryToRemove RemoveAction(Cache, &Fix); RemoveAction(Pkg.VersionList()); } else if (Cache[Pkg].CandidateVer != 0) { - TryToInstall InstallAction(Cache, Fix, BrokenFix); + TryToInstall InstallAction(Cache, &Fix, BrokenFix); InstallAction(Cache[Pkg].CandidateVerIter(Cache)); InstallAction.doAutoInstall(); } else @@ -1791,8 +1796,10 @@ bool DoInstall(CommandLine &CmdL) bool BrokenFix = false; if (Cache->BrokenCount() != 0) BrokenFix = true; - - pkgProblemResolver Fix(Cache); + + pkgProblemResolver* Fix = NULL; + if (_config->FindB("APT::Get::AutoSolving", true) == true) + Fix = new pkgProblemResolver(Cache); static const unsigned short MOD_REMOVE = 1; static const unsigned short MOD_INSTALL = 2; @@ -1823,6 +1830,8 @@ bool DoInstall(CommandLine &CmdL) if (_error->PendingError() == true) { helper.showVirtualPackageErrors(Cache); + if (Fix != NULL) + delete Fix; return false; } @@ -1837,17 +1846,29 @@ bool DoInstall(CommandLine &CmdL) for (unsigned short i = 0; order[i] != 0; ++i) { - if (order[i] == MOD_INSTALL) { + if (order[i] == MOD_INSTALL) InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction); + else if (order[i] == MOD_REMOVE) + RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction); + } + + if (Fix != NULL) + { + for (unsigned short i = 0; order[i] != 0; ++i) + { + if (order[i] != MOD_INSTALL) + continue; InstallAction.propergateReleaseCandiateSwitching(helper.selectedByRelease, c0out); InstallAction.doAutoInstall(); } - else if (order[i] == MOD_REMOVE) - RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction); } if (_error->PendingError() == true) + { + if (Fix != NULL) + delete Fix; return false; + } /* If we are in the Broken fixing mode we do not attempt to fix the problems. This is if the user invoked install without -f and gave @@ -1856,14 +1877,19 @@ bool DoInstall(CommandLine &CmdL) { c1out << _("You might want to run 'apt-get -f install' to correct these:") << endl; ShowBroken(c1out,Cache,false); - + if (Fix != NULL) + delete Fix; return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).")); } - - // Call the scored problem resolver - Fix.InstallProtect(); - if (Fix.Resolve(true) == false) - _error->Discard(); + + if (Fix != NULL) + { + // Call the scored problem resolver + Fix->InstallProtect(); + if (Fix->Resolve(true) == false) + _error->Discard(); + delete Fix; + } // Now we check the state of the packages, if (Cache->BrokenCount() != 0) diff --git a/debian/changelog b/debian/changelog index 774975050..ed60a3047 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,10 +27,11 @@ apt (0.8.13.1) UNRELEASED; urgency=low if non is specified with APT::Architectures (Closes: #612958) * cmdline/apt-get.cc: - do not show simulation notice for non-root commands (Closes: #619072) + - be able to disable resolver with APT::Get::AutoSolving * apt-pkg/deb/deblistparser.cc: - create foo:any provides for all architectures for an allowed package - -- David Kalnischkies Mon, 28 Mar 2011 12:28:21 +0200 + -- David Kalnischkies Mon, 28 Mar 2011 14:10:43 +0200 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From 92d956ea4d68789fa6d15702a4c2336039dcdb0f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 29 Mar 2011 13:13:25 +0200 Subject: be able to disable resolver with APT::Get::CallResolver and disable auto installation with APT::Get::AutoSolving --- cmdline/apt-get.cc | 4 ++-- debian/changelog | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index d71b6fba7..6ffecd777 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1798,7 +1798,7 @@ bool DoInstall(CommandLine &CmdL) BrokenFix = true; pkgProblemResolver* Fix = NULL; - if (_config->FindB("APT::Get::AutoSolving", true) == true) + if (_config->FindB("APT::Get::CallResolver", true) == true) Fix = new pkgProblemResolver(Cache); static const unsigned short MOD_REMOVE = 1; @@ -1852,7 +1852,7 @@ bool DoInstall(CommandLine &CmdL) RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction); } - if (Fix != NULL) + if (Fix != NULL && _config->FindB("APT::Get::AutoSolving", true) == true) { for (unsigned short i = 0; order[i] != 0; ++i) { diff --git a/debian/changelog b/debian/changelog index ed60a3047..e669077fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,11 +27,12 @@ apt (0.8.13.1) UNRELEASED; urgency=low if non is specified with APT::Architectures (Closes: #612958) * cmdline/apt-get.cc: - do not show simulation notice for non-root commands (Closes: #619072) - - be able to disable resolver with APT::Get::AutoSolving + - be able to disable resolver with APT::Get::CallResolver and disable + auto installation with APT::Get::AutoSolving * apt-pkg/deb/deblistparser.cc: - create foo:any provides for all architectures for an allowed package - -- David Kalnischkies Mon, 28 Mar 2011 14:10:43 +0200 + -- David Kalnischkies Tue, 29 Mar 2011 13:12:45 +0200 apt (0.8.13) unstable; urgency=low -- cgit v1.2.3 From 8ff84cf381c254565aa3e1837265f9991909e576 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 2 Apr 2011 17:42:01 +0200 Subject: impossible to be too long but just to be sure use snprintf --- apt-pkg/contrib/strutl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 2e2bb5ebc..ace738d7a 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -699,7 +699,7 @@ string TimeRFC1123(time_t Date) const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul", "Aug","Sep","Oct","Nov","Dec"}; - sprintf(Buf,"%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday], + snprintf(Buf, sizeof(Buf), "%s, %02i %s %i %02i:%02i:%02i GMT",Day[Conv.tm_wday], Conv.tm_mday,Month[Conv.tm_mon],Conv.tm_year+1900,Conv.tm_hour, Conv.tm_min,Conv.tm_sec); return Buf; -- cgit v1.2.3 From 410327e1ee0fac0c28a95e45ea75f7359cc8dcb4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 2 Apr 2011 17:59:10 +0200 Subject: let TimeRFC1123 return an empty string if gmtime() fails --- apt-pkg/contrib/strutl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index ace738d7a..072dda3ac 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -692,9 +692,11 @@ int StringToBool(const string &Text,int Default) year 2000 complient and timezone neutral */ string TimeRFC1123(time_t Date) { - struct tm Conv = *gmtime(&Date); - char Buf[300]; + struct tm Conv; + if (gmtime_r(&Date, &Conv) == NULL) + return ""; + char Buf[300]; const char *Day[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; const char *Month[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul", "Aug","Sep","Oct","Nov","Dec"}; -- cgit v1.2.3