diff --git a/src/bin/pkgman/PackageManager.cpp b/src/bin/pkgman/PackageManager.cpp index 3e71c42070..7cbaec807c 100644 --- a/src/bin/pkgman/PackageManager.cpp +++ b/src/bin/pkgman/PackageManager.cpp @@ -73,7 +73,7 @@ PackageManager::Repository::Config() const PackageManager::PackageManager(BPackageInstallationLocation location, - bool addInstalledRepositories, bool addOtherRepositories) + uint32 flags) : fLocation(location), fSolver(NULL), @@ -92,7 +92,7 @@ PackageManager::PackageManager(BPackageInstallationLocation location, DIE(error, "failed to create solver"); // add installation location repositories - if (addInstalledRepositories) { + if ((flags & ADD_INSTALLED_REPOSITORIES) != 0) { // We add only the repository of our actual installation location as the // "installed" repository. The repositories for the more general // installation locations are added as regular repositories, but with @@ -129,7 +129,7 @@ PackageManager::PackageManager(BPackageInstallationLocation location, } // add other repositories - if (addOtherRepositories) { + if ((flags & ADD_REMOTE_REPOSITORIES) != 0) { BPackageRoster roster; BStringList repositoryNames; error = roster.GetRepositoryNames(repositoryNames); diff --git a/src/bin/pkgman/PackageManager.h b/src/bin/pkgman/PackageManager.h index c212fb314b..b473b90572 100644 --- a/src/bin/pkgman/PackageManager.h +++ b/src/bin/pkgman/PackageManager.h @@ -29,11 +29,15 @@ public: struct Repository; typedef BObjectList RepositoryList; + enum { + ADD_INSTALLED_REPOSITORIES = 0x01, + ADD_REMOTE_REPOSITORIES = 0x02, + }; + public: PackageManager( BPackageInstallationLocation location, - bool addInstalledRepositories, - bool addOtherRepositories); + uint32 flags); ~PackageManager(); BSolver* Solver() const diff --git a/src/bin/pkgman/command_install.cpp b/src/bin/pkgman/command_install.cpp index 09d8748b7a..667ac6006a 100644 --- a/src/bin/pkgman/command_install.cpp +++ b/src/bin/pkgman/command_install.cpp @@ -85,7 +85,9 @@ InstallCommand::Execute(int argc, const char* const* argv) BPackageInstallationLocation location = installInHome ? B_PACKAGE_INSTALLATION_LOCATION_HOME : B_PACKAGE_INSTALLATION_LOCATION_COMMON; - PackageManager packageManager(location, true, true); + PackageManager packageManager(location, + PackageManager::ADD_INSTALLED_REPOSITORIES + | PackageManager::ADD_REMOTE_REPOSITORIES); packageManager.Install(packages, packageCount); return 0; diff --git a/src/bin/pkgman/command_search.cpp b/src/bin/pkgman/command_search.cpp index 73d59470a3..3ae8d3a1af 100644 --- a/src/bin/pkgman/command_search.cpp +++ b/src/bin/pkgman/command_search.cpp @@ -120,7 +120,8 @@ SearchCommand::Execute(int argc, const char* const* argv) // create the solver PackageManager packageManager(B_PACKAGE_INSTALLATION_LOCATION_HOME, - !uninstalledOnly, !installedOnly); + (!uninstalledOnly ? PackageManager::ADD_INSTALLED_REPOSITORIES : 0) + | (!installedOnly ? PackageManager::ADD_REMOTE_REPOSITORIES : 0)); // search BObjectList packages; diff --git a/src/bin/pkgman/command_uninstall.cpp b/src/bin/pkgman/command_uninstall.cpp index 31d486f474..d1d8b24a21 100644 --- a/src/bin/pkgman/command_uninstall.cpp +++ b/src/bin/pkgman/command_uninstall.cpp @@ -85,7 +85,9 @@ UninstallCommand::Execute(int argc, const char* const* argv) BPackageInstallationLocation location = uninstallFromHome ? B_PACKAGE_INSTALLATION_LOCATION_HOME : B_PACKAGE_INSTALLATION_LOCATION_COMMON; - PackageManager packageManager(location, true, true); + PackageManager packageManager(location, + PackageManager::ADD_INSTALLED_REPOSITORIES + | PackageManager::ADD_REMOTE_REPOSITORIES); packageManager.Uninstall(packages, packageCount); return 0; diff --git a/src/bin/pkgman/command_update.cpp b/src/bin/pkgman/command_update.cpp index 91d6a5b04a..036892ea02 100644 --- a/src/bin/pkgman/command_update.cpp +++ b/src/bin/pkgman/command_update.cpp @@ -83,7 +83,9 @@ UpdateCommand::Execute(int argc, const char* const* argv) BPackageInstallationLocation location = installInHome ? B_PACKAGE_INSTALLATION_LOCATION_HOME : B_PACKAGE_INSTALLATION_LOCATION_COMMON; - PackageManager packageManager(location, true, true); + PackageManager packageManager(location, + PackageManager::ADD_INSTALLED_REPOSITORIES + | PackageManager::ADD_REMOTE_REPOSITORIES); packageManager.Update(packages, packageCount); return 0;