diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-26 10:58:26 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-26 10:58:26 +0200 |
commit | 54668e4e591651be2d83b95ff4a9d96668db1e36 (patch) | |
tree | 1b10035fd2c28852020e3035d0a1ff0fe138449d | |
parent | a4decc40b3eb085ea994d2a8b31ee9cddfd570ff (diff) |
* cmdline/apt-get.cc:
- add a scope with a ActionGroup in DoInstall() to speed up the install
of long package lists (e.g. pbuilder)
-rw-r--r-- | cmdline/apt-get.cc | 261 | ||||
-rw-r--r-- | po/apt-all.pot | 110 |
2 files changed, 187 insertions, 184 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 8b3c68573..ad4da133f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1476,159 +1476,162 @@ bool DoInstall(CommandLine &CmdL) if (strcasecmp(CmdL.FileList[0],"remove") == 0) DefRemove = true; else if (strcasecmp(CmdL.FileList[0], "autoremove") == 0) - { - _config->Set("APT::Get::AutomaticRemove", "true"); - DefRemove = true; - } + { + _config->Set("APT::Get::AutomaticRemove", "true"); + DefRemove = true; + } - for (const char **I = CmdL.FileList + 1; *I != 0; I++) + // new scope for the ActionGroup { - // Duplicate the string - unsigned int Length = strlen(*I); - char S[300]; - if (Length >= sizeof(S)) - continue; - strcpy(S,*I); - - // See if we are removing and special indicators.. - bool Remove = DefRemove; - char *VerTag = 0; - bool VerIsRel = false; - while (Cache->FindPkg(S).end() == true) + pkgDepCache::ActionGroup group(Cache); + for (const char **I = CmdL.FileList + 1; *I != 0; I++) { - // Handle an optional end tag indicating what to do - if (Length >= 1 && S[Length - 1] == '-') - { - Remove = true; - S[--Length] = 0; + // Duplicate the string + unsigned int Length = strlen(*I); + char S[300]; + if (Length >= sizeof(S)) continue; - } - - if (Length >= 1 && S[Length - 1] == '+') + strcpy(S,*I); + + // See if we are removing and special indicators.. + bool Remove = DefRemove; + char *VerTag = 0; + bool VerIsRel = false; + while (Cache->FindPkg(S).end() == true) { - Remove = false; - S[--Length] = 0; - continue; - } + // Handle an optional end tag indicating what to do + if (Length >= 1 && S[Length - 1] == '-') + { + Remove = true; + S[--Length] = 0; + continue; + } - char *Slash = strchr(S,'='); - if (Slash != 0) - { - VerIsRel = false; - *Slash = 0; - VerTag = Slash + 1; - } + if (Length >= 1 && S[Length - 1] == '+') + { + Remove = false; + S[--Length] = 0; + continue; + } - Slash = strchr(S,'/'); - if (Slash != 0) - { - VerIsRel = true; - *Slash = 0; - VerTag = Slash + 1; - } + char *Slash = strchr(S,'='); + if (Slash != 0) + { + VerIsRel = false; + *Slash = 0; + VerTag = Slash + 1; + } - break; - } - - // Locate the package - pkgCache::PkgIterator Pkg = Cache->FindPkg(S); - Packages++; - if (Pkg.end() == true) - { - // Check if the name is a regex - const char *I; - for (I = S; *I != 0; I++) - if (*I == '?' || *I == '*' || *I == '|' || - *I == '[' || *I == '^' || *I == '$') - break; - if (*I == 0) - return _error->Error(_("Couldn't find package %s"),S); - - // Regexs must always be confirmed - ExpectedInst += 1000; + Slash = strchr(S,'/'); + if (Slash != 0) + { + VerIsRel = true; + *Slash = 0; + VerTag = Slash + 1; + } - // Compile the regex pattern - regex_t Pattern; - int Res; - if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE | - REG_NOSUB)) != 0) - { - char Error[300]; - regerror(Res,&Pattern,Error,sizeof(Error)); - return _error->Error(_("Regex compilation error - %s"),Error); + break; } - - // Run over the matches - bool Hit = false; - for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++) + + // Locate the package + pkgCache::PkgIterator Pkg = Cache->FindPkg(S); + Packages++; + if (Pkg.end() == true) { - if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0) - continue; + // Check if the name is a regex + const char *I; + for (I = S; *I != 0; I++) + if (*I == '?' || *I == '*' || *I == '|' || + *I == '[' || *I == '^' || *I == '$') + break; + if (*I == 0) + return _error->Error(_("Couldn't find package %s"),S); + + // Regexs must always be confirmed + ExpectedInst += 1000; + + // Compile the regex pattern + regex_t Pattern; + int Res; + if ((Res = regcomp(&Pattern,S,REG_EXTENDED | REG_ICASE | + REG_NOSUB)) != 0) + { + char Error[300]; + regerror(Res,&Pattern,Error,sizeof(Error)); + return _error->Error(_("Regex compilation error - %s"),Error); + } + + // Run over the matches + bool Hit = false; + for (Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++) + { + if (regexec(&Pattern,Pkg.Name(),0,0,0) != 0) + continue; + + ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"), + Pkg.Name(),S); - ioprintf(c1out,_("Note, selecting %s for regex '%s'\n"), - Pkg.Name(),S); + if (VerTag != 0) + if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false) + return false; + Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix, + ExpectedInst,false); + } + regfree(&Pattern); + + if (Hit == false) + return _error->Error(_("Couldn't find package %s"),S); + } + else + { if (VerTag != 0) if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false) return false; - - Hit |= TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix, - ExpectedInst,false); - } - regfree(&Pattern); - - if (Hit == false) - return _error->Error(_("Couldn't find package %s"),S); - } - else - { - if (VerTag != 0) - if (TryToChangeVer(Pkg,Cache,VerTag,VerIsRel) == false) + if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false) return false; - if (TryToInstall(Pkg,Cache,Fix,Remove,BrokenFix,ExpectedInst) == false) - return false; - } - } + } + } - /* If we are in the Broken fixing mode we do not attempt to fix the - problems. This is if the user invoked install without -f and gave - packages */ - if (BrokenFix == true && Cache->BrokenCount() != 0) - { - c1out << _("You might want to run `apt-get -f install' to correct these:") << endl; - ShowBroken(c1out,Cache,false); + /* If we are in the Broken fixing mode we do not attempt to fix the + problems. This is if the user invoked install without -f and gave + packages */ + if (BrokenFix == true && Cache->BrokenCount() != 0) + { + c1out << _("You might want to run `apt-get -f install' to correct these:") << endl; + ShowBroken(c1out,Cache,false); - return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).")); - } + return _error->Error(_("Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).")); + } - // Call the scored problem resolver - Fix.InstallProtect(); - if (Fix.Resolve(true) == false) - _error->Discard(); + // Call the scored problem resolver + Fix.InstallProtect(); + if (Fix.Resolve(true) == false) + _error->Discard(); - // Now we check the state of the packages, - if (Cache->BrokenCount() != 0) - { - c1out << - _("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" - "distribution that some required packages have not yet been created\n" - "or been moved out of Incoming.") << endl; - if (Packages == 1) + // Now we check the state of the packages, + if (Cache->BrokenCount() != 0) { - c1out << endl; c1out << - _("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.") << endl; - } + _("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" + "distribution that some required packages have not yet been created\n" + "or been moved out of Incoming.") << endl; + if (Packages == 1) + { + c1out << endl; + c1out << + _("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.") << endl; + } - c1out << _("The following information may help to resolve the situation:") << endl; - c1out << endl; - ShowBroken(c1out,Cache,false); - return _error->Error(_("Broken packages")); - } - + c1out << _("The following information may help to resolve the situation:") << endl; + c1out << endl; + ShowBroken(c1out,Cache,false); + return _error->Error(_("Broken packages")); + } + } if (_config->FindB("APT::Get::AutomaticRemove")) { if (!DoAutomaticRemove(Cache)) return false; diff --git a/po/apt-all.pot b/po/apt-all.pot index ebf7c01cb..cc075ceb3 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-06-26 07:08+0200\n" +"POT-Creation-Date: 2006-07-26 10:56+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:2426 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 "" @@ -535,7 +535,7 @@ msgstr "" msgid "Y" msgstr "" -#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1558 +#: cmdline/apt-get.cc:143 cmdline/apt-get.cc:1560 #, c-format msgid "Regex compilation error - %s" msgstr "" @@ -694,11 +694,11 @@ msgstr "" msgid "Internal error, Ordering didn't finish" msgstr "" -#: cmdline/apt-get.cc:792 cmdline/apt-get.cc:1857 cmdline/apt-get.cc:1890 +#: cmdline/apt-get.cc:792 cmdline/apt-get.cc:1861 cmdline/apt-get.cc:1894 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:802 cmdline/apt-get.cc:1938 cmdline/apt-get.cc:2174 +#: cmdline/apt-get.cc:802 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 "" @@ -727,7 +727,7 @@ msgstr "" msgid "After unpacking %sB disk space will be freed.\n" msgstr "" -#: cmdline/apt-get.cc:847 cmdline/apt-get.cc:2028 +#: cmdline/apt-get.cc:847 cmdline/apt-get.cc:2032 #, c-format msgid "Couldn't determine free space in %s" msgstr "" @@ -761,7 +761,7 @@ msgstr "" msgid "Do you want to continue [Y/n]? " msgstr "" -#: cmdline/apt-get.cc:962 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2071 +#: cmdline/apt-get.cc:962 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2075 #, c-format msgid "Failed to fetch %s %s\n" msgstr "" @@ -770,7 +770,7 @@ msgstr "" msgid "Some files failed to download" msgstr "" -#: cmdline/apt-get.cc:981 cmdline/apt-get.cc:2080 +#: cmdline/apt-get.cc:981 cmdline/apt-get.cc:2084 msgid "Download complete and in download only mode" msgstr "" @@ -886,7 +886,7 @@ msgid "" "shouldn't happen. Please file a bug report against apt." msgstr "" -#: cmdline/apt-get.cc:1427 cmdline/apt-get.cc:1626 +#: cmdline/apt-get.cc:1427 cmdline/apt-get.cc:1628 msgid "The following information may help to resolve the situation:" msgstr "" @@ -898,27 +898,27 @@ msgstr "" msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1545 cmdline/apt-get.cc:1581 +#: cmdline/apt-get.cc:1547 cmdline/apt-get.cc:1583 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1568 +#: cmdline/apt-get.cc:1570 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1598 +#: cmdline/apt-get.cc:1600 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1601 +#: 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:1613 +#: 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" @@ -926,159 +926,159 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1621 +#: 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:1629 +#: cmdline/apt-get.cc:1631 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1660 +#: cmdline/apt-get.cc:1662 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1731 +#: cmdline/apt-get.cc:1733 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1732 +#: cmdline/apt-get.cc:1734 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1752 +#: cmdline/apt-get.cc:1754 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1755 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1757 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1760 +#: cmdline/apt-get.cc:1762 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1825 cmdline/apt-get.cc:1833 +#: cmdline/apt-get.cc:1829 cmdline/apt-get.cc:1837 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1933 +#: cmdline/apt-get.cc:1937 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1963 cmdline/apt-get.cc:2192 +#: 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:2007 +#: cmdline/apt-get.cc:2011 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:2031 +#: cmdline/apt-get.cc:2035 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:2036 +#: cmdline/apt-get.cc:2040 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2039 +#: cmdline/apt-get.cc:2043 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:2045 +#: cmdline/apt-get.cc:2049 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2076 +#: cmdline/apt-get.cc:2080 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2104 +#: cmdline/apt-get.cc:2108 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2116 +#: cmdline/apt-get.cc:2120 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2117 +#: cmdline/apt-get.cc:2121 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2134 +#: cmdline/apt-get.cc:2138 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2153 +#: cmdline/apt-get.cc:2157 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2169 +#: cmdline/apt-get.cc:2173 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2197 +#: cmdline/apt-get.cc:2201 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2217 +#: cmdline/apt-get.cc:2221 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2269 +#: 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:2321 +#: 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:2356 +#: 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:2381 +#: cmdline/apt-get.cc:2385 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2395 +#: cmdline/apt-get.cc:2399 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2399 +#: cmdline/apt-get.cc:2403 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2431 +#: cmdline/apt-get.cc:2435 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2472 +#: cmdline/apt-get.cc:2476 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -1558,7 +1558,7 @@ msgstr "" msgid "Server closed the connection" msgstr "" -#: methods/ftp.cc:338 methods/rsh.cc:190 apt-pkg/contrib/fileutl.cc:471 +#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:471 methods/rsh.cc:190 msgid "Read error" msgstr "" @@ -1570,7 +1570,7 @@ msgstr "" msgid "Protocol corruption" msgstr "" -#: methods/ftp.cc:446 methods/rsh.cc:232 apt-pkg/contrib/fileutl.cc:510 +#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:510 methods/rsh.cc:232 msgid "Write error" msgstr "" @@ -1828,10 +1828,6 @@ msgstr "" msgid "Internal error" msgstr "" -#: methods/rsh.cc:330 -msgid "Connection closed prematurely" -msgstr "" - #: apt-pkg/contrib/mmap.cc:82 msgid "Can't mmap an empty file" msgstr "" @@ -2123,12 +2119,12 @@ msgstr "" msgid "Reading state information" msgstr "" -#: apt-pkg/depcache.cc:190 +#: apt-pkg/depcache.cc:199 #, c-format msgid "Failed to open StateFile %s" msgstr "" -#: apt-pkg/depcache.cc:196 +#: apt-pkg/depcache.cc:205 #, c-format msgid "Failed to write temporary StateFile %s" msgstr "" @@ -2558,3 +2554,7 @@ msgstr "" #, c-format msgid "Completely removed %s" msgstr "" + +#: methods/rsh.cc:330 +msgid "Connection closed prematurely" +msgstr "" |