RE: Cleaning Out Ports?

2005-02-07 Thread Matt LaPlante
That's correct; this type of functionality is exactly what I was searching
for.


 -Original Message-
 From: Loren M. Lang [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 01, 2005 6:50 AM
 To: Michael C. Shultz
 Cc: freebsd-questions@freebsd.org; Matt LaPlante
 Subject: Re: Cleaning Out Ports?
 
 
 There's still one missing part to it that gentoo's portage has.  In
 addition to the standard database of installed packages, emerge keeps
 track
 of every single package that you explicitly installed in a file called
 world.  Upgrades read this file and update all the packages listed,
 including there dependencies first.  Now if a package that was installed
 to satisfy a dependency, but not explicitly installed is now longer
 needed, it will stay on the system until the next time emerge --depclean
 is run.  --depclean tells emerge to remove any packages that are not in
 the world file and are not needed to satify dependencies for packages in
 the world file, either directly or indirectly.  I think this is the
 behavior that the original poster was asking for.  AFAIK, this is not
 yet possible in FreeBSD, but it should be a trivial matter to add
 something like a world file to portupgrade.  Maybe, if I have time this
 week I could work on a patch...
 
 

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


Re: Cleaning Out Ports?

2005-02-01 Thread Christopher Illies
On Mon, Jan 31, 2005 at 08:32:41PM -0500, Matt LaPlante wrote:
 
 I know the ports system is designed to install dependencies automatically,
 but how does one go about removing them?  Say one large package installs
 several dependencies, but then later on that package is removed...and now
 we're left with several orphaned packages.  Is there a way to either detect,
 or even automatically clean out orphaned packages?  I'm particularly
 concerned because I'm dealing with a few systems which are rather well aged,
 and have gone through several upgrade cycles.  I know the Linux version of
 the ports system found in Gentoo (portage) offers extensive functionality
 for finding and removing orphaned dependencies, so I'm hoping FreeBSD has
 some such feature as well.  Thanks.

Have a look at /usr/ports/sysutils/pkg_cutleaves. It is a script that
detects and removes orphaned dependencies.

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


Re: Cleaning Out Ports?

2005-02-01 Thread Dick Hoogendijk
On 31 Jan Michael C. Shultz wrote:

 If sysutils/pkg_cutleaves isn't right, please provide good detail why.

What's the benefir over using portsclean -D or portsclean -CDPP
Works like a charm. (see man portsclean).

-- 
dick -- http://nagual.st/ -- PGP/GnuPG key: F86289CE
++ Running FreeBSD 4.11 ++ FreeBSD 5.3
+ Nai tiruvantel ar vayuvantel i Valar tielyanna nu vilja
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cleaning Out Ports?

2005-02-01 Thread Michael C. Shultz
On Tuesday 01 February 2005 01:31 am, Dick Hoogendijk wrote:
 On 31 Jan Michael C. Shultz wrote:
  If sysutils/pkg_cutleaves isn't right, please provide good detail
  why.

 What's the benefir over using portsclean -D or portsclean -CDPP
 Works like a charm. (see man portsclean).

Portsclean has nothing to do with what Matt is looking for. He is trying 
to remove ports that are installed but have no useful purpose.

-Mike

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


Re: Cleaning Out Ports?

2005-02-01 Thread Loren M. Lang
On Mon, Jan 31, 2005 at 06:22:58PM -0800, Michael C. Shultz wrote:
 On Monday 31 January 2005 06:16 pm, Matt LaPlante wrote:
  Well what I'm more concerned with is how would you locate orphaned
  dependencies after the fact.  For a parallel example, in gentoo you
  would emerge --depclean which searches the tree for any orphaned
  packages and removes them.  So say I hadn't used the -r flag when
  removing packages on BSD, how could I find the leftovers later?
 
 Look at /usr/ports/sysutils/pkg_cutleaves
 
 here is a excerpt from its man page:
 
 pkg_cutleaves  finds  installed 'leaf' packages, i.e. packages that are
  not referenced by any other installed package, and lets you decide  for
  each  one  if  you want to keep or deinstall it (via pkg_deinstall(1)).
 Once the packages marked for  removal  have  been  flushed/deinstalled,
  you'll  be  asked  if  you want to do another run (to see packages that
  have become 'leaves' now because you've deinstalled the package(s) that
  depended  on  them).  In every run you will be shown only packages that
  you haven't marked for keeping, yet.

