hrev47276 adds 1 changeset to branch 'master' old head: ecf119cc17eea533676a28643bc2a3a30ce40f09 new head: c3a07a5aedcf284c361a5dd2fd3247e60b00b8f8 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=c3a07a5+%5Eecf119c ---------------------------------------------------------------------------- c3a07a5: PackageInstaller: Added -v/--verbose option It enables just a few printf()s in PackageItem.cpp. I went with a quick solution using a global variable instead of using/writing some nice logging framework which could even generate install logs... but it helps in tracking down some package problems without first having to uncomment some printf()s... [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47276 Commit: c3a07a5aedcf284c361a5dd2fd3247e60b00b8f8 URL: http://cgit.haiku-os.org/haiku/commit/?id=c3a07a5 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Wed May 28 21:04:41 2014 UTC ---------------------------------------------------------------------------- 2 files changed, 20 insertions(+), 5 deletions(-) src/apps/packageinstaller/PackageItem.cpp | 17 ++++++++++++----- src/apps/packageinstaller/main.cpp | 8 ++++++++ ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageItem.cpp b/src/apps/packageinstaller/PackageItem.cpp index eec6565..71dfe84 100644 --- a/src/apps/packageinstaller/PackageItem.cpp +++ b/src/apps/packageinstaller/PackageItem.cpp @@ -36,6 +36,8 @@ enum { static const uint32 kDefaultMode = 0777; static const uint8 padding[7] = { 0, 0, 0, 0, 0, 0, 0 }; +extern bool gVerbose; + enum { P_DATA = 0, P_ATTRIBUTE @@ -175,17 +177,20 @@ PackageItem::InitPath(const char* path, BPath* destination) status_t ret = B_OK; if (fPathType == P_INSTALL_PATH) { -// printf("InitPath - relative: %s + %s\n", path, fPath.String()); + if (gVerbose) + printf("InitPath - relative: %s + %s\n", path, fPath.String()); if (path == NULL) { parser_debug("InitPath path is NULL\n"); return B_ERROR; } ret = destination->SetTo(path, fPath.String()); } else if (fPathType == P_SYSTEM_PATH) { -// printf("InitPath - absolute: %s\n", fPath.String()); + if (gVerbose) + printf("InitPath - absolute: %s\n", fPath.String()); ret = destination->SetTo(fPath.String()); } else { -// printf("InitPath - volume: %s + %s\n", path, fPath.String()); + if (gVerbose) + printf("InitPath - volume: %s + %s\n", path, fPath.String()); if (path == NULL) { parser_debug("InitPath path is NULL\n"); return B_ERROR; @@ -237,7 +242,8 @@ PackageItem::InitPath(const char* path, BPath* destination) } if (wasRewritten) { -// printf("rewritten: %s\n", pathString.String()); + if (gVerbose) + printf("rewritten: %s\n", pathString.String()); destination->SetTo(pathString.String()); } } @@ -620,7 +626,8 @@ PackageScript::DoInstall(const char* path, ItemState* state) // that's more fragile... but a common source for // the rewriting of BeOS paths is needed. -// printf("%s\n", script.String()); + if (gVerbose) + printf("%s\n", script.String()); BPath workingDirectory; if (path != NULL) diff --git a/src/apps/packageinstaller/main.cpp b/src/apps/packageinstaller/main.cpp index 6fc9128..4bafeb8 100644 --- a/src/apps/packageinstaller/main.cpp +++ b/src/apps/packageinstaller/main.cpp @@ -27,6 +27,9 @@ #define B_TRANSLATION_CONTEXT "Packageinstaller main" +bool gVerbose = false; + + class PackageInstaller : public BApplication { public: PackageInstaller(); @@ -84,6 +87,11 @@ void PackageInstaller::ArgvReceived(int32 argc, char** argv) { for (int i = 1; i < argc; i++) { + if (strcmp("--verbose", argv[i]) == 0 || strcmp("-v", argv[i]) == 0) { + gVerbose = true; + continue; + } + BPath path; if (path.SetTo(argv[i]) != B_OK) { fprintf(stderr, B_TRANSLATE("Error! \"%s\" is not a valid path.\n"),