]> git.saurik.com Git - apt.git/commitdiff
* merged from apt--tasks
authorMichael Vogt <michael.vogt@ubuntu.com>
Tue, 19 Sep 2006 16:28:47 +0000 (18:28 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Tue, 19 Sep 2006 16:28:47 +0000 (18:28 +0200)
cmdline/apt-get.cc
configure.in
debian/changelog
po/apt-all.pot

index 0c2e15d7e793ae1c57fc66d20d26bd635e8d0eee..6ea0d372796bb0e25cb3078fd71532cfad292b07 100644 (file)
@@ -1499,55 +1499,46 @@ bool DoUpgrade(CommandLine &CmdL)
 // DoInstallTask - Install task from the command line                  /*{{{*/
 // ---------------------------------------------------------------------
 /* Install named task */
-bool DoInstallTask(CommandLine &CmdL)
+bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix, 
+                   bool BrokenFix,
+                   unsigned int& ExpectedInst, 
+                   const char *taskname)
 {
    const char *start, *end;
    pkgCache::PkgIterator Pkg;
+   char buf[64*1024];
+   regex_t Pattern;
 
-   CacheFile Cache;
-   if (Cache.OpenForInstall() == false || 
-       Cache.CheckDeps(CmdL.FileSize() != 1) == false)
-      return false;
-
-   // create the records parser
+   // get the records
    pkgRecords Recs(Cache);
-   
-   unsigned int ExpectedInst = 0;
-   pkgProblemResolver Fix(Cache);
-   char buf[64*1024];
 
-   for (const char **I = CmdL.FileList + 1; *I != 0; I++)
+   // build regexp for the task
+   char S[300];
+   snprintf(S, sizeof(S), "^Task:.*[^a-z]%s[^a-z].*\n", taskname);
+   regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
+   
+   bool found = false;
+   bool res = true;
+   for (Pkg = Cache.PkgBegin(); Pkg.end() == false; Pkg++)
    {
-      regex_t Pattern;
-
-      // build regexp for the task
-      char S[300];
-      snprintf(S, sizeof(S), "^Task:.*[^a-z]%s[^a-z].*\n", *I);
-      regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE);
-
-      for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
-      {
-        pkgCache::VerIterator ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
-        if(ver.end())
-           continue;
-        pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
-        parser.GetRec(start,end);
-        strncpy(buf, start, end-start);
-        buf[end-start] = 0x0;
-        if (regexec(&Pattern,buf,0,0,0) != 0)
-           continue;
-        TryToInstall(Pkg,Cache,Fix,false,true,ExpectedInst);
-      }
-
-      regfree(&Pattern);
+      pkgCache::VerIterator ver = Cache[Pkg].CandidateVerIter(Cache);
+      if(ver.end())
+        continue;
+      pkgRecords::Parser &parser = Recs.Lookup(ver.FileList());
+      parser.GetRec(start,end);
+      strncpy(buf, start, end-start);
+      buf[end-start] = 0x0;
+      if (regexec(&Pattern,buf,0,0,0) != 0)
+        continue;
+      res &= TryToInstall(Pkg,Cache,Fix,false,BrokenFix,ExpectedInst);
+      found = true;
    }
-
-   // Call the scored problem resolver
-   Fix.InstallProtect();
-   Fix.Resolve(true);
    
-   // prompt for install
-   return InstallPackages(Cache,false,true);
+   if(!found)
+      _error->Error(_("Couldn't find task %s"),taskname);
+
+   regfree(&Pattern);
+   return res;
 }
 
 // DoInstall - Install packages from the command line                  /*{{{*/
@@ -1572,6 +1563,7 @@ bool DoInstall(CommandLine &CmdL)
    bool DefRemove = false;
    if (strcasecmp(CmdL.FileList[0],"remove") == 0)
       DefRemove = true;
+
    else if (strcasecmp(CmdL.FileList[0], "autoremove") == 0)
    {
       _config->Set("APT::Get::AutomaticRemove", "true");
@@ -1594,6 +1586,18 @@ bool DoInstall(CommandLine &CmdL)
         bool Remove = DefRemove;
         char *VerTag = 0;
         bool VerIsRel = false;
+
+        // this is a task!
+        if (Length >= 1 && S[Length - 1] == '^')
+        {
+           S[--Length] = 0;
+           // tasks must always be confirmed
+           ExpectedInst += 1000;
+           // see if we can install it
+           TryInstallTask(Cache, Fix, BrokenFix, ExpectedInst, S);
+           continue;
+        }
+
         while (Cache->FindPkg(S).end() == true)
         {
            // Handle an optional end tag indicating what to do
@@ -1682,6 +1686,7 @@ bool DoInstall(CommandLine &CmdL)
         }
         else
         {
+
            if (VerTag != 0)
               if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false)
                  return false;
@@ -2707,7 +2712,6 @@ int main(int argc,const char *argv[])
    CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
                                    {"upgrade",&DoUpgrade},
                                    {"install",&DoInstall},
-                                   {"installtask",&DoInstallTask},
                                    {"remove",&DoInstall},
                                   {"autoremove",&DoInstall},
                                    {"dist-upgrade",&DoDistUpgrade},
index 4647f4ffb0ad51614ee1f5fcad3ccdd02841769e..baedcad129cd4bceb8ff135c3fe0ba17affd042d 100644 (file)
@@ -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.45ubuntu10")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.45ubuntu11")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
index 9111149c9cb73d2d2d24829deed4d4a248a76d5e..f98e02b1adfd2c293b61e5cd11deedd1dd8ebb78 100644 (file)
@@ -1,3 +1,10 @@
+apt (0.6.45ubuntu11) edgy; urgency=low
+
+  * removed "installtask" and change it so that tasknames can be given
+    with "apt-get install taskname^"
+
+ -- 
+
 apt (0.6.45ubuntu10) edgy; urgency=low
 
   * methods/http.cc:
index a329525a6cc6df4b96d02e7c310202c11a901f01..de72c430eb5ec7945a4ac07549d429d6aeb1baed 100644 (file)
@@ -1508,11 +1508,12 @@ msgid "File not found"
 msgstr ""
 
 #: methods/copy.cc:42 methods/gpgv.cc:281 methods/gzip.cc:133
-#: methods/gzip.cc:142
+#: methods/gzip.cc:142 methods/gzip.cc:134 methods/gzip.cc:143
 msgid "Failed to stat"
 msgstr ""
 
 #: methods/copy.cc:79 methods/gpgv.cc:278 methods/gzip.cc:139
+#: methods/gzip.cc:140
 msgid "Failed to set modification time"
 msgstr ""
 
@@ -2143,12 +2144,12 @@ msgstr ""
 msgid "Failed to write temporary StateFile %s"
 msgstr ""
 
-#: apt-pkg/tagfile.cc:85 apt-pkg/tagfile.cc:92
+#: apt-pkg/tagfile.cc:85 apt-pkg/tagfile.cc:92 apt-pkg/tagfile.cc:73
 #, c-format
 msgid "Unable to parse package file %s (1)"
 msgstr ""
 
-#: apt-pkg/tagfile.cc:186
+#: apt-pkg/tagfile.cc:186 apt-pkg/tagfile.cc:160
 #, c-format
 msgid "Unable to parse package file %s (2)"
 msgstr ""