Subject: Re: pkg/14684: make clean in pkgsrc is waaay too slow
To: None <>
From: Greg A. Woods <>
List: tech-pkg
Date: 11/22/2001 22:21:54
[ On Friday, November 23, 2001 at 02:26:59 (+0100), Hubert Feyrer wrote: ]
> Subject: Re: pkg/14684: make clean in pkgsrc is waaay too slow
> On Thu, 22 Nov 2001 wrote:
> > +fastclean:
> > +       rm -rf distfiles/*
> > +       rm -rf */*/work
> Nice idea. Two points:
>  * "make clean" doesn't nuke distfile, so should fastclean. If anything,
>    make a "fastdistclean|

I agree -- distfiles should never be nuked automatically by any "*clean"
target (and I don't see any advantage of having a target to clean all
distfiles since that's trivial to do manually, though a "make distclean"
per module is of course very useful).

"fastclean" should be more explicit to -- eg. maybe "allclean" and maybe
it should only work if invoked from the top of ${PKGSRCDIR} too?

>  * I'm have OBJMACHINE set, as such I don't have */*/work but
>    */*/work.sparc (etc.), this needs to be takein into account.
> It should be discussed on tech-pkg if we want this feature.

I'm not sure how it might relate, but I'd like to point out that I've
got the following set in my /etc/mk.conf (well actually I put them
directly in my local mk/ since they're static in my
environment where I share my /usr/pkgsrc amongst several architectures
and release levels):

	# to build on a (fast(er)) local disk...
	# Note you do not want OBJMACHINE set -- just make sure this
	# directory is unique per build environment.
	# This can be a symlink.
	WRKOBJDIR=	/var/package-obj

and I've made a small change to mk/ so that "make clean" in
any pkgsrc module will _not_ remove the "work" symlink if WRKOBJDIR is
set (though I suppose it should only avoid the rmdir if WRKOBJDIR begins
with a '/').  This is done because with a shared pkgsrc it's rather
disruptive to do "make clean" on one machine while trying to build the
same package on another machine.  Given the static nature of the link
there's no need to ever change it anyway (unless of course WRKOBJDIR is
changed, but of course that won't happen as easily if it's set only in :-).  I'm not even sure the rmdir is needed at all,
but I've not had any problem with keeping it.

  		fi;							\
  .  ifdef WRKOBJDIR
! 	-${_PKG_SILENT}${_PKG_DEBUG}					\
! 	${RMDIR} ${BUILD_DIR} 2>/dev/null;				\
  .  endif
--- 2402,2408 ----
  		fi;							\
  .  ifdef WRKOBJDIR
! 	-${_PKG_SILENT}${_PKG_DEBUG}${RMDIR} -p ${BUILD_DIR} 2>/dev/null;
  .  endif

I haven't bothered inventing the equivalent of "make obj" for pkgsrc
though -- it's just really not necessary until/unless it were to be put
on read-only media in this form (and of course pre-existing WRKOBJDIR
symlinks would be the only way pkgsrc could be used from read-only

For me "make allclean" could have just the following even faster

	${RM} -rf ${WRKOBJDIR}/*

Just FYI, I also do this:

	# Store generated packages on a per-architecture base
	# Possible: any path you like, eg ${PKGSRC_BASE}/packages/${MACHINE_ARCH}
	# Default: /usr/pkgsrc/packages
	# This can be a symlink.
	PACKAGES=       /var/packages

and I've changed my DISTDIR setting in mk/ to always be just
/var/package-distfiles, and since that location can also be a symlink I
just point it on my build machines to a shared NFS directory when and
where that's possible.

							Greg A. Woods

+1 416 218-0098      VE3TCP      <>     <>
Planix, Inc. <>;   Secrets of the Weird <>