From b464a98ab94cbe3f0e2814161a366afdeabfe99d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 17 Nov 2012 04:29:33 +0000 Subject: port to apt.puredata.info and fix bugs with source/debian tarballs svn path=/trunk/; revision=16555 --- scripts/auto-build/create-latest-build-listing.py | 28 +++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/auto-build/create-latest-build-listing.py b/scripts/auto-build/create-latest-build-listing.py index 2aa417d6..571edb55 100755 --- a/scripts/auto-build/create-latest-build-listing.py +++ b/scripts/auto-build/create-latest-build-listing.py @@ -1,22 +1,24 @@ -#!/usr/bin/python +#!/usr/bin/python2.5 +# this is meant to run on apt.puredata.info, which only has python2.5 import string +import glob import os,sys,errno import re import StringIO sourcetarballs = [] -for root, dirs, files in os.walk('/var/www/auto-build/'): +for root, dirs, files in os.walk('/home/apt/www/auto-build/'): dirs.sort() if 'latest' in dirs: dirs.remove('latest') for name in files: - relativeroot = re.sub('/var/www/auto-build', '..', root) + relativeroot = re.sub('/home/apt/www/auto-build', '..', root) m = re.search('^Pd-[01]\.[0-9][0-9].*[^5]$', name) if m: commonbuildname = re.sub('-20[01][0-9][01][0-9][0-9][0-9]', '', name) - commonbuildpath = os.path.join('/var/www/auto-build/latest', commonbuildname) + commonbuildpath = os.path.join('/home/apt/www/auto-build/latest', commonbuildname) buildtarball = os.path.join(relativeroot, m.string) try: os.symlink(buildtarball, commonbuildpath) @@ -25,24 +27,32 @@ for root, dirs, files in os.walk('/var/www/auto-build/'): #print "removing ", commonbuildpath os.remove(commonbuildpath) os.symlink(buildtarball, commonbuildpath) - m2 = re.search('^Pd-extended_[01]\.[0-9][0-9].*-source.*tar.bz2$', name) + m2 = re.search('^Pd-extended_[01]\.[0-9][0-9].*-source.tar.bz2$', name) if m2: sourcetarballs.append(os.path.join(root, m2.string)) +# delete old source links, we only keep one +for f in glob.glob('/home/apt/www/auto-build/latest/Pd-extended*source*'): + if os.path.islink(f): + os.remove(f) + if len(sourcetarballs) > 0: sourcetarball = sourcetarballs[-1] linkname = re.sub('/20[01][0-9]-[01][0-9]-[0-9][0-9]/', '/latest/', sourcetarball) - sourcetarball = re.sub('/var/www/auto-build', '..', sourcetarball) + sourcetarball = re.sub('/home/apt/www/auto-build', '..', sourcetarball) debiantarball = re.sub('-source', '-source.debian', sourcetarball) debianlinkname = re.sub('-source', '-source.debian', linkname) try: os.remove(linkname) os.remove(debianlinkname) - except Exception as e: - print e + except Exception, e: + pass try: + print 'os.symlink(' + sourcetarball + ', ' + linkname + ')' os.symlink(sourcetarball, linkname) + print 'os.symlink(' + debiantarball + ', ' + debianlinkname + ')' os.symlink(debiantarball, debianlinkname) foundsourcetarball = True - except Exception as e: + except Exception, e: + print 'Failed to symlink ', print e -- cgit v1.2.1