I'd like to have the following abilities in the ports infrastructure:
The idea is to support operations like these:
To be able to do this, I propose a new utility, a program, called pkg_trans, that will be used like this:
pkg_trans -b
Begins a transaction. Writes transaction id to stdout.
pkg_trans -a package_name -z trans_id
Records that a package is being installed, as a part of a transaction.
pkg_trans -d package_name -z trans_id
Records that a package is being removed, as a part of a transaction. Optionally, at this point, if pkg_trans_save_deleted_packages="YES" is present in /etc/rc.conf, a binary package backup is created by pkg_create -b to enable undoing the delete. When the transaction is logically over, the following is used:
pkg_trans -e -z trans_id
This ends the transaction, cleans up, whatever is needed. The command
pkg_trans -u -z trans_id
Undos a transaction, while
pkg_trans -l
Shows a list of all recorded transactions, chronologically ordered.
pkg_trans -i -z trans_id
Shows details of a transaction.
I've chosen -z for transaction ID because -t and -x are both used by various pkg_* utilities for other purposes and -z is free in all utilities.
For this to be effective, I think these utilities will have to be modified:
pkg_add - to start a transaction, record added packages, end the transactionpkg_delete - to start a transaction, record the deleted packages, end the transactionmake install infrastructure, I believe this involves pkg_create to register the package, to the same effects as pkg_add. There are several problems here I don't know how to solve currently: 1) the transaction ID has to be kept somehow and passed around and b) make install can be exited by Ctrl-C and I still want the packages registered upto the point of interruption to remain recorded in the transaction and that the transaction ends cleanly.Let's call this “alpha” release :)