#!/bin/bash -e # This file is part of nexdatas - Tango Server for NeXus data writer # # Copyright (C) 2017-2017 DESY, Jan Kotanski <jkotan@mail.desy.de> # # nexdatas is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # nexdatas is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with nexdatas. If not, see <http://www.gnu.org/licenses/>. # PIDPVERSION="1.5.2" for i in "${@:1}" do if [[ $i == -* ]] ; then case $i in -u=*|--user=*) export USER="${i#*=}" ;; -h*|--help*) HELP=YES ;; -r=*|--release=*) export RELEASE="${i#*=}" ;; -g=*|--giturl=*) export GITURL="${i#*=}" ;; *) # unknown option ;; esac else export DEBPACKAGE=$1 fi done DEFRELEASE=jessie if [[ ! -z $HELP ]] && [[ -z $DEBPACKAGE ]] ; then echo "Error: DEB-PACKAGE-NAME argument is not defined" fi if [[ ! -z $HELP ]] || [[ -z $DEBPACKAGE ]] ; then echo "pidppush version $PIDPVERSION" echo "" echo "usage: pidppush <DEB-PACKAGE-NAME> " echo "" echo "push the local gbp package repository into stash." echo " Please execute this command ONLY AFTER SUCCESSFUL TESTS" echo " performed on the created debian package" echo "" echo "possible arguments:" echo " DEB-PACKAGE-NAME debian package name (mandatory)" echo "" echo "optional arguments:" echo " -h, --help show this help message and exit" echo " -u=, --user= stash user name" echo " (default: the local user name)" echo " -r=, --release= debian release flavour, e.g. stretch, jessie, wheezy" echo " -g=, --giturl= repository url, default:" echo " https://$USER@stash.desy.de/scm/pidp/$DEBPACKAGE.git" echo "" echo "examples:" echo " pidppush python-nxstools-extras-p09" echo "" else if [ -z $USER ] ; then export USER=$(whoami) fi if [ -z $RELEASE ] ; then export RELEASE=$DEFRELEASE fi if [[ -z $GITURL ]] ; then export GITURL="https://$USER@stash.desy.de/scm/pidp/$DEBPACKAGE.git" fi CDIR=${PWD##*/} if ! [[ "$CDIR" == "$DEBPACKAGE" ]] ; then cd $DEBPACKAGE fi ORIGIN=$(git remote) if [[ -z $ORIGIN ]] ; then git remote add origin $GITURL fi git push -u origin debian/$RELEASE upstream/$RELEASE pristine-tar --follow-tags fi