Blob Blame Raw
#!/bin/sh

# make sure if some of the commands fails, we will know about that
set -e

if [ $# -ne 1 ]
then
  echo Usage : ./josm-generate-tarball.sh JOSM_SVN_TAG
  exit 1
fi

NAME_VERSION=josm-0
NAME=josm
JOSM_SVN_TAG=$1

# to know svn revision for josm translation, check it in MANIFEST.MF provided by josm svn in trunk/lib/josm-tranlsation.jar

# removing old sources files if exists
rm -rf ${NAME_VERSION} 

# cheking out josm svn
svn -r ${JOSM_SVN_TAG} export https://josm.openstreetmap.de/svn/trunk/ ${NAME_VERSION}

# Delete org.apache.tools.bzip2, it can be found in buildrequires ant package
rm -r ${NAME_VERSION}/src/org/apache
# Delete org.glassfish.json, it can be found in buildrequires ant package
rm -r ${NAME_VERSION}/src/org/glassfish
rm -r ${NAME_VERSION}/src/com/drew
rm -r ${NAME_VERSION}/src/com/kitfox
# The signpost-core package was retired from Fedora so leave it bundled for now
#rm -r ${NAME_VERSION}/src/oauth

# We do not run tests
rm -r ${NAME_VERSION}/test/

# We do not need most of the tools
rm -r ${NAME_VERSION}/tools/error_prone_javac.jar

# We do not need MacOS or Windows things
rm -r ${NAME_VERSION}/macosx
rm -r ${NAME_VERSION}/windows

# Add REVISION.XML to source files
svn -r ${JOSM_SVN_TAG} co https://josm.openstreetmap.de/svn/trunk/ temporary_dir
svn info --xml temporary_dir > ${NAME_VERSION}/REVISION.XML
rm -rf temporary_dir

# Optimize the svg images so the svgsalamander does not choke on them and we have (a bit) smaller tarballs
# Using svgcleaner from "cargo install svgscleaner"
PATH="/home/jjelen/.cargo/bin:$PATH"
find ${NAME_VERSION} -regex ".*.svg" -print0 | xargs -0 -I '{}' svgcleaner '{}' '{}'

# creating source tar
tar zcvf ${NAME_VERSION}.${JOSM_SVN_TAG}svn.tar.gz ${NAME_VERSION} #i18n plugins

# delete temporary directories
rm -rf ${NAME_VERSION} #i18n plugins