mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-13 07:08:23 +01:00
updated build script versioning
This commit is contained in:
parent
549d2625b2
commit
7758af6646
@ -1,27 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# set DATE
|
||||
#
|
||||
if [ -z "$DATE" ]; then
|
||||
DATE=$(date "+%x")
|
||||
fi
|
||||
DATE=$(date -d $DATE "+%Y-%m-%d")
|
||||
|
||||
#
|
||||
# set VER
|
||||
#
|
||||
if [ -z "$VER" ]; then
|
||||
wget https://cran.r-project.org/package=phreeqc -O index.xhtml 2> /dev/null
|
||||
VER=`xmlstarlet sel -t -m "/_:html/_:body/_:table[1]/_:tr[1]/_:td[2]" -v . -n index.xhtml 2> /dev/null`
|
||||
ver_major=`echo $VER | cut -d '.' -f 1`
|
||||
ver_minor=`echo $VER | cut -d '.' -f 2`
|
||||
ver_patch=`echo $VER | cut -d '.' -f 3`
|
||||
###wget https://cran.r-project.org/package=phreeqc -O index.xhtml 2> /dev/null
|
||||
###VER=`xmlstarlet sel -t -m "/_:html/_:body/_:table[1]/_:tr[1]/_:td[2]" -v . -n index.xhtml 2> /dev/null`
|
||||
VER=$(curl https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/phreeqc-version.txt)
|
||||
ver_major=$(echo "$VER" | cut -d '.' -f 1)
|
||||
ver_minor=$(echo "$VER" | cut -d '.' -f 2)
|
||||
ver_patch=$(echo "$VER" | cut -d '.' -f 3)
|
||||
ver_patch=$((ver_patch+1))
|
||||
VER="${ver_major}.${ver_minor}.${ver_patch}"
|
||||
else
|
||||
ver_major=$(echo "$VER" | cut -d '.' -f 1)
|
||||
ver_minor=$(echo "$VER" | cut -d '.' -f 2)
|
||||
ver_patch=$(echo "$VER" | cut -d '.' -f 3)
|
||||
fi
|
||||
if [ "$REL" = 'HEAD' ]; then
|
||||
HEAD=13021
|
||||
if [ -z "$ver_major" ] || [ -z "$ver_minor" ] || [ -z "$ver_patch" ]; then
|
||||
exit 1
|
||||
fi
|
||||
VER="${ver_major}.${ver_minor}.${ver_patch}"
|
||||
export VER
|
||||
|
||||
#
|
||||
# set REL
|
||||
#
|
||||
curl https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/ver.py -o ver.py
|
||||
HEAD=$(python ver.py)
|
||||
if [ -z "$REL" ]; then
|
||||
REL="$HEAD"
|
||||
fi
|
||||
if [ -z "$REL" ]; then
|
||||
REL=13021
|
||||
fi
|
||||
export VER
|
||||
|
||||
# sed files
|
||||
/bin/sh jenkins-dist.sh -v ${VER} -r ${REL} -d ${DATE} -pr ${TAG}
|
||||
cd R
|
||||
|
||||
@ -4,12 +4,18 @@
|
||||
# Sysinternals. The -UseBasicParsing flag may also be required.
|
||||
#
|
||||
|
||||
#
|
||||
# set DATE
|
||||
#
|
||||
if ([string]::IsNullOrEmpty($Env:DATE)) {
|
||||
$Env:DATE = date +%x
|
||||
}
|
||||
$Env:DATE = date -d $Env:DATE +%x
|
||||
$Env:RELEASE_DATE = date -d $Env:DATE "+%B %e, %G"
|
||||
|
||||
#
|
||||
# set VER
|
||||
#
|
||||
if ([string]::IsNullOrEmpty($Env:VER)) {
|
||||
$request = Invoke-WebRequest https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/phreeqc-version.txt -UseBasicParsing
|
||||
$v = ($request.Content) -split "\."
|
||||
@ -22,13 +28,28 @@ if ([string]::IsNullOrEmpty($Env:VER)) {
|
||||
$Env:ver_patch = $v[2]
|
||||
$Env:VER = $v -join "."
|
||||
}
|
||||
else {
|
||||
$v = ($Env:VER) -split "\."
|
||||
$Env:ver_major = $v[0]
|
||||
$Env:ver_minor = $v[1]
|
||||
$Env:ver_patch = $v[2]
|
||||
}
|
||||
if ([string]::IsNullOrEmpty($v[0]) -or [string]::IsNullOrEmpty($v[1]) -or [string]::IsNullOrEmpty($v[2])) {
|
||||
throw "Bad VER"
|
||||
}
|
||||
|
||||
#
|
||||
# set REL
|
||||
#
|
||||
Invoke-WebRequest https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/ver.py -OutFile ver.py -UseBasicParsing
|
||||
$HEAD=$(python ver.py)
|
||||
if ([string]::IsNullOrEmpty($Env:REL)) {
|
||||
$Env:REL = $HEAD
|
||||
}
|
||||
# duplicate build/dist.sh
|
||||
|
||||
#
|
||||
# replace strings
|
||||
#
|
||||
$sed_files=@('phreeqc3-doc/RELEASE.TXT', `
|
||||
'src/Version.h', `
|
||||
'src/IPhreeqc.h')
|
||||
@ -45,13 +66,18 @@ foreach ($file in $sed_files) {
|
||||
} | Set-Content $file
|
||||
}
|
||||
|
||||
#
|
||||
# doxygen
|
||||
cd doc
|
||||
#
|
||||
Set-Location doc
|
||||
doxygen
|
||||
|
||||
#
|
||||
# hhc seems to return 1 on success and 0 (zero) on failure
|
||||
# see https://stackoverflow.com/questions/39012558/html-help-workshop-returns-error-after-successfully-compiled-chm-file
|
||||
#
|
||||
hhc IPhreeqc.hhp
|
||||
if (-Not $?) {
|
||||
$LastExitCode = 0
|
||||
}
|
||||
cd ..
|
||||
Set-Location ..
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user