summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <egon@tas>2008-10-28 18:45:36 +0100
committerMichael Vogt <egon@tas>2008-10-28 18:45:36 +0100
commit742f980e2df763c76431026bd0e03f724797cc50 (patch)
tree9e8ae81c145f34e3e585de7cb5678dffbdfe1afe /apt-pkg/deb
parentcfb776e816dc21c27f422216a9aff8700b28f30b (diff)
parentd210bd7f6a72a2b24a1402f51b39c61438482827 (diff)
* apt-ftparchive might write corrupt Release files (LP: #46439)
* Apply --important option to apt-cache depends (LP: #16947) * apt-pkg/acquire-item.cc: - Added fallback to uncompressed 'Packages' if neither 'bz2' nor 'gz' available. (Closes: #409284) * apt-pkg/algorithm.cc: - Strip username and password from source URL in error message. (Closes: #425150) * Fix typos: - apt-pkg/depcache.cc * Fix compilation warnings: - apt-pkg/acquire.cc - apt-pkg/versionmatch.cc * Compilation fixes and portability improvement for compiling APT against non-GNU libc (thanks to Martin Koeppe, closes: #392063): - buildlib/apti18n.h.in: + textdomain() and bindtextdomain() must not be visible when --disable-nls - buildlib/inttypes.h.in: undefine standard int*_t types - Append INTLLIBS to SLIBS: + cmdline/makefile + ftparchive/makefile + methods/makefile * doc/apt.conf.5.xml: - clarify whether configuration items of apt.conf are case-sensitive (thanks to Vincent McIntyre, closes: #345901) * doc/apt-cache.8.xml: - search command uses POSIX regex, and searches for virtual packages too (closes: #277536) * doc/offline.sgml: clarify remote and target hosts (thanks to Nikolaus Schulz, closes: #175940) * Fix several typos in docs, translations and debian/changelog (thanks to timeless, Nicolas Bonifas and Josh Triplett, closes: #368665, #298821, #411532, #431636, #461458) * Document apt-key finger and adv commands (thanks to Stefan Schmidt, closes: #350575) * Better documentation for apt-get --option (thanks to Tomas Pospisek, closes: #386579) * Retitle the apt-mark.8 manpage (thanks to Justin Pryzby, closes: #471276) * Better documentation on using both APT::Default-Release and /etc/apt/preferences (thanks to Ingo Saitz, closes: #145575) * doc/apt-cache.8.xml: - add missing citerefentry * Upload to unstable * apt-pkg/deb/dpkgpm.cc: - Store the trigger state descriptions in a way that does not break the ABI. The approach taken makes the search for a string O(n) rather than O(lg(n)), but since n == 4, I do not consider this a major concern. If it becomes a concern, we can sort the static array and use std::equal_range(). (Closes: #499322) * apt-pkg/pkgcachegen.cc: - do not add multiple identical descriptions for the same language (closes: #400768) * Catalan updated. Closes: #499462 * Fix typo in cron.daily script. Closes: #486179 * Traditional Chinese updated. Closes: #488526 * German corrected and completed. Closes: #490532, #480002, #498018 * French completed * Bulgarian updated. Closes: #492473 * Slovak updated. Closes: #492475 * Galician updated. Closes: #492794 * Japanese updated. Closes: #492975 * Fix missing space in Greek translation. Closes: #493922 * Greek updated. * Brazilian Portuguese updated. * Basque updated. Closes: #496754 * Romanian updated. Closes: #492773, #488361 * Portuguese updated. Closes: #491790 * Simplified Chinese updated. Closes: #489344 * Norwegian Bokmål updated. Closes: #480022 * Czech updated. Closes: #479628, #497277 * Korean updated. Closes: #464515 * Spanish updated. Closes: #457706 * Lithuanian added. Closes: #493328 * Swedish updated. Closes: #497496 * Vietnamese updated. Closes: #497893 * Portuguese updated. Closes: #498411 * Greek updated. Closes: #498687 * Polish updated. * merge patch that enforces stricter https server certificate checking (thanks to Arnaud Ebalard, closes: #485960) * allow per-mirror specific https settings (thanks to Arnaud Ebalard, closes: #485965) * add doc/examples/apt-https-method-example.cof (thanks to Arnaud Ebalard, closes: #485964) * apt-pkg/depcache.cc: - when checking for new important deps, skip critical ones (closes: #485943) * improve apt progress reporting, display trigger actions * add DPkg::NoTriggers option so that applications that call apt/aptitude (like the installer) defer trigger processing (thanks to Joey Hess) * doc/makefile: - add examples/apt-https-method-example.conf * Russian updated. Closes: #479777, #499029 * fix FTBFS by changing build-depends to * ABI library name change because it's built against * Package that contains all the new features * Branch that contains all the new features:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/dpkgpm.cc51
-rw-r--r--apt-pkg/deb/dpkgpm.h2
2 files changed, 40 insertions, 13 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index c9af2f401..85cf4e119 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -25,6 +25,8 @@
#include <signal.h>
#include <errno.h>
#include <stdio.h>
+#include <string.h>
+#include <algorithm>
#include <sstream>
#include <map>
@@ -39,7 +41,38 @@
using namespace std;
-
+namespace
+{
+ // Maps the dpkg "processing" info to human readable names. Entry 0
+ // of each array is the key, entry 1 is the value.
+ const std::pair<const char *, const char *> PackageProcessingOps[] = {
+ std::make_pair("install", N_("Installing %s")),
+ std::make_pair("configure", N_("Configuring %s")),
+ std::make_pair("remove", N_("Removing %s")),
+ std::make_pair("trigproc", N_("Running post-installation trigger %s"))
+ };
+
+ const std::pair<const char *, const char *> * const PackageProcessingOpsBegin = PackageProcessingOps;
+ const std::pair<const char *, const char *> * const PackageProcessingOpsEnd = PackageProcessingOps + sizeof(PackageProcessingOps) / sizeof(PackageProcessingOps[0]);
+
+ // Predicate to test whether an entry in the PackageProcessingOps
+ // array matches a string.
+ class MatchProcessingOp
+ {
+ const char *target;
+
+ public:
+ MatchProcessingOp(const char *the_target)
+ : target(the_target)
+ {
+ }
+
+ bool operator()(const std::pair<const char *, const char *> &pair) const
+ {
+ return strcmp(pair.first, target) == 0;
+ }
+ };
+}
// DPkgPM::pkgDPkgPM - Constructor /*{{{*/
// ---------------------------------------------------------------------
@@ -362,17 +395,19 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
if(strncmp(list[0], "processing", strlen("processing")) == 0)
{
char s[200];
- map<string,string>::iterator iter;
char *pkg_or_trigger = _strstrip(list[2]);
action =_strstrip( list[1]);
- iter = PackageProcessingOps.find(action);
- if(iter == PackageProcessingOps.end())
+ const std::pair<const char *, const char *> * const iter =
+ std::find_if(PackageProcessingOpsBegin,
+ PackageProcessingOpsEnd,
+ MatchProcessingOp(action));
+ if(iter == PackageProcessingOpsEnd)
{
if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
std::clog << "ignoring unknwon action: " << action << std::endl;
return;
}
- snprintf(s, sizeof(s), _(iter->second.c_str()), pkg_or_trigger);
+ snprintf(s, sizeof(s), _(iter->second), pkg_or_trigger);
status << "pmstatus:" << pkg_or_trigger
<< ":" << (PackagesDone/float(PackagesTotal)*100.0)
@@ -601,12 +636,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
},
};
- // populate the "processing" map
- PackageProcessingOps.insert( make_pair("install",N_("Installing %s")) );
- PackageProcessingOps.insert( make_pair("configure",N_("Configuring %s")) );
- PackageProcessingOps.insert( make_pair("remove",N_("Removing %s")) );
- PackageProcessingOps.insert( make_pair("trigproc",N_("Running post-installation trigger %s")) );
-
// init the PackageOps map, go over the list of packages that
// that will be [installed|configured|removed|purged] and add
// them to the PackageOps map (the dpkg states it goes through)
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 449469126..ebc7e32bf 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -47,8 +47,6 @@ class pkgDPkgPM : public pkgPackageManager
// the int is the state that is already done (e.g. a package that is
// going to be install is already in state "half-installed")
map<string,unsigned int> PackageOpsDone;
- // map the dpkg "processing" info to human readable names
- map<string,string> PackageProcessingOps;
// progress reporting
unsigned int PackagesDone;
unsigned int PackagesTotal;