On Friday 12 October 2007 00:39:27 James wrote:
> On Thu, 2007-10-11 at 18:14 -0400, Robert Huff wrote:
> > James writes:
> > >  What has happened, though, is I've never ran rm in
> > >  /usr/ports/distfiles.  I'm going to think for a little bit about
> > >  a script that can move through /usr/ports/distfiles and reinstall
> > >  everything that exists there.
> >
> >     Having been in almost the identical situation for different
> > rasons, I sympathize.
> >     Yes, this will involve a sweep through /usr/ports distfiles.
> > If you haven't ever deleted anything, I suggest a prelimiary manual
> > run deleting everything but the most recent version.  This has a
> > down-side, but it will prevent cluttering the rebuilt system with
> > unused ports.
>
> /usr/ports/distfiles is definitely looking promising. awk is too damn
> painful to work with, so I'm going to dust off my perl skills.
>
> Hell, this could actually turn out to be fun. And if I write the script
> properly, it might make a nice disaster recovery tool
> for /usr/ports/ports-mgmt - it can be called
> "WhenYou'reAnIdiotLikeJamesWasOnFreeBSDQuestions"
>
>
>
> Well, if you figure out what ports you have installed, you can
> regenerate the
>
> > pkgdb using:
> >
> > make -DNO_BUILD -DNO_INSTALL generate-plist fake-pkg
> >
> > for each port.
> > I just tested that using a temporary PKG_DBDIR. In case you wanna see
> > what happens, here's what I did:
> >
> > mkdir -p /tmp/var/db/pkg
> > cd /usr/ports/shells/bash
> > env PKG_DBDIR=/tmp/var/db/pkg make -DNO_BUILD -DNO_INSTALL \
> >     generate-plist fake-pkg
>
> Wow, that's great! I understand that it has the caveats that you mentioned,
> but it's *at least* a fantastic start.

OK, found the culprit after some digging. Quite enlightening. The pkg_create 
command gets fed the output of make actual-depends-list, which generates a 
package dependency list based on what's really installed, by looking 
into /var/db/pkg. Of course this doesn't work for you.

The solution lies in PKG_ARGS. I created a Makefile.local in x11/kdebase3 (cuz 
I was there), with the following one-liner:
PKG_ARGS=       -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p 
${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} package-depends | ${GREP} -v -E 
${PKG_IGNORE_DEPENDS} | ${SORT} -u -t : -k 2`" ${EXTRA_PKG_ARGS} 
$${_LATE_PKG_ARGS}

This is a copy of PKG_ARGS as defined in /usr/ports/Mk/bsd.port.mk with the 
difference that it uses package-depends rather then actual-package-depends to 
generate the dependency list.

I'm 90% sure this ignores any WITH_ knobs/options you've set to generate the 
dependency list, so you'll have to fix any stale dependencies with pkgdb -F 
or similar tools later.

Adding the above line to /etc/make.conf should work for you - make sure it's 
one line or escape properly ;)

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

Reply via email to