History log of /haiku/src/servers/package/CommitTransactionHandler.h
Revision Date Author Comments
# 3376ed1a 02-Feb-2021 Alexander G. M. Smith <agmsmith@ncf.ca>

Package Kit: Proper Installation for First Boot Packages

Do the final installation operations for all the packages in the
/system/packages directory when the OS is booted for the first time.

This will run their post-install scripts, create users, groups and generate
settings files (marked with a package version attribute). Previously we just
ran all the shell scripts found in the /system/boot/post-install directory
(don't do that as much now).

Fixes bug #14382

This patch has simpler code flow in CommitTransactionHandler::_ApplyChanges
Tested on 32 and 64 bit systems. Once it's official, need to remove the
open_ssh redundant post-install script that creates users etc. from HaikuPorts.
Now we can notice bugs like package version attributes on settings files aren't
fully working. :-)

Didn't remove special case for add_catalog_entry_attributes.sh since it
still does stuff that the build system doesn't do. Might be able to add
that script as part of the Haiku.hpkg. See change 3751 for removing it,
https://review.haiku-os.org/c/haiku/+/3751

Change-Id: I3807b78042fdb70e5a79eca2e2a45816ece0236f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2342
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f8662071 02-Jan-2021 Stephan Aßmus <superstippi@gmx.de>

Package Server: Handle existing files when commiting transaction

Package files to be committed may already exist in the packages folder,
there is no good reason to fail the transaction. These may be packages
which are not activated, or there may be other reasons. While I have
not investigated how this situation may form, I don't see a good reason
to spend the time. Simply compare the contents of the existing file
with the file from the transaction, only fail if they are different.

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


# a22fa0c9 04-Jun-2019 Alexander G. M. Smith <agmsmith@ncf.ca>

package kit: Add pre-uninstall scripts feature.

Just like post-install scripts which run shortly after a package is
installed, pre-uninstall scripts are run just before a package is
removed. Implements enhancement #13427

* Fix script exit code handling vs script launch errors.
* Bump package and repo file version numbers due to new attribute,
unfortunately makes new .hpkg files not backwards compatible.
* Add pre-uninstall functionality, mostly cloning the post-install
except in a few places.
* Discover that _RunQueuedScripts() is never called, a future TODO:?
* Update package documentation for pre-uninstall scripts, and use of
the boot/post-install directory.

Change-Id: I45596255ce74bc102f6e5b606cbf83e4e4347a17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1504
Reviewed-by: Alexander G. M. Smith <agmsmith@ncf.ca>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 6f19d31c 13-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

package_daemon: queue post-install scripts to run after reboot

* Creates symlinks to the post-install scripts into the
administrative/queued-scripts directory.
* Upon reboot, post-install scripts in the queued-scripts
are run, and then the symlinks to the scripts removed.
* This solves the issue of post-install scripts not being
run when the package is installed/upgraded along with the
system packages, as experienced with the latest upgrade
to the bash package.


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


# c2f3b81d 05-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Fix manual package [de/]activation

CommitTransactionHandler: Since the VolumeState is now always copied
(including the contained packages), we can't just use the passed in
packagesAlready{Added,Removed} sets, since they refer to the original
packages.


# fe28d362 30-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Don't apply system package changes immediately

When a system package is going to be deactivated, activate/deactivate
the packages of the whole transaction only to the latest state.
Afterward latest state and active state will differ.


# 2dbf8167 27-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Initial old packages state support

* VolumeState: Move locking to Volume.
* Package: Pull the file related functionality into new class
PackageFile. A Package refers to a PackageFile. A PackageFile can be
referenced by multiple Packages. PackageFiles are managed by the new
PackageFileManager.
* CommitTransactionHandler: Clone the passed volume state.
* Volume now manages two VolumeStates: A state reflecting the currently
active packages and the latest state (i.e. the one reflecting the
situation of the packages directory). Usually the two are the same,
unless an old state has been booted.
* The client interface hasn't been adjusted yet. Clients only see the
latest state.


# 7a3253f0 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Pass volume state CommitTransactionHandler

... and remove the getter from Volume again.


# 8c6e1bf5 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Sever Volume-CommitTransactionHandler friendship

Move quite a bit of transaction related methods from Volume to
CommitTransactionHandler.


# 933e7b32 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Move Volume::CommitTransactionHandler to top level

Also move constant definitions to Constants.h/cpp.


# 6f19d31cd4d8fda1e85d5a2ab8717263c9b84f34 13-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

package_daemon: queue post-install scripts to run after reboot

* Creates symlinks to the post-install scripts into the
administrative/queued-scripts directory.
* Upon reboot, post-install scripts in the queued-scripts
are run, and then the symlinks to the scripts removed.
* This solves the issue of post-install scripts not being
run when the package is installed/upgraded along with the
system packages, as experienced with the latest upgrade
to the bash package.


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


# c2f3b81d45f9f1a2a891813f9499818b1d72515e 05-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Fix manual package [de/]activation

CommitTransactionHandler: Since the VolumeState is now always copied
(including the contained packages), we can't just use the passed in
packagesAlready{Added,Removed} sets, since they refer to the original
packages.


# fe28d36222e1eddf0686a3d9ea98baf59de17cf1 30-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Don't apply system package changes immediately

When a system package is going to be deactivated, activate/deactivate
the packages of the whole transaction only to the latest state.
Afterward latest state and active state will differ.


# 2dbf8167fec7282ac384273014903a1bbdfa49e6 27-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Initial old packages state support

* VolumeState: Move locking to Volume.
* Package: Pull the file related functionality into new class
PackageFile. A Package refers to a PackageFile. A PackageFile can be
referenced by multiple Packages. PackageFiles are managed by the new
PackageFileManager.
* CommitTransactionHandler: Clone the passed volume state.
* Volume now manages two VolumeStates: A state reflecting the currently
active packages and the latest state (i.e. the one reflecting the
situation of the packages directory). Usually the two are the same,
unless an old state has been booted.
* The client interface hasn't been adjusted yet. Clients only see the
latest state.


# 7a3253f07c1268b15f6a16bf15cb0a8607ade304 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Pass volume state CommitTransactionHandler

... and remove the getter from Volume again.


# 8c6e1bf54868b11ec9df027700858e36cb421ac0 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Sever Volume-CommitTransactionHandler friendship

Move quite a bit of transaction related methods from Volume to
CommitTransactionHandler.


# 933e7b3280f1d1ed01b4080288fbe767a2d18379 20-Apr-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Move Volume::CommitTransactionHandler to top level

Also move constant definitions to Constants.h/cpp.