Skip to content

Commit

Permalink
cronjob: fix red new version box injection and script documentation (#…
Browse files Browse the repository at this point in the history
…1173)

This PR modifies the way to inject the "Note: This document is for an older version of GRASS GIS ..." red boxes into the manual page.
Now duplicate boxes should no longer show up.

(affects G78 and G83 core manual and related addon manual pages)

Also significantly improve script documentation.
  • Loading branch information
neteler authored Aug 29, 2024
1 parent fc565ea commit 428c2f7
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 187 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# script to build GRASS GIS new current binaries + addons + progman from the `releasebranch_8_4` binaries
# script to build GRASS GIS new current binaries + addons + progman from the `releasebranch_8_4` branch
# (c) 2002-2024, GPL 2+ Markus Neteler <neteler@osgeo.org>
#
# GRASS GIS github, https://github.com/OSGeo/grass
Expand All @@ -15,7 +15,7 @@
# - generates the user 8 HTML manuals
# - injects DuckDuckGo search field

# Preparations, on server:
# Preparations, on server (neteler@grasslxd:$):
# - Install PROJ incl Datum shift grids
# - Install GDAL
# - Install apt-get install texlive-latex-extra python3-sphinxcontrib.apidoc
Expand All @@ -31,7 +31,9 @@
# ln -s /var/www/code_and_data/grass84 .
#
#################################
PATH=/home/neteler/binaries/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin
# variables for build environment (grass.osgeo.org specific)
MAINDIR=/home/neteler
PATH=$MAINDIR/bin:/bin:/usr/bin:/usr/local/bin

GMAJOR=8
GMINOR=4
Expand All @@ -40,7 +42,6 @@ DOTVERSION=$GMAJOR.$GMINOR
VERSION=$GMAJOR$GMINOR
GVERSION=$GMAJOR

###################
# fail early
set -e

Expand All @@ -49,9 +50,7 @@ CFLAGSSTRING='-O2'
CFLAGSSTRING='-Werror-implicit-function-declaration -fno-common'
LDFLAGSSTRING='-s'

#define several paths if required:

MAINDIR=/home/neteler
# define GRASS GIS build related paths:
# where to find the GRASS sources (git clone):
SOURCE=$MAINDIR/src/
BRANCH=releasebranch_${GMAJOR}_$GMINOR
Expand All @@ -78,18 +77,17 @@ halt_on_error()
exit 1
}

