From owner-freebsd-questions@FreeBSD.ORG Thu Aug 14 12:39:04 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 330F81065677 for ; Thu, 14 Aug 2008 12:39:04 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from mail1.sourcehosting.net (113901-app1.sourcehosting.net [72.32.213.11]) by mx1.freebsd.org (Postfix) with ESMTP id 0D7838FC0A for ; Thu, 14 Aug 2008 12:39:03 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from 68-189-244-97.dhcp.oxfr.ma.charter.com ([68.189.244.97] helo=Gregory-Larkins-Computer.local) by mail1.sourcehosting.net with esmtp (Exim 4.69 (FreeBSD)) (envelope-from ) id 1KTc6H-000CGz-MQ; Thu, 14 Aug 2008 08:38:47 -0400 Received: from [127.0.0.1] (fireball.entropy.prv [192.168.1.12]) by Gregory-Larkins-Computer.local (Postfix) with ESMTP id AEA6A236BFF5; Thu, 14 Aug 2008 08:38:44 -0400 (EDT) Message-ID: <48A42767.7010109@FreeBSD.org> Date: Thu, 14 Aug 2008 08:39:03 -0400 From: Greg Larkin Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Matthias Apitz References: <20080814120951.GA9656@rebelion.Sisis.de> In-Reply-To: <20080814120951.GA9656@rebelion.Sisis.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.3 (-) Cc: freebsd-questions@freebsd.org Subject: Re: portupgrade && installation date of a package X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: glarkin@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2008 12:39:04 -0000 -----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/ 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-----