mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 13:02:50 +00:00
Add the build scripts from the server into the packaging repo
bzr-revno: 18
This commit is contained in:
commit
031a9a0ce7
12
scripts/backup_georss.sh
Executable file
12
scripts/backup_georss.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILENAME=`date +%Y%m%d-%H%M%S`.rss
|
||||
BACKUPDIR=~/georss
|
||||
BACKUPDAYS=14
|
||||
|
||||
# Delete files older than $BACKUPDAYS days ago
|
||||
find $BACKUPDIR -mtime $BACKUPDAYS -exec rm -f {} \;
|
||||
|
||||
# Get the latest GeoRSS from our map
|
||||
wget -c -O $BACKUPDIR/$FILENAME 'http://maps.google.com/maps/ms?ie=UTF8&source=embed&msa=0&output=georss&msid=113314234297482809599.00047e88b1985e07ad495'
|
||||
|
46
scripts/build_dev_deb.sh
Executable file
46
scripts/build_dev_deb.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
# PPA Build Script for OpenLP #
|
||||
###############################################################################
|
||||
|
||||
OPENLP_VERSION=$1
|
||||
RELEASE_NAME=$2
|
||||
PROJECT_DIR=$HOME/Projects/OpenLP
|
||||
UPLOADS_DIR=$PROJECT_DIR/Uploads
|
||||
PACKAGING_DIR=$HOME/Packaging
|
||||
UBUNTU_DIR=$PACKAGING_DIR/debian-package
|
||||
TARGT_TARBALL=$PACKAGING_DIR/Tarballs/openlp_${OPENLP_VERSION}.orig.tar.gz
|
||||
|
||||
export DEBFULLNAME="Raoul Snyman"
|
||||
export DEBEMAIL="raoul@snyman.info"
|
||||
|
||||
echo -n "Copying source tarball..."
|
||||
cd $UPLOADS_DIR
|
||||
if [[ ! -f "$UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz" ]]; then
|
||||
echo "$UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz NOT FOUND, exiting."
|
||||
exit 1
|
||||
fi
|
||||
cp $UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz $TARGT_TARBALL
|
||||
echo done.
|
||||
echo -n "Backing up changelog..."
|
||||
cd $UBUNTU_DIR
|
||||
cp $UBUNTU_DIR/debian/changelog $PACKAGING_DIR/changelog.bak
|
||||
echo done.
|
||||
echo "Building package..."
|
||||
dch --force-distribution -D $RELEASE_NAME -v $OPENLP_VERSION-0ubuntu1~${RELEASE_NAME}1 Autobuild
|
||||
bzr bd --builder='debuild -S -m"Raoul Snyman <raoulsnyman@openlp.org>"' --orig-dir="$PACKAGING_DIR/Tarballs" --build-dir="$PACKAGING_DIR/Builds"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build package, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploading package source..."
|
||||
cd $PACKAGING_DIR/Builds
|
||||
dput openlp-dev openlp_$OPENLP_VERSION-0ubuntu1~${RELEASE_NAME}1_source.changes
|
||||
echo -n "Removing generated files..."
|
||||
rm $PACKAGING_DIR/Tarballs/*
|
||||
rm -r $PACKAGING_DIR/Builds/*
|
||||
echo done.
|
||||
echo -n "Restoring changelog..."
|
||||
cd $UBUNTU_DIR
|
||||
cp $PACKAGING_DIR/changelog.bak $UBUNTU_DIR/debian/changelog
|
||||
echo "done."
|
39
scripts/build_docs.sh
Executable file
39
scripts/build_docs.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
DOCSTYPE=$1
|
||||
OLD_PATH=$PATH
|
||||
PATH=/usr/local/bin:$PATH
|
||||
|
||||
if [[ "$DOCSTYPE" == "api" ]]; then
|
||||
DOCSTITLE="API"
|
||||
DOCSDIR="api"
|
||||
TARBALL="docs"
|
||||
else
|
||||
if [[ "$DOCSTYPE" == "manual" ]]; then
|
||||
DOCSTITLE="Manual"
|
||||
DOCSDIR="manual"
|
||||
TARBALL="manual"
|
||||
else
|
||||
DOCSTITLE="User Guide"
|
||||
DOCSDIR="user-guide"
|
||||
TARBALL="user-guide"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Building $DOCSTITLE documentation..."
|
||||
cd /home/openlp/Projects/documentation/trunk
|
||||
bzr up
|
||||
cd $DOCSDIR
|
||||
echo $DOCSDIR
|
||||
pwd
|
||||
rm -fR build
|
||||
make html
|
||||
echo "Creating tarball..."
|
||||
cd build
|
||||
cp -R html $TARBALL
|
||||
tar -czvf ${TARBALL}.tar.gz $TARBALL
|
||||
echo "Uploading tarball..."
|
||||
scp ${TARBALL}.tar.gz openlp@openlp.org:public_html/
|
||||
ssh openlp@openlp.org "cd ~/public_html && tar -xzvf ${TARBALL}.tar.gz"
|
||||
echo "Finished $DOCSTITLE run."
|
||||
PATH=$OLD_PATH
|
47
scripts/build_nightly_deb.sh
Executable file
47
scripts/build_nightly_deb.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
# PPA Build Script for OpenLP #
|
||||
###############################################################################
|
||||
|
||||
RELEASE_NAME=$1
|
||||
PROJECT_DIR=$HOME/Projects/OpenLP
|
||||
SOURCE_DIR=$PROJECT_DIR/trunk
|
||||
UPLOADS_DIR=$PROJECT_DIR/Uploads
|
||||
OPENLP_VERSION=`~/bin/openlp_version.py $SOURCE_DIR`
|
||||
PACKAGING_DIR=$HOME/Packaging
|
||||
UBUNTU_DIR=$PACKAGING_DIR/debian-package
|
||||
TARGT_TARBALL=$PACKAGING_DIR/Tarballs/openlp_${OPENLP_VERSION}.orig.tar.gz
|
||||
|
||||
export DEBFULLNAME="Raoul Snyman"
|
||||
export DEBEMAIL="raoul@snyman.info"
|
||||
|
||||
echo -n "Copying source tarball..."
|
||||
cd $UPLOADS_DIR
|
||||
if [[ ! -f "$UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz" ]]; then
|
||||
echo "$UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz NOT FOUND, exiting."
|
||||
exit 1
|
||||
fi
|
||||
cp $UPLOADS_DIR/OpenLP-${OPENLP_VERSION}.tar.gz $TARGT_TARBALL
|
||||
echo done.
|
||||
echo -n "Backing up changelog..."
|
||||
cd $UBUNTU_DIR
|
||||
cp $UBUNTU_DIR/debian/changelog $PACKAGING_DIR/changelog.bak
|
||||
echo done.
|
||||
echo "Building package..."
|
||||
dch --force-distribution -D $RELEASE_NAME -v $OPENLP_VERSION-0ubuntu1~${RELEASE_NAME}1 Autobuild
|
||||
bzr bd --builder='debuild -S -m"Raoul Snyman <raoulsnyman@openlp.org>"' --orig-dir="$PACKAGING_DIR/Tarballs" --build-dir="$PACKAGING_DIR/Builds"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to build package, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploading package source..."
|
||||
cd $PACKAGING_DIR/Builds
|
||||
dput openlp-nightly openlp_$OPENLP_VERSION-0ubuntu1~${RELEASE_NAME}1_source.changes
|
||||
#echo -n "Removing generated files..."
|
||||
rm $PACKAGING_DIR/Tarballs/*
|
||||
rm -r $PACKAGING_DIR/Builds/*
|
||||
#echo done.
|
||||
echo -n "Restoring changelog..."
|
||||
cd $UBUNTU_DIR
|
||||
cp $PACKAGING_DIR/changelog.bak $UBUNTU_DIR/debian/changelog
|
||||
echo "done."
|
19
scripts/build_release_deb.sh
Executable file
19
scripts/build_release_deb.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
# Debian Build Script for OpenLP #
|
||||
###############################################################################
|
||||
DEB_VERSION=$1
|
||||
RELEASE_NAME=$2
|
||||
export RELEASE_NAME
|
||||
ROOT_DIR=~/Projects/OpenLP
|
||||
SDIST_TARBALL=$ROOT_DIR/release-${DEB_VERSION}/dist/OpenLP-$DEB_VERSION.tar.gz
|
||||
TARGT_TARBALL=$ROOT_DIR/tarballs/openlp_$DEB_VERSION.orig.tar.gz
|
||||
echo "Copying $SDIST_TARBALL to $TARGT_TARBALL"
|
||||
cp $SDIST_TARBALL $TARGT_TARBALL
|
||||
cd $ROOT_DIR/debian-package
|
||||
dch --force-distribution -D $RELEASE_NAME -v $DEB_VERSION-0ubuntu1~${RELEASE_NAME}1 Autobuild -b
|
||||
bzr bd --builder='debuild -S -sa -m"Raoul Snyman <raoul.snyman@saturnlaboratories.co.za>"' --orig-dir="$ROOT_DIR/tarballs"
|
||||
cd $ROOT_DIR/build-area
|
||||
dput openlp-release openlp_$DEB_VERSION-0ubuntu1~${RELEASE_NAME}1_source.changes
|
||||
cd $ROOT_DIR/debian-package
|
||||
bzr revert
|
21
scripts/deb_version.py
Executable file
21
scripts/deb_version.py
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from bzrlib.branch import Branch
|
||||
from natsort import nsorted
|
||||
|
||||
b = Branch.open_containing('.')[0]
|
||||
b.lock_read()
|
||||
try:
|
||||
# Get the branch's latest revision number.
|
||||
revno = b.revno()
|
||||
# Convert said revision number into a bzr revision id.
|
||||
revision_id = b.dotted_revno_to_revision_id((revno,))
|
||||
# Get a dict of tags, with the revision id as the key.
|
||||
tags = b.tags.get_reverse_tag_dict()
|
||||
# Check if the latest
|
||||
if revision_id in tags:
|
||||
print tags[revision_id][0]
|
||||
else:
|
||||
print '%s+bzr%s' % (nsorted(b.tags.get_tag_dict().keys())[-1], revno)
|
||||
finally:
|
||||
b.unlock()
|
42
scripts/dev_build.sh
Executable file
42
scripts/dev_build.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$1
|
||||
PROJECTS_DIR=/home/openlp/Projects
|
||||
SOURCE_DIR=$PROJECTS_DIR/OpenLP/trunk
|
||||
RELEASE_DIR=release-$VERSION
|
||||
UPLOADS_DIR=/home/openlp/Projects/OpenLP/Uploads
|
||||
FILENAME=OpenLP-$VERSION.tar.gz
|
||||
#TSDIR=$RELEASE/resources/i18n
|
||||
#QMDIR=$RELEASE/openlp/i18n
|
||||
|
||||
echo Starting the OpenLP Development Build Script
|
||||
echo --------------------------------------------
|
||||
echo -ne "Updating trunk...\r"
|
||||
cd $SOURCE_DIR
|
||||
bzr update -q
|
||||
echo "Updating trunk...done."
|
||||
echo -ne "Branching release tag (${VERSION})...\r"
|
||||
cd ..
|
||||
bzr branch trunk $RELEASE_DIR -r tag:$VERSION -q
|
||||
echo "Branching release tag (${VERSION})...done."
|
||||
echo -n "Creating source distribution..."
|
||||
cd /home/openlp/Projects/OpenLP/$RELEASE_DIR
|
||||
python setup.py sdist
|
||||
echo "done."
|
||||
echo -n "Copying release tarball..."
|
||||
cp dist/$FILENAME $UPLOADS_DIR/
|
||||
echo "done."
|
||||
echo -n "Updating Version File..."
|
||||
echo "$VERSION" > dev_version.txt
|
||||
scp dev_version.txt openlp@openlp.org:public_html/files/dev_version.txt
|
||||
rm dev_version.txt
|
||||
echo "Building sources for PPA..."
|
||||
~/bin/build_dev_deb.sh $VERSION trusty
|
||||
~/bin/build_dev_deb.sh $VERSION utopic
|
||||
~/bin/build_dev_deb.sh $VERSION vivid
|
||||
echo -n "Cleaning up..."
|
||||
cd /home/openlp/Projects/OpenLP
|
||||
rm -r $RELEASE_DIR
|
||||
echo "done."
|
||||
echo --------------------------------------------
|
||||
echo Finished the OpenLP Development Build Script
|
11
scripts/fix_bzr.py
Executable file
11
scripts/fix_bzr.py
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
from bzrlib import initialize
|
||||
from bzrlib.plugin import load_plugins
|
||||
from bzrlib.upgrade import Convert
|
||||
|
||||
initialize()
|
||||
load_plugins()
|
||||
Convert(sys.argv[1])
|
35
scripts/natsort.py
Normal file
35
scripts/natsort.py
Normal file
@ -0,0 +1,35 @@
|
||||
# ---------------------------------------------------------
|
||||
# natsort.py: Natural string sorting.
|
||||
# ---------------------------------------------------------
|
||||
|
||||
# By Seo Sanghyeon. Some changes by Connelly Barnes.
|
||||
|
||||
def try_int(s):
|
||||
"Convert to integer if possible."
|
||||
try: return int(s)
|
||||
except: return s
|
||||
|
||||
def natsort_key(s):
|
||||
"Used internally to get a tuple by which s is sorted."
|
||||
import re
|
||||
return map(try_int, re.findall(r'(\d+|\D+)', s))
|
||||
|
||||
def natcmp(a, b):
|
||||
"Natural string comparison, case sensitive."
|
||||
return cmp(natsort_key(a), natsort_key(b))
|
||||
|
||||
def natcasecmp(a, b):
|
||||
"Natural string comparison, ignores case."
|
||||
return natcmp(a.lower(), b.lower())
|
||||
|
||||
def natsort(seq, cmp=natcmp):
|
||||
"In-place natural string sort."
|
||||
seq.sort(cmp)
|
||||
|
||||
def natsorted(seq, cmp=natcmp):
|
||||
"Returns a copy of seq, sorted by natural string sort."
|
||||
import copy
|
||||
temp = copy.copy(seq)
|
||||
natsort(temp, cmp)
|
||||
return temp
|
||||
|
78
scripts/nightly_build.sh
Executable file
78
scripts/nightly_build.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
# Nightly Build Script for OpenLP #
|
||||
###############################################################################
|
||||
|
||||
REGEX='OpenLP-([0-9]\.[0-9]\.[0-9])-bzr([0-9]+)[.|-]'
|
||||
PROJECT_DIR=/home/openlp/Projects/OpenLP
|
||||
SOURCE_DIR=$PROJECT_DIR/trunk
|
||||
VERSION_FILE=$SOURCE_DIR/openlp/.version
|
||||
PACKAGING_DIR=/home/openlp/Packaging
|
||||
UPLOADS_DIR=$PROJECT_DIR/Uploads
|
||||
|
||||
echo Starting the OpenLP 2.2 Nightly Build Script
|
||||
echo --------------------------------------------
|
||||
echo -ne "Updating code...\r"
|
||||
cd $SOURCE_DIR
|
||||
bzr update -q
|
||||
echo "Updating code...done."
|
||||
|
||||
# We can't get the version number until after updating the code
|
||||
# otherwise the version number we get is out-of-date
|
||||
OPENLP_VERSION=`~/bin/openlp_version.py $SOURCE_DIR`
|
||||
UPLOAD_TARBALL=OpenLP-${OPENLP_VERSION}.tar.gz
|
||||
PACKAGE_TARBALL=$PACKAGING_DIR/Tarballs/openlp_${OPENLP_VERSION}.orig.tar.gz
|
||||
|
||||
echo -n "Checking revision..."
|
||||
if [[ -f "$VERSION_FILE" && "`bzr revno`" -eq "`cat $VERSION_FILE`" ]]; then
|
||||
echo done.
|
||||
echo OpenLP is already at the latest revision, aborting build.
|
||||
echo --------------------------------------------
|
||||
echo Finished OpenLP 2.2 Nightly Build Script
|
||||
exit
|
||||
fi
|
||||
echo done.
|
||||
echo -n "Writing version number..."
|
||||
bzr revno > $VERSION_FILE
|
||||
echo done.
|
||||
echo -n "Exporting source for $OPENLP_VERSION ..."
|
||||
if [[ -d "../OpenLP-$OPENLP_VERSION" ]]; then
|
||||
rm -r ../OpenLP-$OPENLP_VERSION
|
||||
fi
|
||||
bzr export ../OpenLP-$OPENLP_VERSION
|
||||
echo done.
|
||||
echo -n "Creating source tarball $UPLOADS_DIR/$UPLOAD_TARBALL ..."
|
||||
cd $PROJECT_DIR
|
||||
tar -czf $UPLOADS_DIR/$UPLOAD_TARBALL OpenLP-$OPENLP_VERSION
|
||||
echo done.
|
||||
echo -n "Uploading tarball to download location..."
|
||||
cd $UPLOADS_DIR
|
||||
scp -q $UPLOADS_DIR/$UPLOAD_TARBALL openlp@openlp.org:public_html/files/
|
||||
ssh -q openlp@openlp.org "python update_builds.py source $UPLOAD_TARBALL"
|
||||
echo done.
|
||||
echo -n "Updating Version File..."
|
||||
echo "$VERSION" > nightly_version.txt
|
||||
scp -q nightly_version.txt openlp@openlp.org:public_html/files/nightly_version.txt
|
||||
rm nightly_version.txt
|
||||
echo done.
|
||||
echo -n "Notifying Twitter..."
|
||||
if [[ $UPLOAD_TARBALL =~ $REGEX ]]; then
|
||||
VERSION_STRING="version ${BASH_REMATCH[1]}, build ${BASH_REMATCH[2]}"
|
||||
else
|
||||
VERSION_STRING="version ${OPENLP_VERSION}"
|
||||
fi
|
||||
~/bin/openlp_tweeter.py openlp_dev "Latest nightly source tarball of OpenLP 2.2 available at http://openlp.org/files/latest.tar.gz - ${VERSION_STRING}."
|
||||
echo done.
|
||||
echo Building sources for PPA...
|
||||
~/bin/build_nightly_deb.sh trusty
|
||||
~/bin/build_nightly_deb.sh utopic
|
||||
~/bin/build_nightly_deb.sh vivid
|
||||
echo -n "Notifying Twitter..."
|
||||
~/bin/openlp_tweeter.py openlp_dev "Latest Ubuntu nightly package of OpenLP 2.2 queued for building in the Nightly PPA (ppa:openlp-core/nightly) - ${VERSION_STRING}."
|
||||
echo done.
|
||||
echo -n "Cleaning up..."
|
||||
rm -r $UPLOADS_DIR/*
|
||||
rm $PACKAGE_TARBALL
|
||||
echo done.
|
||||
echo --------------------------------------------
|
||||
echo Finished OpenLP 2.2 Nightly Build Script
|
40
scripts/notify_build.sh
Executable file
40
scripts/notify_build.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo "Usage: `basename $0` {filename} {windows|osx|portable} [delete]"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
FILENAME=$1
|
||||
BASEFILE=`basename $FILENAME`
|
||||
BUILDTYPE=$2
|
||||
REGEX='(OpenLP-|OpenLPPortable_)([0-9]\.[0-9]\.[0-9]+)(-bzr|\.)([0-9]+)[.|-]'
|
||||
|
||||
if [ $# -eq 3 -a "$3" == "delete" ]; then
|
||||
AUTODELETE=1
|
||||
else
|
||||
AUTODELETE=0
|
||||
fi
|
||||
|
||||
if [ "${BUILDTYPE}x" == "x" ]; then
|
||||
$BUILDTYPE=windows
|
||||
fi
|
||||
if [[ $BASEFILE =~ $REGEX ]]; then
|
||||
if [ "$BUILDTYPE" == "windows" ]; then
|
||||
PLATFORM="Windows"
|
||||
EXT=".exe"
|
||||
elif [ "$BUILDTYPE" == "osx" ]; then
|
||||
PLATFORM="Mac OS X"
|
||||
EXT=".dmg"
|
||||
elif [ "$BUILDTYPE" == "portable" ]; then
|
||||
PLATFORM="PortableApps"
|
||||
EXT="-portable.exe"
|
||||
fi
|
||||
echo "Notifying Twitter..."
|
||||
/home/openlp/bin/openlp_tweeter.py openlp_dev "Latest $PLATFORM development build of OpenLP 2.0 available at http://openlp.org/files/latest$EXT - version ${BASH_REMATCH[2]} build ${BASH_REMATCH[4]}."
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
|
42
scripts/openlp_tweeter.py
Executable file
42
scripts/openlp_tweeter.py
Executable file
@ -0,0 +1,42 @@
|
||||
#!/home/openlp/VirtualEnv/stats/bin/python
|
||||
|
||||
import sys
|
||||
import tweepy
|
||||
|
||||
CONSUMER_KEY = 'MYPnldPBzlbueaSvD1rnw'
|
||||
CONSUMER_SECRET = 'yyDJ4TTADxv7MELAju0dtrNSEGnKa88zplDFoPiw'
|
||||
AUTH_TOKENS = {
|
||||
'openlp_dev': {
|
||||
'key': '703540082-qTYyENzdhoDNMDP9kc95BL0yd98rz0EaVRiirya4',
|
||||
'secret': 'sm9uSck8yoXUBvPkPT3fISiM5Z46KREskgmxTZ8B0'
|
||||
},
|
||||
'openlp': {
|
||||
'key': '72314330-rUzaA2hRQAaEum6KIhFnOWNUPFqt1nkwgIC0ZS7IG',
|
||||
'secret': 'UGMGO6oAcjHKADM8TZnMAos5cK11HL1Jd7CTQVWpJc8'
|
||||
}
|
||||
}
|
||||
|
||||
ACCESS_KEY = '72314330-rUzaA2hRQAaEum6KIhFnOWNUPFqt1nkwgIC0ZS7IG'
|
||||
ACCESS_SECRET = 'UGMGO6oAcjHKADM8TZnMAos5cK11HL1Jd7CTQVWpJc8'
|
||||
|
||||
if __name__ == u'__main__':
|
||||
# Don't bother to do anything if there's nothing to tweet.
|
||||
if len(sys.argv) == 1:
|
||||
print 'Nothing to tweet!'
|
||||
sys.exit(1)
|
||||
try:
|
||||
if len(sys.argv) == 2:
|
||||
account = 'openlp_dev'
|
||||
message = sys.argv[1]
|
||||
else:
|
||||
account = sys.argv[1]
|
||||
message = sys.argv[2]
|
||||
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
|
||||
auth.set_access_token(AUTH_TOKENS[account]['key'], AUTH_TOKENS[account]['secret'])
|
||||
api = tweepy.API(auth)
|
||||
api.update_status(message)
|
||||
print 'Successfully sent tweet.'
|
||||
sys.exit()
|
||||
except tweepy.error.TweepError as error:
|
||||
print error
|
||||
sys.exit(2)
|
38
scripts/openlp_version.py
Executable file
38
scripts/openlp_version.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import os
|
||||
|
||||
from bzrlib.branch import Branch
|
||||
from natsort import natsorted
|
||||
|
||||
def get_version(path):
|
||||
b = Branch.open_containing(path)[0]
|
||||
b.lock_read()
|
||||
result = '0.0.0'
|
||||
try:
|
||||
# Get the branch's latest revision number.
|
||||
revno = b.revno()
|
||||
# Convert said revision number into a bzr revision id.
|
||||
revision_id = b.dotted_revno_to_revision_id((revno,))
|
||||
# Get a dict of tags, with the revision id as the key.
|
||||
tags = b.tags.get_reverse_tag_dict()
|
||||
# Check if the latest
|
||||
if revision_id in tags:
|
||||
result = tags[revision_id][0]
|
||||
else:
|
||||
result = '%s-bzr%s' % (natsorted(b.tags.get_tag_dict().keys())[-1], revno)
|
||||
finally:
|
||||
b.unlock()
|
||||
return result
|
||||
|
||||
def get_path():
|
||||
if len(sys.argv) > 1:
|
||||
return os.path.abspath(sys.argv[1])
|
||||
else:
|
||||
return os.path.abspath('.')
|
||||
|
||||
if __name__ == u'__main__':
|
||||
path = get_path()
|
||||
print get_version(path)
|
||||
|
30
scripts/openlptweet.py
Executable file
30
scripts/openlptweet.py
Executable file
@ -0,0 +1,30 @@
|
||||
#! /usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
from twitter import Api, Status
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
#parser.add_option("-m", "--message", dest="message", metavar="MESSAGE",
|
||||
# help="Status message to post to Twitter", metavar="MESSAGE")
|
||||
parser.add_option("-u", "--username", dest="username", metavar="USERNAME",
|
||||
help="The username to post as, required for authentication.")
|
||||
parser.add_option("-p", "--password", dest="password", metavar="PASSWORD",
|
||||
help="The password for the username, required for authentication.")
|
||||
(options, args) = parser.parse_args()
|
||||
if len(args) == 0:
|
||||
parser.error("You haven't provided a message.")
|
||||
if not options.username or not options.password:
|
||||
parser.error("You need to supply a username and a password.")
|
||||
message = args[0]
|
||||
api = Api(username=options.username, password=options.password)
|
||||
status = api.PostUpdate(message)
|
||||
if not status:
|
||||
print "There was a problem posting your status."
|
||||
else:
|
||||
print "Successfully posted your status!"
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
34
scripts/release_build.sh
Executable file
34
scripts/release_build.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=$1
|
||||
RELEASE=release-$VERSION
|
||||
FILENAME=OpenLP-$VERSION.tar.gz
|
||||
#TSDIR=$RELEASE/resources/i18n
|
||||
#QMDIR=$RELEASE/openlp/i18n
|
||||
|
||||
echo Starting the OpenLP 2.0 Release Build Script
|
||||
echo --------------------------------------------
|
||||
echo -ne "Updating trunk-2.0...\r"
|
||||
cd /home/openlp/Projects/OpenLP/trunk-2.0
|
||||
bzr update -q
|
||||
echo "Updating trunk-2.0...done."
|
||||
echo -ne "Branching release tag...\r"
|
||||
cd /home/openlp/Projects/OpenLP
|
||||
bzr branch trunk-2.0 $RELEASE -r tag:$VERSION -q
|
||||
echo "Branching release tag...done."
|
||||
echo -n "Creating source distribution..."
|
||||
cd /home/openlp/Projects/OpenLP/$RELEASE
|
||||
python setup.py sdist
|
||||
echo "done."
|
||||
#echo -n "Updating Version File..."
|
||||
#echo "$VERSION" > version.txt
|
||||
#scp version.txt openlp@openlp.org:public_html/files/version.txt
|
||||
#rm version.txt
|
||||
echo "Building sources for PPA..."
|
||||
~/bin/build_release_deb.sh $VERSION utopic
|
||||
echo -n "Cleaning up..."
|
||||
cd /home/openlp/Projects/OpenLP
|
||||
rm -fR $RELEASE
|
||||
echo "done."
|
||||
echo --------------------------------------------
|
||||
echo Finished OpenLP 2.0 Release Build Script
|
59
scripts/upload_build.sh
Executable file
59
scripts/upload_build.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo "Usage: `basename $0` {filename} {windows|osx|portable} [delete]"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
FILENAME=$1
|
||||
BASEFILE=`basename $FILENAME`
|
||||
BUILDTYPE=$2
|
||||
REGEX='(OpenLP-|OpenLPPortable_)([0-9]\.[0-9]\.[0-9]+)(-bzr|\.)([0-9]+)[.|-]'
|
||||
|
||||
if [ $# -eq 3 -a "$3" == "delete" ]; then
|
||||
AUTODELETE=1
|
||||
else
|
||||
AUTODELETE=0
|
||||
fi
|
||||
|
||||
if [ ! -f $FILENAME ]; then
|
||||
echo "$FILENAME does not exist, exiting."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${BUILDTYPE}x" == "x" ]; then
|
||||
$BUILDTYPE=windows
|
||||
fi
|
||||
echo "Uploading file..."
|
||||
scp $FILENAME openlp@openlp.org:public_html/files/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to upload ${FILENAME}."
|
||||
exit 2
|
||||
fi
|
||||
echo "Updating build information on server..."
|
||||
ssh openlp@openlp.org "python update_builds.py $BUILDTYPE $BASEFILE"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to update build ${BUILDTYPE} ${BASEFILE}."
|
||||
exit 3
|
||||
fi
|
||||
if [ $AUTODELETE -eq 1 ]; then
|
||||
rm $FILENAME
|
||||
fi
|
||||
if [[ $BASEFILE =~ $REGEX ]]; then
|
||||
if [ "$BUILDTYPE" == "windows" ]; then
|
||||
PLATFORM="Windows"
|
||||
EXT=".exe"
|
||||
elif [ "$BUILDTYPE" == "osx" ]; then
|
||||
PLATFORM="Mac OS X"
|
||||
EXT=".dmg"
|
||||
elif [ "$BUILDTYPE" == "portable" ]; then
|
||||
PLATFORM="PortableApps"
|
||||
EXT="-portable.exe"
|
||||
fi
|
||||
echo "Notifying Twitter..."
|
||||
/home/openlp/bin/openlp_tweeter.py openlp_dev "Latest $PLATFORM development build of OpenLP 2.2 available at http://openlp.org/files/latest$EXT - version ${BASH_REMATCH[2]} build ${BASH_REMATCH[4]}."
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user