Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
automate portus release
Browse files Browse the repository at this point in the history
This commit adds a "release.sh" script that will release portus in the
build service.

It assumes you will have already tagged and update the VERSION file, as
well as updated the CHANGELOG (see http://port.us.org/docs/how_we_release.html)

It includes a small fix in the make_spec.sh that checks for bundler

Signed-off-by: Jordi Massaguer Pla <jmassaguerpla@suse.de>
  • Loading branch information
jordimassaguerpla committed Mar 8, 2016
1 parent 759280f commit 63ce124
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packaging/suse/make_spec.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
bundle version 2>/dev/null
if [ $? != 0 ];then
echo "bundler is not installed. Please install it."
exit -1
fi
cd $(dirname $0)

if [ $TRAVIS_BRANCH ];then
Expand Down
1 change: 1 addition & 0 deletions packaging/suse/release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
project.xml
8 changes: 8 additions & 0 deletions packaging/suse/release/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
release.sh automates the creation of a project in the open suse build service
for a new release and it copies all the dependencies.

To be more specific, it creates a subproject in Virtualization:containers:Portus
and it copies all packages. Then, it will set the version in the spec file and
get the tarball for that specific version (it assumes you have tagged git)


22 changes: 22 additions & 0 deletions packaging/suse/release/project.xml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<project name="Virtualization:containers:Portus:Release:__RELEASE__">
<title>__RELEASE__ Release</title>
<description></description>
<person userid="flavio_castelli" role="maintainer"/>
<person userid="jordimassaguerpla" role="maintainer"/>
<repository name="openSUSE_Leap_42.1">
<path project="openSUSE:Leap:42.1" repository="standard"/>
<arch>x86_64</arch>
</repository>
<repository name="openSUSE_13.2">
<path project="openSUSE:13.2" repository="standard"/>
<arch>x86_64</arch>
</repository>
<repository name="images">
<arch>x86_64</arch>
</repository>
<repository name="SLE_12">
<path project="SUSE:SLE-12:GA" repository="standard"/>
<arch>x86_64</arch>
</repository>
</project>

73 changes: 73 additions & 0 deletions packaging/suse/release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/bash
set -ex
cd $(dirname $0)

usage_and_exit() {
echo "usage $0 X.Y.Z"
echo "Where X.Y.Z is the new release number"
exit -1
}

if [ $# != 1 ];then
usage_and_exit
fi
if [ $1 == "help" ];then
usage_and_exit
fi
if [ $1 == "-h" ];then
usage_and_exit
fi
if [[ ! "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];then
usage_and_exit
fi

RELEASE=$1
MAJOR_VERSION=$(echo $RELEASE | rev | cut -d. -f1 --complement | rev)
BRANCH="v$MAJOR_VERSION"
ORIG_PROJECT=Virtualization:containers:Portus
DEST_PROJECT=$ORIG_PROJECT:Release:$RELEASE
API=https://api.opensuse.org
OSC="osc -A $API"

echo "Setting release $RELEASE in project config template"
sed -e "s/__RELEASE__/$RELEASE/g" project.xml.template > project.xml

echo "Creating new subproject $DEST_PROJECT"
$OSC meta prj $DEST_PROJECT --file=project.xml

echo "Copying packages to the new project"
for package in $($OSC ls $ORIG_PROJECT );do $OSC copypac -e $ORIG_PROJECT $package $DEST_PROJECT; done

echo "Checking out Portus package"
DIR=/tmp/$0/$RANDOM
mkdir -p $DIR
pushd $DIR
$OSC checkout $DEST_PROJECT Portus

echo "Setting version in _service file"
cd $DEST_PROJECT/Portus
sed -e "s/master.tar.gz/$RELEASE.tar.gz/g" -i _service

echo "Getting tarball"
$OSC service run

echo "Generate spec file"
mv _service\:download_url\:$RELEASE.tar.gz $RELEASE.tar.gz
tar zxvf $RELEASE.tar.gz
cd Portus-$RELEASE/packaging/suse
TRAVIS_COMMIT=$RELEASE TRAVIS_BRANCH=$BRANCH ./make_spec.sh
cd -
cp Portus-$RELEASE/packaging/suse/Portus.spec .

echo "Setting version $RELEASE in spec file"
sed -e "s/%define branch master/%define branch $RELEASE/g" -i Portus.spec
sed -e "s/Version: .*/Version: $RELEASE/g" -i Portus.spec

echo "Commiting new project"
$OSC commit -m "set release to $RELEASE"

echo "Cleaning..."
rm -rf $DIR
popd


0 comments on commit 63ce124

Please sign in to comment.