Page MenuHomeFreeBSD

[PR 206055] share/zoneinfo "beforeinstall" fails to create needed directories in DESTDIR
AbandonedPublic

Authored by rpokala on Jan 9 2016, 5:17 AM.

Details

Reviewers
bdrewery
Group Reviewers
Contributor Reviewers (ports)
Summary

Use `install' to explicitly create the target directories before installing
to them.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 2012
Build 2020: arc lint + arc unit

Event Timeline

rpokala updated this revision to Diff 12071.Jan 9 2016, 5:17 AM
rpokala retitled this revision from to [PR 206055] share/zoneinfo "beforeinstall" fails to create needed directories in DESTDIR.
rpokala updated this object.
rpokala edited the test plan for this revision. (Show Details)
bdrewery requested changes to this revision.Jan 11 2016, 8:25 PM
bdrewery edited edge metadata.

This is wrong. Directories are handled in the build by etc/mtree files. etc/mtree/BSD.usr.dist already has this tree in it. You must run 'make distrib-dirs DESTDIR=whatever' from the top-level before installing manually.

This entire beforeinstall: target is a lazy hack that should go away rather than be expanded.

This revision now requires changes to proceed.Jan 11 2016, 8:25 PM

Thank you for pointing this out; I was unaware of the existence of 'make distrib-dirs DESTDIR=whatever'. I'll see if I can get that to work.

So, I can get it to work. However, it makes in excess of 900 directories that I don't need, which seems rather unfortunate.

How does it work now though?

How does it work now though?

I'm not sure what you're asking here. Let me see if I can provide some context and perhaps that will help.

What I need to do is generate a package containing the compiled timezone data files.

As a means to that end, I want to get the compiled timezone data files into an appropriate tree in $DESTDIR.

When we did this on FreeBSD 7, we modified the vendor-provided share/zoneinfo/Makefile, mainly to drop the -D flag to zic, so that we could do "cd $freebsd_src/share/zoneinfo; make DESTDIR=<whatever> beforeinstall" and have it generate the compiled timezone data files into $DESTDIR. Dropping the -D let zic create the intermediate directories as needed.

Now on FreeBSD 10, I am striving to avoid modifying the vendor code as much as possible. One way that I can do that is by duplicating the TZBUILDSUBDIRS list in our own build infrastructure. For instance, I can get the compiled timezone data files into $DESTDIR like this:

for dir in $MY_COPY_OF_TZBUILDSUBDIRS; do mkdir -p $DESTDIR/usr/share/zoneinfo/$dir; done

cd $freebsd_src/share/zoneinfo

make DESTDIR=${DESTDIR} BINOWN=${BINOWN} BINGRP=${BINGRP} NOBINMODE=${NOBINMODE} zoneinfo beforeinstall

But while this does avoid touching the freebsd Makefiles, it entails duplicating part of the Makefiles -- the TZBUILDSUBDIRS list.

The patch I'm proposing here allows me to avoid this duplication, since it lets "make zoneinfo beforeinstall" work without errors when DESTDIR is not already populated with directories.

Now that I know that 'distrib-dirs' is a thing, I can also achieve my end by doing

cd $freebsd_src

make DESTDIR=${DESTDIR} MTREE_CMD='mtree -W' distrib-dirs

instead of the $MY_COPY_OF_TZBUILDSUBDIRS loop I described above. I need to supply -W to mtree so that it doesn't try to apply the file ownerships from the mtree files -- we do our builds as nonroot. But distrib-dirs is a very big hammer that makes hundreds of directories that I don't need, as a way to allow "make zoneinfo beforeinstall" to work. I can further augment my build script to remove all the excess directories, of course. But if, as I have proposed, it would be acceptable to allow "make zoneinfo beforeinstall" to work without needing to create the excess directories in the first place, that would strike me as a cleaner solution :)

rpokala abandoned this revision.Jan 15 2016, 9:19 PM