Skip to content

Commit e6e31dd

Browse files
author
Umer Saleem
authored
Add native-deb* targets to build native Debian packages
In continuation of previous #13451, this commits adds native-deb* targets for make to build native debian packages. Github workflows are updated to build and test native Debian packages. Native packages only build with pre-configured paths (see the dh_auto_configure section in contrib/debian/rules.in). While building native packages, paths should not be configured. Initial config flags e.g. '--enable-debug' are replaced in contrib/debian/rules.in. Additional packages on top of existing zfs packages required to build native packages include debhelper-compat, dh-python, dkms, po-debconf, python3-all-dev, python3-sphinx. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Umer Saleem <[email protected]> Closes #14265
1 parent f3f5263 commit e6e31dd

15 files changed

+50
-92
lines changed

.github/workflows/build-dependencies.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ bc
66
build-essential
77
curl
88
dbench
9+
debhelper-compat
10+
dh-python
11+
dkms
912
fakeroot
1013
fio
1114
gdb
@@ -33,12 +36,15 @@ mdadm
3336
nfs-kernel-server
3437
pamtester
3538
parted
39+
po-debconf
3640
python3
41+
python3-all-dev
3742
python3-cffi
3843
python3-dev
3944
python3-packaging
4045
python3-pip
4146
python3-setuptools
47+
python3-sphinx
4248
rng-tools-debian
4349
rsync
4450
samba

