[79765] users/jmr
jmr at macports.org
jmr at macports.org
Fri Jun 24 23:31:17 PDT 2011
Revision: 79765
http://trac.macports.org/changeset/79765
Author: jmr at macports.org
Date: 2011-06-24 23:31:16 -0700 (Fri, 24 Jun 2011)
Log Message:
-----------
WIP queueing scripts
Added Paths:
-----------
users/jmr/dequeue.plist
users/jmr/dequeue.sh
users/jmr/queue.sh
Added: users/jmr/dequeue.plist
===================================================================
--- users/jmr/dequeue.plist (rev 0)
+++ users/jmr/dequeue.plist 2011-06-25 06:31:16 UTC (rev 79765)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>Label</key>
+ <string>org.macports.mpab</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/path/to/dequeue.sh</string>
+ </array>
+ <key>WatchPaths</key>
+ <array>
+ <string>/path/to/portqueue</string>
+ </array>
+ </dict>
+</plist>
Added: users/jmr/dequeue.sh
===================================================================
--- users/jmr/dequeue.sh (rev 0)
+++ users/jmr/dequeue.sh 2011-06-25 06:31:16 UTC (rev 79765)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+QFILE=./portqueue
+QLOCK=${QFILE}.lock
+LOGSPATH=.
+PORTDBPATH=/opt/local/var/macports
+SWPATH=${PORTDBPATH}/software
+# private key to use for signing
+# XXX set real path
+PRIVKEY=""
+
+MPABCMD=./mpab
+PORTCMD=/opt/local/bin/port
+OPENSSLCMD=/usr/bin/openssl
+DISTCHECK=./port_binary_distributable.tcl
+
+DLHOST=mparchives.local
+# TODO: what directory structure do we want? a subdir per platform?
+DLPATH=/archives
+
+lockfile ${QLOCK}
+# empty the queue and remove duplicates
+< $QFILE sort | uniq > newports
+echo -n > ${QFILE}
+rm -f ${QLOCK}
+
+# do we actually have any ports to build?
+if [[ $(ls -s newports | awk '{print $1}') -eq 0 ]]; then
+ exit 0
+fi
+
+# run mpab on the port list
+${MPABCMD} buildports newports
+
+for log in ${LOGSPATH}/logs-*/success/*.log; do
+ portname=$(basename $log .log)
+ # check if binaries of this port are distributable
+ if ${DISTCHECK} ${portname}; then
+ portversion=$(${PORTCMD} info --version ${portName} | awk '{print $2}')
+ portrevision=$(${PORTCMD} info --revision ${portName} | awk '{print $2}')
+ # sign archive(s) and send them to the download server (there may be a universal version)
+ for archive in ${SWPATH}/${portname}/${portname}-${portversion}_${portrevision}[+.]*; do
+ aname=$(basename $archive)
+ ${OPENSSLCMD} dgst -ripemd160 -sign ${PRIVKEY} -out ./${aname}.rmd160 ${archive}
+ ssh ${DLHOST} mkdir -p ${DLPATH}/${portname}
+ rsync -av ./${aname}.rmd160 ${archive} ${DLHOST}:${DLPATH}/${portname}
+ rm ./${aname}.rmd160
+ done
+ fi
+done
+
+# TODO: do something useful with failure logs
+# would be nice to also update status on MPWA
+# for log in ${LOGSPATH}/logs-*/fail/*.log; do
+# something
+# done
+
+rm -rf ${LOGSPATH}/logs-*
Property changes on: users/jmr/dequeue.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: users/jmr/queue.sh
===================================================================
--- users/jmr/queue.sh (rev 0)
+++ users/jmr/queue.sh 2011-06-25 06:31:16 UTC (rev 79765)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+QFILE=./portqueue
+QLOCK=${QFILE}.lock
+REPO_PATH=/svn/repositories/macports
+DPORTS_PATH=${REPO_PATH}/trunk/dports
+MPAB_HOST=mpab.local
+
+SSHCMD=/usr/bin/ssh
+DIRNAMECMD=/usr/bin/dirname
+BASENAMECMD=/usr/bin/basename
+SVNLOOKCMD=/opt/local/bin/svnlook
+
+if [[ $1 == "commit" ]]; then
+ revision_paths=$(${SVNLOOKCMD} changed ${REPO_PATH} -r $2)
+
+ ${SSHCMD} ${MPAB_HOST} lockfile ${QLOCK}
+ # find port dirs modified by the commit
+ for p in $revision_paths; do
+ if [[ $(${DIRNAMECMD} $(${DIRNAMECMD} $p)) = "$DPORTS_PATH" && $(${BASENAMECMD} $(${DIRNAMECMD} $p)) != "_resources" ]]; then
+ ${SSHCMD} ${MPAB_HOST} "echo $(${BASENAMECMD} $p) >> ${QFILE}"
+ fi
+ done
+
+ ${SSHCMD} ${MPAB_HOST} rm -f ${QLOCK}
+fi
Property changes on: users/jmr/queue.sh
___________________________________________________________________
Added: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110624/b4ab15de/attachment.html>
More information about the macports-changes
mailing list