diff --git a/.gitignore b/.gitignore index 80ea53fd..a6857989 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ ocarina.bin bin/ lib/ include/version.h +PKGBUILD +!PKGBUILD.tmpl diff --git a/PKGBUILD b/PKGBUILD.tmpl similarity index 81% rename from PKGBUILD rename to PKGBUILD.tmpl index 6b72ad29..8cc2c0bd 100644 --- a/PKGBUILD +++ b/PKGBUILD.tmpl @@ -1,6 +1,6 @@ # Maintainer: Bryan Schumaker pkgname=ocarina -pkgver=5.8 +pkgver= pkgrel=1 pkgdesc="A simple GTK and gstreamer based music player." url="http://www.ocarinaproject.net/" @@ -12,8 +12,8 @@ makedepends=('scons') conflicts=() replaces=() backup=() -source=("http://ocarinaproject.net/wp-content/uploads/2012/05/${pkgname}-${pkgver}.tar.gz") -md5sums=('b2aecf434035823fa1d3c759d2ff4b41') +source=("http://ocarinaproject.net/wp-content/uploads/YEAR/MONTH/${pkgname}-${pkgver}.tar.gz") +md5sums= build() { cd "${srcdir}/${pkgname}-${pkgver}" diff --git a/Sconstruct b/Sconstruct index 96f3f91a..2701e88c 100644 --- a/Sconstruct +++ b/Sconstruct @@ -71,9 +71,25 @@ env.Command("uninstall", None, Delete(FindInstalledFiles())) # Clean up the build directory clean = Clean(ocarina, ["include/version.h", "bin/", "lib/"]) -# Create a tarball -def git_archive(target, source, env): +# Create a tarball and a PKGBUILD script +def prepare_release(target, source, env): + import datetime + ocarina="ocarina-%s" % config.version os.popen("git archive --prefix=%s/ -o %s.tar.gz HEAD" % (ocarina, ocarina)) - print "md5sum:", os.popen("md5sum %s.tar.gz" % ocarina).read() -env.Command("archive", None, [git_archive]) + md5 = os.popen("md5sum %s.tar.gz | awk '{print $1}'" % ocarina).read().strip() + + now = datetime.datetime.now() + year = str(now.year) + month = str(now.month) + + f = open("PKGBUILD", "w") + for line in open("PKGBUILD.tmpl"): + line = line.replace("pkgver=", "pkgver=%s.%s" % (config.MAJOR, config.MINOR)) + line = line.replace("md5sums=", "md5sums=('%s')" % md5) + line = line.replace("YEAR", year) + line = line.replace("MONTH", month) + f.write(line) + f.close() + +env.Command("release", None, [prepare_release])