There's still one missing part to it that gentoo's portage has.  In
addition to the standard database of installed packages, emerge keeps track
of every single package that you explicitly installed in a file called
world.  Upgrades read this file and update all the packages listed,
including there dependencies first.  Now if a package that was installed
to satisfy a dependency, but not explicitly installed is now longer
needed, it will stay on the system until the next time emerge --depclean
is run.  --depclean tells emerge to remove any packages that are not in
the world file and are not needed to satify dependencies for packages in
the world file, either directly or indirectly.  I think this is the
behavior that the original poster was asking for.  AFAIK, this is not
yet possible in FreeBSD, but it should be a trivial matter to add
something like a world file to portupgrade.  Maybe, if I have time this
week I could work on a patch...

 
  --
  Matt LaPlante
  System Administrator
  Center for Automation Technologies
  RPI/CAT, CII 8015
  110 8th Street
  Troy, NY 12180
  Phone: (518) 276-2275
  [EMAIL PROTECTED]
  www.cat.rpi.edu
 
   -Original Message-
   From: Pat Maddox [mailto:[EMAIL PROTECTED]
   Sent: Monday, January 31, 2005 8:55 PM
   To: Matt LaPlante
   Cc: freebsd-questions@freebsd.org
   Subject: Re: Cleaning Out Ports?
  
   If you try to remove a package that has child dependencies, then
   it'll let you know.  You'll have to use the -f flag to force it to
   delete the package, despite there being any dependencies.  If you
   want to delete a package along with all its dependencies, you can
   use the -r flag.
  
   Use pkgdb -F to fix any dependencies that might be broken.
  
   I think that's about right.  I'm a FreeBSD newbie :)
 
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to
  [EMAIL PROTECTED]
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

-- 
I sense much NT in you.
NT leads to Bluescreen.
Bluescreen leads to downtime.
Downtime leads to suffering.
NT is the path to the darkside.
Powerful Unix is.

Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc
Fingerprint: B3B9 D669 69C9 09EC 1BCD  835A FAF3 7A46 E4A3 280C
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cleaning Out Ports?

2005-02-01 Thread David J. Weller-Fahy
* David J. Weller-Fahy [EMAIL PROTECTED] [2005-02-01 08:24 +0100]:
 * Matt LaPlante [EMAIL PROTECTED] [2005-02-01 02:36 +0100]:
 Attached is my script, and my conf file.

Unfortunately, my script got stripped.  Here's the script with a txt
extension.

