Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Oct 2008 23:46:02 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        freebsd-ports@freebsd.org
Subject:   pkg_trans progress
Message-ID:  <gcj9n4$4u7$1@ger.gmane.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig91F57FB4CDC8B34F8F00CB01
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

Some time ago I've written about an idea to extend the standard
ports/package infrastructure with "transactions". Here are some notes on =
it:

http://wiki.freebsd.org/IvanVoras/PkgTransProposal

I've been working on it, and the code itself appears to have severely
bad karma, being twice almost completely lost in hardware or software
failures, so I'm publishing it now so it doesn't get lost again :)

The build tree is at

http://people.freebsd.org/~ivoras/big/pkg_install.tgz

To use it:

* Extract it somewhere
* Run make in the created directory
* su to root
* Run make install

Now you have a new utility, pkg_trans, and additions to existing pkg_add
and pkg_delete utilities. It's highly recommended you also add
pkg_trans_save_deleted_packages=3D"YES" to /etc/rc.conf (suggestions for
better placement of this configurable is welcome). To undo this, run
make install from the normal build tree (at
/usr/src/usr.sbin/pkg_install) and manually remove the pkg_trans utility.=


The additional pkg_trans utility is called by patched pkg_add and
pkg_delete, to isolate transaction functionality and minimize changes to
pkg_add and pkg_delete. It also serves to query transactions and undo the=
m.

The man pages are not yet updated, but the wiki page above has simple
descriptions of new options. Here's what currently works:

* Recording pkg_add and pkg_delete transactions (one invocation of
pkg_add/pkg_delete is one transaction, no matter how many packages it
touches).
* Backing up of packages in pkg_delete transactions
* Undoing those transactions
* Querying transaction records.

The transaction records are installed in /var/db/pkgtrans and
/usr/ports/pkgtrans .

For illustration, here's a sample console session with the new
utilities. Note that sqlcached requires sqlite as a dependancy.
Arguments to pkg_trans do the following: -l : list all recorded
transactions, -i : show info about a particular transaction, -u : undo a
transaction. The rest should be self-explanatory.

----

v8:/home/ivoras/temp# ll
total 1
-rw-r--r--  1 root  ivoras   14896 Aug  1 10:17 sqlcached-r4.tbz
-rw-r--r--  1 root  ivoras  639829 Aug  1 07:26 sqlite-2.8.17_1.tbz

v8:/home/ivoras/temp# pkg_info|grep sql

v8:/home/ivoras/temp# pkg_trans -l
0 transaction records found.

v8:/home/ivoras/temp# pkg_add sqlcached-r4.tbz
pkg_add: warning: package 'sqlite-2.8.17_1' requires
'pkg-config-0.23_1', but 'pkg-config-0.22_1' is installed
pkg_add: warning: package 'sqlcached-r4' requires 'pkg-config-0.23_1',
but 'pkg-config-0.22_1' is installed

v8:/home/ivoras/temp# pkg_trans -l
000000001 (2 pkgs added) Wed Oct  8 23:07:04 2008
1 transaction records found.

v8:/home/ivoras/temp# pkg_trans -i -z 1
Transaction 000000001, started on Wed Oct  8 23:07:16 2008
ADD sqlcached-r4
ADD sqlite-2.8.17_1

v8:/home/ivoras/temp# pkg_delete sqlcached-r4 sqlite-2.8.17_1

v8:/home/ivoras/temp# pkg_trans -l
000000001 (2 pkgs added) Wed Oct  8 23:07:04 2008
000000002 (2 pkgs removed) (2 pkgs backed up) Wed Oct  8 23:07:40 2008
2 transaction records found.

v8:/home/ivoras/temp# pkg_trans -i -z 2
Transaction 000000002, started on Wed Oct  8 23:07:55 2008
DEL,B sqlite-2.8.17_1
DEL,B sqlcached-r4

v8:/home/ivoras/temp# pkg_info|grep sql

v8:/home/ivoras/temp# pkg_trans -u -z 2
pkg_add: warning: package 'sqlite-2.8.17_1' requires
'pkg-config-0.23_1', but 'pkg-config-0.22_1' is installed
pkg_add: warning: package 'sqlcached-r4' requires 'pkg-config-0.23_1',
but 'pkg-config-0.22_1' is installed

v8:/home/ivoras/temp# pkg_info | grep sql
sqlcached-r4        A cache daemon using SQL for data manipulation
sqlite-2.8.17_1     An SQL database engine in a C library w/ Tcl wrapper

v8:/home/ivoras/temp# pkg_trans -l
000000001 (2 pkgs added) Wed Oct  8 23:07:04 2008
1 transaction records found.

v8:/home/ivoras/temp# pkg_trans -u -z 1

v8:/home/ivoras/temp# pkg_trans -l
0 transaction records found.

v8:/home/ivoras/temp# pkg_info|grep sql

v8:/home/ivoras/temp#

----

In addition, the utilities now create a file called +USER_INSTALLED in
the install package database for all packages explicitely installed by
the user (i.e. not pulled in as a dependancy). At least this is how it
should work, I'm not sure I tracked down all cases when dependancies are
pulled.

There's currently little "smart" behaviour WRT undoing transactions
depending on other transactions, etc. This is planned but seeing how I'm
little short on time, patches are also welcome.

Also, to make this truly usable, the "make install" infrastructure will
have to be aware of this, and also the utilities like portupgrade. As
I've said before, I cannot work on these so I'm hereby officially
requesting help for those parts.

Testers are welcome for this work, please report back even if it works
well :)


--------------enig91F57FB4CDC8B34F8F00CB01
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjtKiEACgkQldnAQVacBcgzfwCg9F7R7Ue68SDlp0k5rvpxAW1W
8pcAn3tfwtaXySH430/nB5hWcMNoH65t
=lh2a
-----END PGP SIGNATURE-----

--------------enig91F57FB4CDC8B34F8F00CB01--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?gcj9n4$4u7$1>