apt/apt-0.5.15cnc6-alt-rpm-fancypercent.patch
Kachalov Anton 6e5c25c245 0.5.15cnc6-alt1
- Updated to 0.5.15cnc6
- New:
  + apt-0.5.15cnc6-alt-rpm-order (fix RPM::Order default value)
- Updated:
  + apt-0.5.15cnc6-alt-fixes
  + apt-0.5.15cnc6-alt-defaults
  + apt-0.5.15cnc6-alt-rpm-fancypercent
  + apt-0.5.15cnc6-alt-virtual_scores
- Merged upstream:
  + apt-0.5.15cnc6-alt-install_virtual
2004-05-13 12:23:54 +00:00

131 lines
3.0 KiB
Diff

2004-01-16 Dmitry V. Levin <ldv@altlinux.org>
* apt-pkg/rpm/rpmpm.cc(pkgRPMPM::ExecRPM,pkgRPMLibPM::Process):
Honor "quiet" config option.
Pass "fancypercent" option.
--- apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc.orig 2004-05-11 15:08:07 +0400
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc 2004-05-11 15:19:12 +0400
@@ -390,6 +390,7 @@
const char *operation;
unsigned int n = 0;
bool Interactive = _config->FindB("RPM::Interactive",true);
+ int quiet = _config->FindI("quiet",0);
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
@@ -398,18 +399,12 @@
switch (op)
{
case Item::RPMInstall:
- if (Interactive)
- operation = "-ivh";
- else
- operation = "-iv";
+ operation = "-i";
nodeps = true;
break;
case Item::RPMUpgrade:
- if (Interactive)
- operation = "-Uvh";
- else
- operation = "-Uv";
+ operation = "-U";
break;
case Item::RPMErase:
@@ -421,8 +416,22 @@
}
Args[n++] = operation;
- if (Interactive == false && op != Item::RPMErase)
- Args[n++] = "--percent";
+ if (quiet <= 2 && op != Item::RPMErase)
+ {
+ Args[n++] = "-v";
+ if (quiet <= 1)
+ {
+ if (Interactive)
+ {
+ Args[n++] = "-h";
+ if (quiet <= 0)
+ Args[n++] = "--fancypercent";
+ } else
+ {
+ Args[n++] = "--percent";
+ }
+ }
+ }
string rootdir = _config->Find("RPM::RootDir", "");
if (!rootdir.empty())
@@ -551,6 +560,7 @@
return true;
}
+ if (quiet <= 2)
cout << _("Executing RPM (")<<cmd<<")..." << endl;
cout << flush;
@@ -631,7 +641,7 @@
return _error->Error(_("Sub-process %s exited unexpectedly"),Args[0]);
}
- if (Interactive == true)
+ if (quiet <= 2)
cout << _("Done.") << endl;
return true;
@@ -749,6 +759,7 @@
bool Success = false;
bool Interactive = _config->FindB("RPM::Interactive",true);
string Dir = _config->Find("RPM::RootDir");
+ int quiet = _config->FindI("quiet",0);
rpmReadConfigFiles(NULL, NULL);
int probFilter = 0;
@@ -795,10 +806,21 @@
probFilter |= RPMPROB_FILTER_REPLACENEWFILES;
}
- if (Interactive == true)
- notifyFlags |= INSTALL_LABEL | INSTALL_HASH;
- else
- notifyFlags |= INSTALL_LABEL | INSTALL_PERCENT;
+ if (quiet <= 2)
+ notifyFlags |= INSTALL_LABEL;
+
+ if (quiet <= 1)
+ {
+ if (Interactive == true)
+ {
+ notifyFlags |= INSTALL_HASH;
+ extern int fancyPercents;
+ fancyPercents = (quiet <= 0) ? 1 : 0;
+ } else
+ {
+ notifyFlags |= INSTALL_PERCENT;
+ }
+ }
if (uninstall.empty() == false)
AddToTransaction(Item::RPMErase, uninstall);
@@ -854,6 +877,7 @@
goto exit;
}
+ if (quiet <= 2)
cout << _("Committing changes...") << endl << flush;
#if RPM_VERSION >= 0x040100
@@ -877,7 +901,7 @@
Success = true;
if (rc < 0)
_error->Warning(_("Some errors occurred while running transaction"));
- else if (Interactive == true)
+ else if (quiet <= 2)
cout << _("Done.") << endl;
}
rpmpsFree(probs);