Regards,
-- 
dave [ please don't CC me ]
#!/bin/sh
# $HOME/bin/rm_leaf.sh
set -e

LETC=/usr/local/etc
PBASE=/usr/ports
RMLFCNF=rm_leaf.conf
SCRFILE=remove_leaf_ports.sh

PKGINFO=`cd /var/db/pkg  find . -type d | sed '/^.$/d;s/^\.\///'`
PKGREQB=`cd /var/db/pkg  ls */+REQUIRED_BY | sed 's/\/+REQUIRED_BY//g'`
NOTLIST=`cat $LETC/$RMLFCNF`

# remove any packages that are required by any other packages
for PKG in $PKGREQB ; do [ -s /var/db/pkg/$PKG/+REQUIRED_BY ]  \
PKGINFO=`echo $PKGINFO | sed s/$PKG//` ; done

# remove any packages that are in the users list of 'to keep' packages
for PKG in $NOTLIST ; do PKGINFO=`echo $PKGINFO | sed s/$PKG[^ ]*//` ; done

# if there's nothing left in PKGINFO, exit now
[ -z $PKGINFO ]  echo No packages/ports to remove.  exit

rm -f $SCRFILE # remove the script file (just in case)

# match up packages to origin in the ports tree
for PKG in $PKGINFO ; do RMLIST=${RMLIST:-} $PKG:$PBASE/`pkg_info -o $( echo 
$PKG ) | sed -n '/^Origin:$/{n;p;}'` ; done

cat  $SCRFILE  EOFA
#!/bin/sh
# script to remove all leaf packages not listed in /usr/local/etc/rm_leaf.list
set -e

EOFA

# create script to remove all selected packages
for PKG in $RMLIST ; do
PNAME=`echo $PKG | sed 's/:.*$//'`
PPATH=`echo $PKG | sed 's/^[^:]*://'`
cat  $SCRFILE -EOFB
echo Removing $PNAME in $PPATH:
cd $PPATH
make deinstall clean distclean
echo Success! ; echo ; echo
EOFB
done

[ -n ${1:-} ]  cat $SCRFILE  rm $SCRFILE
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cleaning Out Ports?

2005-02-01 Thread RW
On Tuesday 01 February 2005 08:04, Christopher Illies wrote:

 Have a look at /usr/ports/sysutils/pkg_cutleaves. It is a script that
 detects and removes orphaned dependencies.

Just bear in mind that some of the leaves will be required for building other 
ports. Whilst they can be safely removed, it might save time to leave them.

Personally, I think  pkg_cutleaves has it about right, anything more automated 
may lead to nasty surprises. Such systems have no reliable way of knowing 
whether users are making direct use of a port that was originally installed 
as a dependency.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Cleaning Out Ports?

2005-01-31 Thread Pat Maddox
If you try to remove a package that has child dependencies, then it'll
let you know.  You'll have to use the -f flag to force it to delete
the package, despite there being any dependencies.  If you want to
delete a package along with all its dependencies, you can use the -r
flag.

Use pkgdb -F to fix any dependencies that might be broken.

I think that's about right.  I'm a FreeBSD newbie :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: Cleaning Out Ports?

2005-01-31 Thread Matt LaPlante
Well what I'm more concerned with is how would you locate orphaned
dependencies after the fact.  For a parallel example, in gentoo you would
emerge --depclean which searches the tree for any orphaned packages and
removes them.  So say I hadn't used the -r flag when removing packages on
BSD, how could I find the leftovers later?

--
Matt LaPlante
System Administrator
Center for Automation Technologies
RPI/CAT, CII 8015
110 8th Street
Troy, NY 12180
Phone: (518) 276-2275
[EMAIL PROTECTED]
www.cat.rpi.edu

 -Original Message-
 From: Pat Maddox [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 31, 2005 8:55 PM
 To: Matt LaPlante
 Cc: freebsd-questions@freebsd.org
 Subject: Re: Cleaning Out Ports?
 
 If you try to remove a package that has child dependencies, then it'll
 let you know.  You'll have to use the -f flag to force it to delete
 the package, despite there being any dependencies.  If you want to
 delete a package along with all its dependencies, you can use the -r
 flag.
 
 Use pkgdb -F to fix any dependencies that might be broken.
 
 I think that's about right.  I'm a FreeBSD newbie :)

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


Re: Cleaning Out Ports?

2005-01-31 Thread Pat Maddox
pkgdb -F will tell you of any packages that have broken dependencies,
and allow you to fix them if you choose.


On Mon, 31 Jan 2005 21:16:56 -0500, Matt LaPlante [EMAIL PROTECTED] wrote:
 Well what I'm more concerned with is how would you locate orphaned
 dependencies after the fact.  For a parallel example, in gentoo you would
 emerge --depclean which searches the tree for any orphaned packages and
 removes them.  So say I hadn't used the -r flag when removing packages on
 BSD, how could I find the leftovers later?
 
 --
 Matt LaPlante
 System Administrator
 Center for Automation Technologies
 RPI/CAT, CII 8015
 110 8th Street
 Troy, NY 12180
 Phone: (518) 276-2275
 [EMAIL PROTECTED]
 www.cat.rpi.edu
 
  -Original Message-
  From: Pat Maddox [mailto:[EMAIL PROTECTED]
  Sent: Monday, January 31, 2005 8:55 PM
  To: Matt LaPlante
  Cc: freebsd-questions@freebsd.org
  Subject: Re: Cleaning Out Ports?
 
  If you try to remove a package that has child dependencies, then it'll
  let you know.  You'll have to use the -f flag to force it to delete
  the package, despite there being any dependencies.  If you want to
  delete a package along with all its dependencies, you can use the -r
  flag.
 
  Use pkgdb -F to fix any dependencies that might be broken.
 
  I think that's about right.  I'm a FreeBSD newbie :)
 

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


Re: Cleaning Out Ports?

2005-01-31 Thread Michael C. Shultz
On Monday 31 January 2005 06:16 pm, Matt LaPlante wrote:
 Well what I'm more concerned with is how would you locate orphaned
 dependencies after the fact.  For a parallel example, in gentoo you
 would emerge --depclean which searches the tree for any orphaned
 packages and removes them.  So say I hadn't used the -r flag when
 removing packages on BSD, how could I find the leftovers later?

Look at /usr/ports/sysutils/pkg_cutleaves

here is a excerpt from its man page:

pkg_cutleaves  finds  installed 'leaf' packages, i.e. packages that are
 not referenced by any other installed package, and lets you decide  for
 each  one  if  you want to keep or deinstall it (via pkg_deinstall(1)).
Once the packages marked for  removal  have  been  flushed/deinstalled,
 you'll  be  asked  if  you want to do another run (to see packages that
 have become 'leaves' now because you've deinstalled the package(s) that
 depended  on  them).  In every run you will be shown only packages that
 you haven't marked for keeping, yet.

 --
 Matt LaPlante
 System Administrator
 Center for Automation Technologies
 RPI/CAT, CII 8015
 110 8th Street
 Troy, NY 12180
 Phone: (518) 276-2275
 [EMAIL PROTECTED]
 www.cat.rpi.edu

  -Original Message-
  From: Pat Maddox [mailto:[EMAIL PROTECTED]
  Sent: Monday, January 31, 2005 8:55 PM
  To: Matt LaPlante
  Cc: freebsd-questions@freebsd.org
  Subject: Re: Cleaning Out Ports?
 
  If you try to remove a package that has child dependencies, then
  it'll let you know.  You'll have to use the -f flag to force it to
  delete the package, despite there being any dependencies.  If you
  want to delete a package along with all its dependencies, you can
  use the -r flag.
 
  Use pkgdb -F to fix any dependencies that might be broken.
 
  I think that's about right.  I'm a FreeBSD newbie :)

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


