]> git.saurik.com Git - apt.git/commitdiff
Merge remote-tracking branch 'ajt/better-pdiffs-dk' into debian/sid
authorMichael Vogt <mvo@debian.org>
Fri, 24 Jan 2014 22:00:57 +0000 (23:00 +0100)
committerMichael Vogt <mvo@debian.org>
Fri, 24 Jan 2014 22:00:57 +0000 (23:00 +0100)
13 files changed:
.gitignore
apt-private/private-cmndline.cc
apt-private/private-search.cc
apt-private/private-upgrade.cc
apt-private/private-upgrade.h
cmdline/apt-get.cc
cmdline/apt-mark.cc
cmdline/apt.cc
test/integration/test-apt-binary [deleted file]
test/integration/test-apt-cli-list [new file with mode: 0755]
test/integration/test-apt-cli-search [new file with mode: 0755]
test/integration/test-apt-cli-show [new file with mode: 0755]
test/integration/test-apt-cli-upgrade [new file with mode: 0755]

index 321b15471d92f9aa859a9f80eb05782863cc582f..69a229c3ec8e42fe998f0ca2526428365e32796d 100644 (file)
@@ -1,3 +1,4 @@
+*~
 # build artifacts
 /aclocal.m4
 /autom4te.cache/
index cbb40d42e7281d48111e4fc0d7ec440868e38a4b..d6d7bca64be8ebedc56effc33e850d4e3ab0e46c 100644 (file)
@@ -230,11 +230,6 @@ bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * const Cm
       addArg('v', "verbose", "APT::Cmd::List-Include-Summary", 0);
       addArg('a', "all-versions", "APT::Cmd::All-Versions", 0);
    }
-   else if (CmdMatches("upgrade"))
-   {
-      // FIXME: find a better term
-      addArg(0,"dist","APT::Cmd::Dist-Upgrade", CommandLine::Boolean);
-   }
    else if (addArgumentsAPTGet(Args, Cmd) || addArgumentsAPTCache(Args, Cmd))
    {
        // we have no (supported) command-name overlaps so far, so we call
index ff4140fa70099d09128445c4b7490402f8e82e78..9d7f3613850d9c4ed98d1be47c1cd04201498ccc 100644 (file)
@@ -53,7 +53,7 @@ bool FullTextSearch(CommandLine &CmdL)                                        /*{{{*/
    std::map<std::string, std::string>::const_iterator K;
 
    LocalitySortedVersionSet bag;
-   OpTextProgress progress;
+   OpTextProgress progress(*_config);
    progress.OverallProgress(0, 100, 50,  _("Sorting"));
    GetLocalitySortedVersionSet(CacheFile, bag, progress);
    LocalitySortedVersionSet::iterator V = bag.begin();
index e76b5d7fc0efd6e29d255050db3db7108c51aa20..a97e6d25b3afdc02abeb684cc9cf4f35f5fa6f8d 100644 (file)
@@ -1,3 +1,4 @@
+
 // Includes                                                            /*{{{*/
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/upgrade.h>
@@ -39,6 +40,14 @@ bool DoDistUpgrade(CommandLine &CmdL)
    return UpgradeHelper(CmdL, 0);
 }
                                                                        /*}}}*/
