summaryrefslogtreecommitdiff
path: root/packaging/upload-to-private-project.sh
blob: d96c0d2e3b59363fbf7332f88dc4b1f7f7a81393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash

cd `dirname $0`/../
SRCROOT=`pwd`

PROJECT=web-ui-fw
VERSION=`grep 'Version:' packaging/web-ui-fw.spec  | awk '{print $2}'`
TARNAME=$PROJECT-$VERSION

OBS_USER=$1
OBS_LOCAL=home:$OBS_USER
OBSDIR_ROOT=$HOME/obs
OBSDIR_USER=$OBSDIR_ROOT/$OBS_LOCAL
OBSDIR_PROJECT=$OBSDIR_USER/$PROJECT

if test ! -n "$OBS_USER"; then
	echo "Error: No OBS account is given."
	echo "USAGE: $0 <OBS account name> [--upload]"
	echo ""
	echo "${HOME}/obs/home:<OBS account>/web-ui-fw direcory will be created."
	echo "NOTE:"
	echo "  If --upload option is given, OBS build request will be done to your home project."
	echo "  Otherwise, local OBS will be run."
	exit 1
fi

### OBS
test -d "$OBSDIR_ROOT" || mkdir -p $OBSDIR_ROOT
cd $OBSDIR_ROOT
test -d "$OBSDIR_USER" || osc co $OBS_LOCAL/$PROJECT || ( echo "Error: Failed to checkout $OBS_LOCAL/$PROJECT"; exit 1 )
cd $OBSDIR_USER
test -d $OBSDIR_PROJECT || osc mkpac $PROJECT

### Make tarball and spec into obs project dir
cd $OBSDIR_PROJECT
osc rm --force *
rm -rf $OBSDIR_PROJECT/*
cd $SRCROOT
git archive --format=tar --prefix=$TARNAME/ HEAD | gzip > $OBSDIR_PROJECT/$TARNAME.tar.gz
cp -av ./packaging/$PROJECT.spec $OBSDIR_PROJECT/
cd $OBSDIR_PROJECT

echo "Complete."
echo "If you want to build locally, run following command:"
echo "cd $OBSDIR_PROJECT; osc build standard --no-verify --local-package --clean"
echo ""

### Build
if test "$2" == "--upload"; then
	osc add *
	osc ci
else
	#rpmbuild -ba packaging/*.spec
	cd $OBSDIR_PROJECT
	osc build standard --no-verify --local-package --clean
fi