Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-release-src > by-pkgid > 3d02fdcffffceeed72369706428fc9f1 > files > 3

opencpn-4.4.0-2.mga6.src.rpm

#!/bin/bash
#######################################################################
# This script attempts to create versioned tarballs for all the plugins
# and get the latest version of the logbook Layouts and CL-DATA.
# Run this script in the SOURCES directory.
# It also checks upstream version of each plugin against the version in 
# Cauldron and creates a list in SOURCES/PLUGINS/chklist.txt.
#######################################################################
# Set the current upstream LogbookKonni version here:
logbook_ver="1.2"
#######################################################################
mk_tar() {
# mk-tar <upstream_name> <url> <tartype> <mageia_package_name>
cd $wkdir
name=$1
url=$2
tartype=$3
pkgname=$4
chkflag=$5
maj=
min=
patch=
version=
[[ -d git ]] || mkdir git
cd git
[[ -d $name ]] && rm -rf $name
git clone $url $name
cd ..
rm -rf $name && cp -rf git/$name/ .
cd $name

if [[ -f VERSION.cmake ]] ; then
maj=$(cat VERSION.cmake|grep "SET(PLUGIN_VERSION_MAJOR"|cut -d'"' -f2)
min=$(cat VERSION.cmake|grep "SET(PLUGIN_VERSION_MINOR"|cut -d'"' -f2)
patch=$(cat VERSION.cmake|grep "SET(PLUGIN_VERSION_PATCH"|cut -d'"' -f2)
else
maj=$(cat CMakeLists.txt|grep "SET(VERSION_MAJOR"|cut -d'"' -f2)
min=$(cat CMakeLists.txt|grep "SET(VERSION_MINOR"|cut -d'"' -f2)
fi
if [[ -z $maj ]]; then
maj=$(grep -r "   PLUGIN_VERSION_MAJOR   "|rev|cut -d' ' -f1|rev)
min=$(grep -r "   PLUGIN_VERSION_MINOR   "|rev|cut -d' ' -f1|rev)
fi
if [[ -z $patch ]]; then
version=$maj.$min
else
version=$maj.$min.$patch
fi
cd ..

case $tartype in
tar.gz)
opt=z
;;
tar.bz2)
opt=j
;;
tar.xz)
opt=J
;;
tar)
opt=
;;
*)
echo "Unsupported compression type"
exit 1
esac

echo "Please wait creating tarball..."
[[ -f $name-$version.$tartype ]] && rm $name-$version.$tartype
tar -c"$opt"f $name-$version.$tartype $name/ --exclude-vcs
[[ $? = 0 ]] && chmod 644 $name-$version.$tartype && \
echo "Written $name-$version.$tartype"
# If last parameter is Y then check version in Cauldron svn
if [[ $chkflag =~ "Y" ]]; then 
chk-ver
fi

rm -rf $name
# Clear vars created by this fn
pkgname=
name=
url=
tartype=
maj=
min=
patch=
version=
opt=
chkflag=
}

chk-ver() {
# check this version against Mageia svn version
svnver=$(svn cat svn+ssh://svn.mageia.org/svn/packages/cauldron/$pkgname/current/SPECS/$pkgname.spec | \
grep "Version:"|tr -s '\t' ' '|cut -d' ' -f2)
if [[ $svnver == $version ]]; then
echo -e "$pkgname is up to date" >> chklist.txt
else
echo -e "$pkgname is at $svnver in Cauldron, but upstream $name is at $version" >> chklist.txt
fi
# Clear vars created in this fn
svnver=
}

# Main routine -----------
# Check we are in SOURCES
[[ $(pwd|rev|cut -d/ -f1|rev) = "SOURCES" ]] || { echo "Not in SOURCES directory - aborting!"; exit 1; }
mkdir -p PLUGINS
cd PLUGINS
wkdir=$(pwd)
rm -f chklist.txt
rm -rf git
mk_tar LogbookKonni_pi https://github.com/delatbabel/LogbookKonni-$logbook_ver/ tar.gz opencpn
logbook_patch=$patch
mk_tar chartdldr_pi https://github.com/nohal/chartdldr_pi tar.gz opencpn-chartdldr-plugin
mk_tar squiddio_pi https://github.com/mauroc/squiddio_pi tar.gz opencpn-squiddio-plugin
mk_tar BR24radar_pi https://github.com/canboat/BR24radar_pi/ tar.gz opencpn-br24radar-plugin
mk_tar objsearch_pi https://github.com/nohal/objsearch_pi tar.gz opencpn-objsearch-plugin
mk_tar statusbar_pi https://github.com/seandepagnier/statusbar_pi tar.gz opencpn-statusbar-plugin
mk_tar watchdog_pi https://github.com/seandepagnier/watchdog_pi tar.gz opencpn-watchdog-plugin
mk_tar iacfleet_pi https://github.com/nohal/iacfleet_pi tar.gz opencpn-iacfleet-plugin
mk_tar weatherfax_pi https://github.com/seandepagnier/weatherfax_pi tar.gz opencpn-weatherfax-plugin
mk_tar route_pi https://github.com/SaltyPaws/route_pi tar.gz 
mk_tar SAR_pi https://github.com/SaltyPaws/SAR_pi tar.gz
mk_tar climatology_pi https://github.com/seandepagnier/climatology_pi tar.gz opencpn-climatology-plugin
mk_tar polar_pi https://github.com/ptulp/polar_pi tar.gz opencpn-polar-plugin
mk_tar weather_routing_pi https://github.com/seandepagnier/weather_routing_pi tar.gz opencpn-weather-routing-plugin
mk_tar s63_pi https://github.com/bdbcat/s63_pi/ tar.gz opencpn-s63-plugin
mk_tar celestial_navigation_pi https://github.com/seandepagnier/celestial_navigation_pi tar.gz opencpn-celestial-navigation-plugin
mk_tar radar_pi https://github.com/Verezano/radar_pi tar.gz opencpn-ais-radar-plugin
rm -rf git

# Get version of CL-DATA
cl_ver=$(lynx --dump http://sourceforge.net/projects/opencpnplugins/files/climatology_pi/ |grep -m1 "CL-DATA-"|cut -d- -f3|rev|cut -d. -f3-|rev)
# Download it if not in SOURCES
[[ -e ../CL-DATA-$cl_ver.tar.xz ]] || \
wget http://sourceforge.net/projects/opencpnplugins/files/climatology_pi/CL-DATA-$cl_ver.tar.xz

# Get Layouts
[[ -e LogbookKonni_Layouts.zip ]] && rm LogbookKonni_Layouts.zip
#wget https://github.com/delatbabel/LogbookKonni-$logbook_ver/releases/download/v$logbook_ver$logbook_patch/LogbookKonni_Layouts.zip
wget http://downloads.sourceforge.net/project/opencpnplugins/logbookkonni_pi/LogbookKonni_Layouts.zip