[105594] contrib/mpab

jmr at macports.org jmr at macports.org
Fri Apr 26 11:40:59 PDT 2013


Revision: 105594
          https://trac.macports.org/changeset/105594
Author:   jmr at macports.org
Date:     2013-04-26 11:40:59 -0700 (Fri, 26 Apr 2013)
Log Message:
-----------
mpab: don't skip ports due to an existing archive if the archive's variants don't match the current defaults

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

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

Added: contrib/mpab/chroot-scripts/archivepath.tcl
===================================================================
--- contrib/mpab/chroot-scripts/archivepath.tcl	                        (rev 0)
+++ contrib/mpab/chroot-scripts/archivepath.tcl	2013-04-26 18:40:59 UTC (rev 105594)
@@ -0,0 +1,76 @@
+#!/usr/bin/tclsh
+#
+# Prints the archive filename for the given port with the given variations.
+#
+# Copyright (c) 2013 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
+}
+
+source ${prefix}/share/macports/Tcl/macports1.0/macports_fastload.tcl
+package require macports
+
+if {[catch {mportinit "" "" ""} result]} {
+   ui_error "$errorInfo"
+   ui_error "Failed to initialize ports sytem: $result"
+   exit 1
+}
+
+if {[llength $::argv] == 0} {
+    puts stderr "Usage: $argv0 <portname>"
+    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 whatever, MPAB will notice the missing port itself
+    puts "nonexistent"
+    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 "nonexistent"
+        exit 0
+    } else {
+        set workername [ditem_key $mport workername]
+        puts [$workername eval get_portimage_path]
+    }
+    catch {mportclose $mport}
+}


Property changes on: contrib/mpab/chroot-scripts/archivepath.tcl
___________________________________________________________________
Added: svn:executable
   + *

Modified: contrib/mpab/chroot-scripts/buildports
===================================================================
--- contrib/mpab/chroot-scripts/buildports	2013-04-26 15:51:16 UTC (rev 105593)
+++ contrib/mpab/chroot-scripts/buildports	2013-04-26 18:40:59 UTC (rev 105594)
@@ -33,7 +33,6 @@
 if [[ -z "$PREFIX" ]]; then
     PREFIX=/opt/local
 fi
-ARCHIVE_TYPE=".tbz2"
 
 function uninstallPorts()
 {
@@ -79,15 +78,7 @@
 portCount=`echo ${portList} | /usr/bin/wc -w`
 portCount=$(($portCount))   # Get rid of wc's spacing
 
-tclOS=`echo 'puts [string tolower $tcl_platform(os)]' | tclsh`
-tclOSMajor=`echo 'puts [lindex [split $tcl_platform(osVersion) .] 0]' | tclsh`
-packageDir="${PREFIX}/var/macports/software"
 shopt -s extglob
-if [[ $tclOSMajor -ge 10 ]]; then
-    ACCEPT_ARCHS="+(noarch|x86_64|i386|-)"
-else
-    ACCEPT_ARCHS="+(noarch|i386|ppc|-)"
-fi
 
 currentCount=1
 for portName in ${portList}; do
@@ -95,11 +86,7 @@
 
    echo "Building ${portName} (${currentCount} of ${portCount})...\c" | tee -a ${PROGRESSLOG}
    # If there's a package, don't build again
-   portVersion=`${PREFIX}/bin/port info --index --version --line ${portName}`
-   portRevision=`${PREFIX}/bin/port info --index --revision --line ${portName}`
-   portPackageBaseName="${portName}-${portVersion}_${portRevision}"
-   ls ${packageDir}/${portName}/${portPackageBaseName}[+.]*${tclOS}_${tclOSMajor}.${ACCEPT_ARCHS}${ARCHIVE_TYPE} > /dev/null 2>&1
-   if [[ $? == 0 ]]; then
+   if [[ -f `/usr/bin/tclsh /var/tmp/archivepath.tcl $portName` ]]; then
       echo "package found, not building again" | tee -a ${PROGRESSLOG} | tee ${PORTRESULTSDIR}/success/${portName}.log
    else
       skipPort=""

Modified: contrib/mpab/mpab-functions
===================================================================
--- contrib/mpab/mpab-functions	2013-04-26 15:51:16 UTC (rev 105593)
+++ contrib/mpab/mpab-functions	2013-04-26 18:40:59 UTC (rev 105594)
@@ -275,6 +275,7 @@
    echo "Building ports"
 
    cp -p ${baseDir}/chroot-scripts/genportlist.tcl ${chrootPath}/var/tmp/
+   cp -p ${baseDir}/chroot-scripts/archivepath.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: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130426/81768477/attachment-0001.html>


More information about the macports-changes mailing list