From 5fd25d678f51cfa013643efe3429eb08b9504058 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 16 Jan 2014 23:00:27 +0100 Subject: use gpg --homedir instead of explicit file placement Avoids that gpg gets the idea it could use files from the user which weren't overridden specifically like secret keyring and trustdb as before. --- cmdline/apt-key.in | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 463e4b4b4..0ced500db 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -5,22 +5,23 @@ unset GREP_OPTIONS GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring" -# gpg needs a trustdb to function, but it can't be invalid (not even empty) -# so we create a temporary directory to store our fresh readable trustdb in -TRUSTDBDIR="$(mktemp -d)" -CURRENTTRAP="${CURRENTTRAP} rm -rf '${TRUSTDBDIR}';" +# gpg needs (in different versions more or less) files to function correctly, +# so we give it its own homedir and generate some valid content for it +GPGHOMEDIR="$(mktemp -d)" +CURRENTTRAP="${CURRENTTRAP} rm -rf '${GPGHOMEDIR}';" trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM -chmod 700 "$TRUSTDBDIR" -# We also don't use a secret keyring, of course, but gpg panics and +chmod 700 "$GPGHOMEDIR" +# We don't use a secret keyring, of course, but gpg panics and # implodes if there isn't one available - and writeable for imports -SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" +SECRETKEYRING="${GPGHOMEDIR}/secring.gpg" touch $SECRETKEYRING -GPG_CMD="$GPG_CMD --secret-keyring $SECRETKEYRING" -GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg" - -# now create the trustdb with an (empty) dummy keyring -$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING -# and make sure that gpg isn't trying to update the file +GPG_CMD="$GPG_CMD --homedir $GPGHOMEDIR" +# create the trustdb with an (empty) dummy keyring +# older gpgs required it, newer gpgs even warn that it isn't needed, +# but require it nontheless for some commands, so we just play safe +# here for the foreseeable future and create a dummy one +$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING >/dev/null 2>&1 +# tell gpg that it shouldn't try to maintain a trustdb file GPG_CMD="$GPG_CMD --no-auto-check-trustdb --trust-model always" GPG="$GPG_CMD" -- cgit v1.2.3 From 82e7f817a434e29df9ec6fbf19acfd8e7cd890e5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 07:48:43 +0100 Subject: add apt upgrade --dist --- cmdline/apt.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 4bcae0aba..4dc826632 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -86,6 +86,15 @@ bool ShowHelp(CommandLine &CmdL) return true; } +// figure out what kind of upgrade the user wants +bool DoAptUpgrade(CommandLine &CmdL) +{ + if (_config->FindB("Apt::Cmd::Dist-Upgrade")) + return DoDistUpgrade(CmdL); + else + return DoUpgradeWithAllowNewPackages(CmdL); +} + int main(int argc, const char *argv[]) /*{{{*/ { CommandLine::Dispatch Cmds[] = {{"list",&List}, @@ -95,7 +104,7 @@ int main(int argc, const char *argv[]) /*{{{*/ {"install",&DoInstall}, {"remove", &DoInstall}, {"update",&DoUpdate}, - {"upgrade",&DoUpgradeWithAllowNewPackages}, + {"upgrade",&DoAptUpgrade}, // misc {"edit-sources",&EditSources}, // helper -- cgit v1.2.3 From b7159ec8835e61ea3069213d9188be91c109e32c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 07:52:22 +0100 Subject: reword !isatty() warning --- cmdline/apt.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 4dc826632..2d3966e86 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -117,10 +117,9 @@ int main(int argc, const char *argv[]) /*{{{*/ if(!isatty(1)) { std::cerr << std::endl - << "WARNING WARNING " - << argv[0] - << " is *NOT* intended for scripts " - << "use at your own peril^Wrisk" + << "WARNING: " << argv[0] << " " + << "does not have a stable CLI interface yet. " + << "Use with caution in scripts." << std::endl << std::endl; } -- cgit v1.2.3 From 1410955589dc9f0eaa290907cac070b7ebf93b6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 08:43:14 +0100 Subject: add missing integration test for "apt list" --- cmdline/apt.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 2d3966e86..8dc4c292a 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -114,16 +114,6 @@ int main(int argc, const char *argv[]) /*{{{*/ std::vector Args = getCommandArgs("apt", CommandLine::GetCommand(Cmds, argc, argv)); - if(!isatty(1)) - { - std::cerr << std::endl - << "WARNING: " << argv[0] << " " - << "does not have a stable CLI interface yet. " - << "Use with caution in scripts." - << std::endl - << std::endl; - } - InitOutput(); // Set up gettext support @@ -149,6 +139,19 @@ int main(int argc, const char *argv[]) /*{{{*/ return 100; } + if(!isatty(STDOUT_FILENO) && + _config->FindB("Apt::Cmd::Disable-Script-Warning", false) == false) + { + std::cerr << std::endl + << "WARNING: " << argv[0] << " " + << "does not have a stable CLI interface yet. " + << "Use with caution in scripts." + << std::endl + << std::endl; + } + if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) + _config->Set("quiet","1"); + // See if the help should be shown if (_config->FindB("help") == true || _config->FindB("version") == true || -- cgit v1.2.3 From 8a59cc322ac57c6662949e957611ed718a5f5119 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 17 Jan 2014 21:38:23 +0100 Subject: add purge to the apt cmdline --- cmdline/apt.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 8dc4c292a..61d5d938a 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -71,13 +71,16 @@ bool ShowHelp(CommandLine &CmdL) _("Usage: apt [options] command\n" "\n" "CLI for apt.\n" - "Commands: \n" + "Basic commands: \n" " list - list packages based on package names\n" " search - search in package descriptions\n" " show - show package details\n" "\n" " update - update list of available packages\n" + "\n" " install - install packages\n" + " remove - remove packages\n" + "\n" " upgrade - upgrade the systems packages\n" "\n" " edit-sources - edit the source information file\n" @@ -103,6 +106,7 @@ int main(int argc, const char *argv[]) /*{{{*/ // needs root {"install",&DoInstall}, {"remove", &DoInstall}, + {"purge", &DoInstall}, {"update",&DoUpdate}, {"upgrade",&DoAptUpgrade}, // misc -- cgit v1.2.3 From 6d73fe5be080e66a4f6ff2b250ed1957ae7ac063 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Jan 2014 16:41:00 +0100 Subject: add test for apt show --- cmdline/apt.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 61d5d938a..07ade6b7c 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -103,10 +103,11 @@ int main(int argc, const char *argv[]) /*{{{*/ CommandLine::Dispatch Cmds[] = {{"list",&List}, {"search", &FullTextSearch}, {"show", &APT::Cmd::ShowPackage}, - // needs root + // package stuff {"install",&DoInstall}, {"remove", &DoInstall}, {"purge", &DoInstall}, + // system wide stuff {"update",&DoUpdate}, {"upgrade",&DoAptUpgrade}, // misc -- cgit v1.2.3 From 59e81cec3e2277e367f14f113168421909c42035 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 20:33:02 +0100 Subject: add "apt full-upgrade" and tweak "apt upgrade" There is a new "apt full-upgrade" that performs a apt-get dist-upgrade. "apt dist-upgrade" is still supported as a alias. The "apt upgrade" code is changed so that it mirrors the behavior of "apt-get upgrade --with-new-pkgs" and also honors "apt uprade --no-new-pkgs". --- cmdline/apt-get.cc | 8 -------- cmdline/apt.cc | 32 +++++++++++++++++--------------- 2 files changed, 17 insertions(+), 23 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 8a0772ce2..da7d28a1e 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1677,14 +1677,6 @@ void SigWinch(int) if (ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col >= 5) ScreenWidth = ws.ws_col - 1; #endif -} - /*}}}*/ -bool DoUpgrade(CommandLine &CmdL) /*{{{*/ -{ - if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true) - return DoUpgradeWithAllowNewPackages(CmdL); - else - return DoUpgradeNoNewPackages(CmdL); } /*}}}*/ int main(int argc,const char *argv[]) /*{{{*/ diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 07ade6b7c..6fe25e3f3 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -81,7 +81,8 @@ bool ShowHelp(CommandLine &CmdL) " install - install packages\n" " remove - remove packages\n" "\n" - " upgrade - upgrade the systems packages\n" + " upgrade - upgrade the system by installing/upgrading packages\n" + "full-upgrade - upgrade the system by removing/installing/upgrading packages\n" "\n" " edit-sources - edit the source information file\n" ); @@ -89,29 +90,29 @@ bool ShowHelp(CommandLine &CmdL) return true; } -// figure out what kind of upgrade the user wants -bool DoAptUpgrade(CommandLine &CmdL) -{ - if (_config->FindB("Apt::Cmd::Dist-Upgrade")) - return DoDistUpgrade(CmdL); - else - return DoUpgradeWithAllowNewPackages(CmdL); -} - int main(int argc, const char *argv[]) /*{{{*/ { - CommandLine::Dispatch Cmds[] = {{"list",&List}, + CommandLine::Dispatch Cmds[] = { + // query + {"list",&List}, {"search", &FullTextSearch}, {"show", &APT::Cmd::ShowPackage}, + // package stuff {"install",&DoInstall}, {"remove", &DoInstall}, {"purge", &DoInstall}, + // system wide stuff {"update",&DoUpdate}, - {"upgrade",&DoAptUpgrade}, + {"upgrade",&DoUpgrade}, + {"full-upgrade",&DoDistUpgrade}, + // for compat with muscle memory + {"dist-upgrade",&DoDistUpgrade}, + // misc {"edit-sources",&EditSources}, + // helper {"moo",&DoMoo}, {"help",&ShowHelp}, @@ -131,9 +132,10 @@ int main(int argc, const char *argv[]) /*{{{*/ return 100; } - // FIXME: move into a new libprivate/private-install.cc:Install() - _config->Set("DPkgPM::Progress", "1"); - _config->Set("Apt::Color", "1"); + // some different defaults + _config->CndSet("DPkgPM::Progress", "1"); + _config->CndSet("Apt::Color", "1"); + _config->CndSet("APT::Get::Upgrade-Allow-New", true); // Parse the command line and initialize the package library CommandLine CmdL(Args.data(), _config); -- cgit v1.2.3 From 1aef66d5e150c608276fabdf1c2d2aaca9c45b7f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 24 Jan 2014 22:59:36 +0100 Subject: apt-mark help shows all commands now --- cmdline/apt-mark.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmdline') diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index ebb1f9892..d3a3a780b 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -386,6 +386,11 @@ bool ShowHelp(CommandLine &CmdL) "Commands:\n" " auto - Mark the given packages as automatically installed\n" " manual - Mark the given packages as manually installed\n" + " hold - Mark a package as held back\n" + " unhold - Unset a package set as held back\n" + " showauto - Print the list of automatically installed packages\n" + " showmanual - Print the list of manually installed packages\n" + " showhold - Print the list of package on hold\n" "\n" "Options:\n" " -h This help text.\n" -- cgit v1.2.3 From 6ae22905f66064f46c0abf05d269e47869c664be Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 29 Jan 2014 10:37:17 +0100 Subject: fix apt-get download truncation (closes: #736962) --- cmdline/apt-get.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index da7d28a1e..6bff6e7de 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -678,14 +678,17 @@ bool DoDownload(CommandLine &CmdL) // copy files in local sources to the current directory for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I) - if ((*I)->Local == true && (*I)->Status == pkgAcquire::Item::StatDone) + { + std::string const filename = cwd + flNotDir((*I)->DestFile); + if ((*I)->Local == true && + filename != (*I)->DestFile && + (*I)->Status == pkgAcquire::Item::StatDone) { - std::string const filename = cwd + flNotDir((*I)->DestFile); std::ifstream src((*I)->DestFile.c_str(), std::ios::binary); std::ofstream dst(filename.c_str(), std::ios::binary); dst << src.rdbuf(); } - + } return Failed == false; } /*}}}*/ -- cgit v1.2.3 From 33b813ce44c7bafeb2a36b66fd004f8d94a2cbe4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Feb 2014 17:35:33 +0100 Subject: move isatty() check into InitOutput() --- cmdline/apt-get.cc | 4 ---- cmdline/apt.cc | 2 -- 2 files changed, 6 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6bff6e7de..1019ff325 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1736,10 +1736,6 @@ int main(int argc,const char *argv[]) /*{{{*/ // see if we are in simulate mode CheckSimulateMode(CmdL); - // Deal with stdout not being a tty - if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) - _config->Set("quiet","1"); - // Setup the output streams InitOutput(); diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 6fe25e3f3..6ad470faa 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -156,8 +156,6 @@ int main(int argc, const char *argv[]) /*{{{*/ << std::endl << std::endl; } - if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) - _config->Set("quiet","1"); // See if the help should be shown if (_config->FindB("help") == true || -- cgit v1.2.3 From e209542632e61b9bf07b809c333f1e4b9de7fde9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Feb 2014 18:06:28 +0100 Subject: use VersionSet in download to handle repeats Closes: 738103 --- cmdline/apt-get.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6bff6e7de..2a9964722 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -630,8 +630,8 @@ bool DoDownload(CommandLine &CmdL) return false; APT::CacheSetHelper helper(c0out); - APT::VersionList verset = APT::VersionList::FromCommandLine(Cache, - CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper); + APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, + CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); if (verset.empty() == true) return false; @@ -650,7 +650,7 @@ bool DoDownload(CommandLine &CmdL) std::string const cwd = SafeGetCWD(); _config->Set("Dir::Cache::Archives", cwd); int i = 0; - for (APT::VersionList::const_iterator Ver = verset.begin(); + for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver, ++i) { pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]); -- cgit v1.2.3 From 62dcbf84c4aee8cb01e40c594d4c7f3a23b64836 Mon Sep 17 00:00:00 2001 From: John Ogness Date: Fri, 13 Dec 2013 20:59:31 +0100 Subject: apt-cdrom should succeed if any drive succeeds If there are multiple CD-ROM drives, `apt-cdrom add` will abort with an error if any of the drives do not contain a Debian CD which is against the documentation we have saying "a CD-ROM" and also scripts do not expect it this way. This patch modifies apt-cdrom to return success if any of the drives succeeded. If failures occur, apt-cdrom will still continue trying all the drives and report the last failure (if none of them succeeded). The 'ident' command was also changed to match the new 'add' behavior. Closes: 728153 --- cmdline/apt-cdrom.cc | 76 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 17 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 17a60ddcb..20c6e8892 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -111,10 +111,12 @@ OpProgress* pkgCdromTextStatus::GetOpProgress() }; /*}}}*/ // SetupAutoDetect /*{{{*/ -bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i) +bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) { bool Debug = _config->FindB("Debug::Acquire::cdrom", false); + automounted = false; + vector v = UdevCdroms.Scan(); if (i >= v.size()) return false; @@ -137,6 +139,8 @@ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i) mkdir(AptMountPoint.c_str(), 0750); if(MountCdrom(AptMountPoint, v[i].DeviceName) == false) _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str()); + else + automounted = true; _config->Set("Acquire::cdrom::mount", AptMountPoint); _config->Set("APT::CDROM::NoMount", true); } @@ -160,17 +164,35 @@ bool DoAdd(CommandLine &) bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); unsigned int count = 0; + string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); + bool automounted = false; if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count)) - res &= cdrom.Add(&log); - if (count == 0) { - res = cdrom.Add(&log); - if (res == false) { - _error->Error("%s", _(W_NO_CDROM_FOUND)); + while (AutoDetectCdrom(UdevCdroms, count, automounted)) { + if (count == 1) { + // begin loop with res false to detect any success using OR + res = false; + } + + // dump any warnings/errors from autodetect + if (_error->empty() == false) + _error->DumpErrors(); + + res |= cdrom.Add(&log); + + if (automounted) + UnmountCdrom(AptMountPoint); + + // dump any warnings/errors from add/unmount + if (_error->empty() == false) + _error->DumpErrors(); } - } - if(res) + if (count == 0) + res = cdrom.Add(&log); + + if (res == false) + _error->Error("%s", _(W_NO_CDROM_FOUND)); + else cout << _("Repeat this process for the rest of the CDs in your set.") << endl; return res; @@ -187,18 +209,38 @@ bool DoIdent(CommandLine &) pkgCdrom cdrom; bool res = true; - bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect"); + bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); unsigned int count = 0; + string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); + bool automounted = false; if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count)) - res &= cdrom.Ident(ident, &log); - if (count == 0) { - res = cdrom.Ident(ident, &log); - if (res == false) { - _error->Error("%s", _(W_NO_CDROM_FOUND)); + while (AutoDetectCdrom(UdevCdroms, count, automounted)) { + if (count == 1) { + // begin loop with res false to detect any success using OR + res = false; + } + + // dump any warnings/errors from autodetect + if (_error->empty() == false) + _error->DumpErrors(); + + res |= cdrom.Ident(ident, &log); + + if (automounted) + UnmountCdrom(AptMountPoint); + + // dump any warnings/errors from add/unmount + if (_error->empty() == false) + _error->DumpErrors(); } - } + + if (count == 0) + res = cdrom.Ident(ident, &log); + + if (res == false) + _error->Error("%s", _(W_NO_CDROM_FOUND)); + return res; } /*}}}*/ -- cgit v1.2.3 From 8f3594c3487800edc2a97af1f3290049776dc556 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Feb 2014 07:59:07 +0100 Subject: Use a APT::VersionSet instead of a VersionList Use a APT::VersionSet instead of a APT::VersionList in DoDownload() to ensure that there is only one version in the set even if the user passes multiple identical name/versions on the commandline (Bug#738103) --- cmdline/apt-get.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 1019ff325..4d609104c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -630,8 +630,8 @@ bool DoDownload(CommandLine &CmdL) return false; APT::CacheSetHelper helper(c0out); - APT::VersionList verset = APT::VersionList::FromCommandLine(Cache, - CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper); + APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, + CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); if (verset.empty() == true) return false; @@ -650,7 +650,7 @@ bool DoDownload(CommandLine &CmdL) std::string const cwd = SafeGetCWD(); _config->Set("Dir::Cache::Archives", cwd); int i = 0; - for (APT::VersionList::const_iterator Ver = verset.begin(); + for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver, ++i) { pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]); -- cgit v1.2.3 From 52090faab4401ad6a2acb4d2c0c2cb53aa6b8f7f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 13 Feb 2014 14:47:34 +0100 Subject: trivial indent fix --- cmdline/apt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 6ad470faa..7ef9060aa 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -82,7 +82,7 @@ bool ShowHelp(CommandLine &CmdL) " remove - remove packages\n" "\n" " upgrade - upgrade the system by installing/upgrading packages\n" - "full-upgrade - upgrade the system by removing/installing/upgrading packages\n" + " full-upgrade - upgrade the system by removing/installing/upgrading packages\n" "\n" " edit-sources - edit the source information file\n" ); -- cgit v1.2.3 From 46a78c652d80818b4643c471432ae961b1ca5bd9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 22 Feb 2014 18:07:43 +0100 Subject: remove auto-generated apt-key and sources.list on clean (closes: 739749) --- cmdline/makefile | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'cmdline') diff --git a/cmdline/makefile b/cmdline/makefile index 06f170b6a..f89192e10 100644 --- a/cmdline/makefile +++ b/cmdline/makefile @@ -40,20 +40,6 @@ LIB_MAKES = apt-pkg/makefile SOURCE = apt-cdrom.cc include $(PROGRAM_H) -# The apt-key program -apt-key: apt-key.in - sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \ - -e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \ - -e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \ - -e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \ - -e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@ - chmod 755 $@ - -SOURCE=apt-key -TO=$(BIN) -TARGET=program -include $(COPY_H) - # The apt-mark program PROGRAM=apt-mark SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) @@ -99,3 +85,22 @@ SLIBS = -lapt-pkg $(INTLLIBS) LIB_MAKES = apt-pkg/makefile SOURCE = apt-dump-solver.cc include $(PROGRAM_H) + +# The apt-key program +apt-key: apt-key.in + sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \ + -e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \ + -e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \ + -e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \ + -e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@ + chmod 755 $@ + +SOURCE=apt-key +TO=$(BIN) +TARGET=program +include $(COPY_H) + +clean: clean/apt-key + +clean/apt-key: + rm -f apt-key -- cgit v1.2.3 From 1e3f4083db29bba600b9725e9456b0e140975c99 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 22 Feb 2014 18:34:33 +0100 Subject: Fix typos in documentation (codespell) --- cmdline/apt-config.cc | 2 +- cmdline/apt-get.cc | 4 ++-- cmdline/apt-internal-solver.cc | 6 +++--- cmdline/apt-key.in | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 3481eaf5f..30c2a22d5 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -8,7 +8,7 @@ This program will parse a config file and then do something with it. Commands: - shell - Shell mode. After this a series of word pairs should occure. + shell - Shell mode. After this a series of word pairs should occur. The first is the environment var to set and the second is the key to set it from. Use like: eval `apt-config shell QMode apt::QMode` diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 4d609104c..12e385b69 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -15,7 +15,7 @@ upgrade - Smart-Download the newest versions of all packages dselect-upgrade - Follows dselect's changes to the Status: field and installes new and removes old packages - dist-upgrade - Powerfull upgrader designed to handle the issues with + dist-upgrade - Powerful upgrader designed to handle the issues with a new distribution. install - Download and install a given package (by name, not by .deb) check - Update the package cache and check for broken packages @@ -513,7 +513,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) } /* Resolve any problems that dselect created, allupgrade cannot handle - such things. We do so quite agressively too.. */ + such things. We do so quite aggressively too.. */ if (Cache->BrokenCount() != 0) { pkgProblemResolver Fix(Cache); diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 53b38ea43..bf5b8c1fe 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -160,16 +160,16 @@ int main(int argc,const char *argv[]) /*{{{*/ if (upgrade == true) { if (pkgAllUpgrade(CacheFile) == false) { - EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occured", output); + EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occurred", output); return 0; } } else if (distUpgrade == true) { if (pkgDistUpgrade(CacheFile) == false) { - EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occured", output); + EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occurred", output); return 0; } } else if (Fix.Resolve() == false) { - EDSP::WriteError("ERR_UNSOLVABLE", "An error occured", output); + EDSP::WriteError("ERR_UNSOLVABLE", "An error occurred", output); return 0; } diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in index 0ced500db..0774cf4b7 100644 --- a/cmdline/apt-key.in +++ b/cmdline/apt-key.in @@ -18,7 +18,7 @@ touch $SECRETKEYRING GPG_CMD="$GPG_CMD --homedir $GPGHOMEDIR" # create the trustdb with an (empty) dummy keyring # older gpgs required it, newer gpgs even warn that it isn't needed, -# but require it nontheless for some commands, so we just play safe +# but require it nonetheless for some commands, so we just play safe # here for the foreseeable future and create a dummy one $GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING >/dev/null 2>&1 # tell gpg that it shouldn't try to maintain a trustdb file @@ -187,7 +187,7 @@ remove_key_from_keyring() { echo >&2 "Key ${2} is in keyring ${1}, but can't be removed as it is read only." return fi - # check if it is the only key in the keyring and if so remove the keyring alltogether + # check if it is the only key in the keyring and if so remove the keyring altogether if [ '1' = "$($GPG --with-colons --list-keys | grep "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]\+:" | wc -l)" ]; then mv -f "$1" "${1}~" # behave like gpg return -- cgit v1.2.3 From e7f56293f029505f59670be2bad244f6d9912369 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 16 Feb 2014 23:30:48 +0100 Subject: Add support for data.tar, control.tar and control.tar.xz Sync the deb(5) format support with latest dpkg, by allowing uncompressed tar members and xz compressed control.tar. This also refactors the control.tar member extraction by using ExtractTarMember(), which also means future changes only need to be implemented in a single place. --- cmdline/apt-extracttemplates.cc | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 8e1937113..2408a7d9d 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -24,8 +24,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -91,18 +90,9 @@ string DebFile::GetInstalledVer(const string &package) /* */ bool DebFile::Go() { - ARArchive AR(File); - if (_error->PendingError() == true) - return false; - - const ARArchive::Member *Member = AR.FindMember("control.tar.gz"); - if (Member == 0) - return _error->Error(_("%s not a valid DEB package."),File.Name().c_str()); - - if (File.Seek(Member->Start) == false) - return false; - ExtractTar Tar(File, Member->Size,"gzip"); - return Tar.Go(*this); + debDebFile Deb(File); + + return Deb.ExtractTarMember(*this, "control.tar"); } /*}}}*/ // DebFile::DoItem examine element in package and mark /*{{{*/ -- cgit v1.2.3 From ed9665aedf77b3b8345bd4ed33de7885738e29f0 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Feb 2014 16:46:05 +0100 Subject: initial version of apt-helper --- cmdline/apt-helper.cc | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmdline/makefile | 7 +++ 2 files changed, 134 insertions(+) create mode 100644 cmdline/apt-helper.cc (limited to 'cmdline') diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc new file mode 100644 index 000000000..c1c8b2178 --- /dev/null +++ b/cmdline/apt-helper.cc @@ -0,0 +1,127 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +/* ##################################################################### + apt-helper - cmdline helpers + ##################################################################### */ + /*}}}*/ +// Include Files /*{{{*/ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + + +#include + /*}}}*/ +using namespace std; + +bool DoDownloadFile(CommandLine &CmdL) +{ + if (CmdL.FileSize() <= 2) + return _error->Error(_("Must specify at least one pair url/filename")); + + + pkgAcquire Fetcher; + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); + Fetcher.Setup(&Stat); + std::string download_uri = CmdL.FileList[1]; + std::string targetfile = CmdL.FileList[2]; + new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc", + "dest-dir-ignored", targetfile); + Fetcher.Run(); + if (!FileExists(targetfile)) + { + _error->Error(_("Download Failed")); + return false; + } + return true; +} + +bool ShowHelp(CommandLine &CmdL) +{ + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, + COMMON_ARCH,__DATE__,__TIME__); + + if (_config->FindB("version") == true) + return true; + + cout << + _("Usage: apt-helper [options] command\n" + " apt-helper [options] download-file uri target-path\n" + "\n" + "apt-helper is a internal helper for apt\n" + "\n" + "Commands:\n" + " download-file - download the given uri to the target-path\n" + "\n" + " This APT helper has Super Meep Powers.\n"); + return true; +} + + +int main(int argc,const char *argv[]) /*{{{*/ +{ + CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp}, + {"download-file", &DoDownloadFile}, + {0,0}}; + + std::vector Args = getCommandArgs( + "apt-download", CommandLine::GetCommand(Cmds, argc, argv)); + + // Set up gettext support + setlocale(LC_ALL,""); + textdomain(PACKAGE); + + // Parse the command line and initialize the package library + CommandLine CmdL(Args.data(),_config); + if (pkgInitConfig(*_config) == false || + CmdL.Parse(argc,argv) == false || + pkgInitSystem(*_config,_system) == false) + { + if (_config->FindB("version") == true) + ShowHelp(CmdL); + _error->DumpErrors(); + return 100; + } + + // See if the help should be shown + if (_config->FindB("help") == true || + _config->FindB("version") == true || + CmdL.FileSize() == 0) + { + ShowHelp(CmdL); + return 0; + } + + InitOutput(); + + // Match the operation + CmdL.DispatchArg(Cmds); + + // Print any errors or warnings found during parsing + bool const Errors = _error->PendingError(); + if (_config->FindI("quiet",0) > 0) + _error->DumpErrors(); + else + _error->DumpErrors(GlobalError::DEBUG); + return Errors == true ? 100 : 0; +} + /*}}}*/ diff --git a/cmdline/makefile b/cmdline/makefile index f89192e10..c4a249cd6 100644 --- a/cmdline/makefile +++ b/cmdline/makefile @@ -47,6 +47,13 @@ LIB_MAKES = apt-pkg/makefile SOURCE = apt-mark.cc include $(PROGRAM_H) +# The apt-helper +PROGRAM=apt-helper +SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = apt-helper.cc +include $(PROGRAM_H) + # The apt-report-mirror-failure program #SOURCE=apt-report-mirror-failure #TO=$(BIN) -- cgit v1.2.3 From e43a426e5d402d36eb180935fbbf1430a4a86e3f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 27 Feb 2014 16:46:05 +0100 Subject: initial version of apt-helper --- cmdline/apt-helper.cc | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmdline/makefile | 7 +++ 2 files changed, 134 insertions(+) create mode 100644 cmdline/apt-helper.cc (limited to 'cmdline') diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc new file mode 100644 index 000000000..c1c8b2178 --- /dev/null +++ b/cmdline/apt-helper.cc @@ -0,0 +1,127 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +/* ##################################################################### + apt-helper - cmdline helpers + ##################################################################### */ + /*}}}*/ +// Include Files /*{{{*/ +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + + +#include + /*}}}*/ +using namespace std; + +bool DoDownloadFile(CommandLine &CmdL) +{ + if (CmdL.FileSize() <= 2) + return _error->Error(_("Must specify at least one pair url/filename")); + + + pkgAcquire Fetcher; + AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0)); + Fetcher.Setup(&Stat); + std::string download_uri = CmdL.FileList[1]; + std::string targetfile = CmdL.FileList[2]; + new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc", + "dest-dir-ignored", targetfile); + Fetcher.Run(); + if (!FileExists(targetfile)) + { + _error->Error(_("Download Failed")); + return false; + } + return true; +} + +bool ShowHelp(CommandLine &CmdL) +{ + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, + COMMON_ARCH,__DATE__,__TIME__); + + if (_config->FindB("version") == true) + return true; + + cout << + _("Usage: apt-helper [options] command\n" + " apt-helper [options] download-file uri target-path\n" + "\n" + "apt-helper is a internal helper for apt\n" + "\n" + "Commands:\n" + " download-file - download the given uri to the target-path\n" + "\n" + " This APT helper has Super Meep Powers.\n"); + return true; +} + + +int main(int argc,const char *argv[]) /*{{{*/ +{ + CommandLine::Dispatch Cmds[] = {{"help",&ShowHelp}, + {"download-file", &DoDownloadFile}, + {0,0}}; + + std::vector Args = getCommandArgs( + "apt-download", CommandLine::GetCommand(Cmds, argc, argv)); + + // Set up gettext support + setlocale(LC_ALL,""); + textdomain(PACKAGE); + + // Parse the command line and initialize the package library + CommandLine CmdL(Args.data(),_config); + if (pkgInitConfig(*_config) == false || + CmdL.Parse(argc,argv) == false || + pkgInitSystem(*_config,_system) == false) + { + if (_config->FindB("version") == true) + ShowHelp(CmdL); + _error->DumpErrors(); + return 100; + } + + // See if the help should be shown + if (_config->FindB("help") == true || + _config->FindB("version") == true || + CmdL.FileSize() == 0) + { + ShowHelp(CmdL); + return 0; + } + + InitOutput(); + + // Match the operation + CmdL.DispatchArg(Cmds); + + // Print any errors or warnings found during parsing + bool const Errors = _error->PendingError(); + if (_config->FindI("quiet",0) > 0) + _error->DumpErrors(); + else + _error->DumpErrors(GlobalError::DEBUG); + return Errors == true ? 100 : 0; +} + /*}}}*/ diff --git a/cmdline/makefile b/cmdline/makefile index f89192e10..c4a249cd6 100644 --- a/cmdline/makefile +++ b/cmdline/makefile @@ -47,6 +47,13 @@ LIB_MAKES = apt-pkg/makefile SOURCE = apt-mark.cc include $(PROGRAM_H) +# The apt-helper +PROGRAM=apt-helper +SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) +LIB_MAKES = apt-pkg/makefile +SOURCE = apt-helper.cc +include $(PROGRAM_H) + # The apt-report-mirror-failure program #SOURCE=apt-report-mirror-failure #TO=$(BIN) -- cgit v1.2.3 From c1409d1be88557529c62883be3174793481233de Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Mar 2014 20:33:05 +0100 Subject: add hashsum support in apt-file download and add more tests --- cmdline/apt-helper.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cmdline') diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index c1c8b2178..4a24b01d9 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -44,6 +44,9 @@ bool DoDownloadFile(CommandLine &CmdL) Fetcher.Setup(&Stat); std::string download_uri = CmdL.FileList[1]; std::string targetfile = CmdL.FileList[2]; + HashString hash; + if (CmdL.FileSize() > 3) + hash = HashString(CmdL.FileList[3]); new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc", "dest-dir-ignored", targetfile); Fetcher.Run(); @@ -52,6 +55,14 @@ bool DoDownloadFile(CommandLine &CmdL) _error->Error(_("Download Failed")); return false; } + if(hash.empty() == false) + if(hash.VerifyFile(targetfile) == false) + { + _error->Error(_("HashSum Failed")); + Rename(targetfile, targetfile+".failed"); + return false; + } + return true; } -- cgit v1.2.3 From ce7f128c020e1347f91c6074238fc5da58c5df71 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 14:26:18 +0100 Subject: support DEB_BUILD_PROFILES and -P for build profiles Inspired by the rest of the patch in 661537, but abstract the parsing of various ways of setting the build profiles more so it can potentially be reused and all apt parts have the same behaviour. Especially config options, cmdline options and environment will not be combined as proposed as this isn't APTs usual behaviour and dpkg doesn't do it either, so one overrides the other as it normally does. --- cmdline/apt-config.cc | 5 +++++ cmdline/apt-get.cc | 6 ++++++ 2 files changed, 11 insertions(+) (limited to 'cmdline') diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 30c2a22d5..9f20b3c1b 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -155,6 +155,11 @@ int main(int argc,const char *argv[]) /*{{{*/ _config->Set(comp + "UncompressArg::", *a); } + std::vector const profiles = APT::Configuration::getBuildProfiles(); + _config->Clear("APT::Build-Profiles"); + for (std::vector::const_iterator p = profiles.begin(); p != profiles.end(); ++p) + _config->Set("APT::Build-Profiles::", *p); + // Match the operation CmdL.DispatchArg(Cmds); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 12e385b69..f8de80a91 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -970,6 +970,12 @@ bool DoSource(CommandLine &CmdL) string buildopts = _config->Find("APT::Get::Host-Architecture"); if (buildopts.empty() == false) buildopts = "-a" + buildopts + " "; + + // get all active build profiles + std::string const profiles = APT::Configuration::getBuildProfilesString(); + if (profiles.empty() == false) + buildopts.append(" -P").append(profiles).append(" "); + buildopts.append(_config->Find("DPkg::Build-Options","-b -uc")); // Call dpkg-buildpackage -- cgit v1.2.3 From 67c3067f1a615fd6ff0b332c2a526d052442913d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:22:41 +0100 Subject: fix -Wmissing-field-initializers warnings Reported-By: gcc Git-Dch: Ignore --- cmdline/apt-cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index b8892d23d..22778eb24 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -532,7 +532,7 @@ bool DumpAvail(CommandLine &Cmd) if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource) { pkgTagSection Tags; - TFRewriteData RW[] = {{"Status",0},{"Config-Version",0},{}}; + TFRewriteData RW[] = {{"Status", NULL, NULL},{"Config-Version", NULL, NULL},{NULL, NULL, NULL}}; const char *Zero = 0; if (Tags.Scan(Buffer+Jitter,VF.Size+1) == false || TFRewrite(stdout,Tags,&Zero,RW) == false) -- cgit v1.2.3 From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: =?UTF-8?q?warning:=20extra=20=E2=80=98;=E2=80=99=20[-Wpedantic]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- cmdline/apt-cdrom.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 20c6e8892..9aaebefd7 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -54,7 +54,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/ { protected: OpTextProgress Progress; - void Prompt(const char *Text); + void Prompt(const char *Text); string PromptLine(const char *Text); bool AskCdromName(string &name); @@ -64,12 +64,12 @@ public: virtual OpProgress* GetOpProgress(); }; -void pkgCdromTextStatus::Prompt(const char *Text) +void pkgCdromTextStatus::Prompt(const char *Text) { char C; cout << Text << ' ' << flush; if (read(STDIN_FILENO,&C,1) < 0) - _error->Errno("pkgCdromTextStatus::Prompt", + _error->Errno("pkgCdromTextStatus::Prompt", "Failed to read from standard input (not a terminal?)"); if (C != '\n') cout << endl; @@ -78,37 +78,37 @@ void pkgCdromTextStatus::Prompt(const char *Text) string pkgCdromTextStatus::PromptLine(const char *Text) { cout << Text << ':' << endl; - + string Res; getline(cin,Res); return Res; } -bool pkgCdromTextStatus::AskCdromName(string &name) +bool pkgCdromTextStatus::AskCdromName(string &name) { cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush; name = PromptLine(""); - + return true; } - -void pkgCdromTextStatus::Update(string text, int current) + +void pkgCdromTextStatus::Update(string text, int current) { if(text.size() > 0) cout << text << flush; } -bool pkgCdromTextStatus::ChangeCdrom() +bool pkgCdromTextStatus::ChangeCdrom() { Prompt(_("Please insert a Disc in the drive and press enter")); return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() -{ - return &Progress; -}; +OpProgress* pkgCdromTextStatus::GetOpProgress() +{ + return &Progress; +} /*}}}*/ // SetupAutoDetect /*{{{*/ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) -- cgit v1.2.3 From c3ccac9232c2684b15f75fa8622a9a290aeca123 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 03:11:54 +0100 Subject: warning: no previous declaration for foobar() [-Wmissing-declarations] Git-Dch: Ignore Reported-By: gcc -Wmissing-declarations --- cmdline/apt-cache.cc | 48 ++++++++++++++++++++--------------------- cmdline/apt-cdrom.cc | 8 +++---- cmdline/apt-config.cc | 6 +++--- cmdline/apt-dump-solver.cc | 2 +- cmdline/apt-extracttemplates.cc | 8 +++---- cmdline/apt-get.cc | 36 +++++++++++++++---------------- cmdline/apt-helper.cc | 4 ++-- cmdline/apt-internal-solver.cc | 2 +- cmdline/apt-mark.cc | 12 +++++------ cmdline/apt-sortpkgs.cc | 4 ++-- cmdline/apt.cc | 2 +- 11 files changed, 66 insertions(+), 66 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 22778eb24..7e569f2fc 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -58,7 +58,7 @@ using namespace std; // LocalitySort - Sort a version list by package file locality /*{{{*/ // --------------------------------------------------------------------- /* */ -int LocalityCompare(const void *a, const void *b) +static int LocalityCompare(const void *a, const void *b) { pkgCache::VerFile *A = *(pkgCache::VerFile **)a; pkgCache::VerFile *B = *(pkgCache::VerFile **)b; @@ -75,13 +75,13 @@ int LocalityCompare(const void *a, const void *b) return A->File - B->File; } -void LocalitySort(pkgCache::VerFile **begin, +static void LocalitySort(pkgCache::VerFile **begin, unsigned long Count,size_t Size) { qsort(begin,Count,Size,LocalityCompare); } -void LocalitySort(pkgCache::DescFile **begin, +static void LocalitySort(pkgCache::DescFile **begin, unsigned long Count,size_t Size) { qsort(begin,Count,Size,LocalityCompare); @@ -90,7 +90,7 @@ void LocalitySort(pkgCache::DescFile **begin, // UnMet - Show unmet dependencies /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) +static bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) { bool Header = false; for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;) @@ -163,7 +163,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important) } return true; } -bool UnMet(CommandLine &CmdL) +static bool UnMet(CommandLine &CmdL) { bool const Important = _config->FindB("APT::Cache::Important",false); @@ -193,7 +193,7 @@ bool UnMet(CommandLine &CmdL) // DumpPackage - Show a dump of a package record /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DumpPackage(CommandLine &CmdL) +static bool DumpPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; APT::CacheSetHelper helper(true, GlobalError::NOTICE); @@ -258,7 +258,7 @@ bool DumpPackage(CommandLine &CmdL) // Stats - Dump some nice statistics /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Stats(CommandLine &Cmd) +static bool Stats(CommandLine &Cmd) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -371,7 +371,7 @@ bool Stats(CommandLine &Cmd) // Dump - show everything /*{{{*/ // --------------------------------------------------------------------- /* This is worthless except fer debugging things */ -bool Dump(CommandLine &Cmd) +static bool Dump(CommandLine &Cmd) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -423,7 +423,7 @@ bool Dump(CommandLine &Cmd) // --------------------------------------------------------------------- /* This is needed to make dpkg --merge happy.. I spent a bit of time to make this run really fast, perhaps I went a little overboard.. */ -bool DumpAvail(CommandLine &Cmd) +static bool DumpAvail(CommandLine &Cmd) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -562,7 +562,7 @@ bool DumpAvail(CommandLine &Cmd) } /*}}}*/ // ShowDepends - Helper for printing out a dependency tree /*{{{*/ -bool ShowDepends(CommandLine &CmdL, bool const RevDepends) +static bool ShowDepends(CommandLine &CmdL, bool const RevDepends) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -676,7 +676,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends) // Depends - Print out a dependency tree /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Depends(CommandLine &CmdL) +static bool Depends(CommandLine &CmdL) { return ShowDepends(CmdL, false); } @@ -684,7 +684,7 @@ bool Depends(CommandLine &CmdL) // RDepends - Print out a reverse dependency tree /*{{{*/ // --------------------------------------------------------------------- /* */ -bool RDepends(CommandLine &CmdL) +static bool RDepends(CommandLine &CmdL) { return ShowDepends(CmdL, true); } @@ -693,7 +693,7 @@ bool RDepends(CommandLine &CmdL) // --------------------------------------------------------------------- // Code contributed from Junichi Uekawa on 20 June 2002. -bool XVcg(CommandLine &CmdL) +static bool XVcg(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -905,7 +905,7 @@ bool XVcg(CommandLine &CmdL) /* Dotty is the graphvis program for generating graphs. It is a fairly simple queuing algorithm that just writes dependencies and nodes. http://www.research.att.com/sw/tools/graphviz/ */ -bool Dotty(CommandLine &CmdL) +static bool Dotty(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1126,7 +1126,7 @@ static unsigned char const* skipDescriptionFields(unsigned char const * DescP) ++DescP; return DescP; } -bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V) +static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V) { pkgCache *Cache = CacheFile.GetPkgCache(); if (unlikely(Cache == NULL)) @@ -1228,7 +1228,7 @@ struct ExDescFile // Search - Perform a search /*{{{*/ // --------------------------------------------------------------------- /* This searches the package names and package descriptions for a pattern */ -bool Search(CommandLine &CmdL) +static bool Search(CommandLine &CmdL) { bool const ShowFull = _config->FindB("APT::Cache::ShowFull",false); bool const NamesOnly = _config->FindB("APT::Cache::NamesOnly",false); @@ -1388,7 +1388,7 @@ bool Search(CommandLine &CmdL) } /*}}}*/ /* ShowAuto - show automatically installed packages (sorted) {{{*/ -bool ShowAuto(CommandLine &CmdL) +static bool ShowAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1415,7 +1415,7 @@ bool ShowAuto(CommandLine &CmdL) // ShowPackage - Dump the package record to the screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowPackage(CommandLine &CmdL) +static bool ShowPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); @@ -1439,7 +1439,7 @@ bool ShowPackage(CommandLine &CmdL) // ShowPkgNames - Show package names /*{{{*/ // --------------------------------------------------------------------- /* This does a prefix match on the first argument */ -bool ShowPkgNames(CommandLine &CmdL) +static bool ShowPkgNames(CommandLine &CmdL) { pkgCacheFile CacheFile; if (unlikely(CacheFile.BuildCaches(NULL, false) == false)) @@ -1478,7 +1478,7 @@ bool ShowPkgNames(CommandLine &CmdL) // ShowSrcPackage - Show source package records /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowSrcPackage(CommandLine &CmdL) +static bool ShowSrcPackage(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgSourceList *List = CacheFile.GetSourceList(); @@ -1515,7 +1515,7 @@ bool ShowSrcPackage(CommandLine &CmdL) // Policy - Show the results of the preferences file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Policy(CommandLine &CmdL) +static bool Policy(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1644,7 +1644,7 @@ bool Policy(CommandLine &CmdL) // Madison - Look a bit like katie's madison /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Madison(CommandLine &CmdL) +static bool Madison(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgSourceList *SrcList = CacheFile.GetSourceList(); @@ -1717,7 +1717,7 @@ bool Madison(CommandLine &CmdL) // GenCaches - Call the main cache generator /*{{{*/ // --------------------------------------------------------------------- /* */ -bool GenCaches(CommandLine &Cmd) +static bool GenCaches(CommandLine &Cmd) { OpTextProgress Progress(*_config); @@ -1728,7 +1728,7 @@ bool GenCaches(CommandLine &Cmd) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &Cmd) +static bool ShowHelp(CommandLine &Cmd) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 9aaebefd7..dc0e050c3 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -111,7 +111,7 @@ OpProgress* pkgCdromTextStatus::GetOpProgress() } /*}}}*/ // SetupAutoDetect /*{{{*/ -bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) +static bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) { bool Debug = _config->FindB("Debug::Acquire::cdrom", false); @@ -155,7 +155,7 @@ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &aut sequence is to mount/umount the CD, Ident it then scan it for package files and reduce that list. Then we copy over the package files and verify them. Then rewrite the database files */ -bool DoAdd(CommandLine &) +static bool DoAdd(CommandLine &) { pkgUdevCdromDevices UdevCdroms; pkgCdromTextStatus log; @@ -201,7 +201,7 @@ bool DoAdd(CommandLine &) // DoIdent - Ident a CDROM /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoIdent(CommandLine &) +static bool DoIdent(CommandLine &) { pkgUdevCdromDevices UdevCdroms; string ident; @@ -247,7 +247,7 @@ bool DoIdent(CommandLine &) // ShowHelp - Show the help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 9f20b3c1b..e83c4b64b 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -40,7 +40,7 @@ using namespace std; // DoShell - Handle the shell command /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoShell(CommandLine &CmdL) +static bool DoShell(CommandLine &CmdL) { for (const char **I = CmdL.FileList + 1; *I != 0; I += 2) { @@ -63,7 +63,7 @@ bool DoShell(CommandLine &CmdL) // DoDump - Dump the configuration space /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoDump(CommandLine &CmdL) +static bool DoDump(CommandLine &CmdL) { bool const empty = _config->FindB("APT::Config::Dump::EmptyValue", true); std::string const format = _config->Find("APT::Config::Dump::Format", "%f \"%v\";\n"); @@ -78,7 +78,7 @@ bool DoDump(CommandLine &CmdL) // ShowHelp - Show the help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &CmdL) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index aa16b1271..c26cdc70a 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -18,7 +18,7 @@ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp() { +static bool ShowHelp() { std::cout << PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl << diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 2408a7d9d..2b01968e3 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -212,7 +212,7 @@ bool DebFile::ParseInfo() // ShowHelp - show a short help text /*{{{*/ // --------------------------------------------------------------------- /* */ -int ShowHelp(void) +static int ShowHelp(void) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -237,7 +237,7 @@ int ShowHelp(void) // WriteFile - write the contents of the passed string to a file /*{{{*/ // --------------------------------------------------------------------- /* */ -string WriteFile(const char *package, const char *prefix, const char *data) +static string WriteFile(const char *package, const char *prefix, const char *data) { char fn[512]; static int i; @@ -265,7 +265,7 @@ string WriteFile(const char *package, const char *prefix, const char *data) // WriteConfig - write out the config data from a debian package file /*{{{*/ // --------------------------------------------------------------------- /* */ -void WriteConfig(const DebFile &file) +static void WriteConfig(const DebFile &file) { string templatefile = WriteFile(file.Package.c_str(), "template", file.Template); string configscript = WriteFile(file.Package.c_str(), "config", file.Config); @@ -279,7 +279,7 @@ void WriteConfig(const DebFile &file) // InitCache - initialize the package cache /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Go(CommandLine &CmdL) +static bool Go(CommandLine &CmdL) { // Initialize the apt cache MMap *Map = 0; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index f8de80a91..253b2f4a5 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -97,7 +97,7 @@ using namespace std; // --------------------------------------------------------------------- /* This used to be inlined in DoInstall, but with the advent of regex package name matching it was split out.. */ -bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, +static bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, pkgProblemResolver &Fix,bool Remove,bool BrokenFix, bool AllowFail = true) { @@ -138,7 +138,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, // helper that can go wit hthe next ABI break #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) -std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) +static std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) { // FIXME: this cast is the horror, the horror debReleaseIndex *r = (debReleaseIndex*)metaindex; @@ -159,7 +159,7 @@ std::string MetaIndexFileNameOnDisk(metaIndex *metaindex) // GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/ // --------------------------------------------------------------------- /* */ -std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, +static std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, pkgSrcRecords::Parser *Parse) { // try to find release @@ -194,7 +194,7 @@ std::string GetReleaseForSourceRecord(pkgSourceList *SrcList, // FindSrc - Find a source record /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, +static pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgSrcRecords &SrcRecs,string &Src, CacheFile &CacheFile) { @@ -430,7 +430,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, } /*}}}*/ /* mark packages as automatically/manually installed. {{{*/ -bool DoMarkAuto(CommandLine &CmdL) +static bool DoMarkAuto(CommandLine &CmdL) { bool Action = true; int AutoMarkChanged = 0; @@ -475,7 +475,7 @@ bool DoMarkAuto(CommandLine &CmdL) // DoDSelectUpgrade - Do an upgrade by following dselects selections /*{{{*/ // --------------------------------------------------------------------- /* Follows dselect's selections */ -bool DoDSelectUpgrade(CommandLine &CmdL) +static bool DoDSelectUpgrade(CommandLine &CmdL) { CacheFile Cache; if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false) @@ -551,7 +551,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) // DoClean - Remove download archives /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoClean(CommandLine &CmdL) +static bool DoClean(CommandLine &CmdL) { std::string const archivedir = _config->FindDir("Dir::Cache::archives"); std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache"); @@ -599,7 +599,7 @@ class LogCleaner : public pkgArchiveCleaner }; }; -bool DoAutoClean(CommandLine &CmdL) +static bool DoAutoClean(CommandLine &CmdL) { // Lock the archive directory FileFd Lock; @@ -623,7 +623,7 @@ bool DoAutoClean(CommandLine &CmdL) /*}}}*/ // DoDownload - download a binary /*{{{*/ // --------------------------------------------------------------------- -bool DoDownload(CommandLine &CmdL) +static bool DoDownload(CommandLine &CmdL) { CacheFile Cache; if (Cache.ReadOnlyOpen() == false) @@ -696,7 +696,7 @@ bool DoDownload(CommandLine &CmdL) // --------------------------------------------------------------------- /* Opening automatically checks the system, this command is mostly used for debugging */ -bool DoCheck(CommandLine &CmdL) +static bool DoCheck(CommandLine &CmdL) { CacheFile Cache; Cache.Open(); @@ -715,7 +715,7 @@ struct DscFile string Dsc; }; -bool DoSource(CommandLine &CmdL) +static bool DoSource(CommandLine &CmdL) { CacheFile Cache; if (Cache.Open(false) == false) @@ -1016,7 +1016,7 @@ bool DoSource(CommandLine &CmdL) // --------------------------------------------------------------------- /* This function will look at the build depends list of the given source package and install the necessary packages to make it true, or fail. */ -bool DoBuildDep(CommandLine &CmdL) +static bool DoBuildDep(CommandLine &CmdL) { CacheFile Cache; @@ -1410,7 +1410,7 @@ bool DoBuildDep(CommandLine &CmdL) * pool/ next to the deb itself) * Example return: "pool/main/a/apt/apt_0.8.8ubuntu3" */ -string GetChangelogPath(CacheFile &Cache, +static string GetChangelogPath(CacheFile &Cache, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver) { @@ -1437,7 +1437,7 @@ string GetChangelogPath(CacheFile &Cache, * apt-get changelog mplayer-doc: * http://packages.medibuntu.org/pool/non-free/m/mplayer/mplayer_1.0~rc4~try1.dsfg1-1ubuntu1+medibuntu1.changelog */ -bool GuessThirdPartyChangelogUri(CacheFile &Cache, +static bool GuessThirdPartyChangelogUri(CacheFile &Cache, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver, string &out_uri) @@ -1462,7 +1462,7 @@ bool GuessThirdPartyChangelogUri(CacheFile &Cache, /*}}}*/ // DownloadChangelog - Download the changelog /*{{{*/ // --------------------------------------------------------------------- -bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, +static bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, pkgCache::VerIterator Ver, string targetfile) /* Download a changelog file for the given package version to * targetfile. This will first try the server from Apt::Changelogs::Server @@ -1517,7 +1517,7 @@ bool DownloadChangelog(CacheFile &CacheFile, pkgAcquire &Fetcher, /*}}}*/ // DoChangelog - Get changelog from the command line /*{{{*/ // --------------------------------------------------------------------- -bool DoChangelog(CommandLine &CmdL) +static bool DoChangelog(CommandLine &CmdL) { CacheFile Cache; if (Cache.ReadOnlyOpen() == false) @@ -1581,7 +1581,7 @@ bool DoChangelog(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &CmdL) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); @@ -1677,7 +1677,7 @@ bool ShowHelp(CommandLine &CmdL) // SigWinch - Window size change signal handler /*{{{*/ // --------------------------------------------------------------------- /* */ -void SigWinch(int) +static void SigWinch(int) { // Riped from GNU ls #ifdef TIOCGWINSZ diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index c1c8b2178..d8ea0435a 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -33,7 +33,7 @@ /*}}}*/ using namespace std; -bool DoDownloadFile(CommandLine &CmdL) +static bool DoDownloadFile(CommandLine &CmdL) { if (CmdL.FileSize() <= 2) return _error->Error(_("Must specify at least one pair url/filename")); @@ -55,7 +55,7 @@ bool DoDownloadFile(CommandLine &CmdL) return true; } -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &CmdL) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index bf5b8c1fe..108e86b9a 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -30,7 +30,7 @@ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) { +static bool ShowHelp(CommandLine &CmdL) { ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index d3a3a780b..1af17cd7a 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -35,7 +35,7 @@ ostream c1out(0); ostream c2out(0); ofstream devnull("/dev/null"); /* DoAuto - mark packages as automatically/manually installed {{{*/ -bool DoAuto(CommandLine &CmdL) +static bool DoAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -82,7 +82,7 @@ bool DoAuto(CommandLine &CmdL) /* DoMarkAuto - mark packages as automatically/manually installed {{{*/ /* Does the same as DoAuto but tries to do it exactly the same why as the python implementation did it so it can be a drop-in replacement */ -bool DoMarkAuto(CommandLine &CmdL) +static bool DoMarkAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -119,7 +119,7 @@ bool DoMarkAuto(CommandLine &CmdL) } /*}}}*/ /* ShowAuto - show automatically installed packages (sorted) {{{*/ -bool ShowAuto(CommandLine &CmdL) +static bool ShowAuto(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -159,7 +159,7 @@ bool ShowAuto(CommandLine &CmdL) } /*}}}*/ /* DoHold - mark packages as hold by dpkg {{{*/ -bool DoHold(CommandLine &CmdL) +static bool DoHold(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -335,7 +335,7 @@ bool DoHold(CommandLine &CmdL) } /*}}}*/ /* ShowHold - show packages set on hold in dpkg status {{{*/ -bool ShowHold(CommandLine &CmdL) +static bool ShowHold(CommandLine &CmdL) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -372,7 +372,7 @@ bool ShowHold(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &CmdL) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 46989044e..8d9cb23de 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -62,7 +62,7 @@ struct PkgName /*{{{*/ // DoIt - Sort a single file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoIt(string InFile) +static bool DoIt(string InFile) { FileFd Fd(InFile,FileFd::ReadOnly); pkgTagFile Tags(&Fd); @@ -142,7 +142,7 @@ bool DoIt(string InFile) // ShowHelp - Show the help text /*{{{*/ // --------------------------------------------------------------------- /* */ -int ShowHelp() +static int ShowHelp() { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 7ef9060aa..040ed6c25 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -61,7 +61,7 @@ -bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &CmdL) { ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); -- cgit v1.2.3 From 655122418d714f342b5d9789f45f8035f3fe8b9a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 1 Mar 2014 15:11:42 +0100 Subject: =?UTF-8?q?warning:=20unused=20parameter=20=E2=80=98foo=E2=80=99?= =?UTF-8?q?=20[-Wunused-parameter]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-By: gcc -Wunused-parameter Git-Dch: Ignore --- cmdline/apt-cache.cc | 12 ++++++------ cmdline/apt-cdrom.cc | 2 +- cmdline/apt-config.cc | 2 +- cmdline/apt-extracttemplates.cc | 2 +- cmdline/apt-get.cc | 10 +++++----- cmdline/apt-helper.cc | 2 +- cmdline/apt-internal-solver.cc | 2 +- cmdline/apt-mark.cc | 2 +- cmdline/apt.cc | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 7e569f2fc..d50e0c724 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -258,7 +258,7 @@ static bool DumpPackage(CommandLine &CmdL) // Stats - Dump some nice statistics /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool Stats(CommandLine &Cmd) +static bool Stats(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -371,7 +371,7 @@ static bool Stats(CommandLine &Cmd) // Dump - show everything /*{{{*/ // --------------------------------------------------------------------- /* This is worthless except fer debugging things */ -static bool Dump(CommandLine &Cmd) +static bool Dump(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -423,7 +423,7 @@ static bool Dump(CommandLine &Cmd) // --------------------------------------------------------------------- /* This is needed to make dpkg --merge happy.. I spent a bit of time to make this run really fast, perhaps I went a little overboard.. */ -static bool DumpAvail(CommandLine &Cmd) +static bool DumpAvail(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1388,7 +1388,7 @@ static bool Search(CommandLine &CmdL) } /*}}}*/ /* ShowAuto - show automatically installed packages (sorted) {{{*/ -static bool ShowAuto(CommandLine &CmdL) +static bool ShowAuto(CommandLine &) { pkgCacheFile CacheFile; pkgCache *Cache = CacheFile.GetPkgCache(); @@ -1717,7 +1717,7 @@ static bool Madison(CommandLine &CmdL) // GenCaches - Call the main cache generator /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool GenCaches(CommandLine &Cmd) +static bool GenCaches(CommandLine &) { OpTextProgress Progress(*_config); @@ -1728,7 +1728,7 @@ static bool GenCaches(CommandLine &Cmd) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool ShowHelp(CommandLine &Cmd) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index dc0e050c3..8e1d27e52 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -93,7 +93,7 @@ bool pkgCdromTextStatus::AskCdromName(string &name) } -void pkgCdromTextStatus::Update(string text, int current) +void pkgCdromTextStatus::Update(string text, int /*current*/) { if(text.size() > 0) cout << text << flush; diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index e83c4b64b..26f0ea161 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -78,7 +78,7 @@ static bool DoDump(CommandLine &CmdL) // ShowHelp - Show the help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 2b01968e3..a27008233 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -137,7 +137,7 @@ bool DebFile::DoItem(Item &I, int &Fd) // DebFile::Process examine element in package and copy /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DebFile::Process(Item &I, const unsigned char *data, +bool DebFile::Process(Item &/*I*/, const unsigned char *data, unsigned long size, unsigned long pos) { switch (Which) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 253b2f4a5..9a4eb0881 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -475,7 +475,7 @@ static bool DoMarkAuto(CommandLine &CmdL) // DoDSelectUpgrade - Do an upgrade by following dselects selections /*{{{*/ // --------------------------------------------------------------------- /* Follows dselect's selections */ -static bool DoDSelectUpgrade(CommandLine &CmdL) +static bool DoDSelectUpgrade(CommandLine &) { CacheFile Cache; if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false) @@ -551,7 +551,7 @@ static bool DoDSelectUpgrade(CommandLine &CmdL) // DoClean - Remove download archives /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool DoClean(CommandLine &CmdL) +static bool DoClean(CommandLine &) { std::string const archivedir = _config->FindDir("Dir::Cache::archives"); std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache"); @@ -599,7 +599,7 @@ class LogCleaner : public pkgArchiveCleaner }; }; -static bool DoAutoClean(CommandLine &CmdL) +static bool DoAutoClean(CommandLine &) { // Lock the archive directory FileFd Lock; @@ -696,7 +696,7 @@ static bool DoDownload(CommandLine &CmdL) // --------------------------------------------------------------------- /* Opening automatically checks the system, this command is mostly used for debugging */ -static bool DoCheck(CommandLine &CmdL) +static bool DoCheck(CommandLine &) { CacheFile Cache; Cache.Open(); @@ -1581,7 +1581,7 @@ static bool DoChangelog(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index d8ea0435a..8ff2fa037 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -55,7 +55,7 @@ static bool DoDownloadFile(CommandLine &CmdL) return true; } -static bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 108e86b9a..0c2ff0f43 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -30,7 +30,7 @@ // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool ShowHelp(CommandLine &CmdL) { +static bool ShowHelp(CommandLine &) { ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 1af17cd7a..53b5ec158 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -372,7 +372,7 @@ static bool ShowHold(CommandLine &CmdL) // ShowHelp - Show a help screen /*{{{*/ // --------------------------------------------------------------------- /* */ -static bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 040ed6c25..1b7626948 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -61,7 +61,7 @@ -static bool ShowHelp(CommandLine &CmdL) +static bool ShowHelp(CommandLine &) { ioprintf(c1out,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- cmdline/acqprogress.cc | 2 + cmdline/apt-cache.cc | 51 ++++++++++++++----------- cmdline/apt-cdrom.cc | 9 +---- cmdline/apt-config.cc | 2 +- cmdline/apt-dump-solver.cc | 6 ++- cmdline/apt-extracttemplates.cc | 9 ++--- cmdline/apt-extracttemplates.h | 3 +- cmdline/apt-get.cc | 83 +++++++++++++++++++++-------------------- cmdline/apt-helper.cc | 12 ++---- cmdline/apt-internal-solver.cc | 10 ++++- cmdline/apt-mark.cc | 29 +++++++++----- cmdline/apt-sortpkgs.cc | 6 +-- cmdline/apt.cc | 40 ++++---------------- 13 files changed, 130 insertions(+), 132 deletions(-) (limited to 'cmdline') diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index 3ac350aca..c362c1edf 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -10,12 +10,14 @@ // Include files /*{{{*/ #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index d50e0c724..0860ee7bf 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -15,40 +15,49 @@ // Include Files /*{{{*/ #include -#include +#include #include #include -#include -#include -#include #include -#include +#include #include +#include +#include +#include #include -#include -#include +#include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include #include +#include -#include -#include -#include -#include -#include #include +#include #include -#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 8e1d27e52..facb6002b 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -20,22 +20,15 @@ #include #include #include -#include -#include #include #include #include -#include #include -#include #include -#include +#include #include -#include -#include #include -#include #include diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index 26f0ea161..d95780c73 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -26,10 +26,10 @@ #include #include -#include #include #include #include +#include #include diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index c26cdc70a..04e13bde9 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -9,10 +9,12 @@ // Include Files /*{{{*/ #include -#include - +#include +#include #include #include + +#include /*}}}*/ // ShowHelp - Show a help screen /*{{{*/ diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index a27008233..a82623444 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -18,8 +18,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -30,14 +30,13 @@ #include #include #include +#include +#include +#include #include #include -#include #include -#include - -#include #include "apt-extracttemplates.h" diff --git a/cmdline/apt-extracttemplates.h b/cmdline/apt-extracttemplates.h index 6d07a09c2..9cc3f5f25 100644 --- a/cmdline/apt-extracttemplates.h +++ b/cmdline/apt-extracttemplates.h @@ -11,11 +11,12 @@ #define _APTEXTRACTTEMPLATE_H_ #include -#include #include #include +class pkgCache; + class DebFile : public pkgDirStream { FileFd File; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9a4eb0881..a830c2387 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -27,66 +27,67 @@ // Include Files /*{{{*/ #include +#include +#include #include -#include +#include +#include +#include #include -#include +#include #include -#include -#include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include +#include +#include #include #include -#include +#include +#include #include -#include #include -#include -#include +#include #include -#include - -#include - -#include -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include #include - -#include -#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index 8ff2fa037..d66b3ffae 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -7,6 +7,7 @@ // Include Files /*{{{*/ #include +#include #include #include #include @@ -20,14 +21,9 @@ #include #include -#include -#include -#include -#include -#include -#include - - +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc index 0c2ff0f43..b85c07c33 100644 --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@ -20,7 +20,15 @@ #include #include #include - +#include +#include +#include +#include + +#include +#include +#include +#include #include #include diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc index 53b5ec158..ed348358a 100644 --- a/cmdline/apt-mark.cc +++ b/cmdline/apt-mark.cc @@ -11,20 +11,31 @@ #include #include #include +#include #include -#include #include -#include +#include +#include +#include +#include +#include +#include + +#include -#include #include -#include -#include -#include -#include #include - -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index 8d9cb23de..c2b11890a 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -25,9 +25,9 @@ #include #include - -#include -#include +#include +#include +#include #include /*}}}*/ diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 1b7626948..5dbf868d7 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -11,39 +11,12 @@ // Include Files /*{{{*/ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - +#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include - -#include +#include +#include #include #include @@ -55,11 +28,14 @@ #include #include #include -#include #include - /*}}}*/ +#include +#include +#include +#include + /*}}}*/ static bool ShowHelp(CommandLine &) { -- cgit v1.2.3 From a02db58fd50ef7fc2f0284852c6b3f98e458a232 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 00:33:10 +0100 Subject: follow method attribute suggestions by gcc Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn} --- cmdline/apt-cache.cc | 2 +- cmdline/apt-cdrom.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 0860ee7bf..84b775390 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1118,7 +1118,7 @@ static bool Dotty(CommandLine &CmdL) /* This displays the package record from the proper package index file. It is not used by DumpAvail for performance reasons. */ -static unsigned char const* skipDescriptionFields(unsigned char const * DescP) +static APT_PURE unsigned char const* skipDescriptionFields(unsigned char const * DescP) { char const * const TagName = "\nDescription"; size_t const TagLen = strlen(TagName); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index facb6002b..b7447463d 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -98,7 +98,7 @@ bool pkgCdromTextStatus::ChangeCdrom() return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() +APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress() { return &Progress; } -- cgit v1.2.3 From 500dc0700136092692d1cceba4e5c1639bcfc825 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 01:31:55 +0100 Subject: use SPtrArray handling instead of explicit delete[] The warning message from gcc doesn't make that much sense in my reading as there is no loop which could overflow here, but it is better to use our SPtrArray wrapping anyway which fixes the warning as well. warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] delete[] Dsc; Git-Dch: Ignore Reported-By: gcc -Wunsafe-loop-optimizations --- cmdline/apt-get.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index a830c2387..caf69da2a 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -741,7 +741,7 @@ static bool DoSource(CommandLine &CmdL) pkgAcquire Fetcher; Fetcher.SetLog(&Stat); - DscFile *Dsc = new DscFile[CmdL.FileSize()]; + SPtrArray Dsc = new DscFile[CmdL.FileSize()]; // insert all downloaded uris into this set to avoid downloading them // twice @@ -762,7 +762,6 @@ static bool DoSource(CommandLine &CmdL) pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache); if (Last == 0) { - delete[] Dsc; return _error->Error(_("Unable to find a source package for %s"),Src.c_str()); } @@ -796,7 +795,6 @@ static bool DoSource(CommandLine &CmdL) // Back track vector Lst; if (Last->Files(Lst) == false) { - delete[] Dsc; return false; } @@ -859,7 +857,6 @@ static bool DoSource(CommandLine &CmdL) struct statvfs Buf; string OutputDir = "."; if (statvfs(OutputDir.c_str(),&Buf) != 0) { - delete[] Dsc; if (errno == EOVERFLOW) return _error->WarningE("statvfs",_("Couldn't determine free space in %s"), OutputDir.c_str()); @@ -874,7 +871,6 @@ static bool DoSource(CommandLine &CmdL) || unsigned(Stat.f_type) != RAMFS_MAGIC #endif ) { - delete[] Dsc; return _error->Error(_("You don't have enough free space in %s"), OutputDir.c_str()); } @@ -896,7 +892,6 @@ static bool DoSource(CommandLine &CmdL) { for (unsigned I = 0; I != J; I++) ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str()); - delete[] Dsc; return true; } @@ -907,7 +902,6 @@ static bool DoSource(CommandLine &CmdL) for (; I != Fetcher.UriEnd(); ++I) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; - delete[] Dsc; return true; } @@ -915,14 +909,12 @@ static bool DoSource(CommandLine &CmdL) bool Failed = false; if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true) { - delete[] Dsc; return _error->Error(_("Failed to fetch some archives.")); } if (_config->FindB("APT::Get::Download-only",false) == true) { c1out << _("Download complete and in download only mode") << endl; - delete[] Dsc; return true; } @@ -996,7 +988,6 @@ static bool DoSource(CommandLine &CmdL) _exit(0); } - delete[] Dsc; // Wait for the subprocess int Status = 0; -- cgit v1.2.3 From b5ee78aec0b13932bdeb710cbbea148b7041203a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 00:33:38 +0100 Subject: remove code duplication for Add & Ident in apt-cdrom The preparation code to deal with auto-detection and co is the same for both methods, so not sharing them would be bad. Deals also with the prevention of side effects triggered by the auto-detection like disabling mounting for the fallback. Git-Dch: Ignore --- cmdline/apt-cdrom.cc | 202 +++++++++++++++++++++------------------------------ 1 file changed, 81 insertions(+), 121 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index b7447463d..53efe65b8 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -34,12 +34,6 @@ #include /*}}}*/ -static const char *W_NO_CDROM_FOUND = \ - N_("No CD-ROM could be auto-detected or found using " - "the default mount point.\n" - "You may try the --cdrom option to set the CD-ROM mount point. " - "See 'man apt-cdrom' for more " - "information about the CD-ROM auto-detection and mount point."); using namespace std; @@ -103,143 +97,111 @@ APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress() return &Progress; } /*}}}*/ -// SetupAutoDetect /*{{{*/ -static bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) +// AddOrIdent - Add or Ident a CDROM /*{{{*/ +static bool AddOrIdent(bool const Add) { - bool Debug = _config->FindB("Debug::Acquire::cdrom", false); + pkgUdevCdromDevices UdevCdroms; + pkgCdromTextStatus log; + pkgCdrom cdrom; - automounted = false; + bool oneSuccessful = false; + bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); + if (AutoDetect == true && UdevCdroms.Dlopen() == true) + { + bool const Debug = _config->FindB("Debug::Acquire::cdrom", false); + std::string const CDMount = _config->Find("Acquire::cdrom::mount"); + bool const NoMount = _config->FindB("APT::CDROM::NoMount", false); + if (NoMount == false) + _config->Set("APT::CDROM::NoMount", true); + + vector const v = UdevCdroms.Scan(); + for (std::vector::const_iterator cd = v.begin(); cd != v.end(); ++cd) + { + if (Debug) + clog << "Looking at device:" + << "\tDeviveName: '" << cd->DeviceName << "'" + << "\tIsMounted: '" << cd->Mounted << "'" + << "\tMountPoint: '" << cd->MountPath << "'" + << endl; + + std::string AptMountPoint; + if (cd->Mounted) + _config->Set("Acquire::cdrom::mount", cd->MountPath); + else if (NoMount == true) + continue; + else + { + AptMountPoint = _config->FindDir("Dir::Media::MountPath"); + if (FileExists(AptMountPoint) == false) + mkdir(AptMountPoint.c_str(), 0750); + if(MountCdrom(AptMountPoint, cd->DeviceName) == false) + { + _error->Warning(_("Failed to mount '%s' to '%s'"), cd->DeviceName.c_str(), AptMountPoint.c_str()); + continue; + } + _config->Set("Acquire::cdrom::mount", AptMountPoint); + } - vector v = UdevCdroms.Scan(); - if (i >= v.size()) - return false; + _error->PushToStack(); + if (Add == true) + oneSuccessful = cdrom.Add(&log); + else + { + std::string id; + oneSuccessful = cdrom.Ident(id, &log); + } + _error->MergeWithStack(); - if (Debug) - clog << "Looking at devce " << i - << " DeviveName: " << v[i].DeviceName - << " IsMounted: '" << v[i].Mounted << "'" - << " MountPoint: '" << v[i].MountPath << "'" - << endl; + if (AptMountPoint.empty() == false) + UnmountCdrom(AptMountPoint); + } + if (NoMount == false) + _config->Set("APT::CDROM::NoMount", NoMount); + _config->Set("Acquire::cdrom::mount", CDMount); + } - if (v[i].Mounted) + // fallback if auto-detect didn't work + if (oneSuccessful == false) { - // set the right options - _config->Set("Acquire::cdrom::mount", v[i].MountPath); - _config->Set("APT::CDROM::NoMount", true); - } else { - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - if (!FileExists(AptMountPoint)) - mkdir(AptMountPoint.c_str(), 0750); - if(MountCdrom(AptMountPoint, v[i].DeviceName) == false) - _error->Warning(_("Failed to mount '%s' to '%s'"), v[i].DeviceName.c_str(), AptMountPoint.c_str()); + _error->PushToStack(); + if (Add == true) + oneSuccessful = cdrom.Add(&log); else - automounted = true; - _config->Set("Acquire::cdrom::mount", AptMountPoint); - _config->Set("APT::CDROM::NoMount", true); + { + std::string id; + oneSuccessful = cdrom.Ident(id, &log); + } + _error->MergeWithStack(); } - i++; - return true; + if (oneSuccessful == false) + _error->Error("%s", _("No CD-ROM could be auto-detected or found using the default mount point.\n" + "You may try the --cdrom option to set the CD-ROM mount point.\n" + "See 'man apt-cdrom' for more information about the CD-ROM auto-detection and mount point.")); + else if (Add == true) + cout << _("Repeat this process for the rest of the CDs in your set.") << endl; + + return oneSuccessful; } /*}}}*/ // DoAdd - Add a new CDROM /*{{{*/ // --------------------------------------------------------------------- /* This does the main add bit.. We show some status and things. The - sequence is to mount/umount the CD, Ident it then scan it for package + sequence is to mount/umount the CD, Ident it then scan it for package files and reduce that list. Then we copy over the package files and verify them. Then rewrite the database files */ static bool DoAdd(CommandLine &) { - pkgUdevCdromDevices UdevCdroms; - pkgCdromTextStatus log; - pkgCdrom cdrom; - bool res = true; - - bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); - unsigned int count = 0; - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - bool automounted = false; - if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count, automounted)) { - if (count == 1) { - // begin loop with res false to detect any success using OR - res = false; - } - - // dump any warnings/errors from autodetect - if (_error->empty() == false) - _error->DumpErrors(); - - res |= cdrom.Add(&log); - - if (automounted) - UnmountCdrom(AptMountPoint); - - // dump any warnings/errors from add/unmount - if (_error->empty() == false) - _error->DumpErrors(); - } - - if (count == 0) - res = cdrom.Add(&log); - - if (res == false) - _error->Error("%s", _(W_NO_CDROM_FOUND)); - else - cout << _("Repeat this process for the rest of the CDs in your set.") << endl; - - return res; + return AddOrIdent(true); } /*}}}*/ // DoIdent - Ident a CDROM /*{{{*/ -// --------------------------------------------------------------------- -/* */ static bool DoIdent(CommandLine &) { - pkgUdevCdromDevices UdevCdroms; - string ident; - pkgCdromTextStatus log; - pkgCdrom cdrom; - bool res = true; - - bool AutoDetect = _config->FindB("Acquire::cdrom::AutoDetect", true); - - unsigned int count = 0; - string AptMountPoint = _config->FindDir("Dir::Media::MountPath"); - bool automounted = false; - if (AutoDetect && UdevCdroms.Dlopen()) - while (AutoDetectCdrom(UdevCdroms, count, automounted)) { - if (count == 1) { - // begin loop with res false to detect any success using OR - res = false; - } - - // dump any warnings/errors from autodetect - if (_error->empty() == false) - _error->DumpErrors(); - - res |= cdrom.Ident(ident, &log); - - if (automounted) - UnmountCdrom(AptMountPoint); - - // dump any warnings/errors from add/unmount - if (_error->empty() == false) - _error->DumpErrors(); - } - - if (count == 0) - res = cdrom.Ident(ident, &log); - - if (res == false) - _error->Error("%s", _(W_NO_CDROM_FOUND)); - - return res; + return AddOrIdent(false); } /*}}}*/ // ShowHelp - Show the help screen /*{{{*/ -// --------------------------------------------------------------------- -/* */ static bool ShowHelp(CommandLine &) { ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, @@ -306,14 +268,12 @@ int main(int argc,const char *argv[]) /*{{{*/ _config->Set("quiet","1"); // Match the operation - CmdL.DispatchArg(Cmds); + bool returned = CmdL.DispatchArg(Cmds); - // Print any errors or warnings found during parsing - bool const Errors = _error->PendingError(); if (_config->FindI("quiet",0) > 0) _error->DumpErrors(); else _error->DumpErrors(GlobalError::DEBUG); - return Errors == true ? 100 : 0; + return returned == true ? 0 : 100; } /*}}}*/ -- cgit v1.2.3 From 0d58c26ad7b2308f08f4e6002cbf218605c1c7cf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 14:15:45 +0100 Subject: improve debug output in case downloadfile fails Git-Dch: Ignore --- cmdline/apt-helper.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index d66b3ffae..37279ec28 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -27,7 +28,6 @@ #include /*}}}*/ -using namespace std; static bool DoDownloadFile(CommandLine &CmdL) { @@ -43,23 +43,22 @@ static bool DoDownloadFile(CommandLine &CmdL) new pkgAcqFile(&Fetcher, download_uri, "", 0, "desc", "short-desc", "dest-dir-ignored", targetfile); Fetcher.Run(); - if (!FileExists(targetfile)) - { - _error->Error(_("Download Failed")); - return false; - } + bool Failed = false; + if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == false || + FileExists(targetfile) == false) + return _error->Error(_("Download Failed")); return true; } static bool ShowHelp(CommandLine &) { - ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, + ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION, COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) return true; - cout << + std::cout << _("Usage: apt-helper [options] command\n" " apt-helper [options] download-file uri target-path\n" "\n" -- cgit v1.2.3 From 52922e2a6795aadcbb8dd11bba14db0f05da34c6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 15:12:11 +0100 Subject: cmdline parsing: apt-config is not apt-cdrom --- cmdline/apt-config.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmdline') diff --git a/cmdline/apt-config.cc b/cmdline/apt-config.cc index d95780c73..40ba468eb 100644 --- a/cmdline/apt-config.cc +++ b/cmdline/apt-config.cc @@ -108,7 +108,7 @@ int main(int argc,const char *argv[]) /*{{{*/ {"help",&ShowHelp}, {0,0}}; - std::vector Args = getCommandArgs("apt-cdrom", CommandLine::GetCommand(Cmds, argc, argv)); + std::vector Args = getCommandArgs("apt-config", CommandLine::GetCommand(Cmds, argc, argv)); // Set up gettext support setlocale(LC_ALL,""); -- cgit v1.2.3