Use `install' to explicitly create the target directories before installing
to them.
Details
- Reviewers
bdrewery - Group Reviewers
Contributor Reviewers (ports)
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
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.
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.
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 :)