Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Aug 2008 08:39:03 -0400
From:      Greg Larkin <glarkin@FreeBSD.org>
To:        Matthias Apitz <matthias.apitz@oclc.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: portupgrade && installation date of a package
Message-ID:  <48A42767.7010109@FreeBSD.org>
In-Reply-To: <20080814120951.GA9656@rebelion.Sisis.de>
References:  <20080814120951.GA9656@rebelion.Sisis.de>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthias Apitz wrote:
| Hello,
|
| I was updating all packages which have been installed by the FreeBSD
| 7.0R base installation and X11 with portupgrade like this:
|
| # portupgrade -f '<2008-08-13 12:55'
|
| i.e. update all packages/ports which have been installed before
| 2008-08-13 12:55 (this was the time when the installation finished);
| I picked up this time with an
|
| # ls -ltr /var/db/pkg | more
|
| and saw at which point the installation finished; so far so good;
|
| after some time I cancelled the 'portupgrade' because I forgot to say
| "--batch" mode; a look into a new
|
| # ls -ltr /var/db/pkg | more
|
| showed that for each package dir there the time was updated to 'now',
| i.e. no date before 2008-08-13 12:55 any more; but even with this a 2nd
|
| # portupgrade --batch -f '<2008-08-13 12:55'
|
| knows exactly which ports/packages have been installed before that date;
|
| my question is: where is this installation date stored?
|
| thx
|
| 	matthias
|

Hi Matthias,

In the file /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb, there's a
function for determining the package installation date:


~  def date_installed(pkgname)
~    installed?(pkgname) or return nil

~    File.mtime(pkg_comment(pkgname)) ||
~      File.mtime(pkg_descr(pkgname)) ||
~      File.mtime(pkg_contents(pkgname)) rescue Time.at(0)
~  end


I'm not a Ruby programmer, but my reading of that snippet makes me think
the mtime of one of the +COMMENT, +DESCR, or +CONTENTS files in
/var/db/pkg/<pkgname> is used for the installation date.

I just checked a package directory on my system:

fbsd70# cd /var/db/pkg/apache-2.0.63/
fbsd70# ls -latr
total 142
- -rw-r--r--    1 root  wheel   17501 Apr 22 09:46 +MTREE_DIRS
- -rw-r--r--    1 root  wheel     718 Apr 22 09:46 +INSTALL
- -rw-r--r--    1 root  wheel     132 Apr 22 09:46 +DISPLAY
- -rw-r--r--    1 root  wheel     501 Apr 22 09:46 +DESC
- -rw-r--r--    1 root  wheel      49 Apr 22 09:46 +COMMENT
- -rw-r--r--    1 root  wheel  100382 Jul 21 12:02 +CONTENTS
drwxr-xr-x    2 root  wheel     512 Jul 23 14:40 .
- -rw-r--r--    1 root  wheel     598 Jul 25 09:31 +REQUIRED_BY
drwxr-xr-x  421 root  wheel   11776 Aug 13 16:48 ..
fbsd70#

I believe the mtime for +COMMENT will be used, since it appears first in
the Ruby expression above.  The date on the directory itself is later,
and is the same as many other directories in /var/db/pkg, as you noted,
but that's not used.

Hope that helps,
Greg
- --
Greg Larkin
http://www.sourcehosting.net/
http://www.FreeBSD.org/ - The Power To Serve
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIpCdn0sRouByUApARAve0AKCkhRN8ciuiBzny0pLWInTJTv9vxwCghP7b
ObkVBIW3xik7iL62iOiMiyI=
=3h8D
-----END PGP SIGNATURE-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48A42767.7010109>