Explorar el Código

* cmdline/apt-get.cc:
- "apt-get install foo" on a already installed package foo will
clean the automatic installed flag

Michael Vogt hace 19 años
padre
commit
7db98f3149
Se han modificado 3 ficheros con 26 adiciones y 2 borrados
  1. 21 0
      cmdline/apt-get.cc
  2. 1 1
      configure.in
  3. 4 1
      debian/changelog

+ 21 - 0
cmdline/apt-get.cc

@@ -1556,6 +1556,7 @@ bool DoInstall(CommandLine &CmdL)
    if (Cache->BrokenCount() != 0)
       BrokenFix = true;
    
+   unsigned int AutoMarkChanged = 0;
    unsigned int ExpectedInst = 0;
    unsigned int Packages = 0;
    pkgProblemResolver Fix(Cache);
@@ -1692,6 +1693,18 @@ bool DoInstall(CommandLine &CmdL)
 		  return false;
 	    if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false)
 	       return false;
+
+	    // see if we need to fix the auto-mark flag 
+	    // e.g. apt-get install foo 
+	    // where foo is marked automatic
+	    if(Cache[Pkg].Install() == false && 
+	       (Cache[Pkg].Flags & pkgCache::Flag::Auto))
+	    {
+	       ioprintf(c1out,_("%s set to manual installed.\n"),
+			Pkg.Name());
+	       Cache->MarkAuto(Pkg,false);
+	       AutoMarkChanged++;
+	    }
 	 }      
       }
 
@@ -1854,6 +1867,14 @@ bool DoInstall(CommandLine &CmdL)
 
    }
 
+   // if nothing changed in the cache, but only the automark information
+   // we write the StateFile here, otherwise it will be written in 
+   // cache.commit()
+   if (AutoMarkChanged > 0 &&
+       Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
+       Cache->BadCount() == 0)
+      Cache->writeStateFile(NULL);
+
    // See if we need to prompt
    if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0)
       return InstallPackages(Cache,false,false);

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu9")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.46.4ubuntu10")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

+ 4 - 1
debian/changelog

@@ -5,8 +5,11 @@ apt (0.6.46.4ubuntu10) feisty; urgency=low
       of packages in this section manual
   * debian/apt.conf.ubuntu:
     - added APT::Never-MarkAuto-Section "metapackages";
+  * cmdline/apt-get.cc:
+    - "apt-get install foo" on a already installed package foo will
+      clean the automatic installed flag
 
- --
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 14 Mar 2007 12:34:46 +0100
 
 apt (0.6.46.4ubuntu9) feisty; urgency=low