From 10cf8694272e24f6519c8c33e32a084ccdb25b5a Mon Sep 17 00:00:00 2001 From: Lukas Berk Date: Tue, 26 Jul 2016 12:06:03 -0400 Subject: [PATCH] Ensure man pages aren't built if unnecessary Previously, man pages for some packages we're packaged regardless if and were already found on the system (such as perl packages). This caused breakages building on some packages (like containers). Adjust some config variables to be passed to builddefs.in --- build/rpm/GNUmakefile | 1 + build/rpm/pcp.spec.in | 1 - configure | 8 ++++++++ configure.ac | 7 +++++++ src/include/builddefs.in | 10 +++++++++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/build/rpm/GNUmakefile b/build/rpm/GNUmakefile index 17b959414..540c9d264 100644 --- a/build/rpm/GNUmakefile +++ b/build/rpm/GNUmakefile @@ -104,6 +104,7 @@ pcp.spec: pcp.spec.in -e's|@pcp_etc_dir@|$(PCP_ETC_DIR)|g' \ -e's|@pcp_pmdas_dir@|$(PCP_PMDAS_DIR)|g' \ -e's|@rpm_version@|$(RPM_VERSION)|g' \ + -e's|@have_manpages@|$(HAVE_MANPAGES)|g' \ -e's|@make@|$(PCP_MAKE_PROG)|g' <$? >$@ include $(BUILDRULES) diff --git a/build/rpm/pcp.spec.in b/build/rpm/pcp.spec.in index f904a2861..6ec980b94 100755 --- a/build/rpm/pcp.spec.in +++ b/build/rpm/pcp.spec.in @@ -2046,7 +2046,6 @@ BEGIN { while( getline < "import_mrtg2pcp_files") import_mrtg2pcp[$0]=1; while( getline < "import_ganglia2pcp_files") import_ganglia2pcp[$0]=1; while( getline < "import_collectl2pcp_files") import_collectl2pcp[$0]=1; - while( getline < "import_collectl2pcp_files") import_collectl2pcp[$0]=1; while( getline < "conf_files") conf[nconf++]=$0; } { diff --git a/configure b/configure index 730ad9ba9..96a856124 100755 --- a/configure +++ b/configure @@ -659,6 +659,7 @@ have_xzed_manpages have_lzmaed_manpages have_bzip2ed_manpages have_gzipped_manpages +have_manpages pcp_man_dir pcp_x11_pre pcp_x11_extra @@ -13985,6 +13986,7 @@ pcp_x11_extra=$X_EXTRA_LIBS pcp_x11_pre=$X_PRE_LIBS +have_manpages=false have_gzipped_manpages=false have_bzip2ed_manpages=false have_lzmaed_manpages=false @@ -14001,26 +14003,31 @@ do if test -f $d/$sd/man.1.gz then have_gzipped_manpages=true + have_manpages=true man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1` break elif test -f $d/$sd/man.1.bz2 then have_bzip2ed_manpages=true + have_manpages=true man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1` break elif test -f $d/$sd/man.1.lzma then have_lzmaed_manpages=true + have_manpages=true man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1` break elif test -f $d/$sd/man.1.xz then have_xzed_manpages=true + have_manpages=true man_header=`$XZ -d < $d/$sd/man.1.xz | head -1` break elif test -f $d/$sd/man.1 then man_header=`head -1 $d/$sd/man.1` + have_manpages=true break fi done @@ -14035,6 +14042,7 @@ fi + pcp_bin_dir=`eval echo $bindir` pcp_bin_dir=`eval echo $pcp_bin_dir` diff --git a/configure.ac b/configure.ac index 3e8cd5401..0412f77e6 100644 --- a/configure.ac +++ b/configure.ac @@ -2825,6 +2825,7 @@ pcp_x11_pre=$X_PRE_LIBS AC_SUBST(pcp_x11_pre) dnl man pages (source) +have_manpages=false have_gzipped_manpages=false have_bzip2ed_manpages=false have_lzmaed_manpages=false @@ -2842,26 +2843,31 @@ do if test -f $d/$sd/man.1.gz then have_gzipped_manpages=true + have_manpages=true man_header=`$ZIP -d < $d/$sd/man.1.gz | head -1` break elif test -f $d/$sd/man.1.bz2 then have_bzip2ed_manpages=true + have_manpages=true man_header=`$BZIP2 -d < $d/$sd/man.1.bz2 | head -1` break elif test -f $d/$sd/man.1.lzma then have_lzmaed_manpages=true + have_manpages=true man_header=`$LZMA -d < $d/$sd/man.1.lzma | head -1` break elif test -f $d/$sd/man.1.xz then have_xzed_manpages=true + have_manpages=true man_header=`$XZ -d < $d/$sd/man.1.xz | head -1` break elif test -f $d/$sd/man.1 then man_header=`head -1 $d/$sd/man.1` + have_manpages=true break fi done @@ -2870,6 +2876,7 @@ if test x"$man_header" = "x'\\\" t" -o x"$man_header" = "x'\\\" te" ; then need_old_tbl_header=true fi AC_SUBST(pcp_man_dir) +AC_SUBST(have_manpages) AC_SUBST(have_gzipped_manpages) AC_SUBST(have_bzip2ed_manpages) AC_SUBST(have_lzmaed_manpages) diff --git a/src/include/builddefs.in b/src/include/builddefs.in index 470aa0598..6a41d3c14 100644 --- a/src/include/builddefs.in +++ b/src/include/builddefs.in @@ -218,6 +218,7 @@ PUBLICAN = @publican@ BOOK_TOOLCHAIN = @book_toolchain@ BOOK_BRAND = @book_brand@ +HAVE_MANPAGES = @have_manpages@ HAVE_GZIPPED_MANPAGES = @have_gzipped_manpages@ HAVE_BZIP2ED_MANPAGES = @have_bzip2ed_manpages@ HAVE_LZMAED_MANPAGES = @have_lzmaed_manpages@ @@ -464,6 +465,7 @@ INSTALL_MAN = else INSTALL_MAN = \ test -z "$$MAN_PAGES" && MAN_PAGES="$(MAN_PAGES)"; \ + if [ "$(HAVE_MANPAGES)" = "true" ] ; then \ for d in `echo $$MAN_PAGES`; do \ first=true; \ base=`echo $$d | sed -e 's/\.[0-9]//g'`; \ @@ -520,7 +522,8 @@ state==1 { for (i=1;i<=NF;i++) { \ fi; \ first=false; \ done; \ - done + done; \ + fi endif PERL_INSTALL_BASE = @perl_install_base@ @@ -594,6 +597,11 @@ PERL_GET_FILELIST = \ $(HAVE_BZIP2ED_MANPAGES) && _sfx=.bz2; \ $(HAVE_LZMAED_MANPAGES) && _sfx=.lzma; \ $(HAVE_XZED_MANPAGES) && _sfx=.xz; \ + if [ "$(HAVE_MANPAGES)" = "false" ] ; then \ + sed -e '/.*man[1-9].*/d' -e '/.*3pm.*/d' $(2) >$(2).tmp; \ + mv $(2).tmp $(2); \ + find $$DIST_ROOT/$(PERL_INSTALL_BASE) -name "*3pm*" -exec rm -rf '{}' ';' ; \ + fi ;\ sed -n -e '/\.bs$$/d' -e 's/\.[0-9]pm$$/&'"$$_sfx/" -e "s@^$$DIST_ROOT@@p" $(2) >$(2).tmp; \ mv $(2).tmp $(2); \ else echo "Arrgh ... no files to include in package via $(2)"; exit 1; \ -- 2.11.4.GIT