Changeset 49cbfdd7 in subsurface


Ignore:
Timestamp:
Jun 11, 2017, 2:00:02 PM (2 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
5bc91f0
Parents:
b14a522
git-author:
Salvador Cuñat <salvador.cunat@…> (06/11/17 12:58:44)
git-committer:
Dirk Hohndel <dirk@…> (06/11/17 14:00:02)
Message:

smtk2ssrf-mxe-build.sh: add a flag for git repo

Previous script would fail on git folders that pull from more than one
repo. That's not a general case, but pretty usual for developers
pulling/pushing to github.
BTW in this cases, a lind git pull doesn't ensure we are pulling from
the right repo.
When run without flag, default to pull --rebase.

At the same time introduce a tiny func to return a message and bail out
after some command failures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • packaging/windows/smtk2ssrf-mxe-build.sh

    r2261283 r49cbfdd7  
    6363BUILDDIR=$(cd "$EXECDIR"; pwd)
    6464
     65GITREPO=""
     66
     67# Display an error message if we need to bail out
     68#
     69function aborting() {
     70        echo -e "$RED----> $1. Aborting.$DEFAULT"
     71        exit 1
     72}
     73
    6574echo -e "$BLUE-> $BUILDDIR$DEFAULT"
    6675
     
    8796                                        shift;;
    8897                        -d|--dir)       DATADIR="$2"
     98                                        shift;;
     99                        -r|--repo)      GITREPO="$2"
    89100                                        shift;;
    90101                esac
     
    135146                             --disable-man \
    136147                             --disable-gmdb2
    137         make $JOBS >/dev/null
    138         if [ $? -ne 0 ]; then
    139                 echo -e "$RED---> Building mdbtools failed. Aborting ...$DEFAULT "
    140                 exit 1
    141         fi
     148        make $JOBS >/dev/null || aborting "Building mdbtools failed."
    142149        make install
    143150else
     
    149156cd "$BASEDIR/subsurface"
    150157git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT"
    151 git pull "$(git remote -v |grep fetch |awk '{print $1}')" master
    152 if [ $? -ne 0 ]; then
    153         echo -e "$RED---> git pull failed, Subsurface not updated$DEFAULT"
    154 else
    155         echo -e "$BLUE---> Subsurface updated$DEFAULT"
    156 fi
     158if [ ! -z "$GITREPO" ]; then
     159        git pull --rebase "$GITREPO" master || aborting "git pull failed, Subsurface not updated"
     160else
     161        git pull --rebase || aborting "git pull failed, Subsurface not updated"
     162fi
     163echo -e "$BLUE---> Subsurface updated$DEFAULT"
    157164
    158165if [ "$SSRF_TAG" != "" ]; then
    159         git checkout "$SSRF_TAG"
    160         if [ $? -ne 0 ]; then
    161                 echo -e "$RED---> Failed to checkout Subsurface's $SSRF_TAG. Abort building. $DEFAULT"
    162                 exit 1
    163         fi
     166        git checkout "$SSRF_TAG" || aborting "Failed to checkout Subsurface's $SSRF_TAG."
    164167fi
    165168
Note: See TracChangeset for help on using the changeset viewer.