Expanding on NO_ROOT: Categorizing installed files

Sean Fagan sef at ixsystems.com
Thu Jul 10 16:55:48 UTC 2014


On Jul 10, 2014, at 9:41 AM, Brooks Davis <brooks at freebsd.org> wrote:

> I'd prefer we just expand the use of tags.  Thus far a seperator isn't
> defined, but : seems as good as any.  It would be worth checking if
> NetBSD (where -T came from) uses anything.

I'd use commas, as I'm already using : to indicate sub-categories.
(And my packagifying script does use that.)

Using the same option, however, causes some problems here:  the use
of environment variables to allow easy inheritence.  Note the effort that
the various makefiles go to to ensure that INSTALL and its various options
get passed around properly; using the environment variable simplified that
significantly.  And that means it can't simply let the command-line override
the environment variable, because someone adding a tag for debugging
(as you indicated it was used) would result in a mis-categorization, *or* it
means that you can't have the environment variable and then over-ride it
with the command-line option.

Let me think about this for a couple of days, and experiment a bit with it.

>> 
>> So I opted for the most flexible variant, which was to keep NO_ROOT behaving as it did,
>> and add another case that used most of the work from NO_ROOT.
>> 
>> Does that make sense?
> 
> Yes.  I'm reluctant to add yet another option to the toplevel make as
> that's one more thing to test or break.

I understand that.  But I did try it both ways, and having it as another option
gave me a lot more flexibility and desirable results.


> Ideally we'd add support for filtering on catagory/tag to libarchive and
> do all that stuff there.
> 
> Purly FYI, my eventual plan is to generate a METALOG as part of
> buildworld/buildkernel so the install* targets just run tar and
> dramatically limit root privilage use.

Hm, interesting.  That's a lot of makefile rewriting, I think (both for the
top-level makefiles, the included makefiles, and the individual makefiles).

>>> 
>>> I think the .EXPORTVAR is gratutious here and in the other
>>> lib/*/Makefiles.  For that matter, I don't understand why it's needed at
>>> all given the presence of META_CATEGORY in lib/Makefile.
>> 
>> I didn't put it in all of the Makefiles, and the reason for having it in
>> the environment was to allow for sub-directories to pick it up; it also
>> allows for them to easily over-ride it.  (E.g., for any library in src/lib
>> which someone might decide shouldn't really be part of base.)
> 
> I think I wasn't clear here.  Given that META_CATEGORY=base should be in
> the environment already, I don't see why you need to define it in some
> of the library make files.  Thinking about it more, I find my self
> wondering if it's a workaround for the failure to use Makefile.inc.

Possibly.  As I said, I'll try it later.  Some of it may also be hold-over from before
I was using the environment variable.  Fewer changes make me a happier
person. :)


> 
>>>> diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
>>>> index dfa450e8..268ce8a 100644
>>>> --- a/share/man/man9/Makefile
>>>> +++ b/share/man/man9/Makefile
>>>> @@ -1,5 +1,8 @@
>>>> # $FreeBSD$
>>>> 
>>>> +META_CATEGORY=	kernel
>>> 
>>> I can see some loging in this, but it seems like a somewhat odd choice.
>> 
>> Odd choice how?
> 
> While section 9 manpages document the kernel, I don't see them as part of
> it.

I actually was wondering if it should actually be part of "dev", or if I should go
further than I had and have it end up as "kernel:dev:doc".

> 
>>>> diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
>>>> index cd11e3a..ea50d33 100644
>>>> --- a/sys/conf/kmod.mk
>>>> +++ b/sys/conf/kmod.mk
>>>> @@ -68,6 +68,10 @@ KMODLOAD?=	/sbin/kldload
>>>> KMODUNLOAD?=	/sbin/kldunload
>>>> OBJCOPY?=	objcopy
>>>> 
>>>> +.if defined(META_CATEGORY)
>>>> +META_LOG_SYMBOLS=	-P ${META_CATEGORY}:dev
>>> 
>>> There seem to be more spellings of META_LOG_SYMBOLS than necessicary
>>> (_META_INFO).
>> 
>> I'm not sure what you mean?
> 
> You use a variety of variables used to hold "" or "-P
> ${META_CATEGORY}..." in different Makefiles.  It seems like they should
> be the same where possible.

Ah!

Cleanup work:  done at different stages, that's all.  In some cases, I also had
to worry about multiple inclusions of the same .mk file, but for the most part,
it's just stuff that I forgot to clean up.

And that's why I wanted comments and feedback!

Sean.


More information about the freebsd-hackers mailing list