+bool DoUpgrade(CommandLine &CmdL)                                      /*{{{*/
+{
+   if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
+      return DoUpgradeWithAllowNewPackages(CmdL);
+   else
+      return DoUpgradeNoNewPackages(CmdL);
+}
+                                                                       /*}}}*/
 // DoUpgradeNoNewPackages - Upgrade all packages                       /*{{{*/
 // ---------------------------------------------------------------------
 /* Upgrade all packages without installing new packages or erasing old
index 050d3a66825344fdb5ae970d2b7f8fd5d34d39e0..5efc66bf7b9884eb74ad480599e3e5fa47147421 100644 (file)
@@ -5,6 +5,7 @@
 
 
 bool DoDistUpgrade(CommandLine &CmdL);
+bool DoUpgrade(CommandLine &CmdL);
 bool DoUpgradeNoNewPackages(CommandLine &CmdL);
 bool DoUpgradeWithAllowNewPackages(CommandLine &CmdL);
 
index 8a0772ce26b716b6a05834ff48b3c5b263892110..da7d28a1e9ba8044b1760ae32701b69d43ff7148 100644 (file)
@@ -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[])                                  /*{{{*/
index ebb1f98924a8931e94b0c8fafac41b5cfb494aad..d3a3a780bb4072284055867c1c0fdc020cbfd3d6 100644 (file)
@@ -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"
index 61d5d938aba4c7267bf2a1218a1f290801ed26d8..6fe25e3f39f0336fbae59df2dda88717eaf5dd45 100644 (file)
@@ -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,28 +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},
-                                   // needs root
+
+                                   // 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},
@@ -130,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);
diff --git a/test/integration/test-apt-binary b/test/integration/test-apt-binary
deleted file mode 100755 (executable)
index 8d5df90..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-
-setupenvironment
-configarchitecture "i386"
-
-insertpackage 'unstable' 'foo' 'all' '1.0'
-insertinstalledpackage 'bar' 'i386' '1.0'
-
-insertinstalledpackage 'foobar' 'i386' '1.0'
-insertpackage 'unstable' 'foobar' 'i386' '2.0'
-
-setupaptarchive
-
-APTARCHIVE=$(readlink -f ./aptarchive)
-
-testequal "Listing...
-bar/now 1.0 [installed,local] i386
-foo/unstable 1.0 all
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list
-
-testequal "Listing...
-foo/unstable 1.0 all
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*"
-
-testequal "Listing...
-foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable
-
-# FIXME: hm, hm - does it make sense to have this different? shouldn't
-#        we use "installed,upgradable" consitently?
-testequal "Listing...
-bar/now 1.0 [installed,local] i386
-foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed
-
-testequal "Listing...
-foobar/unstable 2.0 [upgradable from: 1.0] i386
-foobar/now 1.0 [installed,upgradable to: 2.0] i386
-" apt list foobar --all-versions
-
-testequal "Listing...
-bar/now 1.0 [installed,local] i386
-  an autogenerated dummy bar=1.0/installed
-" apt list bar --verbose
-
diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list
new file mode 100755 (executable)
index 0000000..8d5df90
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'foo' 'all' '1.0'
+insertinstalledpackage 'bar' 'i386' '1.0'
+
+insertinstalledpackage 'foobar' 'i386' '1.0'
+insertpackage 'unstable' 'foobar' 'i386' '2.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+foo/unstable 1.0 all
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list
+
+testequal "Listing...
+foo/unstable 1.0 all
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*"
+
+testequal "Listing...
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable
+
+# FIXME: hm, hm - does it make sense to have this different? shouldn't
+#        we use "installed,upgradable" consitently?
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed
+
+testequal "Listing...
+foobar/unstable 2.0 [upgradable from: 1.0] i386
+foobar/now 1.0 [installed,upgradable to: 2.0] i386
+" apt list foobar --all-versions
+
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+  an autogenerated dummy bar=1.0/installed
+" apt list bar --verbose
+
diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search
new file mode 100755 (executable)
index 0000000..979aff8
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+DESCR='Some description that has a unusual word xxyyzz and aabbcc'
+DESCR2='Some other description with the unusual aabbcc only'
+insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+insertpackage 'testing' 'bar' 'i386' '2.0' '' '' "$DESCR2"
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# with OP progress 
+testequal "Sorting...
+Full Text Search...
+foo/unstable 1.0 all
+  $DESCR
+" apt search xxyyzz
+
+# without op progress
+testequal "foo/unstable 1.0 all
+  $DESCR
+" apt search -qq xxyyzz
+
+# search with multiple words is a AND search
+testequal "foo/unstable 1.0 all
+  $DESCR
+" apt search -qq aabbcc xxyyzz
+
+# output is sorted and search word finds both package
+testequal "bar/testing 2.0 i386
+  $DESCR2
+
+foo/unstable 1.0 all
+  $DESCR
+" apt search -qq aabbcc
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
new file mode 100755 (executable)
index 0000000..0ab3d2e
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+DESCR='Some description 
+ That has multiple lines'
+insertpackage 'unstable' 'foo' 'all' '1.0' '' '' "$DESCR"
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# note that we do not display Description-md5 with the "apt" cmd
+testequal "Package: foo
+Priority: optional
+Section: other
+Installed-Size: 42
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: all
+Version: 1.0
+Filename: pool/main/foo/foo_1.0_all.deb
+Description: Some description 
+ That has multiple lines
+" apt show foo
diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade
new file mode 100755 (executable)
index 0000000..163a555
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'foo' 'all' '2.0' 'Depends: foo-new-dependency'
+insertpackage 'unstable' 'foo-new-dependency' 'all' '2.0'
+insertinstalledpackage 'foo' 'all' '1.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# default is to allow new dependencies
+testequal "Calculating upgrade... Done
+The following NEW packages will be installed:
+  foo-new-dependency
+The following packages will be upgraded:
+  foo
+1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo-new-dependency (2.0 unstable [all])
+Inst foo [1.0] (2.0 unstable [all])
+Conf foo-new-dependency (2.0 unstable [all])
+Conf foo (2.0 unstable [all])" apt upgrade -qq -s
+
+# ensure 
+testequal "Calculating upgrade... Done
+The following packages have been kept back:
+  foo
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs