]> git.saurik.com Git - apt.git/commitdiff
* cmdline/apt-get.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 12 Mar 2010 09:59:37 +0000 (10:59 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 12 Mar 2010 09:59:37 +0000 (10:59 +0100)
  - add a --only-upgrade flag to install command (Closes: #572259)

That is NOT what is requested in e.g. #74067 - this is a very simple
flag which behaves orthogonal to --no-upgrade not a full-blown
upgrade option for a single package instead of the whole package set.

cmdline/apt-get.cc
debian/changelog
doc/apt-get.8.xml

index 5a814e255e4971f0a42c863244500d9afcbb50cb..b35e16b9274c8a51d904f8627f27bec6712afb41 100644 (file)
@@ -1098,7 +1098,17 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
                  Pkg.Name());
       return true;
    }
-   
+
+   // Ignore request for install if package would be new
+   if (_config->FindB("APT::Get::Only-Upgrade", false) == true &&
+       Pkg->CurrentVer == 0)
+   {
+      if (AllowFail == true)
+        ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"),
+                 Pkg.Name());
+      return true;
+   }
+
    // Check if there is something at all to install
    pkgDepCache::StateCache &State = Cache[Pkg];
    if (Remove == true && Pkg->CurrentVer == 0)
@@ -1779,6 +1789,7 @@ bool DoInstall(CommandLine &CmdL)
               Cache[Pkg].Install() == false && 
               (Cache[Pkg].Flags & pkgCache::Flag::Auto) &&
               _config->FindB("APT::Get::ReInstall",false) == false &&
+              _config->FindB("APT::Get::Only-Upgrade",false) == false &&
               _config->FindB("APT::Get::Download-Only",false) == false)
            {
               ioprintf(c1out,_("%s set to manually installed.\n"),
@@ -2821,6 +2832,7 @@ int main(int argc,const char *argv[])                                     /*{{{*/
       {0,"fix-missing","APT::Get::Fix-Missing",0},
       {0,"ignore-hold","APT::Ignore-Hold",0},      
       {0,"upgrade","APT::Get::upgrade",0},
+      {0,"only-upgrade","APT::Get::Only-Upgrade",0},
       {0,"force-yes","APT::Get::force-yes",0},
       {0,"print-uris","APT::Get::Print-URIs",0},
       {0,"diff-only","APT::Get::Diff-Only",0},
index d1983ee9e96a8c3bd8bf353816f966869fd5f69c..f27c096b60ec066e1ee960c8ca5a16e76dedc4fe 100644 (file)
@@ -14,6 +14,8 @@ apt (0.7.26) UNRELEASED; urgency=low
       Thanks to Osamu Aoki for pointing it out! (Closes: #567669)
   * apt-pkg/deb/dpkgpm.cc:
     - fix error message construction in OpenLog()
+  * cmdline/apt-get.cc:
+    - add a --only-upgrade flag to install command (Closes: #572259)
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 19 Feb 2010 21:21:43 +0100
 
index 3d22f262ca9b2b5c79a7dcc0bad6d12ad4ec2ef6..4f8c801696105743c113d0f440155e4f01892e72 100644 (file)
      Configuration Item: <literal>APT::Get::Upgrade</literal>.</para></listitem>
      </varlistentry>
 
+     <varlistentry><term><option>--only-upgrade</option></term>
+     <listitem><para>Do not install new packages; When used in conjunction with <literal>install</literal>,
+     <literal>only-upgrade</literal> will prevent packages on the command line
+     from being upgraded if they are not already installed.
+     Configuration Item: <literal>APT::Get::Only-Upgrade</literal>.</para></listitem>
+     </varlistentry>
+
      <varlistentry><term><option>--force-yes</option></term>
      <listitem><para>Force yes; This is a dangerous option that will cause apt to continue 
      without prompting if it is doing something potentially harmful. It