From aa863411c358e1b1be61cdd6c00a8c8de499d8f5 Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 2 Jan 2012 12:27:35 +0100 Subject: [PATCH] added option to not package development files --- lib/sde-binary/package.sh | 47 +++++++++++++++++++++++++++++++++---- lib/sde-binary/preconfig.in | 3 ++- scripts/Build-Target | 3 ++- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/lib/sde-binary/package.sh b/lib/sde-binary/package.sh index 2307a53..73eb14c 100755 --- a/lib/sde-binary/package.sh +++ b/lib/sde-binary/package.sh @@ -3,7 +3,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-binary/package.sh -# Copyright (C) 2007 - 2010 The OpenSDE Project +# Copyright (C) 2007 - 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # @@ -31,12 +31,14 @@ Usage: ${0} --type [--versioned] [--root ] [--output ] "$output/$filename.tmp" +tarfilename="$pkg_name${versioned:+-${version}}.tar" + +tmpdir=$( mktemp -d "$SDEROOT/tmp/packaging.$pkg_name.XXXXXXXX" ) +tmpflist="$tmpdir/var/adm/flists/$pkg_name" +tmpcksum="$tmpdir/var/adm/cksums/$pkg_name" +tmpmd5sum="$tmpdir/var/adm/md5sums/$pkg_name" + +# creating backup of var/adm files +mkdir -p "$tmpdir" + +for x in $( grep ' var/adm' "$flist" | cut -d' ' -f2- ); do + mkdir -p "$tmpdir/$(dirname $x)" + cp -a "$root/$x" "$tmpdir/$x" +done + +# pattern to filter development files +if [ "$nodevel" ]; then + filterpattern="-e '/\.\(c\|h\|hpp\|hxx\|o\|a\|la\|m4\|pc\)$/d;'" +fi + +if [ ! -z "$filterpattern" ]; then + eval "sed -i $filterpattern" "$tmpflist" "$tmpcksum" "$tmpmd5sum" +fi + +# create uncompressed tar with the files from the sandbox but without var/adm +( grep -v ' var/adm' "$tmpflist" ) | cut -f2- -d' ' | + tar -C "$root" -cf "$output/$tarfilename.tmp" --no-recursion --files-from=- +errno=$? + +# add adjusted var/adm files from tmpdir to the uncompressed tar +( grep ' var/adm' "$tmpflist" ) | cut -f2- -d' ' | + tar -C "$tmpdir" -rf "$output/$tarfilename.tmp" --no-recursion --files-from=- +errno=$? + +# create the final compressed tar file +eval "$compressor --stdout $output/$tarfilename.tmp > $output/$filename.tmp" errno=$? if [ "$errno" != "0" ]; then echo_error "failed to create '$output/$filename' (errno:$errno)" + rm -f "$output/$tarfilename.tmp" rm -f "$output/$filename.tmp" exit 4 else + rm -rf "$tmpdir" + rm -f "$output/$tarfilename.tmp" mv "$output/$filename.tmp" "$output/$filename" fi diff --git a/lib/sde-binary/preconfig.in b/lib/sde-binary/preconfig.in index 4b7976b..14d8161 100644 --- a/lib/sde-binary/preconfig.in +++ b/lib/sde-binary/preconfig.in @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-binary/preconfig.in -# Copyright (C) 2007 - 2010 The OpenSDE Project +# Copyright (C) 2007 - 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # @@ -29,6 +29,7 @@ EOT cat <> $cfgtmpdir/cache_pkgfile_type.in none 'Create no binary packages' bool 'Append version number to package files' SDECFG_PKGFILE_VER 1 + bool 'Do not package development files' SDECFG_PKGFILE_NODEVEL 0 block_end EOT fi diff --git a/scripts/Build-Target b/scripts/Build-Target index 8eba069..1441041 100755 --- a/scripts/Build-Target +++ b/scripts/Build-Target @@ -3,7 +3,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: scripts/Build-Target -# Copyright (C) 2006 - 2010 The OpenSDE Project +# Copyright (C) 2006 - 2012 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # @@ -239,6 +239,7 @@ pkgloop_package() { else ./lib/sde-binary/package.sh --type "$SDECFG_PKGFILE_TYPE" \ $( if [ "${SDECFG_PKGFILE_VER}" = 1 ]; then echo '--versioned'; fi ) \ + $( if [ "${SDECFG_PKGFILE_NODEVEL}" = 1 ]; then echo '--nodevel'; fi ) \ --root "${build_root}" --output "${build_pkgs}" ${pkg_name} fi fi