[ooo-build-commit] .: bin/ooo-unpack-sources

Petr Mladek pmladek at kemper.freedesktop.org
Thu Sep 9 05:25:45 PDT 2010


 bin/ooo-unpack-sources |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

New commits:
commit f9af3a460f09ac2d09352658921a25911d5a6642
Author: Petr Mladek <pmladek at walk.suse.cz>
Date:   Thu Sep 9 14:21:56 2010 +0200

    ooo-unpack-sources: new helper script for unpacking ooo source tarballs
    
    * bin/ooo-unpack-sources: the new source tarballs have piece-specific top dir;
      this script helps to unpack them and move all modules into a directory

diff --git a/bin/ooo-unpack-sources b/bin/ooo-unpack-sources
new file mode 100755
index 0000000..96b3b79
--- /dev/null
+++ b/bin/ooo-unpack-sources
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+usage()
+{
+    echo "This script unpack ooo source tarballs generated by ooo-pack-sources and"
+    echo "move all modules into a single dir"
+    echo
+    echo "Usage: ${0##*/} [--help] version"
+    echo
+    echo "Parameters:"
+    echo
+    echo "	version:     version of the source tarballs, e.g. 3.3.0.2"
+}
+
+version=
+tarball_prefix="ooo-build"
+
+while test -n "$1" ; do
+    case "$1" in
+	--help)
+	    usage
+	    exit 0;
+	    ;;
+	-*)
+	    echo "Error: unknown option: $1"
+	    exit 1;
+	    ;;
+	*)
+	    if test -z "$version" ; then
+		version="$1"
+	    else
+		echo "Error: unknown parameter: $1"
+	    fi
+	    ;;
+    esac
+    shift
+done
+
+if test -z "$version" ; then
+    echo "Error: Please, define the version. Try --help"
+    exit 1;
+fi
+
+outdir="$tarball_prefix-$version"
+
+if test -d "$outdir" ; then
+    echo "Warning: output directory already exists: $outdir"
+    read -p "Could I replace it? (y/n)" answer
+    if test $answer != "y" ; then
+        echo "	Exiting. You must answer \"y\" to continue"
+	exit 1;
+    fi
+    rm -rf "$outdir"
+fi
+
+mkdir -p "$outdir"
+
+for tarball in $tarball_prefix-$version-*.tar.bz2 ; do
+    echo -n "Unpacking $tarball"
+    tempdir=`mktemp -d "$outdir/$tarball_prefix-$version-XXXXXX"`
+    checkpoint=`du $tarball | cut -f 1`
+    checkpoint=$(($checkpoint / 15 + 1))
+    tar -xf $tarball -C $tempdir --checkpoint=$checkpoint 2>&1 | awk '{ ORS="" ; printf "." ; fflush() }'
+    echo
+    mv $tempdir/*/* $outdir
+    rm -rf $tempdir
+done


More information about the ooo-build-commit mailing list