[31500] trunk/base/src/port
jberry at macports.org
jberry at macports.org
Sun Nov 25 21:47:28 PST 2007
Revision: 31500
http://trac.macosforge.org/projects/macports/changeset/31500
Author: jberry at macports.org
Date: 2007-11-25 21:47:26 -0800 (Sun, 25 Nov 2007)
Log Message:
-----------
Initial support for port load and port unload actions.
These actions call invoke launchctl to load or unload the startupitem.plist
for the specified port(s).
Modified Paths:
--------------
trunk/base/src/port/port.tcl
trunk/base/src/port1.0/Makefile
trunk/base/src/port1.0/port.tcl
trunk/base/src/port1.0/portdestroot.tcl
trunk/base/src/port1.0/portstartupitem.tcl
Added Paths:
-----------
trunk/base/src/port1.0/portload.tcl
trunk/base/src/port1.0/portunload.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2007-11-26 05:41:11 UTC (rev 31499)
+++ trunk/base/src/port/port.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -2164,6 +2164,8 @@
livecheck action_target
distcheck action_target
mirror action_target
+ load action_target
+ unload action_target
archive action_target
unarchive action_target
Modified: trunk/base/src/port1.0/Makefile
===================================================================
--- trunk/base/src/port1.0/Makefile 2007-11-26 05:41:11 UTC (rev 31499)
+++ trunk/base/src/port1.0/Makefile 2007-11-26 05:47:26 UTC (rev 31500)
@@ -3,9 +3,9 @@
SRCS= port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl \
portfetch.tcl portmain.tcl portbuild.tcl portpatch.tcl portutil.tcl \
portinstall.tcl portdepends.tcl portdestroot.tcl portlint.tcl \
- portclean.tcl porttest.tcl portactivate.tcl portsubmit.tcl \
+ portclean.tcl porttest.tcl portactivate.tcl portsubmit.tcl \
port_autoconf.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
- portdistcheck.tcl portmirror.tcl
+ portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl
SUBDIR= resources
Modified: trunk/base/src/port1.0/port.tcl
===================================================================
--- trunk/base/src/port1.0/port.tcl 2007-11-26 05:41:11 UTC (rev 31499)
+++ trunk/base/src/port1.0/port.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -52,3 +52,5 @@
package require portdistcheck 1.0
package require portlivecheck 1.0
package require portmirror 1.0
+package require portload 1.0
+package require portunload 1.0
Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl 2007-11-26 05:41:11 UTC (rev 31499)
+++ trunk/base/src/port1.0/portdestroot.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -47,6 +47,7 @@
options startupitem.name startupitem.start startupitem.stop startupitem.restart
options startupitem.type startupitem.executable
options startupitem.pidfile startupitem.logfile startupitem.logevents startupitem.netchange
+options startupitem.uniquename startupitem.plist startupitem.location
commands destroot
# Set defaults
@@ -62,6 +63,9 @@
default destroot.violate_mtree no
default startupitem.name {${portname}}
+default startupitem.uniquename {org.macports.${startupitem.name}}
+default startupitem.plist {${startupitem.uniquename}.plist}
+default startupitem.location LaunchDaemons
default startupitem.init ""
default startupitem.start ""
default startupitem.stop ""
Added: trunk/base/src/port1.0/portload.tcl
===================================================================
--- trunk/base/src/port1.0/portload.tcl (rev 0)
+++ trunk/base/src/port1.0/portload.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -0,0 +1,59 @@
+# et:ts=4
+# portsubmit.tcl
+# $Id: portsubmit.tcl 26177 2007-06-15 10:11:22Z jmpp at macports.org $
+#
+# Copyright (c) 2007 MacPorts Project
+# Copyright (c) 2007 James D. Berry
+# All rights reserved.
+#
+# 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 Apple Computer, Inc. nor the names of its 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 EXPRESS 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 COPYRIGHT OWNER 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 provide portload 1.0
+package require portutil 1.0
+
+set org.macports.load [target_new org.macports.load load_main]
+target_runtype ${org.macports.load} always
+target_provides ${org.macports.load} load
+target_requires ${org.macports.load} main
+
+set_ui_prefix
+
+proc load_main {args} {
+ global startupitem.type startupitem.name startupitem.location startupitem.plist
+ set launchctl_path ${portutil::autoconf::launchctl_path}
+
+ foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
+ if {[string length $launchctl_path] == 0} {
+ return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
+ } elseif {![file exists $path]} {
+ return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
+ } else {
+ exec $launchctl_path load -w $path
+ }
+ }
+
+ return
+}
Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl 2007-11-26 05:41:11 UTC (rev 31499)
+++ trunk/base/src/port1.0/portstartupitem.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -3,8 +3,9 @@
#
# $Id$
#
-# Copyright (c) 2004, 2005 Markus W. Weissman <mww at macports.org>,
-# Copyright (c) 2005 Robert Shaw <rshaw at opendarwin.org>,
+# Copyright (c) 2004-2007 MacPorts Project
+# Copyright (c) 2006-2007 James D. Berry
+# Copyright (c) 2004,2005 Markus W. Weissman <mww at macports.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -390,9 +391,9 @@
set scriptdir ${prefix}/etc/startup
set itemname ${startupitem.name}
- set uniquename org.macports.${itemname}
- set plistname ${uniquename}.plist
- set daemondest LaunchDaemons
+ set uniquename ${startupitem.uniquename}
+ set plistname ${startupitem.plist}
+ set daemondest ${startupitem.location}
set itemdir ${prefix}/etc/${daemondest}/${uniquename}
set args [list \
"${prefix}/bin/daemondo" \
Added: trunk/base/src/port1.0/portunload.tcl
===================================================================
--- trunk/base/src/port1.0/portunload.tcl (rev 0)
+++ trunk/base/src/port1.0/portunload.tcl 2007-11-26 05:47:26 UTC (rev 31500)
@@ -0,0 +1,59 @@
+# et:ts=4
+# portsubmit.tcl
+# $Id: portsubmit.tcl 26177 2007-06-15 10:11:22Z jmpp at macports.org $
+#
+# Copyright (c) 2007 MacPorts Project
+# Copyright (c) 2007 James D. Berry
+# All rights reserved.
+#
+# 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 Apple Computer, Inc. nor the names of its 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 EXPRESS 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 COPYRIGHT OWNER 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 provide portunload 1.0
+package require portutil 1.0
+
+set org.macports.unload [target_new org.macports.unload unload_main]
+target_runtype ${org.macports.unload} always
+target_provides ${org.macports.unload} unload
+target_requires ${org.macports.unload} main
+
+set_ui_prefix
+
+proc unload_main {args} {
+ global startupitem.type startupitem.name startupitem.location startupitem.plist
+ set launchctl_path ${portutil::autoconf::launchctl_path}
+
+ foreach { path } "/Library/${startupitem.location}/${startupitem.plist}" {
+ if {[string length $launchctl_path] == 0} {
+ return -code error [format [msgcat::mc "launchctl command was not found by configure"]]
+ } elseif {![file exists $path]} {
+ return -code error [format [msgcat::mc "Launchd plist %s was not found"] $path]
+ } else {
+ exec $launchctl_path unload -w $path
+ }
+ }
+
+ return
+}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071125/17ae71fa/attachment.html
More information about the macports-changes
mailing list