-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't hard code the dracut module directory #2312
Conversation
I haven't looked at the changes, but I'm seeing RPM build failures with these running
|
Works for me. Have now tested it on two systems, my primary Debian GNU/Linux Wheezy build machine (which makes rpms and then convert them to debs) and on a Fedora 20. |
Now that I look closer, it's only the first commit that fails. With both applied it works. |
Ah, perfect! Thanx for testing. |
@FransUrbo Extending
Regarding c476d06 it's generally not recommended to use configure results like this in spec files. The problem is that you need to be able to rebuild a stand alone srpm regardless of the environment. This patch wouldn't allow you to get different default paths for say RHEL6 and RHEL7. It's for this reason that spec files will explicitly defines these varaibles based on the platform. Doing something like this would be the most portable, although I agree it's uglier. diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in
index 5c2196f..4955bdb 100644
--- a/rpm/generic/zfs.spec.in
+++ b/rpm/generic/zfs.spec.in
@@ -1,6 +1,7 @@
%global _sbindir /sbin
%global _libdir /%{_lib}
-%if 0%{?fedora} >= 17
+
+%if 0%{?fedora} >= 17 || 0%{?redhat} >= 7 || 0%{?centos} >= 7
%global _udevdir %{_prefix}/lib/udev
%global _dracutdir %{_prefix}/lib/dracut
%else And just for reference: http://www.gnu.org/software/autoconf/manual/autoconf.html#External-Software |
This still makes it hardcoded for everything else than Fedora17, Redhat7 and CentOS7... So if there's a RPM based distribution out there that don't put it in I was thinking of a compromise:
This way, you can still keep the specific distribution %if updated at every release, but a fallback for 'everyone else' should be the value from However, I haven't really gotten the new %if to work... |
For the spec file, this might (!) work. I'm still a little suspicious of the first %if though, but so far it seems to be working.
|
The 0caa7df commit should hopefully address your concerns about being able to be used stand alone, but still allow for the configure option. If you feel this is a good start, I can rebase them and we can go from there. |
@FransUrbo What about just inverting the logic. From what I can tell all the distributions are moving to
If you really want to be able to pass the configure result such that it's picked up by the |
Ok, so how about the new rebase then? |
Absolutely. A rebase would be good. I think the change here is small enough you could squash it in to a single commit. |
@behlendorf Ok, a one commit-rebase done. |
@FransUrbo Nice, this is much better. Let me actually give it a spin and make sure its working properly but then we can get it in. It occurs to me we could go one small step further and handle _udevdir the same way. You're almost there already. |
Ok, did a force push (added a 'Checking/Looking for dracut directory' message to the dracut part and also did the same check for the udev directories. I'm not sure about using strings to get the directories, but it IS the most reliable. Maybe I should make sure strings is available first? |
Btw, maybe do the same for the systemd stuff? Hardcoding paths is one of my pet-peves! They almost always break sooner than later - no system is exactly alike... |
If we rely on As for systemd that's already mostly handled. There's a |
So what's your recommendation regarding strings and which? And I was thinking about:
Why hardcode a default value, when it's better to just search for it? |
The most portable thing to do would be to avoid using them. We could simply do this with a conditional that checks the known possible paths.
Because the distribution specific packaging should be authoritative about where things have to be installed for that distribution. It's normally up to that packaging to pass these values in to configure in the first place. But in order to make things a little more convenient for end users we've extended our build system to assume the settings on the local system are correct and to override the defaults in the packaging. Which is a little backwards since it assumes you're going to be running these packages on the build machine which may not be true... |
And for those that don't know or don't care (the majority), we search for it (we're assuming that the build machine is also the install system - but that's no different from what we do in other places!). I think strings would be quite safe to use, it's in the binutils package which is required to build anything anyway. And I've never seen a system which didn't have 'which'... On Debian GNU/Linux, that is in the 'debianutils' package with priority 'required'. So on any Debian GNU/Linux (and deviates), that should be safe to use as well. What's the status of that command in other systems (RedHat/Fedora based)? If it's already a required command/package anyway... ? |
for it (or accept the value provided by --with-dracutdir). + Don't call configure in the build target with dracutdir. New functionality is to search for it... + Call rpmbuild with the dracut dir to override the value in the spec file.
… dracut... Accept kernel source dir(s) specified by ./configure This adds ability to set the location of the kernel via defines when building from the spec files. This is useful when building against a kernel installed in a non-standard location. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#1874
Rebased against latest master... |
I'll get this reviewed and merged as soon as I can. |
@FransUrbo How about something a little more like #2385. Because there was a lot of common code and the changes are related I squashed the commits together. The updated patch uses the same basic approach but there are a few small differences.
|
I'm ok with that. Still hardcoded, but a good compromise... |
@FransUrbo OK. Then let's go with this. I just hit one snag, which I've fixed, while testing this. But I think it's a good cautionary tale for why auto-detecting these things sounds like a good idea but can bite you if you're not very very careful. It turns out that the ubuntu udev package creates both a /lib/udev and /usr/lib/udev directory. The /lib/udev directory contains all the expected stuff and the /usr/lib/udev directory is empty. I suspect this is just some sort of packaging bug. Regardless, because this patch was checking for the existence of the /usr/lib/udev directory before /lib/udev it caused us to install the udev bits in the wrong place. Consequently none of the udev helpers worked which thankfully resulted in a mess of test regression test failures. |
Obsoleted by #2385 |
Instead, check for it (or accept the value provided by --with-dracutdir).
This check also don't seem to install dracut if the module directory don't exist (it sets 'dracutdir' in the makefile to nothing).
Closes #546, #1680, #2310, #2356.
A little less complicated than commit described in #546.