diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-05-22 16:07:49 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-05-22 16:07:49 +0200 |
commit | 800694cbf33e206935dc9e6e8fa6e9a036b8efad (patch) | |
tree | 1557d96ee0f463a020b11604146be66fb9809a31 /cmdline | |
parent | 6c0c0387e616f8d04f00916fbd1fe899acd265cd (diff) | |
parent | 1351329e376a8dbe7780693693d0f3db0ec749fa (diff) |
merged (and resolved a bunch of conflicts) of the debian-sid branch
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-cache.cc | 4 | ||||
-rw-r--r-- | cmdline/apt-cdrom.cc | 9 | ||||
-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 | 116 | ||||
-rw-r--r-- | cmdline/apt-internal-solver.cc | 9 | ||||
-rw-r--r-- | cmdline/apt-mark.cc | 138 | ||||
-rw-r--r-- | cmdline/apt-sortpkgs.cc | 2 | ||||
-rw-r--r-- | cmdline/makefile | 33 |
10 files changed, 247 insertions, 86 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 1cd5080cc..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) @@ -1739,7 +1739,7 @@ int main(int argc,const char *argv[]) /*{{{*/ {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,"installed","APT::Cache::Installed",0}, - {0,"pre-depends","APT::Cache::ShowPreDepends",0}, + {0,"pre-depends","APT::Cache::ShowPre-Depends",0}, {0,"depends","APT::Cache::ShowDepends",0}, {0,"recommends","APT::Cache::ShowRecommends",0}, {0,"suggests","APT::Cache::ShowSuggests",0}, diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index fa48debcd..2551f4916 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -150,10 +150,9 @@ bool DoAdd(CommandLine &) bool res = true; bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); - unsigned int count = 0; - if (AutoDetect && UdevCdroms.Dlopen()) { + unsigned int count = 0; while (AutoDetectCdrom(UdevCdroms, count)) res &= cdrom.Add(&log); } else { @@ -178,10 +177,10 @@ bool DoIdent(CommandLine &) bool res = true; bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect"); - unsigned int count = 0; - + if (AutoDetect && UdevCdroms.Dlopen()) { + unsigned int count = 0; while (AutoDetectCdrom(UdevCdroms, count)) res &= cdrom.Ident(ident, &log); } else { @@ -196,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 7c7e94eba..1c6d39824 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -713,11 +713,32 @@ public: } virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { - APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::NEWEST); - if (verset.empty() == false) - return *(verset.begin()); - if (ShowError == true) - ioprintf(out, _("Virtual packages like '%s' can't be removed\n"), Pkg.FullName(true).c_str()); + if (Pkg->ProvidesList != 0) + { + APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::NEWEST); + if (verset.empty() == false) + return *(verset.begin()); + if (ShowError == true) + ioprintf(out, _("Virtual packages like '%s' can't be removed\n"), Pkg.FullName(true).c_str()); + } + else + { + pkgCache::GrpIterator Grp = Pkg.Group(); + pkgCache::PkgIterator P = Grp.PackageList(); + for (; P.end() != true; P = Grp.NextPkg(P)) + { + if (P == Pkg) + continue; + if (P->CurrentVer != 0) { + // TRANSLATORS: Note, this is not an interactive question + ioprintf(c1out,_("Package '%s' is not installed, so not removed. Did you mean '%s'?\n"), + Pkg.FullName(true).c_str(), P.FullName(true).c_str()); + break; + } + } + if (P.end() == true) + ioprintf(c1out,_("Package '%s' is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + } return pkgCache::VerIterator(Cache, 0); } @@ -904,7 +925,23 @@ struct TryToRemove { if ((Pkg->CurrentVer == 0 && PurgePkgs == false) || (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled)) { - ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + pkgCache::GrpIterator Grp = Pkg.Group(); + pkgCache::PkgIterator P = Grp.PackageList(); + for (; P.end() != true; P = Grp.NextPkg(P)) + { + if (P == Pkg) + continue; + if (P->CurrentVer != 0 || (PurgePkgs == true && P->CurrentState != pkgCache::State::NotInstalled)) + { + // TRANSLATORS: Note, this is not an interactive question + ioprintf(c1out,_("Package '%s' is not installed, so not removed. Did you mean '%s'?\n"), + Pkg.FullName(true).c_str(), P.FullName(true).c_str()); + break; + } + } + if (P.end() == true) + ioprintf(c1out,_("Package '%s' is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + // MarkInstall refuses to install packages on hold Pkg->SelectedState = pkgCache::State::Hold; } @@ -1378,7 +1415,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; } @@ -1642,10 +1679,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; } /*}}}*/ @@ -1674,12 +1714,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()) @@ -1696,6 +1737,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) @@ -1705,16 +1748,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"; - } - } } } } @@ -1749,14 +1784,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; @@ -1766,6 +1794,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) { @@ -1789,7 +1829,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; } @@ -2749,8 +2789,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"); @@ -3261,7 +3311,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..e7faf88a9 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,18 +20,17 @@ #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 << diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index c7d9b6f6a..2d5eed29d 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -14,9 +14,15 @@ #include <apt-pkg/init.h> #include <apt-pkg/strutl.h> #include <apt-pkg/pkgsystem.h> +#include <apt-pkg/fileutl.h> #include <algorithm> +#include <errno.h> #include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <fcntl.h> #include <apti18n.h> /*}}}*/ @@ -158,13 +164,63 @@ bool DoHold(CommandLine &CmdL) if (unlikely(Cache == NULL)) return false; + // Generate the base argument list for dpkg + std::vector<const char *> Args; + string Tmp = _config->Find("Dir::Bin::dpkg","dpkg"); + { + string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/"); + size_t dpkgChrootLen = dpkgChrootDir.length(); + if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0) + { + if (dpkgChrootDir[dpkgChrootLen - 1] == '/') + --dpkgChrootLen; + Tmp = Tmp.substr(dpkgChrootLen); + } + } + Args.push_back(Tmp.c_str()); + + // Stick in any custom dpkg options + Configuration::Item const *Opts = _config->Tree("DPkg::Options"); + if (Opts != 0) + { + Opts = Opts->Child; + for (; Opts != 0; Opts = Opts->Next) + { + if (Opts->Value.empty() == true) + continue; + Args.push_back(Opts->Value.c_str()); + } + } + + size_t const BaseArgs = Args.size(); + // we need to detect if we can qualify packages with the architecture or not + Args.push_back("--assert-multi-arch"); + Args.push_back(NULL); + + + pid_t dpkgAssertMultiArch = ExecFork(); + if (dpkgAssertMultiArch == 0) + { + std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory"); + if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0) + _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --assert-multi-arch", chrootDir.c_str()); + // redirect everything to the ultimate sink as we only need the exit-status + int const nullfd = open("/dev/null", O_RDONLY); + dup2(nullfd, STDIN_FILENO); + dup2(nullfd, STDOUT_FILENO); + dup2(nullfd, STDERR_FILENO); + execvp(Args[0], (char**) &Args[0]); + _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!"); + _exit(2); + } + APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1); if (pkgset.empty() == true) return _error->Error(_("No packages found")); bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0; - for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg) + for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end();) { if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold) { @@ -172,9 +228,25 @@ bool DoHold(CommandLine &CmdL) ioprintf(c1out,_("%s was already set on hold.\n"), Pkg.FullName(true).c_str()); else ioprintf(c1out,_("%s was already not hold.\n"), Pkg.FullName(true).c_str()); - pkgset.erase(Pkg); - continue; + Pkg = pkgset.erase(Pkg, true); + } + else + ++Pkg; + } + + bool dpkgMultiArch = false; + if (dpkgAssertMultiArch > 0) + { + int Status = 0; + while (waitpid(dpkgAssertMultiArch, &Status, 0) != dpkgAssertMultiArch) + { + if (errno == EINTR) + continue; + _error->WarningE("dpkgGo", _("Waited for %s but it wasn't there"), "dpkg --assert-multi-arch"); + break; } + if (WIFEXITED(Status) == true && WEXITSTATUS(Status) == 0) + dpkgMultiArch = true; } if (pkgset.empty() == true) @@ -192,36 +264,60 @@ bool DoHold(CommandLine &CmdL) return true; } - string dpkgcall = _config->Find("Dir::Bin::dpkg", "dpkg"); - std::vector<string> const dpkgoptions = _config->FindVector("DPkg::options"); - for (std::vector<string>::const_iterator o = dpkgoptions.begin(); - o != dpkgoptions.end(); ++o) - dpkgcall.append(" ").append(*o); - dpkgcall.append(" --set-selections"); - FILE *dpkg = popen(dpkgcall.c_str(), "w"); - if (dpkg == NULL) - return _error->Errno("DoHold", "fdopen on dpkg stdin failed"); + Args.erase(Args.begin() + BaseArgs, Args.end()); + Args.push_back("--set-selections"); + Args.push_back(NULL); + + int external[2] = {-1, -1}; + if (pipe(external) != 0) + return _error->WarningE("DoHold", "Can't create IPC pipe for dpkg --set-selections"); + pid_t dpkgSelection = ExecFork(); + if (dpkgSelection == 0) + { + close(external[1]); + std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory"); + if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0) + _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --set-selections", chrootDir.c_str()); + int const nullfd = open("/dev/null", O_RDONLY); + dup2(external[0], STDIN_FILENO); + dup2(nullfd, STDOUT_FILENO); + dup2(nullfd, STDERR_FILENO); + execvp(Args[0], (char**) &Args[0]); + _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!"); + _exit(2); + } + + FILE* dpkg = fdopen(external[1], "w"); for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg) { if (MarkHold == true) { - fprintf(dpkg, "%s hold\n", Pkg.FullName(true).c_str()); + fprintf(dpkg, "%s hold\n", Pkg.FullName(!dpkgMultiArch).c_str()); ioprintf(c1out,_("%s set on hold.\n"), Pkg.FullName(true).c_str()); } else { - fprintf(dpkg, "%s install\n", Pkg.FullName(true).c_str()); + fprintf(dpkg, "%s install\n", Pkg.FullName(!dpkgMultiArch).c_str()); ioprintf(c1out,_("Canceled hold on %s.\n"), Pkg.FullName(true).c_str()); } } + fclose(dpkg); - int const status = pclose(dpkg); - if (status == -1) - return _error->Errno("DoHold", "dpkg execution failed in the end"); - if (WIFEXITED(status) == false || WEXITSTATUS(status) != 0) - return _error->Error(_("Executing dpkg failed. Are you root?")); - return true; + if (dpkgSelection > 0) + { + int Status = 0; + while (waitpid(dpkgSelection, &Status, 0) != dpkgSelection) + { + if (errno == EINTR) + continue; + _error->WarningE("dpkgGo", _("Waited for %s but it wasn't there"), "dpkg --set-selection"); + break; + } + if (WIFEXITED(Status) == true && WEXITSTATUS(Status) == 0) + return true; + } + return _error->Error(_("Executing dpkg failed. Are you root?")); } /*}}}*/ /* ShowHold - show packages set on hold in dpkg status {{{*/ @@ -264,7 +360,7 @@ 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 << 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) |