[129381] contrib/mpab

jmr at macports.org jmr at macports.org
Thu Dec 11 12:34:16 PST 2014


Revision: 129381
          https://trac.macports.org/changeset/129381
Author:   jmr at macports.org
Date:     2014-12-11 12:34:16 -0800 (Thu, 11 Dec 2014)
Log Message:
-----------
mpab: handle failure caching and skipping due to failed deps for ports with bin/lib/path deps

Modified Paths:
--------------
    contrib/mpab/chroot-scripts/buildports
    contrib/mpab/mpab-functions

Added Paths:
-----------
    contrib/mpab/chroot-scripts/dep_ports.tcl

Modified: contrib/mpab/chroot-scripts/buildports
===================================================================
--- contrib/mpab/chroot-scripts/buildports	2014-12-11 20:02:28 UTC (rev 129380)
+++ contrib/mpab/chroot-scripts/buildports	2014-12-11 20:34:16 UTC (rev 129381)
@@ -99,20 +99,12 @@
          echo "skipping, portfile not modified since last failure" | tee -a ${PROGRESSLOG} | tee ${PORTRESULTSDIR}/fail/${portName}.log
          skipPort=1
       else
-         portDeps=`${PREFIX}/bin/port info --index --depends --line ${portName} | /usr/bin/tr ',' ' '`
-         nonPortDeps=""
-         for oneDep in ${portDeps}; do
-            depType=`echo ${oneDep} | /usr/bin/awk -F : '{print $1}'`
-            if [[ $depType == "port" ]]; then
-               depName=`echo ${oneDep} | /usr/bin/awk -F : '{print $2}'`
-               if [[ -f ${PORTRESULTSDIR}/fail/${depName}.log ]]; then
-                  skipPort=1
-                  echo "skipping, $depName previously failed and is needed" | tee -a ${PROGRESSLOG}
-                  echo "${portName} not built due to failed dependency $depName" > ${PORTRESULTSDIR}/fail/${portName}.log
-                  break
-               fi
-            else
-               nonPortDeps=1
+         for oneDep in `$TCLSH /var/tmp/dep_ports.tcl $portName`; do
+            if [[ -f ${PORTRESULTSDIR}/fail/${oneDep}.log ]]; then
+                skipPort=1
+                echo "skipping, $oneDep previously failed and is needed" | tee -a ${PROGRESSLOG}
+                echo "${portName} not built due to failed dependency $oneDep" > ${PORTRESULTSDIR}/fail/${portName}.log
+                break
             fi
          done
       fi
@@ -126,10 +118,7 @@
             /bin/mv ${PORTRESULTSDIR}/${portName}.log ${PORTRESULTSDIR}/fail
             echo "failure" | tee -a ${PROGRESSLOG}
             ${PREFIX}/bin/port clean --work $portName rdepof:${portName}
-            # check that it definitely failed in its own right before caching
-            if [[ -z "$nonPortDeps" ]]; then
-               touch -r ${portFile} ${FAILCACHE}/${portName}
-            fi
+            touch -r ${portFile} ${FAILCACHE}/${portName}
          fi
          uninstallPorts
          if [[ $? != 0 ]]; then

Copied: contrib/mpab/chroot-scripts/dep_ports.tcl (from rev 129380, contrib/mpab/chroot-scripts/archivepath.tcl)
===================================================================
--- contrib/mpab/chroot-scripts/dep_ports.tcl	                        (rev 0)
+++ contrib/mpab/chroot-scripts/dep_ports.tcl	2014-12-11 20:34:16 UTC (rev 129381)
@@ -0,0 +1,105 @@
+#!/bin/sh
+# \
+if /usr/bin/which -s port-tclsh; then exec port-tclsh "$0" -i `which port-tclsh` "$@"; else exec /usr/bin/tclsh "$0" -i /usr/bin/tclsh "$@"; fi
+#
+# Prints the list of ports that the given port depends on. (Nothing is
+# printed for deps that are fulfilled by files not provided by any port.)
+#
+# Copyright (c) 2013-2014 The MacPorts Project.
+#
+# 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.
+
+if {[info exists env(PREFIX)]} {
+    set prefix $env(PREFIX)
+} else {
+    set prefix /opt/local
+}
+
+if {[llength $::argv] == 0} {
+    puts stderr "Usage: $argv0 <portname>"
+    exit 1
+} elseif {[llength $::argv] >= 3 && [lindex $argv 0] eq "-i"} {
+    set prefixFromInterp [file dirname [file dirname [lindex $argv 1]]]
+    if {$prefixFromInterp ne $prefix} {
+        if {[file executable ${prefix}/bin/port-tclsh]} {
+            exec ${prefix}/bin/port-tclsh $argv0 {*}[lrange $::argv 2 end] <@stdin >@stdout 2>@stderr
+            exit 0
+        } else {
+            puts stderr "No port-tclsh found in ${prefix}/bin"
+            exit 1
+        }
+    }
+    set ::argv [lrange $::argv 2 end]
+}
+
+package require macports
+
+if {[catch {mportinit "" "" ""} result]} {
+   ui_error "$errorInfo"
+   ui_error "Failed to initialize ports sytem: $result"
+   exit 1
+}
+
+set portname [lindex $::argv 0]
+if {[llength $::argv] > 1} {
+    set variations [lindex $::argv 1]
+} else {
+    set variations ""
+}
+
+if {[catch {set one_result [mportlookup $portname]}] || [llength $one_result] < 2} {
+    # just print nothing, MPAB will notice the missing port itself
+    puts ""
+    exit 0
+}
+
+array set portinfo [lindex $one_result 1]
+if {[info exists portinfo(porturl)]} {
+    if {[catch {set mport [mportopen $portinfo(porturl) [list subport $portinfo(name)] $variations]}]} {
+        ui_warn "failed to open port: $portname"
+        puts ""
+        exit 0
+    } else {
+        array unset portinfo
+        array set portinfo [mportinfo $mport]
+        set workername [ditem_key $mport workername]
+        set dep_ports ""
+        # get the actual fulfilling port for each depspec
+        foreach deptype {depends_fetch depends_extract depends_build depends_lib depends_run} {
+            if {![info exists portinfo($deptype)]} {
+                continue
+            }
+            foreach depspec $portinfo($deptype) {
+                set dep_portname [$workername eval _get_dep_port $depspec]
+                if {$dep_portname ne ""} {
+                    lappend dep_ports $dep_portname
+                }
+            }
+        }
+        puts [join $dep_ports]
+    }
+    catch {mportclose $mport}
+}

Modified: contrib/mpab/mpab-functions
===================================================================
--- contrib/mpab/mpab-functions	2014-12-11 20:02:28 UTC (rev 129380)
+++ contrib/mpab/mpab-functions	2014-12-11 20:34:16 UTC (rev 129381)
@@ -276,6 +276,7 @@
 
    cp -p ${baseDir}/chroot-scripts/genportlist.tcl ${chrootPath}/var/tmp/
    cp -p ${baseDir}/chroot-scripts/archivepath.tcl ${chrootPath}/var/tmp/
+   cp -p ${baseDir}/chroot-scripts/dep_ports.tcl ${chrootPath}/var/tmp/
 
    rm -f ${chrootPath}/var/tmp/progress.log ${baseDir}/progress.log
    touch ${baseDir}/progress.log
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141211/321a6eda/attachment.html>


More information about the macports-changes mailing list