Skip to content

Commit c9c1618

Browse files
author
Umer Saleem
committed
Add native-deb* targets to build native Debian packages
In continuation of previous openzfs#13451, this commits adds native-deb* targets to build native debian packages and updates the Github workflows to build and test native packages. Ubuntu 18.04 workflow would still build and test the Alien converted Debian packages due to unmet build and install dependencies. 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. For release, contrib/debian/changelog should be updated with release version. Signed-off-by: Umer Saleem <[email protected]>
1 parent fe97504 commit c9c1618

13 files changed

+54
-72
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,27 @@ 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+
# Build Alien converted Debian packages for Ubuntu 18.04 due to unmet dependencies
36+
if [ "${{ matrix.os }}" = "18.04" ]; then
37+
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
38+
else
39+
make --no-print-directory --silent native-deb-utils native-deb-kmod
40+
mv ../*.deb .
41+
rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
42+
fi
3643
- name: Install
3744
run: |
38-
sudo dpkg -i *.deb
3945
# Update order of directories to search for modules, otherwise
4046
# Ubuntu will load kernel-shipped ones.
4147
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
48+
sudo dpkg -i *.deb
4249
sudo depmod
4350
sudo modprobe zfs
51+
# Native Debian packages enable and start the services
52+
# Stop zfs-zed daemon, as it may interfere with some ZTS test cases
53+
if [ "${{ matrix.os }}" != "18.04" ]; then
54+
sudo systemctl stop zfs-zed
55+
fi
4456
# Workaround for cloud-init bug
4557
# see https://github.com/openzfs/zfs/issues/12644
4658
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ 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
39+
sudo dpkg -i *.deb
3840
sudo depmod
3941
sudo modprobe zfs
42+
# Stop default zfs-zed daemon, it may interfere with some ZTS test cases
43+
sudo systemctl stop zfs-zed
4044
# Workaround for cloud-init bug
4145
# see https://github.com/openzfs/zfs/issues/12644
4246
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules

config/deb.am

Lines changed: 21 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,17 @@ deb-utils: deb-local rpm-utils-initramfs
8588
$$pkg8 $$pkg9 $$pkg10 $$pkg11;
8689

8790
deb: deb-kmod deb-dkms deb-utils
91+
92+
copy-deb:
93+
if ! test -d debian; then cp -r contrib/debian debian; chmod +x debian/rules; fi;
94+
95+
native-deb-utils: native-deb-local copy-deb
96+
if test "x${ASAN_ENABLED}" = "xyes" ; then export DEB_LDFLAGS_APPEND=-static-libasan DEB_CFLAGS_APPEND=-static-libasan ; fi; \
97+
cp contrib/debian/control debian/control; \
98+
$(DPKGBUILD) -b -rfakeroot -us -uc;
99+
100+
native-deb-kmod: native-deb-local copy-deb
101+
sh scripts/make_gitrev.sh; \
102+
fakeroot debian/rules override_dh_binary-modules;
103+
104+
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,

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