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.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 23, 2:37 AM
Unknown Object (File)
Feb 11 2024, 9:32 PM
Unknown Object (File)
Feb 11 2024, 8:49 PM
Unknown Object (File)
Feb 11 2024, 6:08 PM
Unknown Object (File)
Jan 17 2024, 5:13 AM
Unknown Object (File)
Dec 20 2023, 2:19 AM
Unknown Object (File)
Dec 16 2023, 7:03 AM
Unknown Object (File)
Nov 19 2023, 2:25 PM

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 - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2012
Build 2020: arc lint + arc unit

Event Timeline

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 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?

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 :)