History log of /haiku/src/servers/package/CommitTransactionHandler.cpp
Revision Date Author Comments
# 76142a93 21-Mar-2024 Augustin Cavalier <waddlesplash@gmail.com>

package_daemon: Try to use the old activated-packages file time for the state name.

Using the current time can be confusing when looking at packages or
the bootloader, as the time represents whenever the new state was made,
not when the old state was.

When there is no activated-packages file, we just use the current time
anyway. This means that on newly created systems, the first two states
will have the same time, and the second will have an extra "-1" on the
end of its name to distinguish it (if for some reason the activated
file retains its time, then you'll get "-2", etc.)

Change-Id: I128764ae4650a3433e2584f3ed154b04cf850b19
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7543
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 8079adc0 16-Dec-2022 Jessica Hamilton <jessica.l.hamilton@gmail.com>

libroot: fix path inconsistency in the find path API.

With the package kit merge, settings from packages were
placed into ~/config/settings/global for packages installed
into the PackageFS Home mount.

As a result, B_FIND_PATH_SETTINGS_DIRECTORY was returning a
user settings path different to the find directory API, making
transitioning from find directory to find path incompatible.

This change also updates the package_daemon and packagefs
to remove the remapping also occurring there.

Change-Id: Id5d077503e177a5f7cbc48779c132160b0d01890
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5941
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# fce7f3a7 09-Dec-2020 X512 <danger_mail@list.ru>

integrate AutoDeleter's into pointers

Change-Id: I6c3925a7aec4d0647c76c2a03aad7b08985d7166
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3490
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 711e2dc0 01-Dec-2021 Augustin Cavalier <waddlesplash@gmail.com>

Adjust all struct dirent creations (again), this time to use offsetof().

The dirent struct is not packed, so offsetof(dirent, d_name) != sizeof(dirent).
Thus in order not to waste the alignment bytes (which are significant,
on x86_64 at least, sizeof(dirent)==32, but offsetof(...)=26.)

This is also the most portable way to handle things, and should
work just fine in cross-platform code that has a non-zero-sized d_name.


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


# c69ed143 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: CommitTransactionHandler: Minor error case fixes


# 870e93ac 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Move volume change counter back to Volume


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


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

package daemon: CommitTransactionHandler: Use NotOwningEntryRef


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


# c69ed143a642728ec684efd3219c2493e847e9c1 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: CommitTransactionHandler: Minor error case fixes


# 870e93acf88329489473abf19e0471454ff9dd2e 01-May-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package daemon: Move volume change counter back to Volume


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


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

package daemon: CommitTransactionHandler: Use NotOwningEntryRef


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