daps/fetch_source
Frank Sundermeyer 4787c5564f - Completely rewrote the verbosity stuff:
* Verbosity none: only display on line with result (default)
  * Verbosity 1 (-v, --verbose=1): print the most important target results
  * Verbosity 2 (-vv --verbose=2): print all commands called by make
  * Default verbosity level can be overwritten in ~/.daps/config via
    VERBOSITY=(0|1|2)
- General option -d is no longer supported to avoid confusion with
  subcommand option -d (draft mode) - use --debug instead
- Replaced target clean-book with clean-results
- Updated BUGS and TODO
- Stylesheets:
  * fixed bnc#573835 (PDF metadata)
- Bugfix: BUILD_DIR is now set in the makefiles
- Packaging:
  * added script that generates the source tarball via
    svn export
  * added %{ext_man} to spec file

OBS-URL: https://build.opensuse.org/package/show/Documentation:Tools/daps?expand=0&rev=46
2011-09-19 11:20:18 +00:00

71 lines
1.5 KiB
Bash

#!/bin/bash
#
#
# Create DAPS source tarball from SVN
#
# Copyright (C) 2004 - 2011 SUSE Linux Products GmbH
#
# Author:
# Frank Sundermeyer <fsundermeyer at opensuse dot org>
#
NAME=daps
VERSION=
SPECFILE=${NAME}.spec
SVNPATH=https://svn.berlios.de/svnroot/repos/opensuse-doc/trunk/tools/daps
TMPDIR=$(mktemp -q -d --tmpdir daps_XXXXXXXX)
EXCLUDES=${TMPDIR}/${NAME}/packaging/exclude-files_for_daps_package.txt
#----------
# Functions
#----------
# exit on error
#
function exit_on_error {
echo -e "$1"
rm -rf $TMPDIR
exit 1
}
#-----
# MAIN
#-----
#
# This script needs to be called from the daps osc checkout directory, so
# lets check whethter we are in the correct directory
#
if [[ ! -s daps.spec && ! -d .osc ]]; then
echo "Looks like you are not in the daps checkout directory."
read -p "Continue anyway (y/n) [n]: " CONT
if [[ n = $CONT || N = $CONT ]]; then
exit_on_error "Aborted by user."
fi
fi
#
# Export daps from SVN
#
svn export -q $SVNPATH ${TMPDIR}/${NAME} || exit_on_error "SVN export failed"
#
# Get the version number
#
VERSION=$(egrep "^Version:\s*" ${TMPDIR}/${NAME}/packaging/$SPECFILE | sed 's/^Version:\s*//')
if [[ -z $VERSION ]]; then
exit_on_error "Couldn't get version number from spec-file."
fi
#
# Create the tarball
#
export BZIP2=--best
tar cjhf ${NAME}-${VERSION}.tar.bz2 -C ${TMPDIR} \
--exclude-from=$EXCLUDES ${NAME} || exit_on_error "Failed to create the tarball."
echo "Successfully created ${NAME}-${VERSION}.tar.bz2"
rm -rf ${TMPDIR}
exit 0