.github/workflows/zfs-tests-functional.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ jobs:
3232
./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
3333
- name: Make
3434
run: |
35-
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
35+
make --no-print-directory --silent native-deb-utils native-deb-kmod
36+
mv ../*.deb .
37+
rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
3638
- name: Install
3739
run: |
38-
sudo dpkg -i *.deb
3940
# Update order of directories to search for modules, otherwise
4041
# Ubuntu will load kernel-shipped ones.
4142
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
42-
sudo depmod
43-
sudo modprobe zfs
43+
sudo dpkg -i *.deb
44+
# Native Debian packages enable and start the services
45+
# Stop zfs-zed daemon, as it may interfere with some ZTS test cases
46+
sudo systemctl stop zfs-zed
4447
# Workaround for cloud-init bug
4548
# see https://github.com/openzfs/zfs/issues/12644
4649
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules

.github/workflows/zfs-tests-sanity.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@ jobs:
2828
./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
2929
- name: Make
3030
run: |
31-
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
31+
make --no-print-directory --silent native-deb-utils native-deb-kmod
32+
mv ../*.deb .
33+
rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
3234
- name: Install
3335
run: |
34-
sudo dpkg -i *.deb
3536
# Update order of directories to search for modules, otherwise
3637
# Ubuntu will load kernel-shipped ones.
3738
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
38-
sudo depmod
39-
sudo modprobe zfs
39+
sudo dpkg -i *.deb
40+
# Native Debian packages enable and start the services
41+
# Stop zfs-zed daemon, as it may interfere with some ZTS test cases
42+
sudo systemctl stop zfs-zed
4043
# Workaround for cloud-init bug
4144
# see https://github.com/openzfs/zfs/issues/12644
4245
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules

config/deb.am

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
PHONY += deb-kmod deb-dkms deb-utils deb deb-local
1+
PHONY += deb-kmod deb-dkms deb-utils deb deb-local native-deb-local \
2+
native-deb-utils native-deb-kmod native-deb
23

3-
deb-local:
4+
native-deb-local:
45
@(if test "${HAVE_DPKGBUILD}" = "no"; then \
56
echo -e "\n" \
67
"*** Required util ${DPKGBUILD} missing. Please install the\n" \
78
"*** package for your distribution which provides ${DPKGBUILD},\n" \
89
"*** re-run configure, and try again.\n"; \
910
exit 1; \
10-
fi; \
11-
if test "${HAVE_ALIEN}" = "no"; then \
11+
fi)
12+
13+
deb-local: native-deb-local
14+
@(if test "${HAVE_ALIEN}" = "no"; then \
1215
echo -e "\n" \
1316
"*** Required util ${ALIEN} missing. Please install the\n" \
1417
"*** package for your distribution which provides ${ALIEN},\n" \
@@ -85,3 +88,16 @@ deb-utils: deb-local rpm-utils-initramfs
8588
$$pkg8 $$pkg9 $$pkg10 $$pkg11;
8689

8790
deb: deb-kmod deb-dkms deb-utils
91+
92+
debian:
93+
cp -r contrib/debian debian; chmod +x debian/rules;
94+
95+
native-deb-utils: native-deb-local debian
96+
cp contrib/debian/control debian/control; \
97+
$(DPKGBUILD) -b -rfakeroot -us -uc;
98+
99+
native-deb-kmod: native-deb-local debian
100+
sh scripts/make_gitrev.sh; \
101+
fakeroot debian/rules override_dh_binary-modules;
102+
103+
native-deb: native-deb-utils native-deb-kmod

config/zfs-build.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ AC_DEFUN([ZFS_AC_DPKG], [
464464
AC_SUBST(HAVE_DPKGBUILD)
465465
AC_SUBST(DPKGBUILD)
466466
AC_SUBST(DPKGBUILD_VERSION)
467+
AC_SUBST([CFGOPTS], ["$CFGOPTS"])
467468
])
468469

469470
dnl #

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
AC_INIT(m4_esyscmd(awk '/^Name:/ {printf $2}' META),
3434
m4_esyscmd(awk '/^Version:/ {printf $2}' META))
35+
CFGOPTS="$*"
3536
AC_LANG(C)
3637
ZFS_AC_META
3738
AC_CONFIG_AUX_DIR([config])
@@ -65,6 +66,7 @@ ZFS_AC_DEBUG_KMEM_TRACKING
6566
ZFS_AC_DEBUG_INVARIANTS
6667

6768
AC_CONFIG_FILES([
69+
contrib/debian/rules
6870
Makefile
6971
include/Makefile
7072
lib/libzfs/libzfs.pc

contrib/debian/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules

contrib/debian/control

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ Source: openzfs-linux
22
Section: contrib/kernel
33
Priority: optional
44
Maintainer: ZFS on Linux specific mailing list <[email protected]>
5-
Build-Depends: abigail-tools,
6-
debhelper-compat (= 12),
5+
Build-Depends: debhelper-compat (= 12),
76
dh-python,
87
dkms (>> 2.1.1.2-5),
98
libaio-dev,
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22
set -e
33

4-
pam-auth-update --package
4+
if ! $(ldd "/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/security/pam_zfs_key.so" | grep -q "libasan") ; then
5+
pam-auth-update --package
6+
fi
57

68
#DEBHELPER#

contrib/debian/openzfs-zfs-zed.postinst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ set -e
44
zedd="/usr/lib/zfs-linux/zed.d"
55
etcd="/etc/zfs/zed.d"
66

7-
# enable all default zedlets that are not overridden
8-
while read -r file ; do
9-
etcfile="${etcd}/${file}"
10-
[ -e "${etcfile}" ] && continue
11-
ln -sfT "${zedd}/${file}" "${etcfile}"
12-
done < "${zedd}/DEFAULT-ENABLED"
13-
147
# remove the overrides created in prerm
158
find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete
169
# remove any dangling symlinks to old zedlets

contrib/debian/openzfs-zfs-zed.prerm

Lines changed: 0 additions & 16 deletions
This file was deleted.

contrib/debian/openzfs-zfsutils.install

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,4 @@ usr/share/man/man8/zstreamdump.8
131131
usr/share/man/man4/spl.4
132132
usr/share/man/man4/zfs.4
133133
usr/share/man/man7/zpool-features.7
134-
usr/share/man/man7/dracut.zfs.7
135134
usr/share/man/man8/zpool_influxdb.8

contrib/debian/openzfs-zfsutils.postinst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
#!/bin/sh
22
set -e
33

4-
# The hostname and hostid of the last system to access a ZFS pool are stored in
5-
# the ZFS pool itself. A pool is foreign if, during `zpool import`, the
6-
# current hostname and hostid are different than the stored values thereof.
7-
#
8-
# The only way of having a stable hostid is to define it in /etc/hostid.
9-
# This postinst helper will check if we already have the hostid stabilized by
10-
# checking the existence of the file /etc/hostid to be 4 bytes at least.
11-
# If this file don't already exists on our system or has less than 4 bytes, then
12-
# a new (random) value is generated with zgenhostid (8) and stored in
13-
# /etc/hostid
14-
15-
if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then
16-
zgenhostid
17-
fi
18-
194
# When processed to here but zfs kernel module is not loaded, the subsequent
205
# services would fail to start. In this case the installation process just
216
# fails at the postinst stage. The user could do

contrib/debian/rules renamed to contrib/debian/rules.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ override_dh_autoreconf:
3535

3636
override_dh_auto_configure:
3737
@# Build the userland, but don't build the kernel modules.
38-
dh_auto_configure -- \
38+
dh_auto_configure -- @CFGOPTS@ \
3939
--bindir=/usr/bin \
4040
--sbindir=/sbin \
4141
--libdir=/lib/"$(DEB_HOST_MULTIARCH)" \
@@ -195,7 +195,7 @@ override_dh_prep-deb-files:
195195

196196
override_dh_configure_modules: override_dh_configure_modules_stamp
197197
override_dh_configure_modules_stamp:
198-
./configure \
198+
./configure @CFGOPTS@ \
199199
--with-config=kernel \
200200
--with-linux=$(KSRC) \
201201
--with-linux-obj=$(KOBJ)

scripts/debian-packaging.sh

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)