From c158ff49dacb8f6fdca98f9b43329eac44f1a827 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 19 Sep 2006 14:02:53 +0200 Subject: [PATCH 1/1] * 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 "" -- 2.45.2