Re: how to determine the date a port is installed

2008-06-11 Thread Garrett Cooper
On Tue, Jun 10, 2008 at 10:09 PM, Novembre [EMAIL PROTECTED] wrote:
 Hi all,

 Two questions:
 1) Is it possible to determine the date a port/package is installed?
 2) How can I delete all the ports/packages installed after a certain date?

 Thanks a lot :)

1. Please don't cross-post.
2. ls -lt /var/db/pkg/*/+DESC piped to whatever language you want to
analyze the dates will provide you the result you want, _unless_
either you modified the file(s)

Cheers,
-Garrett
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: how to determine the date a port is installed

2008-06-11 Thread Peter Pentchev
On Tue, Jun 10, 2008 at 10:41:25PM -0700, Jeremy Chadwick wrote:
 On Wed, Jun 11, 2008 at 12:09:33AM -0500, Novembre wrote:
  Two questions:
  1) Is it possible to determine the date a port/package is installed?
 
 ls -ld /var/db/pkg/port, use the mtime of the directory.
 
  2) How can I delete all the ports/packages installed after a certain date?
 
 Use a combination of find with the -mtime flag, and pkg_delete.

Not really.  This is a bit dangerous.

The dangerous part is the mtime of the directory.  It would be much
better to use the mtime of the +CONTENTS file, since it never changes
*after* the package has been installed.

It is possible, though not certain, that the mtime of the directory may
change if another package is installed later which depends on this one -
pkg_add(1) then updates some files, most notably +REQUIRED_BY, to
reflect the new dependency, so that pkg_delete(1) may warn you later if
you try to delete something that other packages depend on.  Of course,
the part with the mtime of the directory may change depends a bit on
the filesystem used, but I find it easier to just rely on the +CONTENTS
file that I'm sure should never change - unless I edit it by hand, but
then all bets are off :)

Novembre, you might want to try something like:

# Change the working directory for easier path handling
cd /var/db/pkg

# Create a temporary file with the modification time set to the date
# that you want to examine (in this case, May 15, 2008, 11:00am)
touch -t 200805151100 /tmp/stamp

# Find all +CONTENTS files that have a modification time later than that
# of the stamp file
find . -type f -name '+CONTENTS' -mnewer /tmp/stamp

# Extend the previous command - get only the second component of the
# file path, which is the name of the package directory, which coincides
# with the name of the package :)
find . -type f -name '+CONTENTS' -mnewer /tmp/stamp | cut -d/ -f2

That should give you a list; you may redirect it to a file or, if you
are feeling really adventurous, just pipe it to | xargs pkg_delete :)

G'luck,
Peter

-- 
Peter Pentchev  [EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED]
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I had to translate this sentence into English because I could not read the 
original Sanskrit.


pgpRMeph8IlP3.pgp
Description: PGP signature


Re: how to determine the date a port is installed

2008-06-11 Thread RW
On Wed, 11 Jun 2008 10:31:08 +0300
Peter Pentchev [EMAIL PROTECTED] wrote:

 On Tue, Jun 10, 2008 at 10:41:25PM -0700, Jeremy Chadwick wrote:
  On Wed, Jun 11, 2008 at 12:09:33AM -0500, Novembre wrote:
   Two questions:
   1) Is it possible to determine the date a port/package is
   installed?
  
  ls -ld /var/db/pkg/port, use the mtime of the directory.
  
   2) How can I delete all the ports/packages installed after a
   certain date?
  
  Use a combination of find with the -mtime flag, and pkg_delete.
 
 Not really.  This is a bit dangerous.
 
 The dangerous part is the mtime of the directory.  It would be much
 better to use the mtime of the  file, since it never changes
 *after* the package has been installed.

+CONTENTS can change if you use a tool like portmaster or portupgrade 

If you have portupgrade installed, pkg_glob can list packages installed
before a specific date, so presumably pkg_deinstall can delete them
directly since it support package globs.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: how to determine the date a port is installed

2008-06-11 Thread Florent Thoumie
On Wed, Jun 11, 2008 at 8:31 AM, Peter Pentchev [EMAIL PROTECTED] wrote:
 On Tue, Jun 10, 2008 at 10:41:25PM -0700, Jeremy Chadwick wrote:
 On Wed, Jun 11, 2008 at 12:09:33AM -0500, Novembre wrote:
  Two questions:
  1) Is it possible to determine the date a port/package is installed?

 ls -ld /var/db/pkg/port, use the mtime of the directory.

  2) How can I delete all the ports/packages installed after a certain date?

 Use a combination of find with the -mtime flag, and pkg_delete.

 Not really.  This is a bit dangerous.

 The dangerous part is the mtime of the directory.  It would be much
 better to use the mtime of the +CONTENTS file, since it never changes
 *after* the package has been installed.

It actually does if you're using portupgrade (and probably
portmaster), see the @pkgdep entries.

Use +DESC, +COMMENT or +MTREE_DIRS instead.

-- 
Florent Thoumie
[EMAIL PROTECTED]
FreeBSD Committer
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: how to determine the date a port is installed

2008-06-11 Thread Peter Pentchev
On Wed, Jun 11, 2008 at 01:40:19PM +0100, Florent Thoumie wrote:
 On Wed, Jun 11, 2008 at 8:31 AM, Peter Pentchev [EMAIL PROTECTED] wrote:
  On Tue, Jun 10, 2008 at 10:41:25PM -0700, Jeremy Chadwick wrote:
  On Wed, Jun 11, 2008 at 12:09:33AM -0500, Novembre wrote:
   Two questions:
   1) Is it possible to determine the date a port/package is installed?
 
  ls -ld /var/db/pkg/port, use the mtime of the directory.
 
   2) How can I delete all the ports/packages installed after a certain 
   date?
 
  Use a combination of find with the -mtime flag, and pkg_delete.
 
  Not really.  This is a bit dangerous.
 
  The dangerous part is the mtime of the directory.  It would be much
  better to use the mtime of the +CONTENTS file, since it never changes
  *after* the package has been installed.
 
 It actually does if you're using portupgrade (and probably
 portmaster), see the @pkgdep entries.
 
 Use +DESC, +COMMENT or +MTREE_DIRS instead.

Yep.  Sorry.  Any of those would be a better candidate.
I'd simply forgotten about port management tools modifying
the dependencies in-place.

G'luck,
Peter

-- 
Peter Pentchev  [EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED]
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
Thit sentence is not self-referential because thit is not a word.


pgpKsLwZy90xN.pgp
Description: PGP signature


how to determine the date a port is installed

2008-06-10 Thread Novembre
Hi all,

Two questions:
1) Is it possible to determine the date a port/package is installed?
2) How can I delete all the ports/packages installed after a certain date?

Thanks a lot :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: how to determine the date a port is installed

2008-06-10 Thread Jeremy Chadwick
On Wed, Jun 11, 2008 at 12:09:33AM -0500, Novembre wrote:
 Two questions:
 1) Is it possible to determine the date a port/package is installed?

ls -ld /var/db/pkg/port, use the mtime of the directory.

 2) How can I delete all the ports/packages installed after a certain date?

Use a combination of find with the -mtime flag, and pkg_delete.

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]