Whamcloud - gitweb
EX-3723 build: build lipe-lpcc on client
authorMinh Diep <mdiep@whamcloud.com>
Fri, 3 Sep 2021 00:23:14 +0000 (17:23 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 17 Sep 2021 23:04:08 +0000 (23:04 +0000)
Introduce config param --disable-server to build
rpms that needed for lustre client.

Test-Parameters: trivial

Change-Id: If1812b17f993ebf4031cae30303dda22c179bdc9
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44835
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
contrib/lbuild/lbuild
lipe/Makefile.am
lipe/configure.ac
lipe/lipe.spec.in
lipe/src/Makefile.am
lustre/include/uapi/linux/lustre/Makefile.am

index 6c1607a..fb6c011 100755 (executable)
@@ -879,10 +879,12 @@ do_patch_linux() {
 
 build_lipe() {
        local source="$1"
+       local build_type="$2"
        local lustre_install_root
        local lustre_rpm=''
        local lustre_devel_rpm=''
        local name
+       local config_params=''
 
        # Extract headers and libraries from lustre RPM for build.
        lustre_install_root=$(mktemp -d ${TOPDIR}/root.XXXXXXXX)
@@ -890,11 +892,11 @@ build_lipe() {
        # Find the lustre rpm
        for rpm in ${source}/*.rpm; do
                name=$(rpm --query --queryformat '%{NAME}\n' --package "$rpm")
-               if [[ "$name" == "lustre" ]]; then
+               if [[ "$name" == "lustre${build_type}" ]]; then
                        lustre_rpm="$rpm"
                fi
 
-               if [[ "$name" == "lustre-devel" ]]; then
+               if [[ "$name" == "lustre${build_type}-devel" ]]; then
                        lustre_devel_rpm="$rpm"
                fi
        done
@@ -926,6 +928,9 @@ build_lipe() {
        fi
 
        sh autogen.sh
+       if [[ ${build_type} = *client* ]]; then
+               config_params='--disable-server'
+       fi
 
        CPPFLAGS="\
                -I${lustre_install_root}/usr/include/linux/lnet \
@@ -936,7 +941,7 @@ build_lipe() {
        LDFLAGS="\
                -L${lustre_install_root}/usr/lib64 \
        " \
-       ./configure || fatal 1 "Error in configure lipe."
+       ./configure ${config_params} || fatal 1 "Error in configure lipe."
 
        make rpms || fatal 1 "Error building rpms for lipe"
        mv -f build/RPMS/${TARGET_ARCH}/lipe*.rpm $TOPDIR/RPMS/${TARGET_ARCH}/
@@ -947,6 +952,7 @@ build_lustre() {
     local linux="$1"
     local linuxobj="$2"
     local configure_args=""
+    local client="-client"
 
     cp "$LUSTRE" SOURCES
 
@@ -1014,8 +1020,11 @@ build_lustre() {
 
     popd >/dev/null
 
-       if [ $PATCHLESS == false ] && ! build_lipe $TOPDIR/RPMS/${TARGET_ARCH}; then
-               return 255
+       if [[ $DISTROMAJ =~ rhel ]] && [[ ${TARGET_ARCH} == 'x86_64' ]]; then
+               [[ $PATCHLESS == false ]] && client=""
+               if ! build_lipe $TOPDIR/RPMS/${TARGET_ARCH} ${client}; then
+                       return 255
+               fi
        fi
        if type -p cleanup_rpmmacros; then
                cleanup_rpmmacros
index 20733d1..7fa191b 100644 (file)
@@ -14,6 +14,12 @@ else
 rpmbuild_opt += --without laudit
 endif
 
+if BUILD_SERVER
+rpmbuild_opt += --with server
+else
+rpmbuild_opt += --without server
+endif
+
 if ZFS
 rpmbuild_opt += --with zfs
 else
index 83c36cc..3acca65 100644 (file)
@@ -212,6 +212,15 @@ PKG_CHECK_MODULES([libssh_threads], [libssh_threads],
 )
 AM_CONDITIONAL([HAVE_SSH_THREADS], [test x$have_lssh_threads = xyes])
 
+# -------- check whether enable server build --------
+AC_MSG_CHECKING([whether enable server])
+AC_ARG_ENABLE([server],
+       AC_HELP_STRING([--disable-server],
+                       [disable server]),
+        [enable_server="no"], [enable_server="yes"])
+AC_MSG_RESULT([$enable_server])
+AM_CONDITIONAL([BUILD_SERVER], [test x$enable_server = xyes])
+
 # -------- check whether enable zfs support --------
 AC_MSG_CHECKING([whether enable zfs support])
 AC_ARG_ENABLE([zfs],
index 2dffcba..36201c3 100644 (file)
@@ -2,6 +2,7 @@
 
 # Declare rpmbuild --with/--without parameters
 %bcond_with laudit
+%bcond_with server
 %bcond_with zfs
 %bcond_with hotpool
 
@@ -53,6 +54,36 @@ Group: Applications/System
 %description pylustre
 Pylustre is a python library for managing Lustre file system.
 
+%package lpcc
+Summary: LPCC (Lustre Persisted Client Cache)
+Requires: lipe-pylustre = %{version}-%{release}
+Provides: lipe-lpcc = %{version}-%{release}
+Group: Applications/System
+
+%description lpcc
+Tools for LPCC (Lustre Persisted Client Cache).
+
+%post lpcc
+%if %{with systemd}
+%systemd_post lipe.service
+%endif
+
+%preun lpcc
+%if %{with systemd}
+%systemd_preun lpcc.service
+%else
+/sbin/service lpcc stop >/dev/null 2>&1 ||:
+/sbin/chkconfig --del lpcc
+%endif
+
+%postun lpcc
+%if %{with systemd}
+%systemd_postun_with_restart lpcc.service
+%else
+/sbin/service lpcc condrestart >/dev/null 2>&1 ||:
+%endif
+
+%if %{with server}
 %package loris
 Summary: Lustre Online Reliability Improvement System
 Requires: lipe-pylustre = %{version}-%{release}
@@ -113,35 +144,6 @@ Pyltest is a common test framework for LiPE
 /sbin/service lipe_test_scheduler condrestart >/dev/null 2>&1 ||:
 %endif
 
-%package lpcc
-Summary: LPCC (Lustre Persisted Client Cache)
-Requires: lipe-pylustre = %{version}-%{release}
-Provides: lipe-lpcc = %{version}-%{release}
-Group: Applications/System
-
-%description lpcc
-Tools for LPCC (Lustre Persisted Client Cache).
-
-%post lpcc
-%if %{with systemd}
-%systemd_post lipe.service
-%endif
-
-%preun lpcc
-%if %{with systemd}
-%systemd_preun lpcc.service
-%else
-/sbin/service lpcc stop >/dev/null 2>&1 ||:
-/sbin/chkconfig --del lpcc
-%endif
-
-%postun lpcc
-%if %{with systemd}
-%systemd_postun_with_restart lpcc.service
-%else
-/sbin/service lpcc condrestart >/dev/null 2>&1 ||:
-%endif
-
 %package server
 Summary: Lipe Server Package
 Requires: lustre
@@ -164,6 +166,7 @@ Group: Applications/System
 
 %description client
 Provides lipe tools run on lustre client.
+%endif # end server
 
 Generated using options: @ac_configure_args@
 
@@ -186,11 +189,13 @@ Generated using options: @ac_configure_args@
 
 make V=1
 
-python2 -m py_compile pyclownfish/*.py
 python2 -m py_compile pylustre/*.py
+%if %{with server}
+python2 -m py_compile pyclownfish/*.py
 python2 -m py_compile pylipe/*.py
 python2 -m py_compile pyloris/*.py
 python2 -m py_compile pyltest/*.py
+%endif
 
 find pyclownfish pylustre pylipe pyloris pyltest -maxdepth 1 -type f -a -name "*.python_checked" -o -name "*.py" | xargs rm -f
 
@@ -205,6 +210,19 @@ mkdir -p $RPM_BUILD_ROOT%{_mandir}/man5
 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
 cp \
+       lpcc \
+       lipe_virt \
+       src/lpcc_purge \
+       $RPM_BUILD_ROOT%{_bindir}
+
+cp -a pylustre $RPM_BUILD_ROOT%{python_sitelib}
+cp -a \
+       example_configs/clownfish/seperate_mgs/lipe_virt.conf \
+       lpcc.conf \
+       $RPM_BUILD_ROOT%{_sysconfdir}
+
+%if %{with server}
+cp \
        ldsync \
        lipe_find \
        lipe_convert_expr \
@@ -215,12 +233,9 @@ cp \
        lipe_test_console \
        lipe_test_launch \
        lipe_test_scheduler \
-       lipe_virt \
        loris_backup \
        loris_crontab \
        loris_test \
-       lpcc \
-       src/lpcc_purge \
        src/ext4_inode2path \
        src/lcreatemany \
        src/ldumpstripe \
@@ -245,7 +260,6 @@ install -m 0755 scripts/*.sh $RPM_BUILD_ROOT%{ddntoolsdir}/
 cp -a pyclownfish $RPM_BUILD_ROOT%{python_sitelib}
 cp -a pylipe $RPM_BUILD_ROOT%{python_sitelib}
 cp -a pyloris $RPM_BUILD_ROOT%{python_sitelib}
-cp -a pylustre $RPM_BUILD_ROOT%{python_sitelib}
 cp -a pyltest $RPM_BUILD_ROOT%{python_sitelib}
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
 cp -a \
@@ -255,8 +269,6 @@ cp -a \
        example_configs/loris/loris.conf \
        example_configs/ltest/lipe_test_scheduler.conf \
        lipe.conf \
-       example_configs/clownfish/seperate_mgs/lipe_virt.conf \
-       lpcc.conf \
        $RPM_BUILD_ROOT%{_sysconfdir}
 
 %if %{with laudit}
@@ -267,10 +279,12 @@ cp -a laudit.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/laudit
 %if %{with hotpool}
 cp -a example_configs/hotpool/* $RPM_BUILD_ROOT%{_sysconfdir}/
 %endif
+%endif # end server
 
 %if %{with systemd}
        mkdir -p $RPM_BUILD_ROOT%{_unitdir}/
        install -m 0644 -D systemd/lpcc.service $RPM_BUILD_ROOT%{_unitdir}/lpcc.service
+%if %{with server}
        install -m 0644 -D systemd/lipe_test_scheduler.service \
         $RPM_BUILD_ROOT%{_unitdir}/lipe_test_scheduler.service
 %if %{with hotpool}
@@ -279,60 +293,41 @@ cp -a example_configs/hotpool/* $RPM_BUILD_ROOT%{_sysconfdir}/
        install -m 0644 -D systemd/lamigo@.service \
         $RPM_BUILD_ROOT%{_unitdir}/lamigo@.service
 %endif
+%endif # end server
 %else
        mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
        install -m 0744 -D init.d/lpcc \
                $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/lpcc
+%if %{with server}
        install -m 0744 -D init.d/lipe_test_scheduler \
                $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/lipe_test_scheduler
+%endif # end server
 %endif
-install -m 0644 man/lipe_scan.1 $RPM_BUILD_ROOT%{_mandir}/man1/
-install -m 0644 man/lipe_find.1 $RPM_BUILD_ROOT%{_mandir}/man1/
-install -m 0644 man/lfill.1 $RPM_BUILD_ROOT%{_mandir}/man1/
 install -m 0644 man/lpcc.8 $RPM_BUILD_ROOT%{_mandir}/man8/
 install -m 0644 man/lpcc-start.8 $RPM_BUILD_ROOT%{_mandir}/man8/
 install -m 0644 man/lpcc-stop.8 $RPM_BUILD_ROOT%{_mandir}/man8/
 install -m 0644 man/lpcc-status.8 $RPM_BUILD_ROOT%{_mandir}/man8/
 install -m 0644 man/lpcc.conf.5 $RPM_BUILD_ROOT%{_mandir}/man5/
+%if %{with server}
+install -m 0644 man/lipe_scan.1 $RPM_BUILD_ROOT%{_mandir}/man1/
+install -m 0644 man/lipe_find.1 $RPM_BUILD_ROOT%{_mandir}/man1/
+install -m 0644 man/lfill.1 $RPM_BUILD_ROOT%{_mandir}/man1/
 %if %{with laudit}
 install -m 0644 man/laudit.1 $RPM_BUILD_ROOT%{_mandir}/man1/
 install -m 0644 man/laudit-report.1 $RPM_BUILD_ROOT%{_mandir}/man1/
 install -m 0644 man/laudit.conf.5 $RPM_BUILD_ROOT%{_mandir}/man5/
 %endif
+%endif #end server
 
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%files clownfish
-%{python2_sitelib}/pyclownfish
-%{_bindir}/lcreatemany
-%config(noreplace) %{_sysconfdir}/clownfish.conf
-
-%files loris
-%{python2_sitelib}/pyloris
-%{_bindir}/loris_backup
-%{_bindir}/loris_crontab
-%{_bindir}/loris_test
-%config(noreplace) %{_sysconfdir}/loris.conf
-
 %files pylustre
 %{python2_sitelib}/pylustre
 %{_bindir}/lipe_virt
 %config(noreplace) %{_sysconfdir}/lipe_virt.conf
 
-%files pyltest
-%{python2_sitelib}/pyltest
-%{_bindir}/lipe_test_console
-%{_bindir}/lipe_test_launch
-%{_bindir}/lipe_test_scheduler
-%config(noreplace) %{_sysconfdir}/lipe_test_scheduler.conf
-%if %{with systemd}
-    %{_unitdir}/lipe_test_scheduler.service
-%else
-    %{_sysconfdir}/rc.d/init.d/lipe_test_scheduler
-%endif
-
 %files lpcc
 %defattr(-,root,root)
 %{_bindir}/lpcc
@@ -349,6 +344,31 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/lpcc-status.8*
 %{_mandir}/man5/lpcc.conf.5*
 
+%if %{with server}
+%files loris
+%{python2_sitelib}/pyloris
+%{_bindir}/loris_backup
+%{_bindir}/loris_crontab
+%{_bindir}/loris_test
+%config(noreplace) %{_sysconfdir}/loris.conf
+
+%files clownfish
+%{python2_sitelib}/pyclownfish
+%{_bindir}/lcreatemany
+%config(noreplace) %{_sysconfdir}/clownfish.conf
+
+%files pyltest
+%{python2_sitelib}/pyltest
+%{_bindir}/lipe_test_console
+%{_bindir}/lipe_test_launch
+%{_bindir}/lipe_test_scheduler
+%config(noreplace) %{_sysconfdir}/lipe_test_scheduler.conf
+%if %{with systemd}
+    %{_unitdir}/lipe_test_scheduler.service
+%else
+    %{_sysconfdir}/rc.d/init.d/lipe_test_scheduler
+%endif
+
 %files server
 %defattr(-,root,root)
 %{_bindir}/ext4_inode2path
@@ -393,6 +413,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/lipe_scan.1*
 %{_mandir}/man1/lipe_find.1*
 %{_mandir}/man1/lfill.1*
+%endif # end server
 
 
 %changelog
index a236eb9..30d8eb8 100644 (file)
@@ -6,15 +6,20 @@ AM_CFLAGS = -g -Wall -Werror $(json_c_CFLAGS)
 AM_LDFLAGS = -llnetconfig -llustreapi -lpthread $(json_c_LIBS)
 
 bin_PROGRAMS = \
+       lpcc_purge
+
+noinst_PROGRAMS = generate_definition
+
+if BUILD_SERVER
+bin_PROGRAMS += \
        ext4_inode2path \
        lcreatemany \
        ldumpstripe \
        lfill \
        lipe_scan \
-       lipe_scan2 \
-       lpcc_purge
+       lipe_scan2
 
-noinst_PROGRAMS = lipe_expression_test generate_definition
+noinst_PROGRAMS += lipe_expression_test
 
 if BUILD_LAUDIT
 bin_PROGRAMS += laudit laudit-report
@@ -23,10 +28,10 @@ endif
 if BUILD_HOTPOOL_UTILS
 bin_PROGRAMS += lamigo lpurge
 endif
+endif
 
-ext4_inode2path_SOURCES = debug.c debug.h ext4_inode2path.c
 
-LIPE_SOURCES = cmd.c cmd.h debug.c debug.h \
+LIPE_SOURCES = debug.c debug.h \
                flist.c flist.h misc.c misc.h \
                lustre_ea.c lustre_ea.h \
                lipe_ldiskfs.c lipe_ldiskfs.h \
@@ -34,11 +39,19 @@ LIPE_SOURCES = cmd.c cmd.h debug.c debug.h \
                lipe_object_attrs.h \
                lipe_version.c \
                lipe_version.h \
-               list.h policy.h policy.c \
+               policy.c policy.h \
                ldiskfs_read_ldd.c ldiskfs_read_ldd.h \
                general_policy.h general_policy.c \
                lustre_ea_ldiskfs.c lustre_ea_ldiskfs.h \
                posix.c posix.h posix_ea.c posix_ea.h
+
+if BUILD_SERVER
+ext4_inode2path_SOURCES = debug.c debug.h ext4_inode2path.c
+
+LIPE_SOURCES += cmd.c cmd.h \
+               list.h
+endif
+
 LIPE_CFLAGS = -Wall -Werror -g -I/usr/include $(json_c_CFLAGS)
 LIPE_LDFLAGS = $(AM_LDFLAGS)
 
@@ -48,6 +61,7 @@ LIPE_LDFLAGS += -lzfs -lzpool -lnvpair
 LIPE_CFLAGS += $(zfs_CFLAGS)
 endif
 
+if BUILD_SERVER
 lipe_scan_SOURCES = lipe_scan.c lipe_config.c lipe_config.h lipe_result.c lipe_result.h $(LIPE_SOURCES)
 lipe_scan_CFLAGS = $(LIPE_CFLAGS)
 lipe_scan_LDFLAGS = $(LIPE_LDFLAGS) -lssl -lcrypto -lyaml
@@ -82,19 +96,21 @@ lpurge_SOURCES = lpurge.c $(LIPE_SOURCES)
 lpurge_CFLAGS = $(LIPE_CFLAGS)
 lpurge_LDFLAGS = $(LIPE_LDFLAGS)
 
-lpcc_purge_SOURCES = lpcc_purge.c $(LIPE_SOURCES)
-lpcc_purge_CFLAGS = $(LIPE_CFLAGS)
-lpcc_purge_LDFLAGS = $(LIPE_LDFLAGS)
-
 lipe_expression_test_SOURCES = lipe_expression_test.c $(LIPE_SOURCES)
 lipe_expression_test_CFLAGS = $(LIPE_CFLAGS)
 lipe_expression_test_LDFLAGS = $(LIPE_LDFLAGS)
 
+endif
+
 generate_definition_SOURCES = generate_definition.c debug.c debug.h \
        general_policy.h
 generate_definition_CFLAGS = -Wall -Werror -Wall -Werror -g
 generate_definition_LDFLAGS =
 
+lpcc_purge_SOURCES = lpcc_purge.c $(LIPE_SOURCES)
+lpcc_purge_CFLAGS = $(LIPE_CFLAGS)
+lpcc_purge_LDFLAGS = $(LIPE_LDFLAGS)
+
 C_FILES = $(wildcard *.c *.h)
 C_CHECKS = $(C_FILES:%=%.c_checked)
 CHECKS = $(C_CHECKS)
index 4258024..7e12276 100644 (file)
@@ -32,6 +32,7 @@
 lustreincludedir = /usr/include/linux/lustre
 lustreinclude_HEADERS = \
        lustre_cfg.h \
+       lustre_disk.h \
        lustre_fid.h \
        lustre_fiemap.h \
        lustre_idl.h \
@@ -46,7 +47,6 @@ if SERVER
 lustreinclude_HEADERS += \
        lustre_access_log.h \
        lustre_barrier_user.h \
-       lustre_disk.h \
        lustre_lfsck_user.h \
        lustre_log_user.h
 endif