[38497] trunk/base/portmgr/jobs
wsiegrist at apple.com
wsiegrist at apple.com
Tue Jul 22 11:40:15 PDT 2008
Revision: 38497
http://trac.macosforge.org/projects/macports/changeset/38497
Author: wsiegrist at apple.com
Date: 2008-07-22 11:40:15 -0700 (Tue, 22 Jul 2008)
Log Message:
-----------
Adding scripts used on the servers for mirroring during post-commit and daily
Added Paths:
-----------
trunk/base/portmgr/jobs/mirror_macports.sh
trunk/base/portmgr/jobs/portfile_mirror.pl
Added: trunk/base/portmgr/jobs/mirror_macports.sh
===================================================================
--- trunk/base/portmgr/jobs/mirror_macports.sh (rev 0)
+++ trunk/base/portmgr/jobs/mirror_macports.sh 2008-07-22 18:40:15 UTC (rev 38497)
@@ -0,0 +1,63 @@
+#!/bin/bash
+####
+# Run "port mirror" for each variant of each port
+# Created by William Siegrist,
+# e-mail: wsiegrist at apple.com
+# $Id$
+####
+
+# regexp of ports that we do not mirror
+EXCLUSIONS='^(molden)$'
+
+# macports really wants this, so lets appease it
+export COLUMNS=80
+export LINES=24
+
+# send all output here
+LOG="/admin/var/log/macports.log"
+
+PORT="/opt/local/bin/port"
+CUT=/usr/bin/cut
+GREP=/usr/bin/grep
+XARGS=/usr/bin/xargs
+EGREP=/usr/bin/egrep
+
+exec >> $LOG 2>&1
+
+echo "------------------------------
+ Beginning mirror run
+------------------------------";
+
+# for each port
+for P in `$PORT list | $CUT -f 1 -d " " | $EGREP -v $EXCLUSIONS`;
+do
+
+ NOW=`/bin/date`;
+ echo "TIME: ${NOW}";
+
+ # mirror with no variants
+ echo "Mirroring ${P}";
+ $PORT clean $P;
+ $PORT mirror $P;
+
+ # for each variant
+ for V in `$PORT variants $P | $GREP -v 'has no variants' | $GREP -v 'has the variants' | $CUT -d " " -f 1 | $CUT -d ":" -f 1 | $GREP -v universal | $XARGS`;
+ do
+ # mirror with each variant
+ echo "Mirroring ${P} +${V}";
+ $PORT clean $P;
+ $PORT mirror $P +$V;
+ done
+
+ # clean up the work area
+ $PORT clean --work $P;
+
+done
+
+# record the last time we mirrored
+/bin/date > /rsync/macports-san/distfiles/TIMESTAMP
+
+echo "------------------------------
+ End of mirror run
+------------------------------";
+
Property changes on: trunk/base/portmgr/jobs/mirror_macports.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/base/portmgr/jobs/portfile_mirror.pl
===================================================================
--- trunk/base/portmgr/jobs/portfile_mirror.pl (rev 0)
+++ trunk/base/portmgr/jobs/portfile_mirror.pl 2008-07-22 18:40:15 UTC (rev 38497)
@@ -0,0 +1,88 @@
+#!/opt/local/bin/perl -w
+###
+# Run "port mirror" for all Portfiles changed in a given revision
+# Created by William Siegrist,
+# e-mail: wsiegrist at apple.com
+# $Id$
+###
+
+use strict;
+use Mail::Sendmail;
+
+my $REPOPATH = "/svn/repositories/macports/";
+my $REPOHOST = "http://svn.macosforge.org/repository/macports";
+my $SVNLOOK = "/opt/local/bin/svnlook";
+my $PORTCMD = "/opt/local/bin/port";
+my $SVN = "/opt/local/bin/svn -q --non-interactive";
+my $MKDIR = "/bin/mkdir -p";
+
+my $rev = $ARGV[0] or usage();
+my $TMPROOT = "/tmp/mp_mirror/$rev";
+
+my @changes = `$SVNLOOK changed $REPOPATH -r $rev`;
+
+foreach my $change (@changes) {
+ if ($change =~ /Portfile/) {
+ # remove svn status and whitespace
+ chop($change);
+ $change =~ s/\w\s+([\/\w]+)/$1/g;
+ # extract the portname from parent dir of Portfile
+ my $port = $change;
+ $port =~ s/^.*\/([^\/]+)\/Portfile$/$1/g;
+
+ # get the group directory
+ my $group = $change;
+ $group =~ s/^.*\/([^\/]+)\/[^\/]+\/Portfile$/$1/g;
+
+ # make a temporary work area
+ `$MKDIR $TMPROOT/$group/$port`;
+ chdir("$TMPROOT/$group/$port") or die("Failed to change dir for port: $port");
+ `$SVN co $REPOHOST/trunk/dports/$group/$port/ .`;
+
+ _mirror($port);
+ }
+}
+
+
+#
+# Subroutines
+#
+
+sub _mirror {
+ my ($port) = @_;
+ my $errors = `sudo $PORTCMD -qc mirror`;
+
+ if ($errors) {
+ my $maintainers = `$PORTCMD -q info --maintainer $port`;
+ # strip everything but the email addresses
+ $maintainers =~ s/maintainer: //;
+ $maintainers =~ s/openmaintainer\@macports.org//;
+ $maintainers =~ s/nomaintainer\@macports.org//;
+ chop($maintainers);
+
+ _mail($port, $maintainers, $errors);
+ }
+}
+
+sub _mail {
+ my ($port, $maintainers, $errors) = @_;
+
+ my %mail = (
+ To => $maintainers,
+ From => 'noreply at macports.org',
+ Subject => "[MacPorts Mirror] Portfile Mirror Errors for: $port",
+ Message => "Portfile: $port \n\n\n Errors: $errors \n\n",
+ smtp => 'relay.apple.com',
+ );
+
+ sendmail(%mail) or die $Mail::Sendmail::error;
+}
+
+sub usage {
+ print "usage: portfile_mirror.pl <rev>\n";
+ exit();
+}
+
+
+
+
Property changes on: trunk/base/portmgr/jobs/portfile_mirror.pl
___________________________________________________________________
Name: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080722/938532a5/attachment.html
More information about the macports-changes
mailing list