summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-09-19 17:22:41 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-09-19 17:22:41 +0200
commit39cc1bbdd0faa13dcb150b573f56cd2dd64fa460 (patch)
tree7b5c110b57ff941aacdb7bcc3810afb91013c83f
parentd6df222d8edb3e38401affcee2a4e5eba605da32 (diff)
* cmdline/apt-get.cc:
- changed syntax from "installtask" to "install taskname^" (the ^ <- makes it look for tasks)
-rw-r--r--cmdline/apt-get.cc86
-rw-r--r--po/apt-all.pot99
2 files changed, 96 insertions, 89 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 2062aaa16..09bf572a5 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -1409,55 +1409,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 /*{{{*/
@@ -1496,6 +1487,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
@@ -1512,7 +1515,7 @@ bool DoInstall(CommandLine &CmdL)
S[--Length] = 0;
continue;
}
-
+
char *Slash = strchr(S,'=');
if (Slash != 0)
{
@@ -2600,7 +2603,6 @@ int main(int argc,const char *argv[])
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
{"upgrade",&DoUpgrade},
{"install",&DoInstall},
- {"installtask",&DoInstallTask},
{"remove",&DoInstall},
{"dist-upgrade",&DoDistUpgrade},
{"dselect-upgrade",&DoDSelectUpgrade},
diff --git a/po/apt-all.pot b/po/apt-all.pot
index d4c3a4ff7..46299c8b6 100644
--- a/po/apt-all.pot
+++ b/po/apt-all.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-09-19 15:56+0200\n"
+"POT-Creation-Date: 2006-09-19 17:21+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -148,7 +148,7 @@ msgstr ""
#: cmdline/apt-cache.cc:1652 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70
#: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:550
-#: cmdline/apt-get.cc:2441 cmdline/apt-sortpkgs.cc:144
+#: cmdline/apt-get.cc:2444 cmdline/apt-sortpkgs.cc:144
#, c-format
msgid "%s %s for %s %s compiled on %s %s\n"
msgstr ""
@@ -546,7 +546,7 @@ msgstr ""
msgid "Y"
msgstr ""
-#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1560
+#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1563
#, c-format
msgid "Regex compilation error - %s"
msgstr ""
@@ -705,11 +705,11 @@ msgstr ""
msgid "Internal error, Ordering didn't finish"
msgstr ""
-#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1872 cmdline/apt-get.cc:1905
+#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1875 cmdline/apt-get.cc:1908
msgid "Unable to lock the download directory"
msgstr ""
-#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1953 cmdline/apt-get.cc:2189
+#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1956 cmdline/apt-get.cc:2192
#: apt-pkg/cachefile.cc:67
msgid "The list of sources could not be read."
msgstr ""
@@ -738,7 +738,7 @@ msgstr ""
msgid "After unpacking %sB disk space will be freed.\n"
msgstr ""
-#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:2043
+#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:2046
#, c-format
msgid "Couldn't determine free space in %s"
msgstr ""
@@ -772,7 +772,7 @@ msgstr ""
msgid "Do you want to continue [Y/n]? "
msgstr ""
-#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1365 cmdline/apt-get.cc:2086
+#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1365 cmdline/apt-get.cc:2089
#, c-format
msgid "Failed to fetch %s %s\n"
msgstr ""
@@ -781,7 +781,7 @@ msgstr ""
msgid "Some files failed to download"
msgstr ""
-#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2095
+#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2098
msgid "Download complete and in download only mode"
msgstr ""
@@ -891,27 +891,32 @@ msgstr ""
msgid "Internal error, AllUpgrade broke stuff"
msgstr ""
-#: cmdline/apt-get.cc:1547 cmdline/apt-get.cc:1583
+#: cmdline/apt-get.cc:1448
+#, c-format
+msgid "Couldn't find task %s"
+msgstr ""
+
+#: cmdline/apt-get.cc:1550 cmdline/apt-get.cc:1586
#, c-format
msgid "Couldn't find package %s"
msgstr ""
-#: cmdline/apt-get.cc:1570
+#: cmdline/apt-get.cc:1573
#, c-format
msgid "Note, selecting %s for regex '%s'\n"
msgstr ""
-#: cmdline/apt-get.cc:1600
+#: cmdline/apt-get.cc:1603
msgid "You might want to run `apt-get -f install' to correct these:"
msgstr ""
-#: cmdline/apt-get.cc:1603
+#: cmdline/apt-get.cc:1606
msgid ""
"Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a "
"solution)."
msgstr ""
-#: cmdline/apt-get.cc:1615
+#: cmdline/apt-get.cc:1618
msgid ""
"Some packages could not be installed. This may mean that you have\n"
"requested an impossible situation or if you are using the unstable\n"
@@ -919,163 +924,163 @@ msgid ""
"or been moved out of Incoming."
msgstr ""
-#: cmdline/apt-get.cc:1623
+#: cmdline/apt-get.cc:1626
msgid ""
"Since you only requested a single operation it is extremely likely that\n"
"the package is simply not installable and a bug report against\n"
"that package should be filed."
msgstr ""
-#: cmdline/apt-get.cc:1628
+#: cmdline/apt-get.cc:1631
msgid "The following information may help to resolve the situation:"
msgstr ""
-#: cmdline/apt-get.cc:1631
+#: cmdline/apt-get.cc:1634
msgid "Broken packages"
msgstr ""
-#: cmdline/apt-get.cc:1657
+#: cmdline/apt-get.cc:1660
msgid "The following extra packages will be installed:"
msgstr ""
-#: cmdline/apt-get.cc:1746
+#: cmdline/apt-get.cc:1749
msgid "Suggested packages:"
msgstr ""
-#: cmdline/apt-get.cc:1747
+#: cmdline/apt-get.cc:1750
msgid "Recommended packages:"
msgstr ""
-#: cmdline/apt-get.cc:1767
+#: cmdline/apt-get.cc:1770
msgid "Calculating upgrade... "
msgstr ""
-#: cmdline/apt-get.cc:1770 methods/ftp.cc:702 methods/connect.cc:101
+#: cmdline/apt-get.cc:1773 methods/ftp.cc:702 methods/connect.cc:101
msgid "Failed"
msgstr ""
-#: cmdline/apt-get.cc:1775
+#: cmdline/apt-get.cc:1778
msgid "Done"
msgstr ""
-#: cmdline/apt-get.cc:1840 cmdline/apt-get.cc:1848
+#: cmdline/apt-get.cc:1843 cmdline/apt-get.cc:1851
msgid "Internal error, problem resolver broke stuff"
msgstr ""
-#: cmdline/apt-get.cc:1948
+#: cmdline/apt-get.cc:1951
msgid "Must specify at least one package to fetch source for"
msgstr ""
-#: cmdline/apt-get.cc:1978 cmdline/apt-get.cc:2207
+#: cmdline/apt-get.cc:1981 cmdline/apt-get.cc:2210
#, c-format
msgid "Unable to find a source package for %s"
msgstr ""
-#: cmdline/apt-get.cc:2022
+#: cmdline/apt-get.cc:2025
#, c-format
msgid "Skipping already downloaded file '%s'\n"
msgstr ""
-#: cmdline/apt-get.cc:2046
+#: cmdline/apt-get.cc:2049
#, c-format
msgid "You don't have enough free space in %s"
msgstr ""
-#: cmdline/apt-get.cc:2051
+#: cmdline/apt-get.cc:2054
#, c-format
msgid "Need to get %sB/%sB of source archives.\n"
msgstr ""
-#: cmdline/apt-get.cc:2054
+#: cmdline/apt-get.cc:2057
#, c-format
msgid "Need to get %sB of source archives.\n"
msgstr ""
-#: cmdline/apt-get.cc:2060
+#: cmdline/apt-get.cc:2063
#, c-format
msgid "Fetch source %s\n"
msgstr ""
-#: cmdline/apt-get.cc:2091
+#: cmdline/apt-get.cc:2094
msgid "Failed to fetch some archives."
msgstr ""
-#: cmdline/apt-get.cc:2119
+#: cmdline/apt-get.cc:2122
#, c-format
msgid "Skipping unpack of already unpacked source in %s\n"
msgstr ""
-#: cmdline/apt-get.cc:2131
+#: cmdline/apt-get.cc:2134
#, c-format
msgid "Unpack command '%s' failed.\n"
msgstr ""
-#: cmdline/apt-get.cc:2132
+#: cmdline/apt-get.cc:2135
#, c-format
msgid "Check if the 'dpkg-dev' package is installed.\n"
msgstr ""
-#: cmdline/apt-get.cc:2149
+#: cmdline/apt-get.cc:2152
#, c-format
msgid "Build command '%s' failed.\n"
msgstr ""
-#: cmdline/apt-get.cc:2168
+#: cmdline/apt-get.cc:2171
msgid "Child process failed"
msgstr ""
-#: cmdline/apt-get.cc:2184
+#: cmdline/apt-get.cc:2187
msgid "Must specify at least one package to check builddeps for"
msgstr ""
-#: cmdline/apt-get.cc:2212
+#: cmdline/apt-get.cc:2215
#, c-format
msgid "Unable to get build-dependency information for %s"
msgstr ""
-#: cmdline/apt-get.cc:2232
+#: cmdline/apt-get.cc:2235
#, c-format
msgid "%s has no build depends.\n"
msgstr ""
-#: cmdline/apt-get.cc:2284
+#: cmdline/apt-get.cc:2287
#, c-format
msgid ""
"%s dependency for %s cannot be satisfied because the package %s cannot be "
"found"
msgstr ""
-#: cmdline/apt-get.cc:2336
+#: cmdline/apt-get.cc:2339
#, c-format
msgid ""
"%s dependency for %s cannot be satisfied because no available versions of "
"package %s can satisfy version requirements"
msgstr ""
-#: cmdline/apt-get.cc:2371
+#: cmdline/apt-get.cc:2374
#, c-format
msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new"
msgstr ""
-#: cmdline/apt-get.cc:2396
+#: cmdline/apt-get.cc:2399
#, c-format
msgid "Failed to satisfy %s dependency for %s: %s"
msgstr ""
-#: cmdline/apt-get.cc:2410
+#: cmdline/apt-get.cc:2413
#, c-format
msgid "Build-dependencies for %s could not be satisfied."
msgstr ""
-#: cmdline/apt-get.cc:2414
+#: cmdline/apt-get.cc:2417
msgid "Failed to process build dependencies"
msgstr ""
-#: cmdline/apt-get.cc:2446
+#: cmdline/apt-get.cc:2449
msgid "Supported modules:"
msgstr ""
-#: cmdline/apt-get.cc:2487
+#: cmdline/apt-get.cc:2490
msgid ""
"Usage: apt-get [options] command\n"
" apt-get [options] install|remove pkg1 [pkg2 ...]\n"