diff options
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-cache.cc | 2 | ||||
-rw-r--r-- | cmdline/apt-cdrom.cc | 2 | ||||
-rw-r--r-- | cmdline/apt-config.cc | 12 | ||||
-rw-r--r-- | cmdline/apt-dump-solver.cc | 2 | ||||
-rw-r--r-- | cmdline/apt-extracttemplates.cc | 8 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 169 | ||||
-rw-r--r-- | cmdline/apt-internal-solver.cc | 17 | ||||
-rwxr-xr-x | cmdline/apt-key | 47 | ||||
-rw-r--r-- | cmdline/apt-mark.cc | 4 | ||||
-rw-r--r-- | cmdline/apt-sortpkgs.cc | 2 | ||||
-rw-r--r-- | cmdline/makefile | 33 |
11 files changed, 194 insertions, 104 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 94654ffd4..ce869581b 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1676,7 +1676,7 @@ bool GenCaches(CommandLine &Cmd) /* */ bool ShowHelp(CommandLine &Cmd) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 0017d954e..2551f4916 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -195,7 +195,7 @@ bool DoIdent(CommandLine &) /* */ int ShowHelp() { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) return 0; diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 47bedfe3f..397ce32df 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -63,7 +63,13 @@ bool DoShell(CommandLine &CmdL) /* */ bool DoDump(CommandLine &CmdL) { - _config->Dump(cout); + bool const empty = _config->FindB("APT::Config::Dump::EmptyValue", true); + std::string const format = _config->Find("APT::Config::Dump::Format", "%f \"%v\";\n"); + if (CmdL.FileSize() == 1) + _config->Dump(cout, NULL, format.c_str(), empty); + else + for (const char **I = CmdL.FileList + 1; *I != 0; ++I) + _config->Dump(cout, *I, format.c_str(), empty); return true; } /*}}}*/ @@ -72,7 +78,7 @@ bool DoDump(CommandLine &CmdL) /* */ int ShowHelp() { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) return 0; @@ -100,6 +106,8 @@ int main(int argc,const char *argv[]) /*{{{*/ {'v',"version","version",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, + {0,"empty","APT::Config::Dump::EmptyValue",CommandLine::Boolean}, + {0,"format","APT::Config::Dump::Format",CommandLine::HasArg}, {0,0,0,0}}; CommandLine::Dispatch Cmds[] = {{"shell",&DoShell}, {"dump",&DoDump}, diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index e82e15c6e..aa16b1271 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -21,7 +21,7 @@ bool ShowHelp() { std::cout << - PACKAGE " " VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl << + PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl << "Usage: apt-dump-resolver\n" "\n" "apt-dump-resolver is a dummy solver who just dumps its input to the\n" diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index dc4c110a1..8fe15fdf9 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -36,11 +36,13 @@ #include <string.h> #include <stdlib.h> #include <unistd.h> +#include <locale.h> + #include <fstream> -#include <locale.h> -#include <apti18n.h> #include "apt-extracttemplates.h" + +#include <apti18n.h> /*}}}*/ using namespace std; @@ -224,7 +226,7 @@ bool DebFile::ParseInfo() /* */ int ShowHelp(void) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index f4ad75d1c..ccbe54384 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -254,6 +254,9 @@ bool ShowList(ostream &out,string Title,string List,string VersionsList) */ void ShowBroken(ostream &out,CacheFile &Cache,bool Now) { + if (Cache->BrokenCount() == 0) + return; + out << _("The following packages have unmet dependencies:") << endl; for (unsigned J = 0; J < Cache->Head().PackageCount; J++) { @@ -1415,7 +1418,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, "all files have been overwritten by other packages:", "The following packages disappeared from your system as\n" "all files have been overwritten by other packages:", disappearedPkgs.size()), disappear, ""); - c0out << _("Note: This is done automatic and on purpose by dpkg.") << std::endl; + c0out << _("Note: This is done automatically and on purpose by dpkg.") << std::endl; return true; } @@ -1679,10 +1682,13 @@ bool DoUpdate(CommandLine &CmdL) ListUpdate(Stat, *List); // Rebuild the cache. - pkgCacheFile::RemoveCaches(); - if (Cache.BuildCaches() == false) - return false; - + if (_config->FindB("pkgCacheFile::Generate", true) == true) + { + pkgCacheFile::RemoveCaches(); + if (Cache.BuildCaches() == false) + return false; + } + return true; } /*}}}*/ @@ -1711,12 +1717,13 @@ bool DoAutomaticRemove(CacheFile &Cache) bool smallList = (hideAutoRemove == false && strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0); - string autoremovelist, autoremoveversions; unsigned long autoRemoveCount = 0; APT::PackageSet tooMuch; + APT::PackageList autoRemoveList; // look over the cache to see what can be removed - for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) + for (unsigned J = 0; J < Cache->Head().PackageCount; ++J) { + pkgCache::PkgIterator Pkg(Cache,Cache.List[J]); if (Cache[Pkg].Garbage) { if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install()) @@ -1733,6 +1740,8 @@ bool DoAutomaticRemove(CacheFile &Cache) } else { + if (hideAutoRemove == false && Cache[Pkg].Delete() == false) + autoRemoveList.insert(Pkg); // if the package is a new install and already garbage we don't need to // install it in the first place, so nuke it instead of show it if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0) @@ -1742,16 +1751,8 @@ bool DoAutomaticRemove(CacheFile &Cache) Cache->MarkDelete(Pkg, false); } // only show stuff in the list that is not yet marked for removal - else if(hideAutoRemove == false && Cache[Pkg].Delete() == false) - { + else if(hideAutoRemove == false && Cache[Pkg].Delete() == false) ++autoRemoveCount; - // we don't need to fill the strings if we don't need them - if (smallList == false) - { - autoremovelist += Pkg.FullName(true) + " "; - autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; - } - } } } } @@ -1786,14 +1787,7 @@ bool DoAutomaticRemove(CacheFile &Cache) std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl; Cache->MarkInstall(Pkg, false); if (hideAutoRemove == false) - { ++autoRemoveCount; - if (smallList == false) - { - autoremovelist += Pkg.FullName(true) + " "; - autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; - } - } tooMuch.erase(Pkg); Changed = true; break; @@ -1803,6 +1797,18 @@ bool DoAutomaticRemove(CacheFile &Cache) } while (Changed == true); } + std::string autoremovelist, autoremoveversions; + if (smallList == false && autoRemoveCount != 0) + { + for (APT::PackageList::const_iterator Pkg = autoRemoveList.begin(); Pkg != autoRemoveList.end(); ++Pkg) + { + if (Cache[Pkg].Garbage == false) + continue; + autoremovelist += Pkg.FullName(true) + " "; + autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; + } + } + // Now see if we had destroyed anything (if we had done anything) if (Cache->BrokenCount() != 0) { @@ -1826,7 +1832,7 @@ bool DoAutomaticRemove(CacheFile &Cache) else ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n", "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount); - c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl; + c1out << P_("Use 'apt-get autoremove' to remove it.", "Use 'apt-get autoremove' to remove them.", autoRemoveCount) << std::endl; } return true; } @@ -2356,6 +2362,8 @@ bool DoDownload(CommandLine &CmdL) pkgRecords Recs(Cache); pkgSourceList *SrcList = Cache.GetSourceList(); + bool gotAll = true; + for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) @@ -2366,11 +2374,19 @@ bool DoDownload(CommandLine &CmdL) pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList()); pkgCache::VerFileIterator Vf = Ver.FileList(); if (Vf.end() == true) - return _error->Error("Can not find VerFile"); + { + _error->Error("Can not find VerFile for %s in version %s", Pkg.FullName().c_str(), Ver.VerStr()); + gotAll = false; + continue; + } pkgCache::PkgFileIterator F = Vf.File(); pkgIndexFile *index; if(SrcList->FindIndex(F, index) == false) - return _error->Error("FindIndex failed"); + { + _error->Error(_("Can't find a source to download version '%s' of '%s'"), Ver.VerStr(), Pkg.FullName().c_str()); + gotAll = false; + continue; + } string uri = index->ArchiveURI(rec.FileName()); strprintf(descr, _("Downloading %s %s"), Pkg.Name(), Ver.VerStr()); // get the most appropriate hash @@ -2386,6 +2402,8 @@ bool DoDownload(CommandLine &CmdL) // get the file new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), "."); } + if (gotAll == false) + return false; // Just print out the uris and exit if the --print-uris flag was used if (_config->FindB("APT::Get::Print-URIs") == true) @@ -2493,7 +2511,7 @@ bool DoSource(CommandLine &CmdL) Src.c_str(), vcs.c_str(), uri.c_str()); if(vcs == "Bzr") ioprintf(c1out,_("Please use:\n" - "bzr get %s\n" + "bzr branch %s\n" "to retrieve the latest (possibly unreleased) " "updates to the package.\n"), uri.c_str()); @@ -2786,8 +2804,18 @@ bool DoBuildDep(CommandLine &CmdL) // Process the build-dependencies vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps; - if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch) == false) - return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str()); + // FIXME: Can't specify architecture to use for [wildcard] matching, so switch default arch temporary + if (hostArch.empty() == false) + { + std::string nativeArch = _config->Find("APT::Architecture"); + _config->Set("APT::Architecture", hostArch); + bool Success = Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch); + _config->Set("APT::Architecture", nativeArch); + if (Success == false) + return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str()); + } + else if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch) == false) + return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str()); // Also ensure that build-essential packages are present Configuration::Item const *Opts = _config->Tree("APT::Build-Essential"); @@ -2864,7 +2892,7 @@ bool DoBuildDep(CommandLine &CmdL) pkgCache::PkgIterator Pkg; // Cross-Building? - if (StripMultiArch == false) + if (StripMultiArch == false && D->Type != pkgSrcRecords::Parser::BuildDependIndep) { size_t const colon = D->Package.find(":"); if (colon != string::npos && @@ -2873,39 +2901,48 @@ bool DoBuildDep(CommandLine &CmdL) else Pkg = Cache->FindPkg(D->Package); - // We need to decide if host or build arch, so find a version we can look at - pkgCache::VerIterator Ver; - // a bad version either is invalid or doesn't satify dependency - #define BADVER(Ver) Ver.end() == true || \ - (Ver.end() == false && D->Version.empty() == false && \ - Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false) + #define BADVER(Ver) (Ver.end() == true || \ + (D->Version.empty() == false && \ + Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false)) + APT::VersionList verlist; if (Pkg.end() == false) { - Ver = (*Cache)[Pkg].InstVerIter(*Cache); - if (BADVER(Ver)) - Ver = (*Cache)[Pkg].CandidateVerIter(*Cache); + pkgCache::VerIterator Ver = (*Cache)[Pkg].InstVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); + Ver = (*Cache)[Pkg].CandidateVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); } - if (BADVER(Ver)) + if (verlist.empty() == true) { pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch); if (HostPkg.end() == false) { - Ver = (*Cache)[HostPkg].InstVerIter(*Cache); - if (BADVER(Ver)) - Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache); + pkgCache::VerIterator Ver = (*Cache)[HostPkg].InstVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); + Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); } } - if ((BADVER(Ver)) == false) + #undef BADVER + + string forbidden; + // We need to decide if host or build arch, so find a version we can look at + APT::VersionList::const_iterator Ver = verlist.begin(); + for (; Ver != verlist.end(); ++Ver) { - string forbidden; - if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All) + forbidden.clear(); + if (Ver->MultiArch == pkgCache::Version::None) { if (colon == string::npos) - { Pkg = Ver.ParentPkg().Group().FindPkg(hostArch); - } + else if (strcmp(D->Package.c_str() + colon, ":any") == 0) + forbidden = "Multi-Arch: none"; } else if (Ver->MultiArch == pkgCache::Version::Same) { @@ -2915,7 +2952,7 @@ bool DoBuildDep(CommandLine &CmdL) forbidden = "Multi-Arch: same"; // :native gets the buildArch } - else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) + else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::All) { if (colon != string::npos) forbidden = "Multi-Arch: foreign"; @@ -2937,21 +2974,32 @@ bool DoBuildDep(CommandLine &CmdL) } // native gets buildArch } + if (forbidden.empty() == false) { if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " :any is not allowed from M-A: same package " << (*D).Package << endl; + cout << D->Package.substr(colon, string::npos) << " is not allowed from " << forbidden << " package " << (*D).Package << " (" << Ver.VerStr() << ")" << endl; + continue; + } + + //we found a good version + break; + } + if (Ver == verlist.end()) + { + if (_config->FindB("Debug::BuildDeps",false) == true) + cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl; + + if (forbidden.empty() == false) + { if (hasAlternatives) continue; return _error->Error(_("%s dependency for %s can't be satisfied " "because %s is not allowed on '%s' packages"), Last->BuildDepType(D->Type), Src.c_str(), - D->Package.c_str(), "Multi-Arch: same"); + D->Package.c_str(), forbidden.c_str()); } } - else if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl; - #undef BADVER } else Pkg = Cache->FindPkg(D->Package); @@ -3191,7 +3239,10 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, return true; // error - return _error->Error("changelog download failed"); + pkgRecords Recs(CacheFile); + pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList()); + string srcpkg = rec.SourcePkg().empty() ? Pkg.Name() : rec.SourcePkg(); + return _error->Error("changelog for this version is not (yet) available; try https://launchpad.net/ubuntu/+source/%s/+changelog", srcpkg.c_str()); } /*}}}*/ // DisplayFileInPager - Display File with pager /*{{{*/ @@ -3228,9 +3279,13 @@ bool DoChangelog(CommandLine &CmdL) pkgAcquire Fetcher; if (_config->FindB("APT::Get::Print-URIs", false) == true) + { + bool Success = true; for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) - return DownloadChangelog(Cache, Fetcher, Ver, ""); + Success &= DownloadChangelog(Cache, Fetcher, Ver, ""); + return Success; + } AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); Fetcher.Setup(&Stat); @@ -3295,7 +3350,7 @@ bool DoMoo(CommandLine &CmdL) /* */ bool ShowHelp(CommandLine &CmdL) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 1b636e4d5..aef7636e9 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -7,6 +7,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <config.h> + #include <apt-pkg/error.h> #include <apt-pkg/cmndline.h> #include <apt-pkg/init.h> @@ -18,33 +20,30 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/pkgsystem.h> -#include <config.h> -#include <apti18n.h> - #include <unistd.h> #include <cstdio> + +#include <apti18n.h> /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ bool ShowHelp(CommandLine &CmdL) { - ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); std::cout << - _("Usage: apt-internal-resolver\n" + _("Usage: apt-internal-solver\n" "\n" - "apt-internal-resolver is an interface to use the current internal\n" + "apt-internal-solver is an interface to use the current internal\n" "like an external resolver for the APT family for debugging or alike\n" "\n" "Options:\n" " -h This help text.\n" " -q Loggable output - no progress indicator\n" " -c=? Read this configuration file\n" - " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n" - "apt.conf(5) manual pages for more information and options.\n" - " This APT has Super Cow Powers.\n"); + " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"); return true; } /*}}}*/ diff --git a/cmdline/apt-key b/cmdline/apt-key index 97d6e0323..166508c8e 100755 --- a/cmdline/apt-key +++ b/cmdline/apt-key @@ -11,18 +11,19 @@ GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-k if [ "$(id -u)" -eq 0 ]; then # we could use a tmpfile here too, but creation of this tends to be time-consuming - GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg" + eval $(apt-config shell TRUSTDBDIR Dir::Etc/d) + GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg" fi GPG="$GPG_CMD" -MASTER_KEYRING="" -ARCHIVE_KEYRING_URI="" -#MASTER_KEYRING=/usr/share/keyrings/debian-master-keyring.gpg -#ARCHIVE_KEYRING_URI=http://ftp.debian.org/debian/debian-archive-keyring.gpg -ARCHIVE_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg -REMOVED_KEYS=/usr/share/keyrings/debian-archive-removed-keys.gpg +# ubuntu keyrings +MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg +ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg +REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg +ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg +TMP_KEYRING=/var/lib/apt/keyrings/maybe-import-keyring.gpg requires_root() { if [ "$(id -u)" -ne 0 ]; then @@ -34,7 +35,7 @@ requires_root() { add_keys_with_verify_against_master_keyring() { ADD_KEYRING=$1 MASTER=$2 - + if [ ! -f "$ADD_KEYRING" ]; then echo "ERROR: '$ADD_KEYRING' not found" return @@ -49,12 +50,28 @@ add_keys_with_verify_against_master_keyring() { # all keys that are exported must have a valid signature # from a key in the $distro-master-keyring add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^pub | cut -d: -f5` + all_add_keys=`$GPG_CMD --keyring $ADD_KEYRING --with-colons --list-keys | grep ^[ps]ub | cut -d: -f5` master_keys=`$GPG_CMD --keyring $MASTER --with-colons --list-keys | grep ^pub | cut -d: -f5` + + # ensure there are no colisions LP: #857472 + for all_add_key in $all_add_keys; do + for master_key in $master_keys; do + if [ "$all_add_key" = "$master_key" ]; then + echo >&2 "Keyid collision for '$all_add_key' detected, operation aborted" + return 1 + fi + done + done + for add_key in $add_keys; do - ADDED=0 + # export the add keyring one-by-one + rm -f $TMP_KEYRING + $GPG_CMD --keyring $ADD_KEYRING --output $TMP_KEYRING --export $add_key + # check if signed with the master key and only add in this case + ADDED=0 for master_key in $master_keys; do - if $GPG_CMD --keyring $ADD_KEYRING --list-sigs --with-colons $add_key | grep ^sig | cut -d: -f5 | grep -q $master_key; then - $GPG_CMD --quiet --batch --keyring $ADD_KEYRING --export $add_key | $GPG --import + if $GPG_CMD --keyring $MASTER --keyring $TMP_KEYRING --check-sigs --with-colons $add_key | grep '^sig:!:' | cut -d: -f5 | grep -q $master_key; then + $GPG --import $TMP_KEYRING ADDED=1 fi done @@ -62,12 +79,16 @@ add_keys_with_verify_against_master_keyring() { echo >&2 "Key '$add_key' not added. It is not signed with a master key" fi done + rm -f $TMP_KEYRING } # update the current archive signing keyring from a network URI # the archive-keyring keys needs to be signed with the master key # (otherwise it does not make sense from a security POV) net_update() { + # Disabled for now as code is insecure (LP: #1013639 (and 857472, 1013128)) + exit 1 + if [ -z "$ARCHIVE_KEYRING_URI" ]; then echo >&2 "ERROR: Your distribution is not supported in net-update as no uri for the archive-keyring is set" exit 1 @@ -87,7 +108,7 @@ net_update() { if [ -e $keyring ]; then old_mtime=$(stat -c %Y $keyring) fi - (cd /var/lib/apt/keyrings; wget -q -N $ARCHIVE_KEYRING_URI) + (cd /var/lib/apt/keyrings; wget --timeout=90 -q -N $ARCHIVE_KEYRING_URI) if [ ! -e $keyring ]; then return fi @@ -101,7 +122,7 @@ net_update() { update() { if [ ! -f $ARCHIVE_KEYRING ]; then echo >&2 "ERROR: Can't find the archive-keyring" - echo >&2 "Is the debian-archive-keyring package installed?" + echo >&2 "Is the ubuntu-keyring package installed?" exit 1 fi requires_root diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index ef4331714..2a093c55a 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -360,14 +360,14 @@ bool ShowHold(CommandLine &CmdL) /* */ bool ShowHelp(CommandLine &CmdL) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); cout << _("Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]\n" "\n" "apt-mark is a simple command line interface for marking packages\n" - "as manual or automatical installed. It can also list marks.\n" + "as manually or automatically installed. It can also list marks.\n" "\n" "Commands:\n" " auto - Mark the given packages as automatically installed\n" diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 20ae14f2a..46989044e 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -144,7 +144,7 @@ bool DoIt(string InFile) /* */ int ShowHelp() { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) return 0; diff --git a/cmdline/makefile b/cmdline/makefile index 07e9eb8ca..f3712232a 100644 --- a/cmdline/makefile +++ b/cmdline/makefile @@ -33,20 +33,6 @@ LIB_MAKES = apt-pkg/makefile SOURCE = apt-cdrom.cc include $(PROGRAM_H) -# The apt-sortpkgs program -PROGRAM=apt-sortpkgs -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = apt-sortpkgs.cc -include $(PROGRAM_H) - -# The apt-extracttemplates program -PROGRAM=apt-extracttemplates -SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = apt-extracttemplates.cc -include $(PROGRAM_H) - # The apt-key program SOURCE=apt-key TO=$(BIN) @@ -66,6 +52,25 @@ include $(PROGRAM_H) #TARGET=program #include $(COPY_H) +# +# the following programs are shipped in apt-utils +# +APT_DOMAIN:=apt-utils + +# The apt-sortpkgs program +PROGRAM=apt-sortpkgs +SLIBS = -lapt-pkg $(INTLLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = apt-sortpkgs.cc +include $(PROGRAM_H) + +# The apt-extracttemplates program +PROGRAM=apt-extracttemplates +SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = apt-extracttemplates.cc +include $(PROGRAM_H) + # The internal solver acting as an external PROGRAM=apt-internal-solver SLIBS = -lapt-pkg $(INTLLIBS) |