Skip to content

Commit

Permalink
Add native-deb* targets to build native Debian packages
Browse files Browse the repository at this point in the history
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 on Ubuntu 20.04.

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 rules
file). Initial config flags like --enable-debug are passed to
contrib/debian/rules.

Additional packages on top 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 update with release
version.

Signed-off-by: Umer Saleem <[email protected]>
  • Loading branch information
usaleem-ix committed Nov 27, 2022
1 parent c3b6fd3 commit 8505e49
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 70 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ bc
build-essential
curl
dbench
debhelper-compat
dh-python
dkms
fakeroot
fio
gdb
Expand All @@ -32,11 +35,14 @@ mdadm
nfs-kernel-server
pamtester
parted
po-debconf
python3
python3-all-dev
python3-cffi
python3-dev
python3-packaging
python3-setuptools
python3-sphinx
rng-tools
rsync
samba
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/zfs-tests-functional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ jobs:
./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
- name: Make
run: |
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
# Build Alien converted Debian packages for Ubuntu 18.04 due to unmet dependencies
if [ "${{ matrix.os }}" = "18.04" ]; then
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
else
make --no-print-directory --silent native-deb-utils native-deb-kmod
mv ../*.deb .
rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
fi
- name: Install
run: |
sudo dpkg -i *.deb
Expand All @@ -40,6 +47,11 @@ jobs:
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
sudo depmod
sudo modprobe zfs
# Native Debian packages enable and start the services
# Stop zfs-zed daemon, as it may interfere with some ZTS test cases
if [ "${{ matrix.os }}" != "18.04" ]; then
sudo systemctl stop zfs-zed
fi
# Workaround for cloud-init bug
# see https://github.com/openzfs/zfs/issues/12644
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/zfs-tests-sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
- name: Make
run: |
make -j$(nproc) --no-print-directory --silent pkg-utils pkg-kmod
make --no-print-directory --silent native-deb-utils native-deb-kmod
mv ../*.deb .
rm ./openzfs-zfs-dkms*.deb ./openzfs-zfs-dracut*.deb
- name: Install
run: |
sudo dpkg -i *.deb
Expand All @@ -36,6 +38,8 @@ jobs:
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
sudo depmod
sudo modprobe zfs
# Stop default zfs-zed daemon, it may interfere with some ZTS test cases
sudo systemctl stop zfs-zed
# Workaround for cloud-init bug
# see https://github.com/openzfs/zfs/issues/12644
FILE=/lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
Expand Down
24 changes: 20 additions & 4 deletions config/deb.am
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
PHONY += deb-kmod deb-dkms deb-utils deb deb-local
PHONY += deb-kmod deb-dkms deb-utils deb deb-local native-deb-local \
native-deb-utils native-deb-kmod native-deb

deb-local:
native-deb-local:
@(if test "${HAVE_DPKGBUILD}" = "no"; then \
echo -e "\n" \
"*** Required util ${DPKGBUILD} missing. Please install the\n" \
"*** package for your distribution which provides ${DPKGBUILD},\n" \
"*** re-run configure, and try again.\n"; \
exit 1; \
fi; \
if test "${HAVE_ALIEN}" = "no"; then \
fi)

deb-local: native-deb-local
@(if test "${HAVE_ALIEN}" = "no"; then \
echo -e "\n" \
"*** Required util ${ALIEN} missing. Please install the\n" \
"*** package for your distribution which provides ${ALIEN},\n" \
Expand Down Expand Up @@ -85,3 +88,16 @@ deb-utils: deb-local rpm-utils-initramfs
$$pkg8 $$pkg9 $$pkg10 $$pkg11;

deb: deb-kmod deb-dkms deb-utils

native-deb-utils: native-deb-local
if ! test -d debian; then cp -r contrib/debian debian; chmod +x debian/rules; fi; \
if test "x${ASAN_ENABLED}" = "xyes" ; then export DEB_LDFLAGS_APPEND=-static-libasan DEB_CFLAGS_APPEND=-static-libasan ; fi; \
cp contrib/debian/control debian/control; \
$(DPKGBUILD) -b -rfakeroot -us -uc;

native-deb-kmod: native-deb-local
if ! test -d debian; then cp -r contrib/debian debian; chmod +x debian/rules; fi; \
sh scripts/make_gitrev.sh; \
fakeroot debian/rules override_dh_binary-modules;

native-deb: native-deb-utils native-deb-kmod
1 change: 1 addition & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ AC_DEFUN([ZFS_AC_DPKG], [
AC_SUBST(HAVE_DPKGBUILD)
AC_SUBST(DPKGBUILD)
AC_SUBST(DPKGBUILD_VERSION)
AC_SUBST([CFGOPTS], ["$CFGOPTS"])
])

dnl #
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

AC_INIT(m4_esyscmd(awk '/^Name:/ {printf $2}' META),
m4_esyscmd(awk '/^Version:/ {printf $2}' META))
CFGOPTS="$*"
AC_LANG(C)
ZFS_AC_META
AC_CONFIG_AUX_DIR([config])
Expand Down Expand Up @@ -80,6 +81,7 @@ AC_CONFIG_FILES([
rpm/redhat/zfs.spec
tests/zfs-tests/tests/Makefile
zfs.release
contrib/debian/rules
])


Expand Down
1 change: 1 addition & 0 deletions contrib/debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rules
3 changes: 1 addition & 2 deletions contrib/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ Source: openzfs-linux
Section: contrib/kernel
Priority: optional
Maintainer: ZFS on Linux specific mailing list <[email protected]>
Build-Depends: abigail-tools,
debhelper-compat (= 12),
Build-Depends: debhelper-compat (= 12),
dh-python,
dkms (>> 2.1.1.2-5),
libaio-dev,
Expand Down
7 changes: 0 additions & 7 deletions contrib/debian/openzfs-zfs-zed.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ set -e
zedd="/usr/lib/zfs-linux/zed.d"
etcd="/etc/zfs/zed.d"

# enable all default zedlets that are not overridden
while read -r file ; do
etcfile="${etcd}/${file}"
[ -e "${etcfile}" ] && continue
ln -sfT "${zedd}/${file}" "${etcfile}"
done < "${zedd}/DEFAULT-ENABLED"

# remove the overrides created in prerm
find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete
# remove any dangling symlinks to old zedlets
Expand Down
16 changes: 0 additions & 16 deletions contrib/debian/openzfs-zfs-zed.prerm

This file was deleted.

1 change: 0 additions & 1 deletion contrib/debian/openzfs-zfsutils.install
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,4 @@ usr/share/man/man8/zstreamdump.8
usr/share/man/man4/spl.4
usr/share/man/man4/zfs.4
usr/share/man/man7/zpool-features.7
usr/share/man/man7/dracut.zfs.7
usr/share/man/man8/zpool_influxdb.8
4 changes: 2 additions & 2 deletions contrib/debian/rules → contrib/debian/rules.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ override_dh_autoreconf:

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

override_dh_configure_modules: override_dh_configure_modules_stamp
override_dh_configure_modules_stamp:
./configure \
./configure @CFGOPTS@ \
--with-config=kernel \
--with-linux=$(KSRC) \
--with-linux-obj=$(KOBJ)
Expand Down
36 changes: 0 additions & 36 deletions scripts/debian-packaging.sh

This file was deleted.

0 comments on commit 8505e49

Please sign in to comment.