Autobuild script updated.

This commit is contained in:
Serge Vakulenko
2015-08-27 19:43:03 -07:00
parent 09f3488389
commit 2401afee53
2 changed files with 17 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
#
# Crontab entries for the autobuild server
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
5 * * * * /website/retrobsd/build/retrobsd-autobuild.py

View File

@@ -2,7 +2,7 @@
# #
# Autobuild script for RetroBSD # Autobuild script for RetroBSD
# #
import sys, string, os, subprocess, shutil, datetime, MySQLdb import sys, string, os, subprocess, shutil, time, datetime, MySQLdb
BSD = "/website/retrobsd/build/retrobsd-sources" BSD = "/website/retrobsd/build/retrobsd-sources"
ARCHIVE = "/website/retrobsd/build/master" ARCHIVE = "/website/retrobsd/build/master"
@@ -13,7 +13,7 @@ REPO = "https://github.com/RetroBSD/retrobsd.git"
# #
today = datetime.date.today() today = datetime.date.today()
DATE = "%04d-%02d-%02d" % (today.year, today.month, today.day) DATE = "%04d-%02d-%02d" % (today.year, today.month, today.day)
print "--- Date:", DATE print "--- Started:", time.ctime()
# #
# (1) If BSD directory exists: use 'git pull' to update # (1) If BSD directory exists: use 'git pull' to update
@@ -21,7 +21,7 @@ print "--- Date:", DATE
# #
if os.path.exists(BSD): if os.path.exists(BSD):
print "--- Update the existing source tree" print "--- Update the existing source tree"
os.system("git -C "+BSD+" pull") os.system("git -C "+BSD+" pull > /dev/null")
fresh_sources = False fresh_sources = False
else: else:
print "--- Checkout a fresh snapshot of sources" print "--- Checkout a fresh snapshot of sources"
@@ -35,13 +35,16 @@ rev = subprocess.check_output(string.split("git -C "+BSD+" rev-list HEAD --count
rev = int(rev) rev = int(rev)
print "--- Latest revision:", rev print "--- Latest revision:", rev
rid = subprocess.check_output(string.split("git -C "+BSD+" rev-parse --short HEAD")).strip()
print "--- Commit ID:", rid
# #
# (3) If the REV already exists in the ARCHIVE: all done. # (3) If the REV already exists in the ARCHIVE: all done.
# Otherwise proceed to (4). # Otherwise proceed to (4).
# #
if os.path.exists(ARCHIVE + "/" + str(rev)): if os.path.exists(ARCHIVE + "/" + str(rev)):
print "--- Build for revision "+str(rev)+" already exists" print "--- Build for revision "+str(rev)+" already available"
print "--- Finished" print "--- Finished:", time.ctime()
sys.exit (0) sys.exit (0)
# #
@@ -103,4 +106,5 @@ for r in range(rev-1, 0, -1):
print "--- Delete unused revision", r print "--- Delete unused revision", r
shutil.rmtree(dir) shutil.rmtree(dir)
print "--- Finished:", time.ctime()
sys.exit (0) sys.exit (0)