From 1a50ac4ba72a0197a23089339cb6c04e5a5eb4ab Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Fri, 2 Jan 2009 22:29:32 -0600 Subject: [PATCH] Add Makepkgs support to xfstests (tar & rpm only so far) Signed-off-by: Eric Sandeen Reviewed-by: Christoph Hellwig --- Makepkgs | 88 ++++++++++++++++++++++++++++++++++++++ build/rpm/macros.template | 30 +++++++++++++ build/rpm/xfstests.spec.in | 49 +++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100755 Makepkgs create mode 100644 build/rpm/macros.template create mode 100644 build/rpm/xfstests.spec.in diff --git a/Makepkgs b/Makepkgs new file mode 100755 index 00000000..d5583b44 --- /dev/null +++ b/Makepkgs @@ -0,0 +1,88 @@ +#! /bin/sh +# +# Make whichever packages have been requested. +# Defaults to RPMs. +# +LOGDIR=Logs + +type=rpm +verbose=false + +MAKE=${MAKE:-make} +test ! -z "$MAKE" && make=$MAKE + +for opt in $* +do + case "$opt" in + clean) + ;; # ignored, kept for backward compatibility + rpm) + type=rpm ;; + debian) + type=debian ;; + verbose) + verbose=true ;; + *) + echo "Usage: Makepkgs [verbose] [debian|rpm]"; exit 1 ;; + esac +done + +# start with a clean manifest +test -f files.rpm && rm -f files.rpm +test -f filesdevel.rpm && rm -f filesdevel.rpm +test -f fileslib.rpm && rm -f fileslib.rpm + +test ! -d $LOGDIR && mkdir $LOGDIR +rm -rf $LOGDIR/* > /dev/null 2>&1 + +# build Debian packages, cleans itself before starting +SUDO=${SUDO:-sudo} +test ! -z "$SUDO" && sudo=$SUDO +if [ $type = debian ] ; then + LOGDEB=`pwd` + LOGDEB=../`basename $LOGDEB`.log + echo "== Debian build, log is $LOGDEB"; echo + if $verbose ; then + dpkg-buildpackage -r$SUDO | tee $LOGDEB + else + dpkg-buildpackage -r$SUDO > $LOGDEB || exit 1 + fi + exit 0 +fi + +# build RPM packages - manual clean before starting +echo "== clean, log is $LOGDIR/clean" +if $verbose ; then + $MAKE clean 2>&1 | tee $LOGDIR/clean +else + $MAKE clean > $LOGDIR/clean 2>&1 || exit 1 +fi + +echo +echo "== configure, log is $LOGDIR/configure" +rm -f .census # force configure to run here +if $verbose ; then + $MAKE configure 2>&1 | tee $LOGDIR/configure +else + $MAKE configure > $LOGDIR/configure 2>&1 || exit 1 +fi + +echo +echo "== default, log is $LOGDIR/default" +if $verbose ; then + $MAKE default 2>&1 | tee $LOGDIR/default +else + $MAKE default > $LOGDIR/default 2>&1 || exit 1 +fi + +echo +echo "== dist, log is $LOGDIR/dist" +[ ! -f .census ] && touch .census +if $verbose ; then + $MAKE -C build dist 2>&1 | tee $LOGDIR/dist +else + $MAKE -C build dist > $LOGDIR/dist 2>&1 || exit 1 + grep '^Wrote:' $LOGDIR/dist | sed -e 's/\.\.\/\.\.\///' +fi + +exit 0 diff --git a/build/rpm/macros.template b/build/rpm/macros.template new file mode 100644 index 00000000..200ba39e --- /dev/null +++ b/build/rpm/macros.template @@ -0,0 +1,30 @@ +# +# rpmrc.template +# +# Template to fudge rpm directory structure inside IRIX-like build +# environment + +# Force 386 build on all platforms +%_target i386-pc-linux +%_target_cpu i386 +%_target_os linux + +# topdir == $(WORKAREA) +%_topdir %topdir% + +# Following directories are specific to the topdir +# This is where build is done. In our case it's the same as $WORKAREA +%_builddir %topdir% + +# This is where foo.1.99.tar.gz is living in the real world. +# Be careful not to run full rpm build as it will override the sources +%_sourcedir %topdir%/build + +# This is where binary RPM and source RPM would end up +%_rpmdir %topdir%/build/rpm +%_srcrpmdir %topdir%/build/rpm +%_specdir %topdir%/build/rpm + +# Leave RPM files in the same directory - we're not building for +# multiple architectures +%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm diff --git a/build/rpm/xfstests.spec.in b/build/rpm/xfstests.spec.in new file mode 100644 index 00000000..338e8839 --- /dev/null +++ b/build/rpm/xfstests.spec.in @@ -0,0 +1,49 @@ +Summary: XFS regression test suite +Name: @pkg_name@ +Version: @pkg_version@ +Release: @pkg_release@ +Distribution: @pkg_distribution@ +Packager: Silicon Graphics, Inc. +BuildRoot: @build_root@ +BuildRequires: autoconf, xfsprogs-devel, e2fsprogs-devel +BuildREquires: libacl-devel, libattr-devel, libaio-devel +Requires: bash, xfsprogs, xfsdump, perl, acl, attr, bind-utils +Requires: bc, indent, quota +Source: @pkg_name@-@pkg_version@.src.tar.gz +License: GPL2+ +Vendor: Silicon Graphics, Inc. +URL: http://oss.sgi.com/projects/xfs/ +Group: System Environment/Base + +%description +The XFS regression test suite. Also includes some support for +acl, attr, dmapi, udf, and nfs testing. Contains around 200 specific tests +for userspace & kernelspace. + +%prep +if [ -f .census ] ; then + if [ ! -d ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION} ] ; then + ln -s . ${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION} + fi +else +%setup +INSTALL_USER=root +INSTALL_GROUP=root +export INSTALL_USER INSTALL_GROUP +@make@ configure +fi + +%build +@make@ + +%install +DIST_ROOT="$RPM_BUILD_ROOT" +DIST_INSTALL=`pwd`/install.manifest +export DIST_ROOT DIST_INSTALL +@make@ install DIST_MANIFEST="$DIST_INSTALL" +@make@ -C build/rpm rpmfiles DIST_MANIFEST="$DIST_INSTALL" + +%clean +rm -rf $RPM_BUILD_ROOT + +%files -f build/rpm/rpmfiles -- 2.30.2