History log of /haiku/src/kits/package/manager/PackageManager.cpp
Revision Date Author Comments
# 5140a1bb 24-Jun-2023 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Package Kit/Launch Server: avoid/ignore use of requires keyword

In C++20 `requires` is a reserved keyword. GCC13 warns against its use. This
change removes the use of the keyword in our own code, and ignores it in the
external 'libsolv' code.

Change-Id: I3319d20c0a3fdad89630683cdff5ea3b17f04e99
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6647
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 2be10edf 23-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

Package Kit: Improvements to partial download handling.

* Move IsDownloadComplete call into DownloadFileRequest; this way
we will always revalidate checksums even if the file is fully
downloaded instead of skipping that.

* Treat ERANGE as a "bad data" error in PackageManager (it usually means
we have a size mismatch between the local and the server's file)

* If we fail checksum validation or get ERANGE, and we reused a download,
immediately try again without reusing the download. This fixes most
problems that previously required you to delete old transaction
directories.

Change-Id: Ia3079655691b871e0b206e366b59fca0f832c63d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4730
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# dd3b46ac 23-Jan-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

Package Kit: smarter download resume

Pick the most advanced partial download to resume from if there are
multiple ones.

Fixes the remaining part of #16744.

Change-Id: I0ed7daf42e0346632918552e97d660b4946405cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3672
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# 7e677f64 10-Jan-2021 Stephan Aßmus <superstippi@gmx.de>

Package Kit: Delete downloads failing the checksum check

Change-Id: I3a7a914ea88e7b7b5bcc79160f46a9b4fcbba01b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3619
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f15516ff 19-Nov-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Package Kit: re-use downloads from unfinished transactions

There are three parts to this change:
- In FetchFileJob, if the request fails with a timeout or IO error
(probably because of unstable connection) attempt to resume the
download with a range request. No limit on number of retries
currently, maybe we should add one.
- In PackageManager, before downloading a file, look around in other
transaction directories in case it's already there. Partial and
complete downloads are differentiated by an attribute which the
fetch file job maintains. For complete downloads, no fetch job is
scheduled, for partial downloads, the fetch job will request the
remainder of the file.
- In BHttpRequest, the implementation of SetRangeStart() and
SetRangeEnd() have been added, along with some refactoring to
handle listener notifications consistently. This also fixed a
bug where the final notification for download progress was not
emitted for compressed data.

Fixes #12414.

Change-Id: I3e285741ed0e5651594a7c2e1c7170644a9d297d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3404
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 106ae4ec 17-Aug-2018 CodeforEvolution <themysterymail555@gmail.com>

Remove Curl, Switch to NetApi in Package Kit

Change-Id: I92213ab60dc987175c323d1d9ed11ac8b3517f2f
Reviewed-on: https://review.haiku-os.org/475
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 99e5e3fd 08-Jul-2017 Humdinger <humdingerb@gmail.com>

Package daemon notifications

* Sentence casing
* Localize notification texts in the package kit
* Have "Package daemon" as group name and "Warning" as title
* Use ::BPrivate in Bitmap.h to solve an ambiguity (as pointed out
by PulkoMandy). Though not needed for my changes any more, since
a the icon of the notifying app is now shown by default.

Fixes #13590.


# ab8f11bf 20-Mar-2017 Brian Hill <supernova@warpmail.net>

SoftwareUpdater updates

Bug fix- show correct version on package uninstall list item tooltip
Correct if else formatting
Use the BPackageManager FullSync() function instead of Update
Change warning strings in BPackageManager to sentence casing
Show list item tooltip on a mouse down (helps with touch devices)


# 36a9daf6 21-Aug-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

Package kit: more style fixes.

Pointed out by Axel this time. Thanks!


# a22f114f 21-Aug-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

chroot support in package kit: style fixes

- Catching an exception in the normal flow is not a good thing, instead,
test before calling the function (I've been doing too much python
lately)
- Avoid using uninitialized nodeRef if there is no system root and also
no specified root in the message.

Thanks to Ingo or the code review.


# 6262ccbb 18-Aug-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

Fix use of findpaths from inside chroot

The package kit needs to provide the package daemon with the node_ref of
the root directory, so the package daemon gives the correct results when
the request comes from inside a chroot.

Moreover, the package kit must be able to handle a root with a system
but no home package dir, as is the case inside the chroot environment
created by haikuporter.

Fixes #12602.


# 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).


# d228f29f 25-Oct-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add SetDebugLevel()

Sets the debug level of the solver.


# 9002c943 25-Oct-2014 Stephan Aßmus <superstippi@gmx.de>

Package Kit: Always allocate local repository

Consequently always register it with the solver in Init(). This solves the
problem that it made a difference at which time Init() is called. Init() is
called at the beginning of Install() and Uninstall(), but HaikuDepot was
calling it before that for other reasons. A second call to Init() will exit
early. If local package files were added to the PackageManager instance,
the local repository was created lazily, but because Init() did not run a
second time, the local repository was not registered with the solver. Now
it already is, since it is no longer created on demand, but always.


# f2f19f11 15-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Support installing/updating local package files

* The Install() and Update() versions that take a const char* array
now check whether a string looks like a path to a local package file.
If so, they use that file instead of interpreting the string as a
search string.
* Extend the repository hierarchy. There's now a LocalRepository base
class from which InstalledRepository and the new MiscLocalRepository
derive. The latter is instantiated once and collects all package files
specified by path.


# 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().


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

package daemon: Rework error and issue propagation to client

* BDaemonClient: Move inner class BCommitTransactionResult to top level
and make it public.
* BCommitTransactionResult:
- Add a whole bunch of specific error code enum values. Such an error
code is now the primary error, as opposed to before where we would
mix status_t and enum value errors. There's a systemError property
of type status_t which may provide additional information, though
(depending on the primary error type).
- Remove the errorMessage property. Due to mapping all errors to the
specific error codes this is no longer necessary. Mixing such a
message with another error description is also not very helpful when
it comes to localization (still not supported, though).
- Add several properties (paths, strings, error codes) that serve as
arguments to the primary error and are used by FullErrorMessage().
- Add issues property, a list of instances of new class
BTransactionIssue. Those describe non-critical issues (e.g. failed
update of a settings file) that occurred in the process of
committing the transaction. Those issues should be presented to the
user by the package management program.
* Exception: Adjust to transport the BCommitTransactionResult
properties.
* CommitTransactionHandler, FsTransactions, Root, Volume: Adjust to
BCommitTransactionResult/Exception changes.
* CommitTransactionHandler: Now requires a BCommitTransactionResult to
which it adds the issues it encounters. The reply BMessage is no
longer needed, though.
* Volume: Refactor common code from the three methods that use
CommitTransactionHandler into new method _CommitTransaction.


# 6ef57ae2 25-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add full-sync command

* BSolver/LibsolvSolver: Add FullSync() method. It uses libsolv's
SOLVER_DISTUPGRADE mode.
* BPackageManager: Add FullSync() using the new solver mode.
* pkgman: Add full-sync command.

The new command is similar to the update command without arguments, just
more aggressive, allowing downgrading or even removal of packages, to
match the state of the repositories. Just like "update" it doesn't work
properly yet.


# ee8e9158 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager::UserInteractionHandler: Make non-abstract

Most of the hooks don't strictly need a non-empty implementation. The
defaults now simply throw exceptions in those that do. This allows the
class to be instantiated, which is useful when a BPackageManager is only
used for finding packages.


# 6722e1ae 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add mandatory constructor parameters

Require the installation interface and the user interaction handle to
be passed to the constructor. Formerly, derived classes set them
manually in their constructors. This makes using the class without
having to subclass it possible.


# 4b7e2196 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 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.


# 81a828b6 29-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Auto-refresh if repository cache is missing

This makes the initial "pkgman refresh" superfluous, that was necessary
for "install"/"search" to work.


# 99f9333a 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager::_CommitPackageChanges(): Fix error handling

The error returned by CommitTransaction() is just indicates whether
transactionResult has been initialized.


# d3c96ad8 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Support pre-added packages

... as needed for the package daemon. _PreparePackageChanges() doesn't
try to clone them in this case.


# 36204024 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add InstalledRepository::EnablePackage()


# 018173a2 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add ResultComputed() callback


# c032903a 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add VerifyInstallation()


# 7e0d2c4f 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add alternate Install()/Uninstall()/Update()


# 5a5d1465 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Make _InstallationRepository() protected


# 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.


# 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).


# d228f29f6e11f67e35f8d6e190aa8028ecb5fee8 25-Oct-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add SetDebugLevel()

Sets the debug level of the solver.


# 9002c943459a1033bc8589c4188f0e6988b7fca5 25-Oct-2014 Stephan Aßmus <superstippi@gmx.de>

Package Kit: Always allocate local repository

Consequently always register it with the solver in Init(). This solves the
problem that it made a difference at which time Init() is called. Init() is
called at the beginning of Install() and Uninstall(), but HaikuDepot was
calling it before that for other reasons. A second call to Init() will exit
early. If local package files were added to the PackageManager instance,
the local repository was created lazily, but because Init() did not run a
second time, the local repository was not registered with the solver. Now
it already is, since it is no longer created on demand, but always.


# f2f19f110d94b924183dad8e7df2c8e122c0ebac 15-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Support installing/updating local package files

* The Install() and Update() versions that take a const char* array
now check whether a string looks like a path to a local package file.
If so, they use that file instead of interpreting the string as a
search string.
* Extend the repository hierarchy. There's now a LocalRepository base
class from which InstalledRepository and the new MiscLocalRepository
derive. The latter is instantiated once and collects all package files
specified by path.


# 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().


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

package daemon: Rework error and issue propagation to client

* BDaemonClient: Move inner class BCommitTransactionResult to top level
and make it public.
* BCommitTransactionResult:
- Add a whole bunch of specific error code enum values. Such an error
code is now the primary error, as opposed to before where we would
mix status_t and enum value errors. There's a systemError property
of type status_t which may provide additional information, though
(depending on the primary error type).
- Remove the errorMessage property. Due to mapping all errors to the
specific error codes this is no longer necessary. Mixing such a
message with another error description is also not very helpful when
it comes to localization (still not supported, though).
- Add several properties (paths, strings, error codes) that serve as
arguments to the primary error and are used by FullErrorMessage().
- Add issues property, a list of instances of new class
BTransactionIssue. Those describe non-critical issues (e.g. failed
update of a settings file) that occurred in the process of
committing the transaction. Those issues should be presented to the
user by the package management program.
* Exception: Adjust to transport the BCommitTransactionResult
properties.
* CommitTransactionHandler, FsTransactions, Root, Volume: Adjust to
BCommitTransactionResult/Exception changes.
* CommitTransactionHandler: Now requires a BCommitTransactionResult to
which it adds the issues it encounters. The reply BMessage is no
longer needed, though.
* Volume: Refactor common code from the three methods that use
CommitTransactionHandler into new method _CommitTransaction.


# 6ef57ae2a96085ccb56e356e21e652cc11777ac0 25-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

pkgman: Add full-sync command

* BSolver/LibsolvSolver: Add FullSync() method. It uses libsolv's
SOLVER_DISTUPGRADE mode.
* BPackageManager: Add FullSync() using the new solver mode.
* pkgman: Add full-sync command.

The new command is similar to the update command without arguments, just
more aggressive, allowing downgrading or even removal of packages, to
match the state of the repositories. Just like "update" it doesn't work
properly yet.


# ee8e91583ecf0977326ede58e1f92fda92ae594f 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager::UserInteractionHandler: Make non-abstract

Most of the hooks don't strictly need a non-empty implementation. The
defaults now simply throw exceptions in those that do. This allows the
class to be instantiated, which is useful when a BPackageManager is only
used for finding packages.


# 6722e1ae43d51bb855e472045e84bb45592751cd 20-Nov-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add mandatory constructor parameters

Require the installation interface and the user interaction handle to
be passed to the constructor. Formerly, derived classes set them
manually in their constructors. This makes using the class without
having to subclass it possible.


# 4b7e219688450694efc9d1890f83f816758c16d3 03-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Remove /boot/common for good

* Remove support for the "common" installation location from packagefs,
package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
I'm sure some occurrence still remain. They can be adjusted when the
remaining B_COMMON_*_DIRECTORY constants are removed.


# 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.


# 81a828b660cf54ac1adeb9c4a5f12fa9cd496ecf 29-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Auto-refresh if repository cache is missing

This makes the initial "pkgman refresh" superfluous, that was necessary
for "install"/"search" to work.


# 99f9333a2a6f17c91995afaf74c4e120862d3d4c 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager::_CommitPackageChanges(): Fix error handling

The error returned by CommitTransaction() is just indicates whether
transactionResult has been initialized.


# d3c96ad80967b792ed25425288c374624273295d 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Support pre-added packages

... as needed for the package daemon. _PreparePackageChanges() doesn't
try to clone them in this case.


# 36204024cfc0c357f9a422317665256f8ae2443f 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add InstalledRepository::EnablePackage()


# 018173a2f5ba97ee56e8579d63261d55d1e8ccae 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add ResultComputed() callback


# c032903abc04a8ac1fec08704e0a8e7212402711 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add VerifyInstallation()


# 7e0d2c4f94ac5381a39ea2da4b183e9c39635877 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Add alternate Install()/Uninstall()/Update()


# 5a5d146510f3459c597f4c7ab35cc423db7dd321 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageManager: Make _InstallationRepository() protected


# 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.