[30391] trunk/base
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 26 05:06:17 PDT 2007
Revision: 30391
http://trac.macosforge.org/projects/macports/changeset/30391
Author: afb at macports.org
Date: 2007-10-26 05:06:16 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
mdmg, meta-package disk image target (#12791)
Modified Paths:
--------------
trunk/base/doc/port.1
trunk/base/src/package1.0/Makefile
trunk/base/src/package1.0/package.tcl
trunk/base/src/port/port.tcl
Added Paths:
-----------
trunk/base/src/package1.0/portmdmg.tcl
Modified: trunk/base/doc/port.1
===================================================================
--- trunk/base/doc/port.1 2007-10-26 11:57:23 UTC (rev 30390)
+++ trunk/base/doc/port.1 2007-10-26 12:06:16 UTC (rev 30391)
@@ -495,6 +495,10 @@
.Ss dmg
Creates an internet-enabled disk image containing an OS X package of
.Ar portname .
+.Ss mdmg
+Creates an internet-enabled disk image containing an OS X metapackage of
+.Ar portname
+and its dependencies.
.Ss rpm
Creates an RPM binary package of
.Ar portname ,
Modified: trunk/base/src/package1.0/Makefile
===================================================================
--- trunk/base/src/package1.0/Makefile 2007-10-26 11:57:23 UTC (rev 30390)
+++ trunk/base/src/package1.0/Makefile 2007-10-26 12:06:16 UTC (rev 30391)
@@ -1,7 +1,7 @@
INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/package1.0
-SRCS= package.tcl portdmg.tcl portmpkg.tcl portpkg.tcl portrpm.tcl \
- portsrpm.tcl portdpkg.tcl portunarchive.tcl portarchive.tcl
+SRCS= package.tcl portdmg.tcl portmdmg.tcl portmpkg.tcl portpkg.tcl \
+ portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl portarchive.tcl
include ../../Mk/macports.autoconf.mk
Modified: trunk/base/src/package1.0/package.tcl
===================================================================
--- trunk/base/src/package1.0/package.tcl 2007-10-26 11:57:23 UTC (rev 30390)
+++ trunk/base/src/package1.0/package.tcl 2007-10-26 12:06:16 UTC (rev 30391)
@@ -37,6 +37,7 @@
package require portpkg 1.0
package require portmpkg 1.0
package require portdmg 1.0
+package require portmdmg 1.0
package require portdpkg 1.0
package require portunarchive 1.0
package require portarchive 1.0
Copied: trunk/base/src/package1.0/portmdmg.tcl (from rev 29515, trunk/base/src/package1.0/portdmg.tcl)
===================================================================
--- trunk/base/src/package1.0/portmdmg.tcl (rev 0)
+++ trunk/base/src/package1.0/portmdmg.tcl 2007-10-26 12:06:16 UTC (rev 30391)
@@ -0,0 +1,98 @@
+# et:ts=4
+# portmdmg.tcl
+# $Id$
+#
+# Copyright (c) 2003 Apple Computer, Inc.
+# 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 portmdmg 1.0
+package require portutil 1.0
+
+set org.macports.mdmg [target_new org.macports.mdmg mdmg_main]
+target_runtype ${org.macports.mdmg} always
+target_provides ${org.macports.mdmg} mdmg
+target_requires ${org.macports.mdmg} mpkg
+
+set_ui_prefix
+
+proc mdmg_main {args} {
+ global portname portversion portrevision package.destpath UI_PREFIX
+
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Creating disk image for %s-%s"] ${portname} ${portversion}]"
+
+ return [package_mdmg $portname $portversion $portrevision]
+}
+
+proc package_mdmg {portname portversion portrevision} {
+ global UI_PREFIX package.destpath portpath
+
+ if {[expr (${portrevision} > 0)]} {
+ set imagename "${portname}-${portversion}-${portrevision}"
+ } else {
+ set imagename "${portname}-${portversion}"
+ }
+
+ set tmp_image ${package.destpath}/${imagename}.tmp.dmg
+ set final_image ${package.destpath}/${imagename}.dmg
+ set mpkgpath ${package.destpath}/${portname}-${portversion}.mpkg
+
+ if {[file readable $final_image] && ([file mtime ${final_image}] >= [file mtime ${portpath}/Portfile])} {
+ ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s-%s is up-to-date"] ${portname} ${portversion}]"
+ return 0
+ }
+
+ # size for .dmg
+ set size [dirSize ${mpkgpath}]
+ if {[expr ($size < 4194304)]} {
+ # there is a minimum of 8292 512 blocks in a dmg
+ set blocks 8292
+ } else {
+ # this should later be replaced with hdiutil create -srcfolder
+ set blocks [expr ($size/512) + ((($size/512)*3)/100)]
+ }
+
+ if {[system "hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
+ return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
+ }
+ if {[catch {set devicename [exec hdid ${tmp_image} | grep "s2" | awk "{ print \$1 }"]} error]} {
+ return -code error [format [msgcat::mc "Failed to attach temporary image: %s"] ${error}]
+ }
+ set mount_point [exec mount | grep "${devicename}"]
+ regexp {(\/Volumes/[A-Za-z0-9\-\_\s].+)\s\(} $mount_point code mount_point
+ system "ditto -rsrcFork ${mpkgpath} '${mount_point}/${portname}-${portversion}.mpkg'"
+ system "hdiutil detach ${devicename} -quiet"
+ if {[system "hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
+ return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
+ }
+ if {[system "hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
+ return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
+ }
+ system "rm -f ${tmp_image}"
+
+ return 0
+}
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2007-10-26 11:57:23 UTC (rev 30390)
+++ trunk/base/src/port/port.tcl 2007-10-26 12:06:16 UTC (rev 30391)
@@ -2159,6 +2159,7 @@
archive action_target
unarchive action_target
dmg action_target
+ mdmg action_target
dpkg action_target
mpkg action_target
pkg action_target
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071026/c277e411/attachment.html
More information about the macports-changes
mailing list