# function to configure for compilation
configure_grass()
{

# which package?
# --with-mysql --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql \

# cleanup
# cleanup from previous run
rm -f config_$GMAJOR.$GMINOR.git_log.txt

# reset i18N POT files to git, just to be sure
git checkout locale/templates/*.pot

# configure for compilation
CFLAGS=$CFLAGSSTRING LDFLAGS=$LDFLAGSSTRING ./configure \
--with-cxx \
--with-sqlite \
Expand All @@ -104,6 +102,7 @@ CFLAGS=$CFLAGSSTRING LDFLAGS=$LDFLAGSSTRING ./configure \
--with-pdal \
--with-fftw \
--with-nls \
--with-libsvm \
--with-blas --with-blas-includes=/usr/include/atlas/ \
--with-lapack --with-lapack-includes=/usr/include/atlas/ \
--with-zstd \
Expand All @@ -114,12 +113,12 @@ CFLAGS=$CFLAGSSTRING LDFLAGS=$LDFLAGSSTRING ./configure \
fi
}

######## update from git:
# be sure the directories are there

mkdir -p $TARGETDIR
cd $GRASSBUILDDIR/

# clean up
# clean up from previous run
touch include/Make/Platform.make
$MYMAKE distclean > /dev/null 2>&1

Expand All @@ -128,31 +127,30 @@ git status | grep '.rst' | xargs rm -f
rm -rf lib/python/docs/_build/ lib/python/docs/_templates/layout.html
rm -f config_${DOTVERSION}.git_log.txt ChangeLog

# be sure to be on branch
# be sure to be on the right branch
git checkout $BRANCH

echo "git update..."
git fetch --all --prune && git checkout $BRANCH && git pull --rebase || halt_on_error "git update error!"
git status

# for the contributors list in CMS
# for the "contributors list" in old CMSMS (still needed for hugo?)
cp -f *.csv $TARGETMAIN/uploads/grass/

#configure
# configure for compilation
echo "configuring"
configure_grass || (echo "$0: an error occurred" ; exit 1)
pwd
ARCH=`cat include/Make/Platform.make | grep ^ARCH | cut -d'=' -f2 | xargs`

######## now GRASS is prepared ####################

#### next compile GRASS:
######## now GRASS GIS source code is prepared ####################
#### next compile GRASS, takes a while
$MYMAKE


echo "GRASS $VERSION compilation done"

# now GRASS is prepared ############################################
######## now GRASS GIS binaries are prepared ####################

#### create module overview (https://trac.osgeo.org/grass/ticket/1203)
#sh utils/module_synopsis.sh
Expand All @@ -175,9 +173,11 @@ rm -f $TARGETHTMLDIR/*.*
cp -rp dist.$ARCH/docs/html/* $TARGETHTMLDIR/
echo "Copied pygrass progman to http://grass.osgeo.org/grass${VERSION}/manuals/libpython/"

# search to be improved with mkdocs or similar; for now we use DuckDuckGo
echo "Injecting DuckDuckGo search field into manual main page..."
(cd $TARGETHTMLDIR/ ; sed -i -e "s+</table>+</table><\!\-\- injected in cron_grass8_relbranch_build_binaries.sh \-\-> <center><iframe src=\"https://duckduckgo.com/search.html?site=grass.osgeo.org%26prefill=Search%20manual%20pages%20at%20DuckDuckGo\" style=\"overflow:hidden;margin:0;padding:0;width:410px;height:40px;\" frameborder=\"0\"></iframe></center>+g" index.html)

# copy important files to web space
cp -p AUTHORS CHANGES CITING CITATION.cff COPYING GPL.TXT INSTALL.md REQUIREMENTS.md $TARGETDIR/

# clean wxGUI sphinx manual etc
Expand Down Expand Up @@ -233,19 +233,19 @@ cat i18n_stats.txt | grep lib > i18n_stats_libs.txt
cat i18n_stats.txt | grep wxpy > i18n_stats_wxpy.txt
cd $GRASSBUILDDIR

# package the package
# package the GRASS GIS package
$MYMAKE bindist
if [ $? -ne 0 ] ; then
halt_on_error "make bindist."
fi

#report system:
# report system:
echo "System:
$ARCH, compiled with:" > grass-$DOTVERSION\_$ARCH\_bin.txt
## echo "Including precompiled $GDALVERSION library for r.in.gdal" >> grass-$DOTVERSION\_$ARCH\_bin.txt
gcc -v 2>&1 | grep -v Reading >> grass-$DOTVERSION\_$ARCH\_bin.txt

# clean old version off
# clean old version from previous run
rm -f $TARGETDIR/grass-$DOTVERSION\_$ARCH\_bin.txt
rm -f $TARGETDIR/grass-${DOTVERSION}*.tar.gz
rm -f $TARGETDIR/grass-${DOTVERSION}*install.sh
Expand Down Expand Up @@ -273,7 +273,7 @@ cd $GRASSBUILDDIR
# compile addons

# update addon repo (addon repo has been cloned twice on the server to
# separate grass7 and grass8 addon compilation)
# have separate grass7 and grass8 addon compilation)
(cd ~/src/grass$GMAJOR-addons/; git checkout grass$GMAJOR; git pull origin grass$GMAJOR)
# compile addons
cd $GRASSBUILDDIR
Expand All @@ -298,14 +298,15 @@ for dir in `find ~/.grass$GMAJOR/addons -maxdepth 1 -type d`; do
fi
done
sh ~/cronjobs/grass-addons-index.sh $GMAJOR $GMINOR $GPATCH $TARGETHTMLDIR/addons/
# copy over hamburger menu assets
cp $TARGETHTMLDIR/grass_logo.png \
$TARGETHTMLDIR/hamburger_menu.svg \
$TARGETHTMLDIR/hamburger_menu_close.svg \
$TARGETHTMLDIR/grassdocs.css \
$TARGETHTMLDIR/addons/
chmod -R a+r,g+w $TARGETHTMLDIR 2> /dev/null

# cp logs from ~/.grass$GMAJOR/addons/logs/
# copy over logs from ~/.grass$GMAJOR/addons/logs/
mkdir -p $TARGETMAIN/addons/grass$GMAJOR/logs/
cp -p ~/.grass$GMAJOR/addons/logs/* $TARGETMAIN/addons/grass$GMAJOR/logs/

Expand Down
32 changes: 21 additions & 11 deletions utils/cronjobs_osgeo_lxd/cron_grass_current_stable_src_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@
#
# GRASS GIS github, https://github.com/OSGeo/grass
#
## prep
# git clone https://github.com/OSGeo/grass.git main
###################################################################
# how it works:
# - it updates locally the GRASS source code from github server
# - packages the source code tarball
#
# Preparations, on server (neteler@grasslxd:$):
# mkdir -p ~/src
# cd ~/src
# git clone https://github.com/OSGeo/grass.git release_branch_8_4
#
###################################################################

# variables for packaging environment (grass.osgeo.org specific)
MAINDIR=/home/neteler
PATH=$MAINDIR/bin:/bin:/usr/bin:/usr/local/bin

# https://github.com/OSGeo/grass/tags
GMAJOR=8
GMINOR=4
GVERSION=$GMAJOR.$GMINOR.git
Expand Down Expand Up @@ -50,7 +60,7 @@ mkdir -p $TARGETDIR
cd $SOURCE/$BRANCH/
date

# clean up
# clean up from previous run
touch include/Make/Platform.make
$MYMAKE distclean > /dev/null 2>&1
rm -f grass-$GMAJOR.*-install.sh grass-$GMAJOR.*.tar.gz grass-$GMAJOR.*_bin.txt
Expand All @@ -73,27 +83,27 @@ git merge origin/$BRANCH

git status

#generate changelog
# generate changelog
touch include/Make/Platform.make # workaround for https://trac.osgeo.org/grass/ticket/3853
make changelog
rm -f include/Make/Platform.make

# go to parent for packaging
# go to parent directory for packaging
cd ..

date
#package it (we rename the directory to have the date inside the package):
# package it (we rename the directory to have the date inside the package):
DATE=`date '+_%Y_%m_%d'`
mv $BRANCH $PACKAGENAME\src_snapshot$DATE
# exclude version control system directories (the flag order matters!)
$TAR cfz $PACKAGENAME\src_snapshot$DATE.tar.gz --exclude-vcs $PACKAGENAME\src_snapshot$DATE
mv $PACKAGENAME\src_snapshot$DATE $BRANCH

#remove old snapshot:
# remove old snapshot:
rm -f $TARGETDIR/$PACKAGENAME\src_snapshot*
rm -f $TARGETDIR/ChangeLog.gz

#publish the new one:
# publish the new one:
cd $BRANCH/
cp -p ChangeLog AUTHORS CHANGES CITING CITATION.cff COPYING GPL.TXT INSTALL.md REQUIREMENTS.md $TARGETDIR

Expand All @@ -102,9 +112,9 @@ gzip $TARGETDIR/ChangeLog
cp $PACKAGENAME\src_snapshot$DATE.tar.gz $TARGETDIR
rm -f $PACKAGENAME\src_snapshot$DATE.tar.gz
chmod a+r,g+w $TARGETDIR/* 2> /dev/null
#chgrp grass $TARGETDIR/* 2> /dev/null
# chgrp grass $TARGETDIR/* 2> /dev/null

# link for convenience:
# "latest" link for convenience:
(cd $TARGETDIR ; rm -f $PACKAGENAME\src_snapshot_latest.tar.gz ; ln -s $PACKAGENAME\src_snapshot$DATE.tar.gz $PACKAGENAME\src_snapshot_latest.tar.gz)

echo "Written to: $TARGETDIR
Expand Down
Loading

0 comments on commit 428c2f7

Please sign in to comment.