aff04e7652
Find issues in our GitHub tracker at https://github.com/openSUSE/suse-xsl/issues/NUMBER PDF only: * Support footnotes, requested by Stefan Quandt (suse-xsl #313, suse-xsl #314) * No colons after type/number in languages other than English (suse-xsl #334) HTML only: * Glossdiv Title: rendered in gray instead of green (suse-xsl #350) PDF/HTML: * No more spaces at the end of titles in formalparas (suse-xsl #288) * Intra xref to step doesn't work (suse-xsl #343) I18N: * ja: don't generate the word "book" in intra-xrefs (suse-xsl #323) * Correct German quotes (suse-xsl #324, suse-xsl #340) * glossseealso: "See Also" -> "See also" (suse-xsl #330) General: * Exclude drupal and db2mediawiki stylesheets as they are now obsolete (suse-xsl #310, suse-xsl #312) * Check length of text content in screen (suse-xsl #328) * Validate stylesheets through Jing in Travis (suse-xsl #327, suse-xsl #337, suse-xsl #342) Project/Spec File: * Use catalog.d mechanism and remove old XML catalog files, see https://en.opensuse.org/openSUSE:Packaging_XML_Schemas_and_Stylesheets#Add_XML_Catalog_Support * Fix susexsl-fetch-source-git script: OBS-URL: https://build.opensuse.org/package/show/Documentation:Tools/suse-xsl-stylesheets?expand=0&rev=115
153 lines
3.3 KiB
Bash
153 lines
3.3 KiB
Bash
#!/bin/bash
|
|
#
|
|
#
|
|
# Create suse-xsl source tarball from GitHub
|
|
# Needed because we would like to exclude unnecessary stuff from
|
|
# the source RPM in order to keep it lean
|
|
#
|
|
# Copyright (C) 2015 SUSE Linux GmbH
|
|
#
|
|
# Author:
|
|
# Frank Sundermeyer <fsundermeyer at opensuse dot org>
|
|
#
|
|
#
|
|
|
|
NAME=suse-xsl
|
|
PNAME=suse-xsl-stylesheets
|
|
VERSION=
|
|
SPECFILE=${PNAME}.spec
|
|
TMPDIR=$(mktemp -q -d --tmpdir susexsl_XXXXXXXX)
|
|
|
|
#----------
|
|
# Functions
|
|
#----------
|
|
|
|
# exit on error
|
|
#
|
|
function exit_on_error {
|
|
echo -e "$1"
|
|
# rm -rf $TMPDIR
|
|
exit 1
|
|
}
|
|
|
|
function help {
|
|
echo -e "$(basename $0) <ARCHIVE_FILENAME>\n"
|
|
}
|
|
|
|
function download_archive {
|
|
echo "Downloading archive:"
|
|
(cd $TMPDIR && wget --connect-timeout=10 -nv $ARCHIVE_URL) || exit_on_error "Download of $ARCHIVE_URL failed"
|
|
}
|
|
|
|
function copy_archive {
|
|
echo "Copying archive:"
|
|
cp -v $ARCHIVE_URL $TMPDIR || exit_on_error "Copying of $ARCHIVE_URL failed"
|
|
}
|
|
|
|
function detect_archive {
|
|
case ${ARCHIVE_NAME##*.} in
|
|
zip)
|
|
UNPACK="unzip"
|
|
ARCHIVE_DIR=$(basename $ARCHIVE_NAME .zip)
|
|
;;
|
|
gz)
|
|
UNPACK="tar xfz"
|
|
ARCHIVE_DIR=$(basename $ARCHIVE_NAME .tar.gz)
|
|
;;
|
|
bz2)
|
|
UNPACK="tar xfj"
|
|
ARCHIVE_DIR=$(basename $ARCHIVE_NAME .tar.bz2)
|
|
;;
|
|
*)
|
|
exit_on_error "Unknown archive format"
|
|
esac
|
|
}
|
|
|
|
function unpack_archive {
|
|
SRC_DIR=${TMPDIR}/${PNAME}
|
|
pushd $TMPDIR
|
|
mkdir $PNAME
|
|
$UNPACK $ARCHIVE_NAME -C $PNAME --strip-components 1
|
|
[[ $? ]] || exit_on_error "Unpacking $ARCHIVE_NAME failed"
|
|
popd
|
|
}
|
|
#-----
|
|
# MAIN
|
|
#-----
|
|
#
|
|
# Check for archive file name
|
|
#
|
|
if [[ -z $1 ]]; then
|
|
exit_on_error "Please specify a URL for a suse-xsl release archive on Github, e.g.\https://github.com/openSUSE/suse-xsl/archive/2.0-rc5.tar.gz. Alternatively, use --tag [TAG_NAME]."
|
|
elif [[ $1 = '--tag' ]] && [[ $2 ]]; then
|
|
ARCHIVE_URL="https://github.com/openSUSE/suse-xsl/archive/$2.tar.gz"
|
|
ARCHIVE_NAME="${ARCHIVE_URL##*/}"
|
|
else
|
|
ARCHIVE_URL="$1"
|
|
ARCHIVE_NAME="${ARCHIVE_URL##*/}"
|
|
fi
|
|
|
|
# This script needs to be called from the osc checkout directory, so
|
|
# lets check whether we are in the correct directory
|
|
#
|
|
if [[ ! -s $SPECFILE && ! -d .osc ]]; then
|
|
echo "Looks like you are not in the suse-xsl checkout directory."
|
|
read -p "Continue anyway (y/n) [n]: " CONT
|
|
if [[ n = $CONT || N = $CONT ]]; then
|
|
exit_on_error "Aborted by user."
|
|
fi
|
|
fi
|
|
|
|
#-----------
|
|
# Download archive
|
|
#
|
|
|
|
if [[ ${ARCHIVE_URL} == http* ]]; then
|
|
download_archive
|
|
else
|
|
copy_archive
|
|
fi
|
|
|
|
#-----------
|
|
# Unpack archive
|
|
#
|
|
detect_archive
|
|
unpack_archive
|
|
|
|
|
|
#-----------
|
|
# Get the version number
|
|
#
|
|
VERSION=$(egrep "^Version:\s*" ./$SPECFILE | sed 's/^Version:\s*//')
|
|
|
|
if [[ -z $VERSION ]]; then
|
|
exit_on_error "Couldn't get version number from spec-file."
|
|
fi
|
|
|
|
echo "Detected version=$VERSION"
|
|
|
|
#-----------
|
|
# Create the tarball
|
|
#
|
|
export BZIP2=--best
|
|
tar cf ${PNAME}-${VERSION}.tar -C ${TMPDIR} ${PNAME} || exit_on_error "Failed to create the tarball."
|
|
bzip2 ${PNAME}-${VERSION}.tar
|
|
|
|
echo "Successfully wrote source tarball ${PNAME}-${VERSION}.tar.bz2"
|
|
#
|
|
# Copy the spec file if necessary
|
|
#
|
|
if [[ -e ${SRC_DIR}/packaging/$SPECFILE ]]; then
|
|
diff -q $SPECFILE ${SRC_DIR}/packaging/$SPECFILE >/dev/null
|
|
if [[ 0 = $? ]]; then
|
|
echo "Spec file is up-to-date."
|
|
else
|
|
cp ${SRC_DIR}/packaging/$SPECFILE . || exit_on_error "Failed to copy the specfile."
|
|
echo "Successfully updated the spec file."
|
|
fi
|
|
fi
|
|
|
|
#rm -rf ${TMPDIR}
|
|
|
|
exit 0
|