From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1OlvSw-0004El-IE for garchives@archives.gentoo.org; Thu, 19 Aug 2010 03:06:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5F5AAE0883; Thu, 19 Aug 2010 03:05:44 +0000 (UTC) Received: from ironport2-out.pppoe.ca (ironport2-out.teksavvy.com [206.248.154.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 541F4E0883 for ; Thu, 19 Aug 2010 03:05:44 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEFADo8bExFxLf4/2dsb2JhbACTP40Ycr9phTcEjF+EEA X-IronPort-AV: E=Sophos;i="4.56,231,1280721600"; d="scan'208";a="72968325" Received: from 69-196-183-248.dsl.teksavvy.com (HELO waltdnes.org) ([69.196.183.248]) by ironport2-out.pppoe.ca with SMTP; 18 Aug 2010 23:05:42 -0400 Received: by waltdnes.org (sSMTP sendmail emulation); Wed, 18 Aug 2010 23:05:41 -0400 From: "Walter Dnes" Date: Wed, 18 Aug 2010 23:05:41 -0400 To: gentoo-user@lists.gentoo.org Subject: [gentoo-user] autodepclean script (was "how to remove HAL") Message-ID: <20100819030541.GA7423@waltdnes.org> References: <20100728090511.59fecb92@zaphod.digimed.co.uk> <20100817194922.GB6494@nibiru.local> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="v9Ux+11Zm5mwPlX6" Content-Disposition: inline In-Reply-To: <20100817194922.GB6494@nibiru.local> User-Agent: Mutt/1.5.20 (2009-06-14) X-Archives-Salt: c6bbd161-09f2-4d9b-a938-b66990d64a12 X-Archives-Hash: ffa98256e8b8a27e7fd7b4cc7831208b --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 17, 2010 at 09:49:22PM +0200, Enrico Weigelt wrote > I've just experimented a bit with that and it turned out that > --depclean doesn't clean up the buildtime-only deps. But if I > remove one of them (eg. cabextract), they don't get pulled in again > (that's indicating the depending ebuilds are written properly). This reminds me of a script I've been working on to remove unnecessary cruft. Everything that follows is run as root, because it runs "emerge". The attached script "autodepclean" parses the output from "emerge --pretend --depclean" and generates a script "cleanscript" that you can run to clean up your system. This should handle your situation, but it's also a general solution to the entire class of problems of cleaning up when you remove all programs or USE flags that pull in a lib. It is not restricted to just HAL Warning, this script is beta. Use with care. It will remove gentoo-sources versions higher than your current kernel. This is technically correct for removing unused ebuilds. But it may not be what you want. -- Walter Dnes --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=autodepclean #!/bin/bash # autodepclean script v 0.01 released under GPL v3 by Walter Dnes 2010/08/18 # Generates a file "cleanscript" to remove unused ebuilds, including # buildtime-only dependancies. # # Warning; this script is still beta. I recommend that you check the output # in cleanscript before running it. It is agressive about removing unused # gentoo-sources versions. This includes those that are higher than your # current kernel. This is technically correct for removing unused ebuilds, # but it may not be what you want. # echo "#!/bin/bash" > cleanscript echo "#" > cleanscript.000 emerge --pretend --depclean |\ grep -A1 "^ .*/" |\ grep -v "^ \*" |\ grep -v "^--" |\ sed ":/: { N s:\n:: s/ selected: /-/ s/^ /emerge --depclean =/ }" >> cleanscript.000 while read do echo "${REPLY}" >> cleanscript if [ "${REPLY:0:6}" == "emerge" ]; then echo "revdep-rebuild" >> cleanscript fi done < cleanscript.000 chmod 744 cleanscript --v9Ux+11Zm5mwPlX6--