View Issue Details

IDProjectCategoryView StatusLast Update
0001528OpenFOAM[All Projects] Bugpublic2015-02-14 16:06
ReporterwyldckatAssigned Tohenry 
PrioritynormalSeveritytweakReproducibilityN/A
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0001528: "FOAM_ONLINE_REPO" in "doc/Doxygen/Allwmake" suggested in #1516 ignores the specific branch/tag
DescriptionWith the new feature suggested in report #1516, the new local "FOAM_ONLINE_REPO" variable is not taking into account the discussed feature on that report of using the respective branch/tag name for browsing the online folders of the respective respective version.

Attached is the update "doc/Doxygen/Allwmake" that fixes this issue, by relying on generically checking a few of the known combos for version numbers. The new code in question is shown below in the "Steps To Reproduce" section.
Steps To ReproducedefineURL() {
  
  case "$WM_PROJECT_VERSION" in
  [0-9].[0-9].x)
    FOAM_BRANCH_NAME="master"
    FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
    ;;
  [0-9].[0-9].[0-9])
    FOAM_BRANCH_NAME="version-$WM_PROJECT_VERSION"
    FOAM_REPO_VERSION="$WM_PROJECT-${WM_PROJECT_VERSION%.*}.x"
    ;;
  *)
    FOAM_BRANCH_NAME="master"
    FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
    ;;
  esac
  
  export FOAM_BASE_REPO="https://github.com/$WM_PROJECT/$FOAM_REPO_VERSION"
  export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/tree/$FOAM_BRANCH_NAME"
}
Additional InformationI was going to reopen the report #1516, but the updated Allwmake script would conflict with the one on that report.


Example results of testing the new function:

$ export WM_PROJECT_VERSION=2.3.0
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-2.3.x/tree/version-2.3.0

$ export WM_PROJECT_VERSION=dev
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-dev/tree/master

$ export WM_PROJECT_VERSION=2.3
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-2.3/tree/master

$ export WM_PROJECT_VERSION=2.3.1
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-2.3.x/tree/version-2.3.1

$ export WM_PROJECT_VERSION=2.3.3
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-2.3.x/tree/version-2.3.3

$ export WM_PROJECT_VERSION=2.3.x
$ ./Allwmake -online
https://github.com/OpenFOAM/OpenFOAM-2.3.x/tree/master

TagsNo tags attached.

Activities

wyldckat

2015-02-14 14:59

updater  

Allwmake (1,815 bytes)
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

[ -d "$WM_PROJECT_DIR" ] || {
    echo "Error: WM_PROJECT_DIR directory does not exist"
    echo "    Check the OpenFOAM entries in your dot-files and source them."
    echo "    WM_PROJECT_DIR=$WM_PROJECT_DIR"
    exit 1
}

usage() {
    exec 1>&2
    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
    cat<<USAGE

usage: ${0##*/} [OPTION]
options:
  -online    use the links to the Github repositories instead of the local source code
  -help

USAGE
    exit 1
}

defineURL() {
  
  case "$WM_PROJECT_VERSION" in
  [0-9].[0-9].x)
    FOAM_BRANCH_NAME="master"
    FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
    ;;
  [0-9].[0-9].[0-9])
    FOAM_BRANCH_NAME="version-$WM_PROJECT_VERSION"
    FOAM_REPO_VERSION="$WM_PROJECT-${WM_PROJECT_VERSION%.*}.x"
    ;;
  *)
    FOAM_BRANCH_NAME="master"
    FOAM_REPO_VERSION="$WM_PROJECT-$WM_PROJECT_VERSION"
    ;;
  esac
  
  export FOAM_BASE_REPO="https://github.com/$WM_PROJECT/$FOAM_REPO_VERSION"
  export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/tree/$FOAM_BRANCH_NAME"
}

# parse options
while [ "$#" -gt 0 ]
do
    case "$1" in
    -h | -help)
        usage
        ;;
    -online)
        defineURL
        shift
        ;;
    *)
        usage "unknown option/argument: '$*'"
        ;;
    esac
done

#------------------------------------------------------------------------------

set -x

rm -rf latex man

# remove html directory in background
mv html html-stagedRemove$$ 2> /dev/null
rm -rf html-stagedRemove$$ >/dev/null 2>&1 &

# ensure that created files are readable by everyone
umask 22
doxygen

# fix permissions (NB: '+X' and not '+x'!)
chmod -R a+rX html latex man 2>/dev/null

echo
echo "Done doxygen"
echo

# ----------------------------------------------------------------- end-of-file
Allwmake (1,815 bytes)

henry

2015-02-14 16:06

manager   ~0003766

Thanks Bruno. Having added the tags to the github repository I also thought it would be a good idea to automate the setting of FOAM_ONLINE_REPO but hadn't got around to it yet.

Resolved by commit d90d9290c4e01196ca515a339b0f071f5e3339f8

Issue History

Date Modified Username Field Change
2015-02-14 14:59 wyldckat New Issue
2015-02-14 14:59 wyldckat File Added: Allwmake
2015-02-14 16:06 henry Note Added: 0003766
2015-02-14 16:06 henry Status new => resolved
2015-02-14 16:06 henry Resolution open => fixed
2015-02-14 16:06 henry Assigned To => henry