From 7758af6646d8993acd2e5092dd375d96ce6849d9 Mon Sep 17 00:00:00 2001 From: "Charlton, Scott R" Date: Wed, 31 Mar 2021 16:17:28 -0600 Subject: [PATCH] updated build script versioning --- jenkins-R-dist.sh | 41 +++++++++++++++++++++++++++++------------ jenkins-dist-build.ps1 | 32 +++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/jenkins-R-dist.sh b/jenkins-R-dist.sh index b49d89ae..8cf84035 100755 --- a/jenkins-R-dist.sh +++ b/jenkins-R-dist.sh @@ -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 diff --git a/jenkins-dist-build.ps1 b/jenkins-dist-build.ps1 index 93070a1e..b993b02d 100644 --- a/jenkins-dist-build.ps1 +++ b/jenkins-dist-build.ps1 @@ -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 ..