Date: Wed, 12 Nov 2008 11:11:20 +0100 From: Romain =?iso-8859-1?Q?Tarti=E8re?= <romain@blogreen.org> To: freebsd-ports@freebsd.org Subject: Re: On pkg_trans Message-ID: <20081112101120.GA44033@marvin.blogreen.org> In-Reply-To: <get7u1$aac$1@ger.gmane.org> References: <get7u1$aac$1@ger.gmane.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3D`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: | romain@trilian ~ # pkg_trans -l | 0 transaction records found. | romain@trilian ~ # 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. | romain@trilian ~ # 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. | romain@trilian ~ #=20 Worst, reverting the situation is not as easy as: | for t in 5 4 3 2 1; do pkg_trans -u -z $t; done | romain@trilian ~ # pkg_trans -i -z 5 | Transaction 000000005, started on Sun Nov 9 18:02:23 2008 | ADD libslang2-2.1.4 | romain@trilian ~ # pkg_trans -i -z 1 | Transaction 000000001, started on Sun Nov 9 18:02:29 2008 | ADD most-5.0.0 | romain@trilian ~ #=20 Reading dependencies informations, we can determine the order in which we have to undo changes: | romain@trilian /var/db/pkg # pkg_info -r *-* | Information for libiconv-1.11_1: | Depends on: |=20 | Information for libslang2-2.1.4: | Depends on: | Dependency: png-1.2.32 | Dependency: pcre-7.8 | Dependency: libiconv-1.11_1 |=20 | 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 |=20 | Information for pcre-7.8: | Depends on: |=20 | Information for png-1.2.32: | Depends on: |=20 | romain@trilian /var/db/pkg # for t in 1 5 2 3 4; do pkg_trans -u -z$t; do= ne | romain@trilian /var/db/pkg # pkg_trans -l | 0 transaction records found. | romain@trilian /var/db/pkg # Is there any plan regarding this? I guess the best would be to have a single transaction. Kind regards, Romain --=20 Romain Tarti=E8re <romain@blogreen.org> http://romain.blogreen.org/ pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43) (plain text =3Dnon-HTML=3D PGP/GPG encrypted/signed e-mail much appreciated) --WIyZ46R2i8wDzkSu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkkaq8gACgkQ2OmjP/9W/0Pn3ACeP/pzADln1fqW5SLMCR2uCrod Jf0AmwZPtCZSWn67xM5dcaaFAjRMkbap =V9EM -----END PGP SIGNATURE----- --WIyZ46R2i8wDzkSu--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081112101120.GA44033>