History log of /haiku/src/bin/pkgman/PackageManager.h
Revision Date Author Comments
# bc6674c8 05-Mar-2024 Emir SARI <bitigchi@me.com>

pkgman: Use BNumberFormat for i18n

Change-Id: I2441f1d37bfccd5f5dbc9b763aeb87d017e628bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7508
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 45c3eb3a 13-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

pkgman: Split "interactive" and "show progress" logic.

Previously we didn't show progress in non-interactive mode. Now
we do, so long as stdout is a TTY.

Fixes #14603.


# 21e99b47 10-Sep-2018 Augustin Cavalier <waddlesplash@gmail.com>

pkgman: Suppress the erroneous "aborted: No Error" messages on no internet.

Here's what happens:
* BPackageManager created a BRefreshRepositoryRequest with a BContext
of an empty DecisionProvider and itself.
* Since there is no internet access, the FetchFileJobs that the refresh
class queued fail. Specifically, the first one does, but then as the
subsequent ones depend on it, they are all aborted.
* As some jobs were aborted, the StateListener is notified.
* The state listener of course has the BPackageManager class as one of
the listeners, and so calls it, because even though the handler methods
of BRefreshRepositoryRequest, they are powerless to stop event propagation.
* The BPackageManager's highest subclass' implementation gets called, which is
of course pkgman's.
* pkgman decides to DIE() upon receiving word that a job was aborted.

There are thus four potential solutions to this issue:
* Rewrite the package kit's event & job handling systems to not be so
screwed up in terms of propagation. Seriously, there is way too much
stuff that we send to the "user" in here, and as you can see, it can
get *extremely* convoluted even for supposedly "simple" tasks. This
is probably the best "long-term" solution; but obviously is far too
involved for the present.
* Only partially rework event handling; specifically in the SupportKit to
allow JobStateListeners to stop further propagation. This is probably
the best "medium-term" solution.
* Do not pass the package manager as the JobStateListener to the
RefreshRepositoryRequest. This would have the downside that the
regular notifications about download state, etc. would not be returned
at all, which we don't want. We could make a shim ... but that would be
a lot of code for little benefit. The prior solution makes more sense.
* Completely ignore "JobAborted" notices in pkgman. In fact, this is the
solution that virtually all other consumers of this API take (although
some of them seem to have TODOs about it), including package_daemon,
HaikuDepot, etc., and so it's the one I've taken here. If a "job aborted"
error is actually fatal, then it's the Package Kit's problem.

Fixes #13075.


# a9c1157a 30-Oct-2017 Augustin Cavalier <waddlesplash@gmail.com>

pkgman: Completely rework download progress indicator.

* Remove the Unicode progress characters, instead change terminal
background color
* Include downloaded/total size in the displayed information
* Include transfer rate (over the last 1s)

Here's a quick screenshot of what it looks like now:
https://i.imgur.com/x4II3Fu.png

"Inspired" by a very old patch by Axel, but almost all of this is my own work.

Fixes #13424.


# e711e6e4 18-May-2015 Axel Dörfler <axeld@pinc-software.de>

Moved BJob, and JobQueue into the support kit.

* Put it in the BSupportKit namespace, following the style introduced
with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
under Haiku with an older release.


# 1aaa0c21 24-Jan-2015 Axel Dörfler <axeld@pinc-software.de>

Package Kit: FetchFileJob now contains package size.

* So that you know how much already was, and still has to be downloaded.
* Automatic whitespace cleanup.
* The link in FetchFileJob.h did not fetch the correct header under
Haiku anymore (since the addition of the private headers to the
image).


# 87d0590f 30-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

pkgman: better download progress bar

* Use Unicode block drawing characters to provide sub-character accuracy
* Also display the download progress percentage as a number

When downloading big packages this helps seeing that the bar continues
moving and that the download is not stalled.


# eee42275 14-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Make BCommitTransactionResult available

* BFatalErrorException: Add commitTransactionResult property and
respective constructor. In case committing the transaction failed,
BPackageManager throws a BFatalErrorException with the result.
* BFatalErrorException::UserInteractionHandler: Pass
BCommitTransactionResult to ProgressTransactionCommitted().


# 83f63a21 22-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman [un]install/update: Add non-interactive mode (-y)


# d3f4a865 02-Oct-2013 Rene Gollent <rene@gollent.com>

Implement #10051.

- Add a simple download progress meter to pkgman that prints a hash mark
for every 2% of the download completed. Improvements welcome.


