From owner-freebsd-ports@FreeBSD.ORG Wed Nov 12 10:11:23 2008 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F0EE1065677 for ; Wed, 12 Nov 2008 10:11:23 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from smtp7-g19.free.fr (smtp7-g19.free.fr [212.27.42.64]) by mx1.freebsd.org (Postfix) with ESMTP id C51248FC1B for ; Wed, 12 Nov 2008 10:11:22 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from smtp7-g19.free.fr (localhost [127.0.0.1]) by smtp7-g19.free.fr (Postfix) with ESMTP id 7089DB0179 for ; Wed, 12 Nov 2008 11:11:21 +0100 (CET) Received: from marvin.blogreen.org (marvin.blogreen.org [82.247.213.140]) by smtp7-g19.free.fr (Postfix) with ESMTP id 46C9BB015B for ; Wed, 12 Nov 2008 11:11:21 +0100 (CET) Received: by marvin.blogreen.org (Postfix, from userid 1001) id BEF545C12B; Wed, 12 Nov 2008 11:11:20 +0100 (CET) Date: Wed, 12 Nov 2008 11:11:20 +0100 From: Romain =?iso-8859-1?Q?Tarti=E8re?= To: freebsd-ports@freebsd.org Message-ID: <20081112101120.GA44033@marvin.blogreen.org> Mail-Followup-To: freebsd-ports@freebsd.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WIyZ46R2i8wDzkSu" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-PGP-Key: http://romain.blogreen.org/pubkey.asc Subject: Re: On pkg_trans X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 10:11:23 -0000 --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 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--