From a5578b401aea004dff209b2e0ffa093033ed26df Mon Sep 17 00:00:00 2001 From: Minh Diep Date: Wed, 29 Sep 2021 12:08:15 -0700 Subject: [PATCH] EX-3803 build: build lipe-lpcc on ubuntu 20.04 client * only support client. need to use ./configure --disable-server Test-Parameters: trivial Change-Id: I83c7a712cc0c58dcadd5df59bb49e3fc3d85f9b1 Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/45095 Tested-by: jenkins Reviewed-by: Feng, Lei Tested-by: Maloo Reviewed-by: Andreas Dilger --- lipe/Makefile.am | 16 +++++++ lipe/configure.ac | 2 +- lipe/debian/changelog | 5 +++ lipe/debian/compat | 1 + lipe/debian/control | 16 +++++++ lipe/debian/control.main | 16 +++++++ lipe/debian/lipe-lpcc.install | 4 ++ lipe/debian/lipe-lpcc.manpages | 1 + lipe/debian/rules | 94 ++++++++++++++++++++++++++++++++++++++++++ lipe/debian/source/format | 1 + lipe/detect-distro.sh | 3 ++ 11 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 lipe/debian/changelog create mode 100644 lipe/debian/compat create mode 100644 lipe/debian/control create mode 100644 lipe/debian/control.main create mode 100644 lipe/debian/lipe-lpcc.install create mode 100644 lipe/debian/lipe-lpcc.manpages create mode 100755 lipe/debian/rules create mode 100644 lipe/debian/source/format diff --git a/lipe/Makefile.am b/lipe/Makefile.am index 7fa191b..e5bfddf 100644 --- a/lipe/Makefile.am +++ b/lipe/Makefile.am @@ -132,6 +132,22 @@ rpms: lipe.spec dist --define="_prefix $(prefix)" -tb $(distdir).tar.gz \ && echo "RPMs successfully generated in $(build_dir)/RPMS" +debs: + pkgversion=$$(echo @PACKAGE_VERSION@ | tr '_' '-'); \ + liperelease=$$(echo @LIPE_RELEASE@ | tr '_' '-'); \ + cversion=$$(sed -ne '1s/^lipe-lpcc (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \ + if [ "$$pkgversion-$$liperelease" != "$$cversion" ]; then \ + echo -e "1i\nlipe-lpcc ($$pkgversion-$$liperelease) unstable; urgency=low\n\n * Automated changelog entry update\n\n -- Minh Diep $$(date -R)\n\n.\nwq" | ed debian/changelog; \ + fi; \ + rm -rf debs; \ + dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp + VER=$$(sed -ne '1s/^lipe-lpcc (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \ + mkdir -p debs && \ + mv ../lipe-lpcc_$${VER}_*.deb \ + ../lipe-lpcc_$${VER}_*.changes \ + ../lipe-lpcc_$${VER}.dsc \ + debs/ + lipe-$(PACKAGE_VERSION).x86_64.iso: rpms @if test -z "$(CACHED_ISO_PATH)"; then \ echo -e "Error: Can not build ISO without the cached ISO path," \ diff --git a/lipe/configure.ac b/lipe/configure.ac index 3acca65..3e74216 100644 --- a/lipe/configure.ac +++ b/lipe/configure.ac @@ -178,7 +178,7 @@ AM_CONDITIONAL(BUILD_LAUDIT, test "$BUILD_LAUDIT" = "yes") AC_MSG_CHECKING([for distro version]) DISTRO=$(sh detect-distro.sh) DISTRO_NAME=$(echo $DISTRO | awk -F '-' '{print $1}') -if [[[ "$DISTRO_NAME" != "rhel" && "$DISTRO_NAME" != "fc" ]]]; then +if [[[ "$DISTRO_NAME" != "rhel" && "$DISTRO_NAME" != "fc" && "$DISTRO_NAME" != "ubuntu" ]]]; then AC_MSG_ERROR([$DISTRO_NAME is not a supported distro.]) fi DISTRO_RELEASE=$(echo $DISTRO | awk -F 'rhel-' '{print $2}' | awk -F '.' '{print $1}') diff --git a/lipe/debian/changelog b/lipe/debian/changelog new file mode 100644 index 0000000..7564c89 --- /dev/null +++ b/lipe/debian/changelog @@ -0,0 +1,5 @@ +lipe-lpcc (1.19-1) unstable; urgency=low + + * Initial release + + -- Minh Diep Tue, 28 Sep 2021 10:21:04 +0000 diff --git a/lipe/debian/compat b/lipe/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/lipe/debian/compat @@ -0,0 +1 @@ +7 diff --git a/lipe/debian/control b/lipe/debian/control new file mode 100644 index 0000000..dd32c26 --- /dev/null +++ b/lipe/debian/control @@ -0,0 +1,16 @@ +Source: lipe-lpcc +Section: admin +Priority: optional +Maintainer: Minh Diep +Uploaders: Minh Diep +Standards-Version: 3.8.3 +Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool +Homepage: https://wiki.whamcloud.com/ +Vcs-Git: git://git.whamcloud.com/fs/lustre-release.git + +Package: lipe-lpcc +Section: utils +Architecture: all +Priority: optional +Depends: ${shlibs:Depends}, ${misc:Depends}, e2fsprogs (>= 1.42.13.wc6) +Description: Tools for LPCC (Lustre Persisted Client Cache) diff --git a/lipe/debian/control.main b/lipe/debian/control.main new file mode 100644 index 0000000..dd32c26 --- /dev/null +++ b/lipe/debian/control.main @@ -0,0 +1,16 @@ +Source: lipe-lpcc +Section: admin +Priority: optional +Maintainer: Minh Diep +Uploaders: Minh Diep +Standards-Version: 3.8.3 +Build-Depends: module-assistant, libreadline-dev, debhelper (>=9.0.0), dpatch, automake (>=1.7) | automake1.7 | automake1.8 | automake1.9, pkg-config, libtool +Homepage: https://wiki.whamcloud.com/ +Vcs-Git: git://git.whamcloud.com/fs/lustre-release.git + +Package: lipe-lpcc +Section: utils +Architecture: all +Priority: optional +Depends: ${shlibs:Depends}, ${misc:Depends}, e2fsprogs (>= 1.42.13.wc6) +Description: Tools for LPCC (Lustre Persisted Client Cache) diff --git a/lipe/debian/lipe-lpcc.install b/lipe/debian/lipe-lpcc.install new file mode 100644 index 0000000..7c87c84 --- /dev/null +++ b/lipe/debian/lipe-lpcc.install @@ -0,0 +1,4 @@ +lpcc /usr/bin +src/lpcc_purge /usr/bin +lpcc.conf /etc +systemd/lpcc.service /usr/lib/systemd/system diff --git a/lipe/debian/lipe-lpcc.manpages b/lipe/debian/lipe-lpcc.manpages new file mode 100644 index 0000000..7f0e0c2 --- /dev/null +++ b/lipe/debian/lipe-lpcc.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/*/* diff --git a/lipe/debian/rules b/lipe/debian/rules new file mode 100755 index 0000000..d707661 --- /dev/null +++ b/lipe/debian/rules @@ -0,0 +1,94 @@ +#!/usr/bin/make -f +# +# Created 2021 by Minh Diep based on lustre debian +# +# Uncomment this to turn on verbose mode. +# export DH_VERBOSE=1 + +DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM) +DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU) + + +CFLAGS = -Wall -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +# This is the debhelper compatibility version to use. +export DH_COMPAT=9 + +ARCH=$(shell dpkg --print-architecture) +TOP_DIR:=$(shell pwd) + +# Packages provided for both client and server builds +LPCC_PKG=lipe-lpcc + +BUILDDIR=. +SRCDIR=. + +AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1) +ifneq ($(AVAIL_CPUS),1) + PMAKEARGS := -j $(AVAIL_CPUS) +endif + +configure: configure-stamp +configure-stamp: debian/control.main + dh_testdir + # touch files to same date, to avoid auto* + # Build only client + export EXTRAFLAGS="--disable-server"; \ + echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \ + ( cd $(BUILDDIR) && \ + $(SRCDIR)/configure $${EXTRAFLAGS} \ + $(EXTRA_OPTIONS) \ + ); \ + touch $@ + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + $(MAKE) -C $(BUILDDIR) $(PMAKEARGS) + $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install + cp $(BUILDDIR)/lpcc $(TOP_DIR)/debian/tmp/usr/bin + mkdir -p $(TOP_DIR)/debian/tmp/etc + cp $(BUILDDIR)/lpcc.conf $(TOP_DIR)/debian/tmp/etc + mkdir -p $(TOP_DIR)/debian/tmp/usr/lib/systemd/system + cp $(BUILDDIR)/systemd/lpcc.service $(TOP_DIR)/debian/tmp/usr/lib/systemd/system + mkdir -p $(TOP_DIR)/debian/tmp/usr/share/man/man5 + mkdir -p $(TOP_DIR)/debian/tmp/usr/share/man/man8 + cp $(BUILDDIR)/man/*.5 $(TOP_DIR)/debian/tmp/usr/share/man/man5 + cp $(BUILDDIR)/man/*.8 $(TOP_DIR)/debian/tmp/usr/share/man/man8 + touch $@ + +binary-arch: binary-$(LPCC_PKG) + +binary: binary-arch + +binary-$(LPCC_PKG): build-stamp + dh_testdir + dh_testroot + dh_installdirs -p $(LPCC_PKG) + dh_install -p $(LPCC_PKG) + dh_installman -p $(LPCC_PKG) + dh_makeshlibs -p $(LPCC_PKG) + dh_compress -p $(LPCC_PKG) + dh_strip -p $(LPCC_PKG) + dh_installdeb -p $(LPCC_PKG) + dh_fixperms -p $(LPCC_PKG) + dh_gencontrol -p $(LPCC_PKG) + dh_md5sums -p $(LPCC_PKG) + dh_builddeb -p $(LPCC_PKG) + +clean: + dh_testdir + dh_testroot + -$(MAKE) distclean + rm -rf debian/substvars debian/*.bak debian/*~ *~ *-stamp + dh_clean + # make sure we have at least a basic control in place (see build-stamp) + rm -f debian/control + cp debian/control.main debian/control + +.PHONY: binary-arch clean source diff binary binary-arch install configure diff --git a/lipe/debian/source/format b/lipe/debian/source/format new file mode 100644 index 0000000..d3827e7 --- /dev/null +++ b/lipe/debian/source/format @@ -0,0 +1 @@ +1.0 diff --git a/lipe/detect-distro.sh b/lipe/detect-distro.sh index fa8d8fd..154c0d2 100755 --- a/lipe/detect-distro.sh +++ b/lipe/detect-distro.sh @@ -30,6 +30,9 @@ if which lsb_release >/dev/null 2>&1; then "Fedora") name="fc" ;; + "Ubuntu") + name="ubuntu" + ;; *) fatal 1 "I don't know what distro name $name and version $version is.\nEither update autodetect_distro() or use the --distro argument." ;; -- 1.8.3.1