From c158ff49dacb8f6fdca98f9b43329eac44f1a827 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 14:02:53 +0200 Subject: * tasksupport (apt-get installtask lala) added --- Makefile | 4 +-- cmdline/apt-get.cc | 56 +++++++++++++++++++++++++++++++ po/apt-all.pot | 98 +++++++++++++++++++++++++++--------------------------- 3 files changed, 107 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index 72cac61b5..b35ad4a0d 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ all headers library clean veryclean binary program doc dirs: $(MAKE) -C cmdline $@ $(MAKE) -C ftparchive $@ $(MAKE) -C dselect $@ - $(MAKE) -C doc $@ - $(MAKE) -C po $@ +# $(MAKE) -C doc $@ +# $(MAKE) -C po $@ # Some very common aliases .PHONY: maintainer-clean dist-clean distclean pristine sanity diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 64882e3e8..9705f84dc 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1406,6 +1406,61 @@ bool DoUpgrade(CommandLine &CmdL) return InstallPackages(Cache,true); } /*}}}*/ +// DoInstallTask - Install task from the command line /*{{{*/ +// --------------------------------------------------------------------- +/* Install named task */ +bool DoInstallTask(CommandLine &CmdL) +{ + const char *start, *end; + pkgCache::PkgIterator Pkg; + + CacheFile Cache; + if (Cache.OpenForInstall() == false || + Cache.CheckDeps(CmdL.FileSize() != 1) == false) + return false; + + // create the records parser + pkgRecords Recs(Cache); + + unsigned int ExpectedInst = 0; + unsigned int Packages = 0; + pkgProblemResolver Fix(Cache); + char buf[64*1024]; + + for (const char **I = CmdL.FileList + 1; *I != 0; I++) + { + regex_t Pattern; + int Res; + + // build regexp for the task + char S[300]; + snprintf(S, sizeof(S), "^Task:.*%s.*\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,false,ExpectedInst); + } + } + + // Call the scored problem resolver + Fix.InstallProtect(); + if (Fix.Resolve(true) == false) + _error->Discard(); + + // prompt for install + return InstallPackages(Cache,false,true); +} + // DoInstall - Install packages from the command line /*{{{*/ // --------------------------------------------------------------------- /* Install named packages */ @@ -2546,6 +2601,7 @@ 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 352f2f5a6..006a07bfc 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-12 11:18+0200\n" +"POT-Creation-Date: 2006-09-19 13:29+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \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:2387 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2430 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:1506 +#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1549 #, 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:1818 cmdline/apt-get.cc:1851 +#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1861 cmdline/apt-get.cc:1894 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1899 cmdline/apt-get.cc:2135 +#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1942 cmdline/apt-get.cc:2178 #: 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:1989 +#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:2032 #, 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:2032 +#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1365 cmdline/apt-get.cc:2075 #, 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:2041 +#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2084 msgid "Download complete and in download only mode" msgstr "" @@ -891,27 +891,27 @@ msgstr "" msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1493 cmdline/apt-get.cc:1529 +#: cmdline/apt-get.cc:1536 cmdline/apt-get.cc:1572 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1516 +#: cmdline/apt-get.cc:1559 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1546 +#: cmdline/apt-get.cc:1589 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1549 +#: cmdline/apt-get.cc:1592 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1561 +#: cmdline/apt-get.cc:1604 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 +919,163 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1569 +#: cmdline/apt-get.cc:1612 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:1574 +#: cmdline/apt-get.cc:1617 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1577 +#: cmdline/apt-get.cc:1620 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1603 +#: cmdline/apt-get.cc:1646 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1692 +#: cmdline/apt-get.cc:1735 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1693 +#: cmdline/apt-get.cc:1736 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1713 +#: cmdline/apt-get.cc:1756 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1716 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1759 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1721 +#: cmdline/apt-get.cc:1764 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1786 cmdline/apt-get.cc:1794 +#: cmdline/apt-get.cc:1829 cmdline/apt-get.cc:1837 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1894 +#: cmdline/apt-get.cc:1937 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1924 cmdline/apt-get.cc:2153 +#: cmdline/apt-get.cc:1967 cmdline/apt-get.cc:2196 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:1968 +#: cmdline/apt-get.cc:2011 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1992 +#: cmdline/apt-get.cc:2035 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:1997 +#: cmdline/apt-get.cc:2040 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2000 +#: cmdline/apt-get.cc:2043 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2006 +#: cmdline/apt-get.cc:2049 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2037 +#: cmdline/apt-get.cc:2080 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2065 +#: cmdline/apt-get.cc:2108 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2077 +#: cmdline/apt-get.cc:2120 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2078 +#: cmdline/apt-get.cc:2121 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2095 +#: cmdline/apt-get.cc:2138 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2114 +#: cmdline/apt-get.cc:2157 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2130 +#: cmdline/apt-get.cc:2173 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2158 +#: cmdline/apt-get.cc:2201 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2178 +#: cmdline/apt-get.cc:2221 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2230 +#: cmdline/apt-get.cc:2273 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2282 +#: cmdline/apt-get.cc:2325 #, 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:2317 +#: cmdline/apt-get.cc:2360 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2342 +#: cmdline/apt-get.cc:2385 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2356 +#: cmdline/apt-get.cc:2399 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2360 +#: cmdline/apt-get.cc:2403 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2392 +#: cmdline/apt-get.cc:2435 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2433 +#: cmdline/apt-get.cc:2476 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -2112,12 +2112,12 @@ msgstr "" msgid "Dependency generation" msgstr "" -#: 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:160 #, c-format msgid "Unable to parse package file %s (2)" msgstr "" -- cgit v1.2.3 From ab04fa68f216974b277c708ab0788ef8798f879f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 15:41:52 +0200 Subject: * cmdline/apt-get.cc: - install with FixBroken=true --- cmdline/apt-get.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9705f84dc..57e0e9ec7 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1434,7 +1434,7 @@ bool DoInstallTask(CommandLine &CmdL) // build regexp for the task char S[300]; - snprintf(S, sizeof(S), "^Task:.*%s.*\n", *I); + 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++) @@ -1448,14 +1448,13 @@ bool DoInstallTask(CommandLine &CmdL) buf[end-start] = 0x0; if (regexec(&Pattern,buf,0,0,0) != 0) continue; - TryToInstall(Pkg,Cache,Fix,false,false,ExpectedInst); + TryToInstall(Pkg,Cache,Fix,false,true,ExpectedInst); } } // Call the scored problem resolver Fix.InstallProtect(); - if (Fix.Resolve(true) == false) - _error->Discard(); + Fix.Resolve(true); // prompt for install return InstallPackages(Cache,false,true); -- cgit v1.2.3 From 352a3d00984634f65dd7a929c3254fd160fd931a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 15:46:14 +0200 Subject: * Makefile: - re-comment the building of the manual stuff --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b35ad4a0d..72cac61b5 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ all headers library clean veryclean binary program doc dirs: $(MAKE) -C cmdline $@ $(MAKE) -C ftparchive $@ $(MAKE) -C dselect $@ -# $(MAKE) -C doc $@ -# $(MAKE) -C po $@ + $(MAKE) -C doc $@ + $(MAKE) -C po $@ # Some very common aliases .PHONY: maintainer-clean dist-clean distclean pristine sanity -- cgit v1.2.3 From d6df222d8edb3e38401affcee2a4e5eba605da32 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 16:06:06 +0200 Subject: * cmdline/apt-get.cc: - call regexp_free() --- cmdline/apt-get.cc | 4 +-- po/apt-all.pot | 94 +++++++++++++++++++++++++++--------------------------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 57e0e9ec7..2062aaa16 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1423,14 +1423,12 @@ bool DoInstallTask(CommandLine &CmdL) pkgRecords Recs(Cache); unsigned int ExpectedInst = 0; - unsigned int Packages = 0; pkgProblemResolver Fix(Cache); char buf[64*1024]; for (const char **I = CmdL.FileList + 1; *I != 0; I++) { regex_t Pattern; - int Res; // build regexp for the task char S[300]; @@ -1450,6 +1448,8 @@ bool DoInstallTask(CommandLine &CmdL) continue; TryToInstall(Pkg,Cache,Fix,false,true,ExpectedInst); } + + regfree(&Pattern); } // Call the scored problem resolver diff --git a/po/apt-all.pot b/po/apt-all.pot index 006a07bfc..d4c3a4ff7 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 13:29+0200\n" +"POT-Creation-Date: 2006-09-19 15:56+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \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:2430 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2441 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:1549 +#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1560 #, 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:1861 cmdline/apt-get.cc:1894 +#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1872 cmdline/apt-get.cc:1905 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1942 cmdline/apt-get.cc:2178 +#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1953 cmdline/apt-get.cc:2189 #: 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:2032 +#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:2043 #, 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:2075 +#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1365 cmdline/apt-get.cc:2086 #, 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:2084 +#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2095 msgid "Download complete and in download only mode" msgstr "" @@ -891,27 +891,27 @@ msgstr "" msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1536 cmdline/apt-get.cc:1572 +#: cmdline/apt-get.cc:1547 cmdline/apt-get.cc:1583 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1559 +#: cmdline/apt-get.cc:1570 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1589 +#: cmdline/apt-get.cc:1600 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1592 +#: cmdline/apt-get.cc:1603 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1604 +#: cmdline/apt-get.cc:1615 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 +919,163 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1612 +#: cmdline/apt-get.cc:1623 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:1617 +#: cmdline/apt-get.cc:1628 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1620 +#: cmdline/apt-get.cc:1631 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1646 +#: cmdline/apt-get.cc:1657 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1735 +#: cmdline/apt-get.cc:1746 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1736 +#: cmdline/apt-get.cc:1747 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1756 +#: cmdline/apt-get.cc:1767 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1759 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1770 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1764 +#: cmdline/apt-get.cc:1775 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1829 cmdline/apt-get.cc:1837 +#: cmdline/apt-get.cc:1840 cmdline/apt-get.cc:1848 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1937 +#: cmdline/apt-get.cc:1948 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1967 cmdline/apt-get.cc:2196 +#: cmdline/apt-get.cc:1978 cmdline/apt-get.cc:2207 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:2011 +#: cmdline/apt-get.cc:2022 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:2035 +#: cmdline/apt-get.cc:2046 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:2040 +#: cmdline/apt-get.cc:2051 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2043 +#: cmdline/apt-get.cc:2054 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2049 +#: cmdline/apt-get.cc:2060 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2080 +#: cmdline/apt-get.cc:2091 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2108 +#: cmdline/apt-get.cc:2119 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2120 +#: cmdline/apt-get.cc:2131 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2121 +#: cmdline/apt-get.cc:2132 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2138 +#: cmdline/apt-get.cc:2149 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2157 +#: cmdline/apt-get.cc:2168 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2173 +#: cmdline/apt-get.cc:2184 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2201 +#: cmdline/apt-get.cc:2212 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2221 +#: cmdline/apt-get.cc:2232 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2273 +#: cmdline/apt-get.cc:2284 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2325 +#: cmdline/apt-get.cc:2336 #, 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:2360 +#: cmdline/apt-get.cc:2371 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2385 +#: cmdline/apt-get.cc:2396 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2399 +#: cmdline/apt-get.cc:2410 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2403 +#: cmdline/apt-get.cc:2414 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2435 +#: cmdline/apt-get.cc:2446 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2476 +#: cmdline/apt-get.cc:2487 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" -- cgit v1.2.3 From 39cc1bbdd0faa13dcb150b573f56cd2dd64fa460 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 17:22:41 +0200 Subject: * cmdline/apt-get.cc: - changed syntax from "installtask" to "install taskname^" (the ^ <- makes it look for tasks) --- cmdline/apt-get.cc | 86 ++++++++++++++++++++++++----------------------- po/apt-all.pot | 99 ++++++++++++++++++++++++++++-------------------------- 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 \n" "Language-Team: LANGUAGE \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" -- cgit v1.2.3