Skip to content

Commit

Permalink
Changes: rather avoid jenkins-support-scripts dependency because of c…
Browse files Browse the repository at this point in the history
…yclic deps

Signed-off-by: Miroslav Safr <Miroslav.Safr@gmail.com>
  • Loading branch information
safrm committed Mar 7, 2014
1 parent f91290e commit 69f8fe6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
8 changes: 4 additions & 4 deletions appver.spec
Expand Up @@ -12,7 +12,8 @@ Vendor: Miroslav Safr <miroslav.safr@gmail.com>
Source0: %{name}-%{version}.tar.bz2
Autoreq: on
Autoreqprov: on
BuildRequires: jenkins-support-scripts >= 1.2.1
BuildRequires: libxslt
BuildRequires: docbook-xsl-stylesheets

%description
smart way how to handle versions
Expand All @@ -21,7 +22,8 @@ smart way how to handle versions
%setup -c -n ./%{name}-%{version}

%build
jss-docs-update ./doc -sv %{version}
#rather avoid jenkins-support-scripts update because of cyclic deps
cd doc && ./update_docs.sh ./ -sv %{version} && cd -

%install
rm -fr %{buildroot}
Expand Down Expand Up @@ -50,5 +52,3 @@ done
%{_mandir}/man1/appver.1*




2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -2,7 +2,7 @@ Source: appver
Section: devel
Priority: optional
Maintainer: Miroslav Safr <miroslav.safr@gmail.com>
Build-Depends: debhelper (>= 5),git-core, rpmmake, jenkins-support-scripts (>= 1.2.1)
Build-Depends: debhelper (>= 5),git-core, rpmmake, xsltproc, docbook-xsl
Standards-Version: 3.8.1
Homepage: http://safrm.net/projects/appver

Expand Down
3 changes: 2 additions & 1 deletion debian/rules
Expand Up @@ -12,7 +12,8 @@ export DH_VERBOSE=1
# dh_installchangelogs debian/changelog
override_dh_auto_build:
DEBVERSION=$(dpkg-parsechangelog | sed -n -e 's/^Version: //p' 2>/dev/null)
jss-docs-update ./doc -sv $DEBVERSION
#rather avoid jenkins-support-scripts update because of cyclic deps
./doc/update_docs.sh ./doc -sv $DEBVERSION
dh_auto_build


58 changes: 58 additions & 0 deletions doc/update_docs.sh
@@ -0,0 +1,58 @@
#!/bin/sh
#web: http://safrm.net/projects/appver
#author: Miroslav Safr <miroslav.safr@gmail.com>
#old version of jss-docs-update to avoid cyclic dependency
#first argument passes release version for releasing package builds


command_exists () {
command -v "$1" 1>/dev/null 2>&1 ;
}

if ! command_exists xsltproc ; then
echo "xsltproc does not exist, exiting.."
exit 1
fi

MANXSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl
if [ ! -e $MANXSL ]; then
MANXSL=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
fi

HTMLXSL=/usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl
if [ ! -e $HTMLXSL ]; then
HTMLXSL=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
fi

#automatic version to avoid package recures
#if command -v appver &>/dev/null; then . appver; else APP_SHORT_VERSION=NA ; APP_FULL_VERSION_TAG=NA ; APP_BUILD_DATE=`date +'%Y%m%d_%H%M'`; fi
. ../appver $1

#first syntax and DTD check
if command_exists jss-xml-validator ; then
jss-xml-validator ./ -dtd /usr/share/sgml/docbook/dtd/xml/4.5/docbookx.dtd
if [ $? != 0 ]; then
echo "Syntax errors"
exit 1
fi
else
echo "Syntax and validity check skipped (install jenkins-support-scripts..)"
fi

TEMP_DIR=./tmp
rm -fr $TEMP_DIR && mkdir $TEMP_DIR
#update version and date
for PAGEXML in $( find . -type f -name "*1.xml" )
do
cp $PAGEXML $TEMP_DIR/
sed -i".bkp" "1,/<productnumber>/s/<productnumber>.*/<productnumber>$APP_SHORT_VERSION_TAG<\/productnumber>/" $TEMP_DIR/$PAGEXML && rm -f $TEMP_DIR/$PAGEXML.bkp
sed -i".bkp" "1,/<\/date>/s/<date>.*/<date>$APP_BUILD_DATE<\/date>/" $TEMP_DIR/$PAGEXML && rm -f $TEMP_DIR/$PAGEXML.bkp
done

#generate man and html pages
for PAGEXML in $( find ./tmp -type f -name "*1.xml" )
do
PAGENAME=`basename $PAGEXML .1.xml`
xsltproc -o ./htmlpages/$PAGENAME.html $HTMLXSL $PAGEXML
xsltproc -o ./manpages/$PAGENAME.1 $MANXSL $PAGEXML
done

0 comments on commit 69f8fe6

Please sign in to comment.