[151046] contrib/mp-buildbot
cal at macports.org
cal at macports.org
Sat Aug 6 05:45:17 PDT 2016
Revision: 151046
https://trac.macports.org/changeset/151046
Author: cal at macports.org
Date: 2016-08-06 05:45:17 -0700 (Sat, 06 Aug 2016)
Log Message:
-----------
mp-buildbot: Do not build obsolete ports
Avoid wasting build resources and generating useless failure emails by
filtering all ports that include the obsolete-1.0 PortGroup in mpbb
list-subports.
Modified Paths:
--------------
contrib/mp-buildbot/mpbb-list-subports
Added Paths:
-----------
contrib/mp-buildbot/tools/portgroups.tcl
Modified: contrib/mp-buildbot/mpbb-list-subports
===================================================================
--- contrib/mp-buildbot/mpbb-list-subports 2016-08-06 06:48:34 UTC (rev 151045)
+++ contrib/mp-buildbot/mpbb-list-subports 2016-08-06 12:45:17 UTC (rev 151046)
@@ -12,7 +12,23 @@
print-subports() {
local portname=$1
- "${option_prefix}/bin/port" -q info --index --line --name "subportof:${portname}" "${portname}" 2>/dev/null || return $?
+ local port
+ local portgroup
+ local ports
+ local exclude
+
+ ports=$("${option_prefix}/bin/port" -q info --index --line --name "subportof:${portname}" "${portname}" 2>/dev/null) || return $?
+ for port in $ports; do
+ exclude=0
+ for portgroup in $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/portgroups.tcl" "$port"); do
+ if [ "$portgroup" = "obsolete-1.0" ]; then
+ exclude=1
+ fi
+ done
+ if [ $exclude -ne 1 ]; then
+ echo "$port"
+ fi
+ done
}
list-subports() {
Added: contrib/mp-buildbot/tools/portgroups.tcl
===================================================================
--- contrib/mp-buildbot/tools/portgroups.tcl (rev 0)
+++ contrib/mp-buildbot/tools/portgroups.tcl 2016-08-06 12:45:17 UTC (rev 151046)
@@ -0,0 +1,99 @@
+#!/usr/bin/env port-tclsh
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+#
+# Writes a list of included PortGroups for a given port to stdout.
+#
+# Copyright (c) 2016 The MacPorts Project.
+# Copyright (c) 2016 Clemens Lang <cal at macports.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name of the MacPorts project, nor the names of any contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+package require macports
+
+if {[llength $::argv] == 0} {
+ puts stderr "Usage: $argv0 <portname>"
+ exit 1
+}
+
+# initialize macports
+if {[catch {mportinit "" "" ""} result]} {
+ ui_error "$errorInfo"
+ ui_error "Failed to initialize ports sytem: $result"
+ exit 1
+}
+
+# look up the path of the Portfile for the given port
+set portname [lindex $::argv 0]
+#try -pass_signal {
+try {
+ set result [mportlookup $portname]
+ if {[llength $result] < 2} {
+ ui_error "No such port: $portname"
+ exit 1
+ }
+} catch {{*} eCode eMessage} {
+ ui_error "mportlookup $portname failed: $eMessage"
+ exit 1
+}
+
+# open the port so we can run dependency calculation
+array set portinfo [lindex $result 1]
+#try -pass_signal {
+try {
+ set mport [mportopen $portinfo(porturl) [list subport $portname] {}]
+} catch {{*} eCode eMessage} {
+ ui_error "mportopen ${portinfo(porturl)} failed: $eMessage"
+ exit 1
+}
+
+# obtain PortInfo array for this port and print the list of included
+# PortGroups
+array set portinfo [mportinfo $mport]
+# only ports that include at least one PortGroup have portinfo(portgroups) set
+if {[info exists portinfo(portgroups)]} {
+ foreach portgroup $portinfo(portgroups) {
+ lassign $portgroup group version
+ puts "$group-$version"
+ }
+}
+
+# close the Port
+#try -pass_signal {
+try {
+ mportclose $mport
+} catch {{*} eCode eMessage} {
+ ui_error "mportclose $portname failed: $eMessage"
+ exit 1
+}
+
+# shut down MacPorts
+#try -pass_signal {
+try {
+ mportshutdown
+} catch {{*} eCode eMessage} {
+ ui_error "mportshutdown failed: $eMessage"
+ exit 1
+}
Property changes on: contrib/mp-buildbot/tools/portgroups.tcl
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160806/94008611/attachment.html>
More information about the macports-changes
mailing list