[49087] trunk/base/src/port1.0
raimue at macports.org
raimue at macports.org
Fri Apr 3 04:34:32 PDT 2009
Revision: 49087
http://trac.macports.org/changeset/49087
Author: raimue at macports.org
Date: 2009-04-03 04:34:32 -0700 (Fri, 03 Apr 2009)
Log Message:
-----------
port1.0:
Create namespaces for the packages in port1.0, stop polluting the global
namespace with many local helper functions.
Modified Paths:
--------------
trunk/base/src/port1.0/portactivate.tcl
trunk/base/src/port1.0/portbuild.tcl
trunk/base/src/port1.0/portchecksum.tcl
trunk/base/src/port1.0/portclean.tcl
trunk/base/src/port1.0/portconfigure.tcl
trunk/base/src/port1.0/portdepends.tcl
trunk/base/src/port1.0/portdestroot.tcl
trunk/base/src/port1.0/portdistcheck.tcl
trunk/base/src/port1.0/portdistfiles.tcl
trunk/base/src/port1.0/portextract.tcl
trunk/base/src/port1.0/portfetch.tcl
trunk/base/src/port1.0/portinstall.tcl
trunk/base/src/port1.0/portlint.tcl
trunk/base/src/port1.0/portlivecheck.tcl
trunk/base/src/port1.0/portload.tcl
trunk/base/src/port1.0/portmain.tcl
trunk/base/src/port1.0/portmirror.tcl
trunk/base/src/port1.0/portpatch.tcl
trunk/base/src/port1.0/portstartupitem.tcl
trunk/base/src/port1.0/portsubmit.tcl
trunk/base/src/port1.0/porttest.tcl
trunk/base/src/port1.0/porttrace.tcl
trunk/base/src/port1.0/portunload.tcl
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portactivate.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -36,7 +36,7 @@
package provide portactivate 1.0
package require portutil 1.0
-set org.macports.activate [target_new org.macports.activate activate_main]
+set org.macports.activate [target_new org.macports.activate portactivate::activate_main]
target_runtype ${org.macports.activate} always
target_state ${org.macports.activate} no
target_provides ${org.macports.activate} activate
@@ -46,9 +46,12 @@
target_requires ${org.macports.activate} main fetch extract checksum patch configure build destroot install
}
+namespace eval portactivate {
+}
+
set_ui_prefix
-proc activate_main {args} {
+proc portactivate::activate_main {args} {
global portname portversion portrevision portvariants user_options portnotes
registry_activate $portname ${portversion}_${portrevision}${portvariants} [array get user_options]
Modified: trunk/base/src/port1.0/portbuild.tcl
===================================================================
--- trunk/base/src/port1.0/portbuild.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portbuild.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -33,11 +33,14 @@
package provide portbuild 1.0
package require portutil 1.0
-set org.macports.build [target_new org.macports.build build_main]
+set org.macports.build [target_new org.macports.build portbuild::build_main]
target_provides ${org.macports.build} build
target_requires ${org.macports.build} main fetch extract checksum patch configure
-target_prerun ${org.macports.build} build_start
+target_prerun ${org.macports.build} portbuild::build_start
+namespace eval portbuild {
+}
+
# define options
options build.target
options build.nice
@@ -48,7 +51,7 @@
# defaults
default build.asroot no
default build.dir {${workpath}/${worksrcdir}}
-default build.cmd {[build_getmaketype]}
+default build.cmd {[portbuild::build_getmaketype]}
default build.nice {${buildnicevalue}}
default build.jobs {${buildmakejobs}}
default build.pre_args {${build.target}}
@@ -57,7 +60,7 @@
set_ui_prefix
-proc build_getmaketype {args} {
+proc portbuild::build_getmaketype {args} {
if {![exists build.type]} {
return make
}
@@ -103,7 +106,7 @@
}
}
-proc build_getnicevalue {args} {
+proc portbuild::build_getnicevalue {args} {
if {![exists build.nice] || [string match "* *" [option build.cmd]]} {
return ""
}
@@ -114,7 +117,7 @@
return "nice -n $nice "
}
-proc build_getmakejobs {args} {
+proc portbuild::build_getmakejobs {args} {
# check if port allows a parallel build
global use_parallel_build
if {![tbool use_parallel_build]} {
@@ -136,7 +139,7 @@
return " -j$jobs"
}
-proc build_start {args} {
+proc portbuild::build_start {args} {
global UI_PREFIX build.asroot
ui_msg "$UI_PREFIX [format [msgcat::mc "Building %s"] [option portname]]"
@@ -150,7 +153,7 @@
}
-proc build_main {args} {
+proc portbuild::build_main {args} {
global build.cmd
set nice_prefix [build_getnicevalue]
Modified: trunk/base/src/port1.0/portchecksum.tcl
===================================================================
--- trunk/base/src/port1.0/portchecksum.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portchecksum.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,11 +34,14 @@
package provide portchecksum 1.0
package require portutil 1.0
-set org.macports.checksum [target_new org.macports.checksum checksum_main]
+set org.macports.checksum [target_new org.macports.checksum portchecksum::checksum_main]
target_provides ${org.macports.checksum} checksum
target_requires ${org.macports.checksum} main fetch
-target_prerun ${org.macports.checksum} checksum_start
+target_prerun ${org.macports.checksum} portchecksum::checksum_start
+namespace eval portchecksum {
+}
+
# Options
options checksums checksum.skip
@@ -68,7 +71,7 @@
# (4) first word is one of the checksums types.
#
# return yes if the syntax was correct, no if there was a problem.
-proc parse_checksums {checksums_str} {
+proc portchecksum::parse_checksums {checksums_str} {
global checksums_array all_dist_files checksum_types checksum_types_count
# Parse the string of checksums.
@@ -147,7 +150,7 @@
# Calculate the md5 checksum for the given file.
# Return the checksum.
#
-proc calc_md5 {file} {
+proc portchecksum::calc_md5 {file} {
return [md5 file $file]
}
@@ -156,7 +159,7 @@
# Calculate the sha1 checksum for the given file.
# Return the checksum.
#
-proc calc_sha1 {file} {
+proc portchecksum::calc_sha1 {file} {
return [sha1 file $file]
}
@@ -165,7 +168,7 @@
# Calculate the rmd160 checksum for the given file.
# Return the checksum.
#
-proc calc_rmd160 {file} {
+proc portchecksum::calc_rmd160 {file} {
return [rmd160 file $file]
}
@@ -173,7 +176,7 @@
#
# Target prerun procedure; simply prints a message about what we're doing.
#
-proc checksum_start {args} {
+proc portchecksum::checksum_start {args} {
global UI_PREFIX
ui_msg "$UI_PREFIX [format [msgcat::mc "Verifying checksum(s) for %s"] [option portname]]"
@@ -183,7 +186,7 @@
#
# Target main procedure. Verifies the checksums of all distfiles.
#
-proc checksum_main {args} {
+proc portchecksum::checksum_main {args} {
global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip
# If no files have been downloaded, there is nothing to checksum.
Modified: trunk/base/src/port1.0/portclean.tcl
===================================================================
--- trunk/base/src/port1.0/portclean.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portclean.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -37,22 +37,25 @@
package require portutil 1.0
package require Pextlib 1.0
-set org.macports.clean [target_new org.macports.clean clean_main]
+set org.macports.clean [target_new org.macports.clean portclean::clean_main]
target_runtype ${org.macports.clean} always
target_state ${org.macports.clean} no
target_provides ${org.macports.clean} clean
target_requires ${org.macports.clean} main
-target_prerun ${org.macports.clean} clean_start
+target_prerun ${org.macports.clean} portclean::clean_start
+namespace eval portclean {
+}
+
set_ui_prefix
-proc clean_start {args} {
+proc portclean::clean_start {args} {
global UI_PREFIX
ui_msg "$UI_PREFIX [format [msgcat::mc "Cleaning %s"] [option portname]]"
}
-proc clean_main {args} {
+proc portclean::clean_main {args} {
global UI_PREFIX
global ports_clean_dist ports_clean_work ports_clean_archive
global ports_clean_all usealtworkpath
@@ -85,7 +88,7 @@
return 0
}
-proc clean_altsource {args} {
+proc portclean::clean_altsource {args} {
global usealtworkpath worksymlink
set sourcepath [string map {"work" ""} $worksymlink]
@@ -107,7 +110,7 @@
# Remove the directory where the distfiles reside.
# This is crude, but works.
#
-proc clean_dist {args} {
+proc portclean::clean_dist {args} {
global ports_force portname distpath dist_subdir distfiles
# remove known distfiles for sure (if they exist)
@@ -174,7 +177,7 @@
return 0
}
-proc clean_work {args} {
+proc portclean::clean_work {args} {
global portbuildpath worksymlink
if {[file isdirectory $portbuildpath]} {
@@ -196,7 +199,7 @@
return 0
}
-proc clean_archive {args} {
+proc portclean::clean_archive {args} {
global workpath portarchivepath portname portversion ports_version_glob
# Define archive destination directory and target filename
Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portconfigure.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,11 +34,14 @@
package provide portconfigure 1.0
package require portutil 1.0
-set org.macports.configure [target_new org.macports.configure configure_main]
+set org.macports.configure [target_new org.macports.configure portconfigure::configure_main]
target_provides ${org.macports.configure} configure
target_requires ${org.macports.configure} main fetch extract checksum patch
-target_prerun ${org.macports.configure} configure_start
+target_prerun ${org.macports.configure} portconfigure::configure_start
+namespace eval portconfigure {
+}
+
# define options
commands configure autoreconf automake autoconf xmkmf
# defaults
@@ -54,12 +57,12 @@
default xmkmf.dir {${worksrcpath}}
default use_configure yes
-option_proc use_autoreconf set_configure_type
-option_proc use_automake set_configure_type
-option_proc use_autoconf set_configure_type
-option_proc use_xmkmf set_configure_type
+option_proc use_autoreconf portconfigure::set_configure_type
+option_proc use_automake portconfigure::set_configure_type
+option_proc use_autoconf portconfigure::set_configure_type
+option_proc use_xmkmf portconfigure::set_configure_type
-proc set_configure_type {option action args} {
+proc portconfigure::set_configure_type {option action args} {
if {[string equal ${action} "set"] && [tbool args]} {
switch $option {
use_autoreconf {
@@ -90,19 +93,19 @@
options configure.optflags configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
default configure.optflags {-O2}
# compiler flags section
-default configure.cflags {[configure_get_cflags]}
+default configure.cflags {[portconfigure::configure_get_cflags]}
default configure.cppflags {"-I${prefix}/include"}
-default configure.cxxflags {[configure_get_cflags]}
-default configure.objcflags {[configure_get_cflags]}
+default configure.cxxflags {[portconfigure::configure_get_cflags]}
+default configure.objcflags {[portconfigure::configure_get_cflags]}
default configure.ldflags {"-L${prefix}/lib"}
default configure.libs {}
-default configure.fflags {[configure_get_cflags]}
-default configure.f90flags {[configure_get_cflags]}
-default configure.fcflags {[configure_get_cflags]}
+default configure.fflags {[portconfigure::configure_get_cflags]}
+default configure.f90flags {[portconfigure::configure_get_cflags]}
+default configure.fcflags {[portconfigure::configure_get_cflags]}
default configure.classpath {}
# internal function to return the system value for CFLAGS/CXXFLAGS/etc
-proc configure_get_cflags {args} {
+proc portconfigure::configure_get_cflags {args} {
global configure.optflags
global configure.m32 configure.m64 configure.march configure.mtune
set flags "${configure.optflags}"
@@ -142,30 +145,30 @@
default configure.universal_target {${universal_target}}
default configure.universal_sysroot {${universal_sysroot}}
default configure.universal_archs {${universal_archs}}
-default configure.universal_args {[configure_get_universal_args]}
-default configure.universal_cflags {[configure_get_universal_cflags]}
-default configure.universal_cppflags {[configure_get_universal_cppflags]}
-default configure.universal_cxxflags {[configure_get_universal_cflags]}
-default configure.universal_ldflags {[configure_get_universal_ldflags]}
+default configure.universal_args {[portconfigure::configure_get_universal_args]}
+default configure.universal_cflags {[portconfigure::configure_get_universal_cflags]}
+default configure.universal_cppflags {[portconfigure::configure_get_universal_cppflags]}
+default configure.universal_cxxflags {[portconfigure::configure_get_universal_cflags]}
+default configure.universal_ldflags {[portconfigure::configure_get_universal_ldflags]}
# Select a distinct compiler (C, C preprocessor, C++)
options configure.ccache configure.distcc configure.pipe configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc configure.javac configure.compiler
default configure.ccache {${configureccache}}
default configure.distcc {${configuredistcc}}
default configure.pipe {${configurepipe}}
-default configure.cc {[configure_get_compiler cc]}
-default configure.cxx {[configure_get_compiler cxx]}
-default configure.cpp {[configure_get_compiler cpp]}
-default configure.objc {[configure_get_compiler objc]}
-default configure.f77 {[configure_get_compiler f77]}
-default configure.f90 {[configure_get_compiler f90]}
-default configure.fc {[configure_get_compiler fc]}
-default configure.javac {[configure_get_compiler javac]}
-default configure.compiler {[configure_get_default_compiler]}
+default configure.cc {[portconfigure::configure_get_compiler cc]}
+default configure.cxx {[portconfigure::configure_get_compiler cxx]}
+default configure.cpp {[portconfigure::configure_get_compiler cpp]}
+default configure.objc {[portconfigure::configure_get_compiler objc]}
+default configure.f77 {[portconfigure::configure_get_compiler f77]}
+default configure.f90 {[portconfigure::configure_get_compiler f90]}
+default configure.fc {[portconfigure::configure_get_compiler fc]}
+default configure.javac {[portconfigure::configure_get_compiler javac]}
+default configure.compiler {[portconfigure::configure_get_default_compiler]}
set_ui_prefix
-proc configure_start {args} {
+proc portconfigure::configure_start {args} {
global UI_PREFIX
global configure.compiler
@@ -202,7 +205,7 @@
}
# internal function to determine canonical system name for configure
-proc configure_get_universal_system_name {args} {
+proc portconfigure::configure_get_universal_system_name {args} {
global configure.universal_target configure.universal_archs
set arch "unknown"
switch -- ${configure.universal_archs} {
@@ -225,7 +228,7 @@
}
# internal function to determine the universal args for configure.cmd
-proc configure_get_universal_args {args} {
+proc portconfigure::configure_get_universal_args {args} {
global configure.universal_archs
set system [configure_get_universal_system_name]
set params "--disable-dependency-tracking"
@@ -237,7 +240,7 @@
}
# internal function to determine the "-arch xy" flags for the compiler
-proc configure_get_universal_archflags {args} {
+proc portconfigure::configure_get_universal_archflags {args} {
global configure.universal_archs
set flags ""
foreach arch ${configure.universal_archs} {
@@ -247,7 +250,7 @@
}
# internal function to determine the CPPFLAGS for the compiler
-proc configure_get_universal_cppflags {args} {
+proc portconfigure::configure_get_universal_cppflags {args} {
global configure.universal_sysroot
set flags ""
# include sysroot in CPPFLAGS too (twice), for the benefit of autoconf
@@ -258,7 +261,7 @@
}
# internal function to determine the CFLAGS for the compiler
-proc configure_get_universal_cflags {args} {
+proc portconfigure::configure_get_universal_cflags {args} {
global configure.universal_sysroot configure.universal_target
set flags [configure_get_universal_archflags]
# these flags should be valid for C/C++ and similar compiler frontends
@@ -269,7 +272,7 @@
}
# internal function to determine the LDFLAGS for the compiler
-proc configure_get_universal_ldflags {args} {
+proc portconfigure::configure_get_universal_ldflags {args} {
global configure.universal_sysroot configure.universal_target
global os.arch
set flags [configure_get_universal_archflags]
@@ -281,7 +284,7 @@
}
# internal function to determine the default compiler
-proc configure_get_default_compiler {args} {
+proc portconfigure::configure_get_default_compiler {args} {
global os.platform os.major
set compiler ""
switch -exact "${os.platform} ${os.major}" {
@@ -295,7 +298,7 @@
}
# internal function to find correct compilers
-proc configure_get_compiler {type} {
+proc portconfigure::configure_get_compiler {type} {
global configure.compiler prefix
set ret ""
switch -exact ${configure.compiler} {
@@ -438,7 +441,7 @@
return $ret
}
-proc configure_main {args} {
+proc portconfigure::configure_main {args} {
global [info globals]
global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
global configure.env configure.pipe configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
Modified: trunk/base/src/port1.0/portdepends.tcl
===================================================================
--- trunk/base/src/port1.0/portdepends.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portdepends.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -33,21 +33,24 @@
package provide portdepends 1.0
package require portutil 1.0
+namespace eval portdepends {
+}
+
# define options
options depends_build depends_run depends_lib depends
# Export options via PortInfo
options_export depends_build depends_lib depends_run
-option_proc depends_build validate_depends_options
-option_proc depends_run validate_depends_options
-option_proc depends_lib validate_depends_options
+option_proc depends_build portdepends::validate_depends_options
+option_proc depends_run portdepends::validate_depends_options
+option_proc depends_lib portdepends::validate_depends_options
# New option for the new dependency. We generate a warning because we don't handle this yet.
-option_proc depends validate_depends_options_new
+option_proc depends portdepends::validate_depends_options_new
set_ui_prefix
-proc validate_depends_options {option action {value ""}} {
+proc portdepends::validate_depends_options {option action {value ""}} {
global targets
switch $action {
set {
@@ -63,6 +66,6 @@
}
}
-proc validate_depends_options_new {option action {value ""}} {
+proc portdepends::validate_depends_options_new {option action {value ""}} {
ui_warn [msgcat::mc "depends option is not handled yet"]
}
Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portdestroot.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,12 +34,17 @@
package provide portdestroot 1.0
package require portutil 1.0
-set org.macports.destroot [target_new org.macports.destroot destroot_main]
+set org.macports.destroot [target_new org.macports.destroot portdestroot::destroot_main]
target_provides ${org.macports.destroot} destroot
target_requires ${org.macports.destroot} main fetch extract checksum patch configure build
-target_prerun ${org.macports.destroot} destroot_start
-target_postrun ${org.macports.destroot} destroot_finish
+target_prerun ${org.macports.destroot} portdestroot::destroot_start
+target_postrun ${org.macports.destroot} portdestroot::destroot_finish
+namespace eval portdestroot {
+ # Save old umask
+ variable oldmask
+}
+
# define options
options destroot.target destroot.destdir destroot.clean destroot.keepdirs destroot.umask
options destroot.violate_mtree destroot.asroot
@@ -81,15 +86,11 @@
set_ui_prefix
-namespace eval destroot {
- # Save old umask
- variable oldmask
-}
-
-proc destroot_start {args} {
+proc portdestroot::destroot_start {args} {
global UI_PREFIX prefix portname porturl destroot os.platform destroot.clean portsharepath
- global destroot::oldmask destroot.umask destroot.asroot macportsuser euid egid usealtworkpath altprefix
+ global destroot.umask destroot.asroot macportsuser euid egid usealtworkpath altprefix
global applications_dir frameworks_dir
+ variable oldmask
ui_msg "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${portname}]"
@@ -137,19 +138,20 @@
system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f [file join ${portsharepath} install prefix.mtree]"
}
-proc destroot_main {args} {
+proc portdestroot::destroot_main {args} {
command_exec destroot
return 0
}
-proc destroot_finish {args} {
- global UI_PREFIX destroot prefix portname startupitem.create destroot::oldmask destroot.violate_mtree
+proc portdestroot::destroot_finish {args} {
+ global UI_PREFIX destroot prefix portname startupitem.create destroot.violate_mtree
global os.platform os.version
+ variable oldmask
# Create startup-scripts/items
if {[tbool startupitem.create]} {
package require portstartupitem 1.0
- startupitem_create
+ portstartupitem::startupitem_create
}
# Prune empty directories in ${destroot}
Modified: trunk/base/src/port1.0/portdistcheck.tcl
===================================================================
--- trunk/base/src/port1.0/portdistcheck.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portdistcheck.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -36,19 +36,22 @@
package require portutil 1.0
package require portfetch 1.0
-set org.macports.distcheck [target_new org.macports.distcheck distcheck_main]
+set org.macports.distcheck [target_new org.macports.distcheck portdistcheck::distcheck_main]
target_runtype ${org.macports.distcheck} always
target_state ${org.macports.distcheck} no
target_provides ${org.macports.distcheck} distcheck
target_requires ${org.macports.distcheck} main
+namespace eval portdistcheck {
+}
+
# define options
options distcheck.check
# defaults
default distcheck.check moddate
-proc distcheck_main {args} {
+proc portdistcheck::distcheck_main {args} {
global distcheck.check
global fetch.type
global portname portpath
Modified: trunk/base/src/port1.0/portdistfiles.tcl
===================================================================
--- trunk/base/src/port1.0/portdistfiles.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portdistfiles.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -35,21 +35,24 @@
package require portfetch 1.0
package require portchecksum 1.0
-set org.macports.distfiles [target_new org.macports.distfiles distfiles_main]
+set org.macports.distfiles [target_new org.macports.distfiles portdistfiles::distfiles_main]
target_runtype ${org.macports.distfiles} always
target_state ${org.macports.distfiles} no
target_provides ${org.macports.distfiles} distfiles
target_requires ${org.macports.distfiles} main
-target_prerun ${org.macports.distfiles} distfiles_start
+target_prerun ${org.macports.distfiles} portdistfiles::distfiles_start
+namespace eval portdistfiles {
+}
+
set_ui_prefix
-proc distfiles_start {args} {
+proc portdistfiles::distfiles_start {args} {
global UI_PREFIX portname
ui_msg "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${portname}]"
}
-proc distfiles_main {args} {
+proc portdistfiles::distfiles_main {args} {
global UI_PREFIX master_sites fetch_urls url_var distfile checksums_array
# give up on ports that do not provide URLs
@@ -58,13 +61,13 @@
}
# from portfetch... process the sites, files and patches
- checkfiles
+ portfetch::checkfiles
# get checksum data from the portfile and parse it
set checksums_str [option checksums]
- set result [parse_checksums $checksums_str]
+ set result [portchecksum::parse_checksums $checksums_str]
- foreach {url_var distfile} $fetch_urls {
+ foreach {url_var distfile} $portfetch::fetch_urls {
ui_msg "\[$distfile\]"
@@ -76,10 +79,9 @@
}
# determine sites to download from
- global portfetch::$url_var
+ namespace import ::portfetch::$url_var
if {![info exists $url_var]} {
set url_var master_sites
- global portfetch::$url_var
}
# determine URLs to download
@@ -91,4 +93,4 @@
ui_msg " "
}
-}
\ No newline at end of file
+}
Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portextract.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,12 +34,15 @@
package provide portextract 1.0
package require portutil 1.0
-set org.macports.extract [target_new org.macports.extract extract_main]
-target_init ${org.macports.extract} extract_init
+set org.macports.extract [target_new org.macports.extract portextract::extract_main]
+target_init ${org.macports.extract} portextract::extract_init
target_provides ${org.macports.extract} extract
target_requires ${org.macports.extract} fetch checksum
-target_prerun ${org.macports.extract} extract_start
+target_prerun ${org.macports.extract} portextract::extract_start
+namespace eval portextract {
+}
+
# define options
options extract.only extract.mkdir
commands extract
@@ -47,7 +50,7 @@
# Set up defaults
# XXX call out to code in portutil.tcl XXX
# This cleans the distfiles list of all site tags
-default extract.only {[disttagclean $distfiles]}
+default extract.only {[portextract::disttagclean $distfiles]}
default extract.dir {${workpath}}
default extract.cmd gzip
@@ -57,7 +60,20 @@
set_ui_prefix
-proc extract_init {args} {
+# XXX
+# Helper function for portextract.tcl that strips all tag names from a list
+# Used to clean ${distfiles} for setting the ${extract.only} default
+proc portextract::disttagclean {list} {
+ if {"$list" == ""} {
+ return $list
+ }
+ foreach name $list {
+ lappend val [getdistname $name]
+ }
+ return $val
+}
+
+proc portextract::extract_init {args} {
global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_lzma use_zip use_7z use_dmg workpath
# should the distfiles be extracted to worksrcpath instead?
@@ -91,13 +107,13 @@
}
}
-proc extract_start {args} {
+proc portextract::extract_start {args} {
global UI_PREFIX
ui_msg "$UI_PREFIX [format [msgcat::mc "Extracting %s"] [option portname]]"
}
-proc extract_main {args} {
+proc portextract::extract_main {args} {
global UI_PREFIX filespath worksrcpath extract.dir
if {![exists distfiles] && ![exists extract.only]} {
Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portfetch.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,12 +34,23 @@
package require portutil 1.0
package require Pextlib 1.0
-set org.macports.fetch [target_new org.macports.fetch fetch_main]
-target_init ${org.macports.fetch} fetch_init
+set org.macports.fetch [target_new org.macports.fetch portfetch::fetch_main]
+target_init ${org.macports.fetch} portfetch::fetch_init
target_provides ${org.macports.fetch} fetch
target_requires ${org.macports.fetch} main
-target_prerun ${org.macports.fetch} fetch_start
+target_prerun ${org.macports.fetch} portfetch::fetch_start
+namespace eval portfetch {
+ variable fetch_urls {}
+}
+
+# Name space for internal site lists storage
+namespace eval portfetch::mirror_sites {
+ variable sites
+
+ array set sites {}
+}
+
# define options: distname master_sites
options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 use_lzma use_7z use_dmg dist_subdir \
fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
@@ -87,7 +98,7 @@
default hg.tag {tip}
# Set distfiles
-default distfiles {[suffix $distname]}
+default distfiles {[portfetch::suffix $distname]}
default dist_subdir {${portname}}
# user name & password
@@ -109,16 +120,16 @@
option_deprecate svn.tag svn.revision
# Option-executed procedures
-option_proc use_bzip2 set_extract_type
-option_proc use_lzma set_extract_type
-option_proc use_zip set_extract_type
-option_proc use_7z set_extract_type
-option_proc use_dmg set_extract_type
+option_proc use_bzip2 portfetch::set_extract_type
+option_proc use_lzma portfetch::set_extract_type
+option_proc use_zip portfetch::set_extract_type
+option_proc use_7z portfetch::set_extract_type
+option_proc use_dmg portfetch::set_extract_type
-option_proc fetch.type set_fetch_type
+option_proc fetch.type portfetch::set_fetch_type
# We should probably add something like a depends_fetch; see #15161
-proc set_extract_type {option action args} {
+proc portfetch::set_extract_type {option action args} {
global extract.suffix
if {[string equal ${action} "set"] && [tbool args]} {
switch $option {
@@ -144,7 +155,7 @@
}
}
-proc set_fetch_type {option action args} {
+proc portfetch::set_fetch_type {option action args} {
if {[string equal ${action} "set"]} {
switch $args {
cvs {
@@ -163,14 +174,11 @@
}
}
-# Name space for internal implementation variables
-# Site lists are stored here
-namespace eval portfetch { }
-
set_ui_prefix
+
# Given a distname, return a suffix based on the use_zip / use_bzip2 / use_dmg / extract.suffix options
-proc suffix {distname} {
+proc portfetch::suffix {distname} {
global extract.suffix fetch.type
switch -- "${fetch.type}" {
cvs -
@@ -181,6 +189,9 @@
default { return "${distname}${extract.suffix}" }
}
}
+# XXX import suffix into the global namespace as it is currently used from
+# Portfiles, but should better go somewhere else
+namespace import portfetch::suffix
# Given a site url and the name of the distfile, assemble url and
# return it.
@@ -192,22 +203,9 @@
}
}
-# XXX
-# Helper function for portextract.tcl that strips all tag names from a list
-# Used to clean ${distfiles} for setting the ${extract.only} default
-proc disttagclean {list} {
- if {"$list" == ""} {
- return $list
- }
- foreach name $list {
- lappend val [getdistname $name]
- }
- return $val
-}
-
# For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
# pre-registered set of sites, and if so, return them.
-proc mirror_sites {mirrors tag subdir} {
+proc portfetch::mirror_sites {mirrors tag subdir} {
global UI_PREFIX portname porturl mirror_sites.listfile mirror_sites.listpath dist_subdir
global global_mirror_site fallback_mirror_site
@@ -269,10 +267,10 @@
# within that tag distfiles are added in $site $distfile format, where $site is
# the name of a variable in the portfetch:: namespace containing a list of fetch
# sites
-proc checksites {args} {
+proc portfetch::checksites {args} {
global patch_sites master_sites master_sites.mirror_subdir \
patch_sites.mirror_subdir fallback_mirror_site global_mirror_site env
-
+
append master_sites " ${global_mirror_site} ${fallback_mirror_site}"
if {[info exists env(MASTER_SITE_LOCAL)]} {
set master_sites [concat $env(MASTER_SITE_LOCAL) $master_sites]
@@ -334,8 +332,9 @@
}
# Checks patch files and their tags to assemble url lists for later fetching
-proc checkpatchfiles {args} {
- global patchfiles all_dist_files patch_sites fetch_urls filespath
+proc portfetch::checkpatchfiles {args} {
+ global patchfiles all_dist_files patch_sites filespath
+ variable fetch_urls
if {[info exists patchfiles]} {
foreach file $patchfiles {
@@ -356,8 +355,9 @@
}
# Checks dist files and their tags to assemble url lists for later fetching
-proc checkdistfiles {args} {
- global distfiles all_dist_files fetch_urls master_sites filespath
+proc portfetch::checkdistfiles {args} {
+ global distfiles all_dist_files master_sites filespath
+ variable fetch_urls
if {[info exists distfiles]} {
foreach file $distfiles {
@@ -376,17 +376,18 @@
}
# sorts fetch_urls in order of ping time
-proc sortsites {args} {
- global fetch_urls fallback_mirror_site
+proc portfetch::sortsites {args} {
+ global fallback_mirror_site
+ variable fetch_urls
set fallback_mirror_list [mirror_sites $fallback_mirror_site {} {}]
foreach {url_var distfile} $fetch_urls {
- global portfetch::$url_var
+ variable portfetch::$url_var
if {![info exists $url_var]} {
ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
set url_var master_sites
- global portfetch::$url_var
+ variable portfetch::$url_var
}
set urllist [set $url_var]
set hosts {}
@@ -451,10 +452,9 @@
# Perform the full checksites/checkpatchfiles/checkdistfiles sequence.
# This method is used by distcheck target.
-proc checkfiles {args} {
- # Set fetch_urls to be empty in case there is no file to fetch.
- global fetch_urls
- set fetch_urls {}
+proc portfetch::checkfiles {args} {
+ variable fetch_urls
+
checksites
checkpatchfiles
checkdistfiles
@@ -463,7 +463,7 @@
# Perform a CVS login and fetch, storing the CVS login
# information in a custom .cvspass file
-proc cvsfetch {args} {
+proc portfetch::cvsfetch {args} {
global workpath cvs.env cvs.cmd cvs.args cvs.post_args
global cvs.root cvs.date cvs.tag cvs.method cvs.password
global patch_sites patchfiles filespath
@@ -502,13 +502,13 @@
}
if {[info exists patchfiles]} {
- return [fetchfiles]
+ return [portfetch::fetchfiles]
}
return 0
}
# Perform an svn fetch
-proc svnfetch {args} {
+proc portfetch::svnfetch {args} {
global workpath prefix_frozen
global svn.env svn.cmd svn.args svn.post_args svn.revision svn.url svn.method
@@ -537,14 +537,14 @@
}
if {[info exists patchfiles]} {
- return [fetchfiles]
+ return [portfetch::fetchfiles]
}
return 0
}
# Perform a git fetch
-proc gitfetch {args} {
+proc portfetch::gitfetch {args} {
global worksrcpath prefix_frozen
global git.url git.branch git.sha1
@@ -583,14 +583,14 @@
}
if {[info exists patchfiles]} {
- return [fetchfiles]
+ return [portfetch::fetchfiles]
}
return 0
}
# Perform a mercurial fetch.
-proc hgfetch {args} {
+proc portfetch::hgfetch {args} {
global worksrcpath prefix_frozen
global hg.url hg.tag
@@ -615,7 +615,7 @@
}
if {[info exists patchfiles]} {
- return [fetchfiles]
+ return [portfetch::fetchfiles]
}
return 0
@@ -623,11 +623,12 @@
# Perform a standard fetch, assembling fetch urls from
# the listed url variable and associated distfile
-proc fetchfiles {args} {
- global distpath all_dist_files UI_PREFIX fetch_urls
+proc portfetch::fetchfiles {args} {
+ global distpath all_dist_files UI_PREFIX
global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time
global distfile site
global portverbose
+ variable fetch_urls
if {![file isdirectory $distpath]} {
if {[catch {file mkdir $distpath} result]} {
@@ -664,11 +665,11 @@
sortsites
set sorted yes
}
- global portfetch::$url_var
+ variable portfetch::$url_var
if {![info exists $url_var]} {
ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
set url_var master_sites
- global portfetch::$url_var
+ variable portfetch::$url_var
}
unset -nocomplain fetched
foreach site [set $url_var] {
@@ -711,8 +712,9 @@
}
# Utility function to delete fetched files.
-proc fetch_deletefiles {args} {
- global distpath fetch_urls
+proc portfetch::fetch_deletefiles {args} {
+ global distpath
+ variable fetch_urls
foreach {url_var distfile} $fetch_urls {
if {[file isfile $distpath/$distfile]} {
file delete -force "${distpath}/${distfile}"
@@ -721,8 +723,9 @@
}
# Utility function to add files to a list of fetched files.
-proc fetch_addfilestomap {filemapname} {
- global distpath fetch_urls $filemapname
+proc portfetch::fetch_addfilestomap {filemapname} {
+ global distpath $filemapname
+ variable fetch_urls
foreach {url_var distfile} $fetch_urls {
if {[file isfile $distpath/$distfile]} {
filemap set $filemapname $distpath/$distfile 1
@@ -731,7 +734,7 @@
}
# Initialize fetch target and call checkfiles.
-proc fetch_init {args} {
+proc portfetch::fetch_init {args} {
global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
global altprefix usealtworkpath
@@ -748,10 +751,10 @@
set distpath ${distpath}/${dist_subdir}
set fetch_init_done yes
}
- checkfiles
+ portfetch::checkfiles
}
-proc fetch_start {args} {
+proc portfetch::fetch_start {args} {
global UI_PREFIX portname
ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching %s"] $portname]"
@@ -761,7 +764,7 @@
# If all_dist_files is not populated and $fetch.type == standard, then
# there are no files to download. Otherwise, either do a cvs checkout
# or call the standard fetchfiles procedure
-proc fetch_main {args} {
+proc portfetch::fetch_main {args} {
global distname distpath all_dist_files fetch.type
# Check for files, download if necessary
@@ -776,6 +779,6 @@
git { return [gitfetch] }
hg { return [hgfetch] }
standard -
- default { return [fetchfiles] }
+ default { return [portfetch::fetchfiles] }
}
}
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portinstall.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,7 +34,7 @@
package provide portinstall 1.0
package require portutil 1.0
-set org.macports.install [target_new org.macports.install install_main]
+set org.macports.install [target_new org.macports.install portinstall::install_main]
target_state ${org.macports.install} no
target_provides ${org.macports.install} install
if {[option portarchivemode] == "yes"} {
@@ -42,8 +42,11 @@
} else {
target_requires ${org.macports.install} main fetch extract checksum patch configure build destroot
}
-target_prerun ${org.macports.install} install_start
+target_prerun ${org.macports.install} portinstall::install_start
+namespace eval portinstall {
+}
+
# define options
options install.asroot
@@ -52,7 +55,7 @@
set_ui_prefix
-proc install_start {args} {
+proc portinstall::install_start {args} {
global UI_PREFIX portname portversion portrevision variations portvariants
global install.asroot prefix
ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $portname $portversion $portrevision $portvariants]"
@@ -69,7 +72,7 @@
}
-proc install_element {src_element dst_element} {
+proc portinstall::install_element {src_element dst_element} {
# don't recursively copy directories
if {[file isdirectory $src_element] && [file type $src_element] != "link"} {
file mkdir $dst_element
@@ -93,7 +96,7 @@
}
}
-proc directory_dig {rootdir workdir regref {cwd ""}} {
+proc portinstall::directory_dig {rootdir workdir regref {cwd ""}} {
global installPlist
set pwd [pwd]
if {[catch {_cd $workdir} err]} {
@@ -145,7 +148,7 @@
_cd $pwd
}
-proc install_main {args} {
+proc portinstall::install_main {args} {
global portname portversion portpath categories description long_description homepage depends_run installPlist package-install uninstall workdir worksrcdir pregrefix UI_PREFIX destroot portrevision maintainers ports_force portvariants targets depends_lib PortInfo epoch
# Begin the registry entry
@@ -194,7 +197,7 @@
return 0
}
-proc proc_disasm {pname} {
+proc portinstall::proc_disasm {pname} {
set p "proc "
append p $pname " \{"
set space ""
Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portlint.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -5,13 +5,16 @@
package provide portlint 1.0
package require portutil 1.0
-set org.macports.lint [target_new org.macports.lint lint_main]
+set org.macports.lint [target_new org.macports.lint portlint::lint_main]
target_runtype ${org.macports.lint} always
target_state ${org.macports.lint} no
target_provides ${org.macports.lint} lint
target_requires ${org.macports.lint} main
-target_prerun ${org.macports.lint} lint_start
+target_prerun ${org.macports.lint} portlint::lint_start
+namespace eval portlint {
+}
+
set_ui_prefix
set lint_portsystem \
@@ -107,7 +110,7 @@
]
-proc seems_utf8 {str} {
+proc portlint::seems_utf8 {str} {
set len [string length $str]
for {set i 0} {$i<$len} {incr i} {
set c [scan [string index $str $i] %c]
@@ -140,12 +143,12 @@
}
-proc lint_start {args} {
+proc portlint::lint_start {args} {
global UI_PREFIX portname
ui_msg "$UI_PREFIX [format [msgcat::mc "Verifying Portfile for %s"] ${portname}]"
}
-proc lint_main {args} {
+proc portlint::lint_main {args} {
global UI_PREFIX portname portpath porturl ports_lint_nitpick
set portfile ${portpath}/Portfile
set portdirs [split ${portpath} /]
Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portlivecheck.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -36,12 +36,15 @@
package require portutil 1.0
package require portfetch 1.0
-set org.macports.livecheck [target_new org.macports.livecheck livecheck_main]
+set org.macports.livecheck [target_new org.macports.livecheck portlivecheck::livecheck_main]
target_runtype ${org.macports.livecheck} always
target_state ${org.macports.livecheck} no
target_provides ${org.macports.livecheck} livecheck
target_requires ${org.macports.livecheck} main
+namespace eval portlivecheck {
+}
+
# define options
options livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
@@ -54,7 +57,7 @@
default livecheck.distname default
default livecheck.version {$version}
-proc livecheck_main {args} {
+proc portlivecheck::livecheck_main {args} {
global livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert
global homepage portname portpath workpath
Modified: trunk/base/src/port1.0/portload.tcl
===================================================================
--- trunk/base/src/port1.0/portload.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portload.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,14 +34,17 @@
package provide portload 1.0
package require portutil 1.0
-set org.macports.load [target_new org.macports.load load_main]
+set org.macports.load [target_new org.macports.load portload::load_main]
target_runtype ${org.macports.load} always
target_provides ${org.macports.load} load
-target_requires ${org.macports.load} main
+target_requires ${org.macports.load} portload::main
+namespace eval portload {
+}
+
set_ui_prefix
-proc load_main {args} {
+proc portload::load_main {args} {
global startupitem.type startupitem.name startupitem.location startupitem.plist
set launchctl_path ${portutil::autoconf::launchctl_path}
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portmain.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -36,10 +36,13 @@
package provide portmain 1.0
package require portutil 1.0
-set org.macports.main [target_new org.macports.main main]
+set org.macports.main [target_new org.macports.main portmain::main]
target_provides ${org.macports.main} main
target_state ${org.macports.main} no
+namespace eval portmain {
+}
+
# define options
options prefix macportsuser name version revision epoch categories maintainers
options long_description description homepage
@@ -131,6 +134,6 @@
}
}
-proc main {args} {
+proc portmain::main {args} {
return 0
}
Modified: trunk/base/src/port1.0/portmirror.tcl
===================================================================
--- trunk/base/src/port1.0/portmirror.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portmirror.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -38,17 +38,20 @@
package require portfetch 1.0
package require portchecksum 1.0
-set org.macports.mirror [target_new org.macports.mirror mirror_main]
+set org.macports.mirror [target_new org.macports.mirror portmirror::mirror_main]
target_runtype ${org.macports.mirror} always
target_state ${org.macports.mirror} no
target_provides ${org.macports.mirror} mirror
target_requires ${org.macports.mirror} main
+namespace eval portmirror {
+}
+
# Mirror is a target that fetches & checksums files and delete them
# if the checksum isn't correct.
# It also records the path in a database.
-proc mirror_main {args} {
+proc portmirror::mirror_main {args} {
global fetch.type portname mirror_filemap ports_mirror_new portdbpath
set mirror_filemap_path [file join $portdbpath distfiles_mirror.db]
@@ -65,18 +68,18 @@
# Check the distfiles if it's a regular fetch phase.
if {"${fetch.type}" == "standard"} {
# fetch the files.
- fetch_init $args
+ portfetch::fetch_init $args
#fetch_start
- fetch_main $args
+ portfetch::fetch_main $args
# checksum the files.
#checksum_start
- if {[catch {checksum_main $args}]} {
+ if {[catch {portchecksum::checksum_main $args}]} {
# delete the files.
- fetch_deletefiles $args
+ portfetch::fetch_deletefiles $args
} else {
# add the list of files.
- fetch_addfilestomap mirror_filemap
+ portfetch::fetch_addfilestomap mirror_filemap
}
}
Modified: trunk/base/src/port1.0/portpatch.tcl
===================================================================
--- trunk/base/src/port1.0/portpatch.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portpatch.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -33,10 +33,13 @@
package provide portpatch 1.0
package require portutil 1.0
-set org.macports.patch [target_new org.macports.patch patch_main]
+set org.macports.patch [target_new org.macports.patch portpatch::patch_main]
target_provides ${org.macports.patch} patch
target_requires ${org.macports.patch} main fetch checksum extract
+namespace eval portpatch {
+}
+
set_ui_prefix
# Add command patch
@@ -49,7 +52,7 @@
default patch.cmd patch
default patch.pre_args -p0
-proc patch_main {args} {
+proc portpatch::patch_main {args} {
global UI_PREFIX
# First make sure that patchfiles exists and isn't stubbed out.
Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portstartupitem.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -68,9 +68,12 @@
package provide portstartupitem 1.0
package require portutil 1.0
+namespace eval portstartupitem {
+}
+
set_ui_prefix
-proc startupitem_create_rcng {args} {
+proc portstartupitem::startupitem_create_rcng {args} {
global prefix destroot portname os.platform
global startupitem.name startupitem.requires
global startupitem.start startupitem.stop startupitem.restart
@@ -116,7 +119,7 @@
close ${fd}
}
-proc startupitem_create_darwin_systemstarter {args} {
+proc portstartupitem::startupitem_create_darwin_systemstarter {args} {
global UI_PREFIX prefix destroot destroot.keepdirs portname os.platform
global startupitem.name startupitem.requires startupitem.init
global startupitem.start startupitem.stop startupitem.restart startupitem.executable
@@ -382,7 +385,7 @@
ui_msg "###########################################################"
}
-proc startupitem_create_darwin_launchd {args} {
+proc portstartupitem::startupitem_create_darwin_launchd {args} {
global UI_PREFIX prefix destroot destroot.keepdirs portname os.platform
global startupitem.name startupitem.uniquename startupitem.plist startupitem.location
global startupitem.init startupitem.start startupitem.stop startupitem.restart startupitem.executable
@@ -608,7 +611,7 @@
ui_msg "###########################################################"
}
-proc startupitem_create {args} {
+proc portstartupitem::startupitem_create {args} {
global UI_PREFIX
global startupitem.type os.platform
Modified: trunk/base/src/port1.0/portsubmit.tcl
===================================================================
--- trunk/base/src/port1.0/portsubmit.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portsubmit.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,16 +34,19 @@
package require portutil 1.0
package require portportpkg 1.0
-set org.macports.submit [target_new org.macports.submit submit_main]
+set org.macports.submit [target_new org.macports.submit portsubmit::submit_main]
target_runtype ${org.macports.submit} always
target_provides ${org.macports.submit} submit
target_requires ${org.macports.submit} portpkg
+namespace eval portsubmit {
+}
+
set_ui_prefix
# escape quotes, and things that make the shell cry
-proc shell_escape {str} {
+proc portsubmit::shell_escape {str} {
regsub -all -- {\\} $str {\\\\} str
regsub -all -- {"} $str {\"} str
regsub -all -- {'} $str {\'} str
@@ -51,7 +54,7 @@
}
-proc submit_main {args} {
+proc portsubmit::submit_main {args} {
global mp_remote_submit_url portname portversion portverbose prefix UI_PREFIX workpath portpath
set submiturl $mp_remote_submit_url
Modified: trunk/base/src/port1.0/porttest.tcl
===================================================================
--- trunk/base/src/port1.0/porttest.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/porttest.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -5,11 +5,14 @@
package provide porttest 1.0
package require portutil 1.0
-set org.macports.test [target_new org.macports.test test_main]
+set org.macports.test [target_new org.macports.test porttest::test_main]
target_provides ${org.macports.test} test
target_requires ${org.macports.test} main fetch extract checksum patch configure build
-target_prerun ${org.macports.test} test_start
+target_prerun ${org.macports.test} porttest::test_start
+namespace eval porttest {
+}
+
# define options
options test.run test.target
commands test
@@ -22,12 +25,12 @@
set_ui_prefix
-proc test_start {args} {
+proc porttest::test_start {args} {
global UI_PREFIX portname
ui_msg "$UI_PREFIX [format [msgcat::mc "Testing %s"] ${portname}]"
}
-proc test_main {args} {
+proc porttest::test_main {args} {
global portname test.run
if {[tbool test.run]} {
command_exec test
Modified: trunk/base/src/port1.0/porttrace.tcl
===================================================================
--- trunk/base/src/port1.0/porttrace.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/porttrace.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -35,7 +35,10 @@
package provide porttrace 1.0
package require Pextlib 1.0
-proc trace_start {workpath} {
+namespace eval porttrace {
+}
+
+proc porttrace::trace_start {workpath} {
global os.platform
if {${os.platform} == "darwin"} {
if {[catch {package require Thread} error]} {
@@ -89,7 +92,7 @@
# Enable the fence.
# Only done for targets that should only happen in the sandbox.
-proc trace_enable_fence {} {
+proc porttrace::trace_enable_fence {} {
global env trace_sandboxbounds
set env(DARWINTRACE_SANDBOX_BOUNDS) $trace_sandboxbounds
tracelib enablefence
@@ -97,7 +100,7 @@
# Disable the fence.
# Unused yet.
-proc trace_disable_fence {} {
+proc porttrace::trace_disable_fence {} {
global env
if [info exists env(DARWINTRACE_SANDBOX_BOUNDS)] {
unset env(DARWINTRACE_SANDBOX_BOUNDS)
@@ -108,9 +111,9 @@
# Output a warning for every port the trace revealed a dependency on
# that isn't included in portslist
# This method must be called after trace_start
-proc trace_check_deps {target portslist} {
+proc porttrace::trace_check_deps {target portslist} {
# Get the list of ports.
- set ports [slave_send slave_get_ports]
+ set ports [slave_send porttrace::slave_get_ports]
# Compare with portslist
set portslist [lsort $portslist]
@@ -129,9 +132,9 @@
# Check that no violation happened.
# Output a warning for every sandbox violation the trace revealed.
# This method must be called after trace_start
-proc trace_check_violations {} {
+proc porttrace::trace_check_violations {} {
# Get the list of violations.
- set violations [slave_send slave_get_sandbox_violations]
+ set violations [slave_send porttrace::slave_get_sandbox_violations]
foreach violation [lsort $violations] {
ui_warn "An activity was attempted outside sandbox: $violation"
@@ -140,7 +143,7 @@
# Stop the trace and return the list of ports the port depends on.
# This method must be called after trace_start
-proc trace_stop {} {
+proc porttrace::trace_stop {} {
global os.platform
if {${os.platform} == "darwin"} {
global env trace_fifo
@@ -155,7 +158,7 @@
tracelib clean
# Clean up.
- slave_send slave_stop
+ slave_send porttrace::slave_stop
# Delete the slave.
delete_slave
@@ -166,7 +169,7 @@
# Private
# Create the slave thread.
-proc create_slave {workpath trace_fifo} {
+proc porttrace::create_slave {workpath trace_fifo} {
global trace_thread
# Create the thread.
set trace_thread [macports_create_thread]
@@ -177,12 +180,12 @@
thread::send -async $trace_thread "package require porttrace 1.0"
# Start the slave work.
- thread::send -async $trace_thread "slave_start $trace_fifo $workpath"
+ thread::send -async $trace_thread "porttrace::slave_start $trace_fifo $workpath"
}
# Private
# Send a command to the thread without waiting for the result.
-proc slave_send_async {command} {
+proc porttrace::slave_send_async {command} {
global trace_thread
thread::send -async $trace_thread "$command"
@@ -190,7 +193,7 @@
# Private
# Send a command to the thread.
-proc slave_send {command} {
+proc porttrace::slave_send {command} {
global trace_thread
# ui_warn "slave send $command ?"
@@ -201,7 +204,7 @@
# Private
# Destroy the thread.
-proc delete_slave {} {
+proc porttrace::delete_slave {} {
global trace_thread
# Destroy the thread.
@@ -210,7 +213,7 @@
# Private.
# Slave method to read a line from the trace.
-proc slave_read_line {chan} {
+proc porttrace::lave_read_line {chan} {
global ports_list trace_filemap sandbox_violation_list workpath
global env
@@ -271,7 +274,7 @@
# Private.
# Slave init method.
-proc slave_start {fifo p_workpath} {
+proc porttrace::slave_start {fifo p_workpath} {
global ports_list trace_filemap sandbox_violation_list
# Save the workpath.
set workpath $p_workpath
@@ -285,7 +288,7 @@
# Private.
# Slave cleanup method.
-proc slave_stop {} {
+proc porttrace::slave_stop {} {
global trace_filemap trace_fifo_r_chan trace_fifo_w_chan
# Close the virtual filemap.
filemap close trace_filemap
@@ -294,19 +297,19 @@
# Private.
# Slave ports export method.
-proc slave_get_ports {} {
+proc porttrace::slave_get_ports {} {
global ports_list
return $ports_list
}
# Private.
# Slave sandbox violations export method.
-proc slave_get_sandbox_violations {} {
+proc porttrace::slave_get_sandbox_violations {} {
global sandbox_violation_list
return $sandbox_violation_list
}
-proc slave_add_sandbox_violation {path} {
+proc porttrace::slave_add_sandbox_violation {path} {
global sandbox_violation_list
lappend sandbox_violation_list $path
}
Modified: trunk/base/src/port1.0/portunload.tcl
===================================================================
--- trunk/base/src/port1.0/portunload.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portunload.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -34,14 +34,17 @@
package provide portunload 1.0
package require portutil 1.0
-set org.macports.unload [target_new org.macports.unload unload_main]
+set org.macports.unload [target_new org.macports.unload portunload::unload_main]
target_runtype ${org.macports.unload} always
target_provides ${org.macports.unload} unload
target_requires ${org.macports.unload} main
+namespace eval portunload {
+}
+
set_ui_prefix
-proc unload_main {args} {
+proc portunload::unload_main {args} {
global startupitem.type startupitem.name startupitem.location startupitem.plist
set launchctl_path ${portutil::autoconf::launchctl_path}
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2009-04-03 11:19:09 UTC (rev 49086)
+++ trunk/base/src/port1.0/portutil.tcl 2009-04-03 11:34:32 UTC (rev 49087)
@@ -813,7 +813,6 @@
return $name
}
-
########### Misc Utility Functions ###########
# tbool (testbool)
@@ -1311,7 +1310,7 @@
&& [info exists ports_trace]
&& $ports_trace == "yes"
&& $target != "clean")} {
- trace_start $workpath
+ porttrace::trace_start $workpath
# Enable the fence to prevent any creation/modification
# outside the sandbox.
@@ -1319,7 +1318,7 @@
&& $target != "archive"
&& $target != "fetch"
&& $target != "install"} {
- trace_enable_fence
+ porttrace::trace_enable_fence
}
# collect deps
@@ -1415,10 +1414,10 @@
tracelib closesocket
- trace_check_violations
+ porttrace::trace_check_violations
# End of trace.
- trace_stop
+ porttrace::trace_stop
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090403/f3647579/attachment-0001.html>
More information about the macports-changes
mailing list