# 9345049a 28-Sep-2013 Rene Gollent <anevilyak@gmail.com>

Package Kit: Implement progress notifications.

- BJobStateListener: Add progress state and corresponding hook.
- FetchFileJob: Notify job progress hook on libcurl notifications.
- UserInteractionHandler: Add hooks for download progress and checksum
validation progress.
- PackageManager: inherit from JobStateListener and watch for job
notifications for internally generated jobs. Forward to corresponding
UserInteractionHandler hooks as needed.
- Adapt pkgman, HaikuDepot and package_daemon to above changes.
Neither HaikuDepot nor package_daemon's progress hooks are wired up to
do anything yet though.


# fe39d2eb 27-Sep-2013 Rene Gollent <anevilyak@gmail.com>

BPackageManager: Eliminate RequestHandler.

- Pull functionality back into package manager itself since the extra
indirection doesn't really buy us anything in this case, as neither
request that it handles requires a decision provider.
- Adjust pkgman and HaikuDepot accordingly.


# cf3bb0d7 31-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Abstract installed repository initialization

* Rename TransactionHandler -> InstallationInterface and
DaemonClientTransactionHandler -> ClientInstallationInterface.
* Add InstallationInterface::InitInstalledRepository(). Use in
_AddInstalledRepository() to get the repository packages instead of
using the package roster. The ClientInstallationInterface
implementation does it that way.


# 83462cc2 31-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor reusable pkgman code into libpackage

* Move RepositoryBuilder class to libpackage and add B* prefix to name.
* Pull BPackageManager class out of PackageManager and move to
libpackage. The base class is customizable via three handler objects
responsible for transaction handling, request execution, respectively
user interaction.
* Reorganize _ApplyPackageChanges(): Now we first prepare the
transactions for all affected installation locations (downloading
files etc.) and then commit them.


# 08fb013f 29-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman uninstall: Verify more specific locations

... after having determined the packages to remove from the selected
installation location. This uninstalls packages from the more specific
locations when their dependencies have been removed.


# a54a50b4 28-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: add support for [un]installing/updating in system


# 3381a1bf 28-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman uninstall: improve correctness

... with respect to inter-installation-location dependencies. E.g.
uninstalling a package from common should only uninstall packages
depending on it, when system doesn't still provide those dependencies.

We don't consider uninstalling packages from more specific installation
locations when dependencies are uninstalled from a more general one yet.


# 90f9f139 27-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman install: Add base package support

If any of the packages to install has requires a base package, that is
installed in a more general installation location, we copy the package
to the target installation location. Ideally we'd hard-link, but BFS
doesn't support that. Symlinks would be a small nightmare to maintain.

We might want to choose the installation location intelligently
depending on the base package requirement -- e.g. install curl_devel in
system rather than common, since curl is installed in system -- so we
can avoid duplicating packages.


# ce4f3676 26-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: auto-refresh repositories only for update/install


# 8b26ef67 25-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: PackageManager: Use flags instead of bools in ctor


# a5999f6f 21-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add "update" command


# df2685d8 20-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add "uninstall" command


# 3ac0de3b 20-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Refactoring -> PackageManager

Move common and reusable functionality from "search" and "install" to
new PackageManager class.


# e711e6e42fd7ec3111ba9dc2324fa8efedd6674b 18-May-2015 Axel Dörfler <axeld@pinc-software.de>

Moved BJob, and JobQueue into the support kit.

* Put it in the BSupportKit namespace, following the style introduced
with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
under Haiku with an older release.


# 1aaa0c2142c6c843e93bd1ee8edd4c7ea6256559 24-Jan-2015 Axel Dörfler <axeld@pinc-software.de>

Package Kit: FetchFileJob now contains package size.

* So that you know how much already was, and still has to be downloaded.
* Automatic whitespace cleanup.
* The link in FetchFileJob.h did not fetch the correct header under
Haiku anymore (since the addition of the private headers to the
image).


# 87d0590f6091f16a32dfa672888f050de2e0266b 30-Oct-2014 Adrien Destugues <pulkomandy@gmail.com>

pkgman: better download progress bar

* Use Unicode block drawing characters to provide sub-character accuracy
* Also display the download progress percentage as a number

When downloading big packages this helps seeing that the bar continues
moving and that the download is not stalled.


# eee422752c6de8ab971937a81225008d254ad785 14-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Make BCommitTransactionResult available

