Hi Ivan. On Wed, Nov 05, 2008 at 11:49:29PM +0100, Ivan Voras wrote: > I'll probably have some time in the next few days to work on pkg_trans > again, but first I'd like to get some input on the whole thing. The last > time I talked about it I've made code available but I've received no > feedback.
I have just grabbed the source tarball, and give pkg_trans a try. Here are a few remarks: 1) As you said, $pkg_trans_save_deleted_packages should be set somewhere else. Why not /etc/pkg_install.conf? Another solution would be to rely on a switch (as -b used by pkg_create(8) for creating backups. However, the configuration file is surely "safer". 2) Semantic remark: when I hear "transaction" I think "commit" / "rollback", not "end" nor "undo". I have not tested using `pkg_trans -[bade]` with `pkg_{add,delete} -z` directly to build "custom transactions" (e.g. update a package from one version to another as part of a single transaction (or 2, one for removing outdated packages and a second one of installs new packages versions)), but I guess it would be something like this (please confirm, I did not have a look to the source code and could not find informations about doing this in the links you provided): | z=`pkg_trans -b` | pkg_trans -d package-1.0 -z $z | pkg_delete package-1.0 | pkg_add package-2.0 | pkg_trans -a package-2.0 -z $z | pkg_trans -e -z $z Assuming package-2.0 depends on a package that is not available, installation will fail. Is the only way to rollback this to "end" the transaction and "undo" it? 3) If I pkg_add -r some_package, it will create as many transactions as packages installed: | [EMAIL PROTECTED] ~ # pkg_trans -l | 0 transaction records found. | [EMAIL PROTECTED] ~ # pkg_add -r most | Fetching http://tinderbox.sigabrt.org/packages/7.0-BSD-sharp-latest-with-gnome/Latest/most.tbz... Done. | Fetching http://tinderbox.sigabrt.org/packages/7.0-BSD-sharp-latest-with-gnome/All/png-1.2.32.tbz... Done. | Fetching http://tinderbox.sigabrt.org/packages/7.0-BSD-sharp-latest-with-gnome/All/pcre-7.8.tbz... Done. | Fetching http://tinderbox.sigabrt.org/packages/7.0-BSD-sharp-latest-with-gnome/All/libiconv-1.11_1.tbz... Done. | Fetching http://tinderbox.sigabrt.org/packages/7.0-BSD-sharp-latest-with-gnome/All/libslang2-2.1.4.tbz... Done. | [EMAIL PROTECTED] ~ # pkg_trans -l | 000000001 (1 pkgs added) Sun Nov 9 18:01:20 2008 | 000000002 (1 pkgs added) Sun Nov 9 18:01:21 2008 | 000000003 (1 pkgs added) Sun Nov 9 18:01:22 2008 | 000000004 (1 pkgs added) Sun Nov 9 18:01:23 2008 | 000000005 (1 pkgs added) Sun Nov 9 18:01:24 2008 | 5 transaction records found. | [EMAIL PROTECTED] ~ # Worst, reverting the situation is not as easy as: | for t in 5 4 3 2 1; do pkg_trans -u -z $t; done | [EMAIL PROTECTED] ~ # pkg_trans -i -z 5 | Transaction 000000005, started on Sun Nov 9 18:02:23 2008 | ADD libslang2-2.1.4 | [EMAIL PROTECTED] ~ # pkg_trans -i -z 1 | Transaction 000000001, started on Sun Nov 9 18:02:29 2008 | ADD most-5.0.0 | [EMAIL PROTECTED] ~ # Reading dependencies informations, we can determine the order in which we have to undo changes: | [EMAIL PROTECTED] /var/db/pkg # pkg_info -r *-* | Information for libiconv-1.11_1: | Depends on: | | Information for libslang2-2.1.4: | Depends on: | Dependency: png-1.2.32 | Dependency: pcre-7.8 | Dependency: libiconv-1.11_1 | | Information for most-5.0.0: | Depends on: | Dependency: png-1.2.32 | Dependency: pcre-7.8 | Dependency: libiconv-1.11_1 | Dependency: libslang2-2.1.4 | | Information for pcre-7.8: | Depends on: | | Information for png-1.2.32: | Depends on: | | [EMAIL PROTECTED] /var/db/pkg # for t in 1 5 2 3 4; do pkg_trans -u -z$t; done | [EMAIL PROTECTED] /var/db/pkg # pkg_trans -l | 0 transaction records found. | [EMAIL PROTECTED] /var/db/pkg # Is there any plan regarding this? I guess the best would be to have a single transaction. Kind regards, Romain -- Romain Tartière <[EMAIL PROTECTED]> http://romain.blogreen.org/ pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43) (plain text =non-HTML= PGP/GPG encrypted/signed e-mail much appreciated)
pgpazEQGIYMy9.pgp
Description: PGP signature