summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc17
-rw-r--r--cmdline/apt-get.cc12
-rwxr-xr-xcmdline/apt-key1
-rwxr-xr-xcmdline/apt-mark22
4 files changed, 33 insertions, 19 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 286f306cd..3f68579cc 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -1498,15 +1498,26 @@ bool ShowSrcPackage(CommandLine &CmdL)
if (_error->PendingError() == true)
return false;
+ unsigned found = 0;
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
SrcRecs.Restart();
pkgSrcRecords::Parser *Parse;
- while ((Parse = SrcRecs.Find(*I,false)) != 0)
- cout << Parse->AsStr() << endl;;
+ unsigned found_this = 0;
+ while ((Parse = SrcRecs.Find(*I,false)) != 0) {
+ cout << Parse->AsStr() << endl;;
+ found++;
+ found_this++;
+ }
+ if (found_this == 0) {
+ _error->Warning(_("Unable to locate package %s"),*I);
+ continue;
+ }
}
- return true;
+ if (found > 0)
+ return true;
+ return _error->Error(_("No packages found"));
}
/*}}}*/
// Policy - Show the results of the preferences file /*{{{*/
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index d4fefa9c7..3c90354b0 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1506,10 +1506,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
// only show stuff in the list that is not yet marked for removal
if(Cache[Pkg].Delete() == false)
{
+ ++autoRemoveCount;
// we don't need to fill the strings if we don't need them
- if (smallList == true)
- ++autoRemoveCount;
- else
+ if (smallList == false)
{
autoremovelist += string(Pkg.Name()) + " ";
autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
@@ -1522,9 +1521,12 @@ bool DoAutomaticRemove(CacheFile &Cache)
if (doAutoRemove == false && (autoremovelist.empty() == false || autoRemoveCount != 0))
{
if (smallList == false)
- ShowList(c1out, _("The following packages were automatically installed and are no longer required:"), autoremovelist, autoremoveversions);
+ ShowList(c1out, P_("The following package is automatically installed and is no longer required:",
+ "The following packages were automatically installed and are no longer required:",
+ autoRemoveCount), autoremovelist, autoremoveversions);
else
- ioprintf(c1out, _("%lu packages were automatically installed and are no longer required.\n"), autoRemoveCount);
+ ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n",
+ "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
}
// Now see if we had destroyed anything (if we had done anything)
diff --git a/cmdline/apt-key b/cmdline/apt-key
index e45468fd4..27731ef7d 100755
--- a/cmdline/apt-key
+++ b/cmdline/apt-key
@@ -146,6 +146,7 @@ if [ "$1" = "--keyring" ]; then
else
#echo "generate list"
TRUSTEDFILE="/etc/apt/trusted.gpg"
+ eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
if [ -r "$TRUSTEDFILE" ]; then
GPG="$GPG --keyring $TRUSTEDFILE"
fi
diff --git a/cmdline/apt-mark b/cmdline/apt-mark
index 466a56f27..31383d987 100755
--- a/cmdline/apt-mark
+++ b/cmdline/apt-mark
@@ -19,10 +19,10 @@ def show_automatic(filename):
if not os.path.exists(STATE_FILE):
return
auto = set()
- tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
- while tagfile.Step():
- pkgname = tagfile.Section.get("Package")
- autoInst = tagfile.Section.get("Auto-Installed")
+ tagfile = apt_pkg.TagFile(open(STATE_FILE))
+ for section in tagfile:
+ pkgname = section.get("Package")
+ autoInst = section.get("Auto-Installed")
if int(autoInst):
auto.add(pkgname)
print "\n".join(sorted(auto))
@@ -33,24 +33,24 @@ def mark_unmark_automatic(filename, action, pkgs):
# open the statefile
if os.path.exists(STATE_FILE):
try:
- tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
+ tagfile = apt_pkg.TagFile(open(STATE_FILE))
outfile = open(STATE_FILE+".tmp","w")
except IOError, msg:
print "%s, are you root?" % (msg)
sys.exit(1)
- while tagfile.Step():
- pkgname = tagfile.Section.get("Package")
- autoInst = tagfile.Section.get("Auto-Installed")
+ for section in tagfile:
+ pkgname = section.get("Package")
+ autoInst = section.get("Auto-Installed")
if pkgname in pkgs:
if options.verbose:
print "changing %s to %s" % (pkgname,action)
- newsec = apt_pkg.RewriteSection(tagfile.Section,
+ newsec = apt_pkg.rewrite_section(section,
[],
[ ("Auto-Installed",str(action)) ])
pkgs.remove(pkgname)
outfile.write(newsec+"\n")
else:
- outfile.write(str(tagfile.Section)+"\n")
+ outfile.write(str(section)+"\n")
if action == 1:
for pkgname in pkgs:
if options.verbose:
@@ -78,7 +78,7 @@ if __name__ == "__main__":
# get the state-file
if not options.filename:
- STATE_FILE = apt_pkg.Config.FindDir("Dir::State") + "extended_states"
+ STATE_FILE = apt_pkg.config.find_dir("Dir::State") + "extended_states"
else:
STATE_FILE=options.filename