* BFatalErrorException: Add commitTransactionResult property and
respective constructor. In case committing the transaction failed,
BPackageManager throws a BFatalErrorException with the result.
* BFatalErrorException::UserInteractionHandler: Pass
BCommitTransactionResult to ProgressTransactionCommitted().


# 83f63a216ee17213be3e9125c17f611bdb26e1b5 22-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman [un]install/update: Add non-interactive mode (-y)


# d3f4a86549823f80504a10118e7fc41f51f06a24 02-Oct-2013 Rene Gollent <rene@gollent.com>

Implement #10051.

- Add a simple download progress meter to pkgman that prints a hash mark
for every 2% of the download completed. Improvements welcome.


# 9345049af828506bd2b20408e3612655a0153db1 28-Sep-2013 Rene Gollent <anevilyak@gmail.com>

Package Kit: Implement progress notifications.

- BJobStateListener: Add progress state and corresponding hook.
- FetchFileJob: Notify job progress hook on libcurl notifications.
- UserInteractionHandler: Add hooks for download progress and checksum
validation progress.
- PackageManager: inherit from JobStateListener and watch for job
notifications for internally generated jobs. Forward to corresponding
UserInteractionHandler hooks as needed.
- Adapt pkgman, HaikuDepot and package_daemon to above changes.
Neither HaikuDepot nor package_daemon's progress hooks are wired up to
do anything yet though.


# fe39d2eb8d03c1e71d835bab5d939c9b75440316 27-Sep-2013 Rene Gollent <anevilyak@gmail.com>

BPackageManager: Eliminate RequestHandler.

- Pull functionality back into package manager itself since the extra
indirection doesn't really buy us anything in this case, as neither
request that it handles requires a decision provider.
- Adjust pkgman and HaikuDepot accordingly.


# cf3bb0d753b4cf0a90db533152c58af2a568fc9e 31-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Abstract installed repository initialization

* Rename TransactionHandler -> InstallationInterface and
DaemonClientTransactionHandler -> ClientInstallationInterface.
* Add InstallationInterface::InitInstalledRepository(). Use in
_AddInstalledRepository() to get the repository packages instead of
using the package roster. The ClientInstallationInterface
implementation does it that way.


# 83462cc28d356d564a818c1d34605ed2ec83f274 31-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactor reusable pkgman code into libpackage

* Move RepositoryBuilder class to libpackage and add B* prefix to name.
* Pull BPackageManager class out of PackageManager and move to
libpackage. The base class is customizable via three handler objects
responsible for transaction handling, request execution, respectively
user interaction.
* Reorganize _ApplyPackageChanges(): Now we first prepare the
transactions for all affected installation locations (downloading
files etc.) and then commit them.


# 08fb013f56bf7119a68ea7c06cac8f947dc4661e 29-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman uninstall: Verify more specific locations

... after having determined the packages to remove from the selected
installation location. This uninstalls packages from the more specific
locations when their dependencies have been removed.


# a54a50b48e316421f2735e9c46219164e16dd8cd 28-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: add support for [un]installing/updating in system


# 3381a1bf81eb9d0c21e37cb031ab4b436294cbdf 28-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman uninstall: improve correctness

... with respect to inter-installation-location dependencies. E.g.
uninstalling a package from common should only uninstall packages
depending on it, when system doesn't still provide those dependencies.

We don't consider uninstalling packages from more specific installation
locations when dependencies are uninstalled from a more general one yet.


# 90f9f1392b5bac87c6333ec9627eda462035617d 27-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman install: Add base package support

If any of the packages to install has requires a base package, that is
installed in a more general installation location, we copy the package
to the target installation location. Ideally we'd hard-link, but BFS
doesn't support that. Symlinks would be a small nightmare to maintain.

We might want to choose the installation location intelligently
depending on the base package requirement -- e.g. install curl_devel in
system rather than common, since curl is installed in system -- so we
can avoid duplicating packages.


# ce4f36769285c1c491491dac6a909c76b7d761ad 26-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: auto-refresh repositories only for update/install


# 8b26ef6779119ba64f5de3ce47ea4cac154ab4e8 25-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: PackageManager: Use flags instead of bools in ctor


# a5999f6ff7fbadb4f8cc94f5e4283dacbf231a59 21-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add "update" command


# df2685d885f3b940bc04b1cf5f39511ce6750ddf 20-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add "uninstall" command


# 3ac0de3b1fac18912d6cb7758b502468e3802ee9 20-Apr-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Refactoring -> PackageManager

Move common and reusable functionality from "search" and "install" to
new PackageManager class.