using namespace std;
/*}}}*/
-
+// Strip - Remove white space from the front and back of a string /*{{{*/
+// ---------------------------------------------------------------------
+namespace APT {
+ namespace String {
+std::string Strip(const std::string &s)
+{
+ size_t start = s.find_first_not_of(" \t\n");
+ // only whitespace
+ if (start == string::npos)
+ return "";
+ size_t end = s.find_last_not_of(" \t\n");
+ return s.substr(start, end-start+1);
+}
+}
+}
+ /*}}}*/
// UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/
// ---------------------------------------------------------------------
/* This is handy to use before display some information for enduser */
using std::ostream;
#endif
+namespace APT {
+ namespace String {
+ std::string Strip(const std::string &s);
+ };
+};
+
+
bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
char *_strstrip(char *String);
char *_strrstrip(char *String); // right strip only
// check if the package moved to the next dpkg state
if(next_action && (action == next_action))
{
+ // we moved from one dpkg state to a new one, report that
+ PackageOpsDone[pkg]++;
+ PackagesDone++;
+
// only read the translation if there is actually a next
// action
const char *translation = _(states[PackageOpsDone[pkg]].str);
strprintf(msg, translation, i18n_pkgname.c_str());
d->progress->StatusChanged(pkgname, PackagesDone, PackagesTotal, msg);
- // we moved from one dpkg state to a new one, report that
- PackageOpsDone[pkg]++;
- PackagesDone++;
}
if (Debug == true)
std::clog << "(parsed from dpkg) pkg: " << short_pkgname
}
PackageManagerProgressFd::PackageManagerProgressFd(int progress_fd)
+ : StepsDone(0), StepsTotal(1)
{
OutStatusFd = progress_fd;
}
<< ":" << pkg_action
<< std::endl;
WriteToStatusFd(status.str());
+
+ if(_config->FindB("Debug::APT::Progress::PackageManagerFd", false) == true)
+ std::cerr << "progress: " << PackageName << " " << xStepsDone
+ << " " << xTotalSteps << " " << pkg_action
+ << std::endl;
+
+
return true;
}
public:
PackageManager()
- : percentage(0.0), last_reported_progress(0) {};
+ : percentage(0.0), last_reported_progress(-1) {};
virtual ~PackageManager() {};
virtual void Start() {};
pmstatus:testing:66.6667:Removing testing (amd64)
pmstatus:testing:100:Removed testing (amd64)" cat apt-progress.log
-
# install non-native and ensure we get proper progress info
exec 3> apt-progress.log
testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3