Subject: Re: How to properly use shell commands that are defined in make(1)
To: Hubert Feyrer <feyrer@cs.stevens.edu>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 11/24/2005 22:58:10
Hubert Feyrer wrote:
> On Thu, 24 Nov 2005, Roland Illig wrote:
> 
>> Quite a few shell programs in pkgsrc use commands similar to how they 
>> are used in the pkgsrc Makefiles. As it were much better if the tools 
>> were used not only similar but _equal_ to inside Makefiles, I've 
>> written a quiet little, but useful make(1) target:
> 
> 
> I didn't understand the problem. Can you elaborate, please?

Today, in the bulk builds, I noticed that the PKG_INFO and PKG_DELETE 
programs operated on /var/db/pkg instead of /home/bulk/pkg/var/db/pkg, 
which I had expected. I then looked at the definition of PKG_DELETE in 
bsd.prefs.mk and noticed that before the PKGTOOLS_ENV there was a 
${SETENV} missing(?), at least there wasn't any.

I planned to rewrite the code that runs pkg_delete and pkg_info. But 
when it comes to transferring shell commands between different programs 
it starts getting ugly if you want it to be 100% perfect. Especially 
shell metacharacters are often handled in unexpected ways. Functions are 
much cleaner for this. So, guessing that no one had done such things 
before, I wrote the new code.

Roland