[64915] trunk/base/src
jmr at macports.org
jmr at macports.org
Wed Mar 17 10:19:59 PDT 2010
Revision: 64915
http://trac.macports.org/changeset/64915
Author: jmr at macports.org
Date: 2010-03-17 10:19:57 -0700 (Wed, 17 Mar 2010)
Log Message:
-----------
factor repeated calculation of archs into a helper function
Modified Paths:
--------------
trunk/base/src/package1.0/portarchive.tcl
trunk/base/src/package1.0/portarchivefetch.tcl
trunk/base/src/package1.0/portunarchive.tcl
trunk/base/src/port1.0/portinstall.tcl
trunk/base/src/port1.0/portlint.tcl
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/package1.0/portarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portarchive.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/package1.0/portarchive.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -70,7 +70,6 @@
global name version revision portvariants
global archive.destpath archive.type archive.meta
global archive.file archive.path archive.fulldestpath
- global os.arch configure.build_arch configure.universal_archs supported_archs
# Check mode in case archive called directly by user
if {[option portarchivemode] != "yes"} {
@@ -79,14 +78,10 @@
# Define archive destination directory and target filename
if {![string equal ${archive.destpath} ${workpath}] && ![string equal ${archive.destpath} ""]} {
- if {$supported_archs == "noarch"} {
- set archive.fulldestpath [file join ${archive.destpath} [option os.platform] noarch]
- } elseif {[variant_exists universal] && [variant_isset universal]} {
+ if {[llength [get_canonical_archs]] > 1} {
set archive.fulldestpath [file join ${archive.destpath} [option os.platform] "universal"]
- } elseif {${configure.build_arch} != ""} {
- set archive.fulldestpath [file join ${archive.destpath} [option os.platform] ${configure.build_arch}]
} else {
- set archive.fulldestpath [file join ${archive.destpath} [option os.platform] ${os.arch}]
+ set archive.fulldestpath [file join ${archive.destpath} [option os.platform] [get_canonical_archs]]
}
} else {
set archive.fulldestpath ${archive.destpath}
@@ -107,15 +102,7 @@
set any_missing no
foreach archive.type [option portarchivetype] {
if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
- if {$supported_archs == "noarch"} {
- set archstring noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- set archstring [join [lsort -ascii ${configure.universal_archs}] -]
- } elseif {${configure.build_arch} != ""} {
- set archstring ${configure.build_arch}
- } else {
- set archstring ${os.arch}
- }
+ set archstring [join [get_canonical_archs] -]
set archive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${archive.type}"
set archive.path "[file join ${archive.fulldestpath} ${archive.file}]"
if {![file exists ${archive.path}]} {
@@ -305,7 +292,7 @@
global name epoch version revision portvariants
global archive.fulldestpath archive.type archive.file archive.path
global archive.meta archive.metaname archive.metapath
- global os.platform os.arch configure.build_arch configure.universal_archs supported_archs
+ global os.platform
# Create archive destination path (if needed)
if {![file isdirectory ${archive.fulldestpath}]} {
@@ -359,15 +346,7 @@
puts $fd "@portepoch ${epoch}"
puts $fd "@portversion ${version}"
puts $fd "@portrevision ${revision}"
- if {$supported_archs == "noarch"} {
- puts $fd "@archs noarch"
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- puts $fd "@archs [lsort -ascii ${configure.universal_archs}]"
- } elseif {${configure.build_arch} != ""} {
- puts $fd "@archs ${configure.build_arch}"
- } else {
- puts $fd "@archs ${os.arch}"
- }
+ puts $fd "@archs [get_canonical_archs]"
array set ourvariations $PortInfo(active_variants)
set vlist [lsort -ascii [array names ourvariations]]
foreach v $vlist {
@@ -415,14 +394,10 @@
putel $sd minor 0
putel $sd platform ${os.platform}
- if {$supported_archs == "noarch"} {
- putel $sd arch noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- putlist $sd archs arch [lsort -ascii ${configure.universal_archs}]
- } elseif {${configure.build_arch} != ""} {
- putel $sd arch ${configure.build_arch}
+ if {[llength [get_canonical_archs]] > 1} {
+ putlist $sd archs arch [get_canonical_archs]
} else {
- putel $sd arch ${os.arch}
+ putel $sd arch [get_canonical_archs]
}
putlist $sd variants variant $vlist
@@ -481,15 +456,7 @@
close $sd
}
- if {$supported_archs == "noarch"} {
- set archstring noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- set archstring [join [lsort -ascii ${configure.universal_archs}] -]
- } elseif {${configure.build_arch} != ""} {
- set archstring ${configure.build_arch}
- } else {
- set archstring ${os.arch}
- }
+ set archstring [join [get_canonical_archs] -]
# Now create the archive(s)
# Loop through archive types
foreach archive.type [option portarchivetype] {
Modified: trunk/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- trunk/base/src/package1.0/portarchivefetch.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/package1.0/portarchivefetch.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -66,35 +66,22 @@
# Checks possible archive files to assemble url lists for later fetching
proc portarchivefetch::checkarchivefiles {urls} {
- global all_archive_files supported_archs configure.build_arch os.arch \
- configure.universal_archs archivefetch.fulldestpath \
+ global all_archive_files archivefetch.fulldestpath \
portarchivepath name version revision portvariants archive_sites
upvar $urls fetch_urls
# Define archive directory, file, and path
- if {$supported_archs == "noarch"} {
- set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] noarch]
- } elseif {[variant_exists universal] && [variant_isset universal]} {
+ if {[llength [get_canonical_archs]] > 1} {
set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] "universal"]
- } elseif {${configure.build_arch} != ""} {
- set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] ${configure.build_arch}]
} else {
- set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] ${os.arch}]
+ set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] [get_canonical_archs]]
}
set unsupported 0
set found 0
foreach archive.type [option portarchivetype] {
if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
- if {$supported_archs == "noarch"} {
- set archstring noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- set archstring [join [lsort -ascii ${configure.universal_archs}] -]
- } elseif {${configure.build_arch} != ""} {
- set archstring ${configure.build_arch}
- } else {
- set archstring ${os.arch}
- }
+ set archstring [join [get_canonical_archs] -]
set archive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${archive.type}"
set archive.path [file join ${archivefetch.fulldestpath} ${archive.file}]
if {[file exists ${archive.path}]} {
Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/package1.0/portunarchive.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -65,7 +65,6 @@
global ports_force ports_source_only ports_binary_only
global name version revision portvariants portpath
global unarchive.srcpath unarchive.type unarchive.file unarchive.path unarchive.fullsrcpath
- global os.arch configure.build_arch configure.universal_archs supported_archs
# Check mode in case archive called directly by user
if {[option portarchivemode] != "yes"} {
@@ -74,14 +73,10 @@
# Define archive directory, file, and path
if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} {
- if {$supported_archs == "noarch"} {
- set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] noarch]
- } elseif {[variant_exists universal] && [variant_isset universal]} {
+ if {[llength [get_canonical_archs]] > 1} {
set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] "universal"]
- } elseif {${configure.build_arch} != ""} {
- set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] ${configure.build_arch}]
} else {
- set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] ${os.arch}]
+ set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] [get_canonical_archs]]
}
} else {
set unarchive.fullsrcpath ${unarchive.srcpath}
@@ -105,15 +100,7 @@
set unsupported 0
foreach unarchive.type [option portarchivetype] {
if {[catch {archiveTypeIsSupported ${unarchive.type}} errmsg] == 0} {
- if {$supported_archs == "noarch"} {
- set archstring noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- set archstring [join [lsort -ascii ${configure.universal_archs}] -]
- } elseif {${configure.build_arch} != ""} {
- set archstring ${configure.build_arch}
- } else {
- set archstring ${os.arch}
- }
+ set archstring [join [get_canonical_archs] -]
set unarchive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${unarchive.type}"
set unarchive.path "[file join ${unarchive.fullsrcpath} ${unarchive.file}]"
if {[file exist ${unarchive.path}]} {
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/port1.0/portinstall.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -144,7 +144,6 @@
worksrcdir UI_PREFIX destroot revision maintainers user_options \
portvariants negated_variants targets depends_lib PortInfo epoch license \
registry.installtype registry.path registry.format \
- os.arch configure.build_arch configure.universal_archs supported_archs \
os.platform os.major
if {[string equal ${registry.format} "receipt_sqlite"]} {
@@ -170,15 +169,7 @@
$regref requested $user_options(ports_requested)
$regref os_platform ${os.platform}
$regref os_major ${os.major}
- if {$supported_archs == "noarch"} {
- $regref archs noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- $regref archs [lsort -ascii ${configure.universal_archs}]
- } elseif {${configure.build_arch} != ""} {
- $regref archs ${configure.build_arch}
- } else {
- $regref archs ${os.arch}
- }
+ $regref archs [get_canonical_archs]
# Trick to have a portable GMT-POSIX epoch-based time.
$regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
if {[info exists negated_variants]} {
@@ -232,15 +223,7 @@
registry_prop_store $regref os_platform ${os.platform}
registry_prop_store $regref os_major ${os.major}
- if {$supported_archs == "noarch"} {
- registry_prop_store $regref archs noarch
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- registry_prop_store $regref archs [lsort -ascii ${configure.universal_archs}]
- } elseif {${configure.build_arch} != ""} {
- registry_prop_store $regref archs ${configure.build_arch}
- } else {
- registry_prop_store $regref archs ${os.arch}
- }
+ registry_prop_store $regref archs [get_canonical_archs]
if {[info exists description]} {
registry_prop_store $regref description [string map {\n \\n} ${description}]
Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/port1.0/portlint.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -270,8 +270,7 @@
global os.platform os.arch os.version
global version revision epoch
- # hoping for "noarch" :
- set portarch ${os.arch}
+ set portarch [get_canonical_archs]
global description long_description platforms categories all_variants
global maintainers homepage master_sites checksums patchfiles
global depends_fetch depends_extract depends_lib depends_build depends_run distfiles fetch.type
@@ -530,7 +529,7 @@
ui_debug "Epoch: $epoch"
ui_debug "Version: $version"
ui_debug "Revision: $revision"
- ui_debug "Arch: $portarch"
+ ui_debug "Archs: $portarch"
###################################################################
ui_msg "$UI_PREFIX [format [msgcat::mc "%d errors and %d warnings found."] $errors $warnings]"
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2010-03-17 16:04:47 UTC (rev 64914)
+++ trunk/base/src/port1.0/portutil.tcl 2010-03-17 17:19:57 UTC (rev 64915)
@@ -2539,3 +2539,17 @@
}
}
}
+
+# returns the list of archs that the port is targeting
+proc get_canonical_archs {} {
+ global supported_archs os.arch configure.build_arch configure.universal_archs
+ if {$supported_archs == "noarch"} {
+ return "noarch"
+ } elseif {[variant_exists universal] && [variant_isset universal]} {
+ return [lsort -ascii ${configure.universal_archs}]
+ } elseif {${configure.build_arch} != ""} {
+ return ${configure.build_arch}
+ } else {
+ return ${os.arch}
+ }
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100317/002dcb78/attachment-0001.html>
More information about the macports-changes
mailing list