Re: Cleaning Out Ports?

2005-01-31 Thread Nathan Wheeler
I think portsclean does that. I can't remember how though. Its in the 
portupgrade package.

Nathan
- Original Message - 
From: Matt LaPlante [EMAIL PROTECTED]
To: 'Pat Maddox' [EMAIL PROTECTED]
Cc: freebsd-questions@freebsd.org
Sent: Monday, January 31, 2005 7:16 PM
Subject: RE: Cleaning Out Ports?


Well what I'm more concerned with is how would you locate orphaned
dependencies after the fact.  For a parallel example, in gentoo you would
emerge --depclean which searches the tree for any orphaned packages and
removes them.  So say I hadn't used the -r flag when removing packages on
BSD, how could I find the leftovers later?
--
Matt LaPlante
System Administrator
Center for Automation Technologies
RPI/CAT, CII 8015
110 8th Street
Troy, NY 12180
Phone: (518) 276-2275
[EMAIL PROTECTED]
www.cat.rpi.edu
-Original Message-
From: Pat Maddox [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 8:55 PM
To: Matt LaPlante
Cc: freebsd-questions@freebsd.org
Subject: Re: Cleaning Out Ports?
If you try to remove a package that has child dependencies, then it'll
let you know.  You'll have to use the -f flag to force it to delete
the package, despite there being any dependencies.  If you want to
delete a package along with all its dependencies, you can use the -r
flag.
Use pkgdb -F to fix any dependencies that might be broken.
I think that's about right.  I'm a FreeBSD newbie :)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
[EMAIL PROTECTED]

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


RE: Cleaning Out Ports?

2005-01-31 Thread Matt LaPlante
This looks like what I'm after, thank you!

 -Original Message-
 From: Michael C. Shultz [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 31, 2005 9:23 PM
 To: freebsd-questions@freebsd.org
 Cc: Matt LaPlante
 Subject: Re: Cleaning Out Ports?
 
 On Monday 31 January 2005 06:16 pm, Matt LaPlante wrote:
  Well what I'm more concerned with is how would you locate orphaned
  dependencies after the fact.  For a parallel example, in gentoo you
  would emerge --depclean which searches the tree for any orphaned
  packages and removes them.  So say I hadn't used the -r flag when
  removing packages on BSD, how could I find the leftovers later?
 
 Look at /usr/ports/sysutils/pkg_cutleaves
 
 here is a excerpt from its man page:
 
 pkg_cutleaves  finds  installed 'leaf' packages, i.e. packages that are
  not referenced by any other installed package, and lets you decide  for
  each  one  if  you want to keep or deinstall it (via pkg_deinstall(1)).
 Once the packages marked for  removal  have  been  flushed/deinstalled,
  you'll  be  asked  if  you want to do another run (to see packages that
  have become 'leaves' now because you've deinstalled the package(s) that
  depended  on  them).  In every run you will be shown only packages that
  you haven't marked for keeping, yet.
 
  --
  Matt LaPlante
  System Administrator
  Center for Automation Technologies
  RPI/CAT, CII 8015
  110 8th Street
  Troy, NY 12180
  Phone: (518) 276-2275
  [EMAIL PROTECTED]
  www.cat.rpi.edu
 
   -Original Message-
   From: Pat Maddox [mailto:[EMAIL PROTECTED]
   Sent: Monday, January 31, 2005 8:55 PM
   To: Matt LaPlante
   Cc: freebsd-questions@freebsd.org
   Subject: Re: Cleaning Out Ports?
  
   If you try to remove a package that has child dependencies, then
   it'll let you know.  You'll have to use the -f flag to force it to
   delete the package, despite there being any dependencies.  If you
   want to delete a package along with all its dependencies, you can
   use the -r flag.
  
   Use pkgdb -F to fix any dependencies that might be broken.
  
   I think that's about right.  I'm a FreeBSD newbie :)
 
  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to
  [EMAIL PROTECTED]

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


Re: Cleaning Out Ports?

2005-01-31 Thread Michael C. Shultz
On Monday 31 January 2005 06:35 pm, Matt LaPlante wrote:
 This looks like what I'm after, thank you!

After you try it, if sysutils/pkg_cutleaves doesn't meet your 
requirements please let me know.  I can add exactly what you asked for 
to sysutils/portmanager.  I don't want to add features that are 
available elsewhere unless there is a very compelling reason.
If sysutils/pkg_cutleaves isn't right, please provide good detail why.

-Mike


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