Skip to content
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

Fix --with-systemd on Debian-based distributions #6963

Merged
merged 1 commit into from
Dec 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions config/user-systemd.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
AC_ARG_ENABLE(systemd,
AC_HELP_STRING([--enable-systemd],
[install systemd unit/preset files [[default: yes]]]),
[],enable_systemd=yes)
[enable_systemd=$enableval],
[enable_systemd=check])
AC_ARG_WITH(systemdunitdir,
AC_HELP_STRING([--with-systemdunitdir=DIR],
Expand All @@ -19,16 +20,27 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [
[install systemd module load files into dir [[/usr/lib/modules-load.d]]]),
systemdmoduleloaddir=$withval,systemdmodulesloaddir=/usr/lib/modules-load.d)
AS_IF([test "x$enable_systemd" = xcheck], [
AS_IF([systemctl --version >/dev/null 2>&1],
[enable_systemd=yes],
[enable_systemd=no])
])
AS_IF([test "x$enable_systemd" = xyes],
[
AC_MSG_CHECKING(for systemd support)
AC_MSG_RESULT([$enable_systemd])
AS_IF([test "x$enable_systemd" = xyes], [
ZFS_INIT_SYSTEMD=systemd
ZFS_MODULE_LOAD=modules-load.d
DEFINE_SYSTEMD='--with systemd --define "_unitdir $(systemdunitdir)" --define "_presetdir $(systemdpresetdir)"'
modulesloaddir=$systemdmodulesloaddir
])
],[
DEFINE_SYSTEMD='--without systemd'
])
AC_SUBST(ZFS_INIT_SYSTEMD)
AC_SUBST(ZFS_MODULE_LOAD)
AC_SUBST(DEFINE_SYSTEMD)
AC_SUBST(systemdunitdir)
AC_SUBST(systemdpresetdir)
AC_SUBST(modulesloaddir)
Expand Down
2 changes: 1 addition & 1 deletion config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ AC_DEFUN([ZFS_AC_RPM], [
])
RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"'
RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)'
RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS) $(DEFINE_SYSTEMD)'
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
RPM_DEFINE_DKMS=
Expand Down
5 changes: 4 additions & 1 deletion rpm/generic/zfs.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,15 @@ BuildRequires: libudev-devel
BuildRequires: libattr-devel
BuildRequires: openssl-devel
Requires: openssl
%if 0%{?_systemd}
BuildRequires: systemd
%endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to move this inside the first %if 0%{?rhel}%{?fedora}%{?suse_version} condition, the rpm binary on my Debian9 doesn't know how to handle the "BuildRequires" tag (probably because we're missing the rpmdb on Debian-based distros).

This is from gdb attached to the rpmbuild process:

Breakpoint 1, unsatisfiedDepend (ts=0x555555797b10, dcache=0x5555557eb770, dep=0x5555557e9a10) at depends.c:784
warning: Source file is more recent than executable.
784		rc = 1;
(gdb) bt
#0  unsatisfiedDepend (ts=0x555555797b10, dcache=0x5555557eb770, dep=0x5555557e9a10) at depends.c:784
#1  0x00007ffff7b8823f in checkDS (ts=0x555555797b10, dcache=0x5555557eb770, te=0x5555557d0120, pkgNEVRA=0x5555557cb280 "zfs-0.7.0-213_gf6940bb9e.x86_64", ds=0x5555557e9a10, tscolor=3) at depends.c:808
#2  0x00007ffff7b8891f in rpmtsCheck (ts=0x555555797b10) at depends.c:936
#3  0x00007ffff771b4c7 in rpmSpecCheckDeps (ts=0x555555797b10, spec=0x5555557982a0) at spec.c:322
#4  0x0000555555556b7f in checkSpec (ts=0x555555797b10, spec=0x5555557982a0) at rpmbuild.c:234
#5  0x000055555555758d in buildForTarget (ts=0x555555797b10, arg=0x55555578ac50 "SPECS/zfs.spec", ba=0x55555575a9e0 <rpmBTArgs>) at rpmbuild.c:453
#6  0x00005555555576ed in build (ts=0x555555797b10, arg=0x55555578ac50 "SPECS/zfs.spec", ba=0x55555575a9e0 <rpmBTArgs>, rcfile=0x0) at rpmbuild.c:490
#7  0x0000555555557cc2 in main (argc=18, argv=0x7fffffffea98) at rpmbuild.c:626
(gdb) p *dep
$1 = {pool = 0x5555557d0240, Type = 0x7ffff7bc1e61 "Requires", DNEVR = 0x555555826940 "R systemd", N = 0x5555557e9a70, EVR = 0x5555557e9ab0, Flags = 0x5555557e9ad0, Color = 0x0, tagN = 1049, Count = 1, 
  instance = 0, i = 0, nopromote = 1, nrefs = 1, ti = 0x0}
(gdb) fin
Run till exit from #0  unsatisfiedDepend (ts=0x555555797b10, dcache=0x5555557eb770, dep=0x5555557e9a10) at depends.c:784
0x00007ffff7b8823f in checkDS (ts=0x555555797b10, dcache=0x5555557eb770, te=0x5555557d0120, pkgNEVRA=0x5555557cb280 "zfs-0.7.0-213_gf6940bb9e.x86_64", ds=0x5555557e9a10, tscolor=3) at depends.c:808
808		if (unsatisfiedDepend(ts, dcache, ds) == is_problem)
Value returned is $2 = 1
(gdb) 

%endif

%if 0%{?_systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%endif

# The zpool iostat/status -c scripts call some utilities like lsblk and iostat
Expand Down