[36708] trunk/base/src/port1.0

ryandesign at macports.org ryandesign at macports.org
Mon May 12 20:27:26 PDT 2008


Revision: 36708
          http://trac.macosforge.org/projects/macports/changeset/36708
Author:   ryandesign at macports.org
Date:     2008-05-12 20:27:25 -0700 (Mon, 12 May 2008)

Log Message:
-----------
Allow distfiles to be disk images with new "use_dmg yes" port option; #13509.

Modified Paths:
--------------
    trunk/base/src/port1.0/portextract.tcl
    trunk/base/src/port1.0/portfetch.tcl

Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl	2008-05-13 03:11:06 UTC (rev 36707)
+++ trunk/base/src/port1.0/portextract.tcl	2008-05-13 03:27:25 UTC (rev 36708)
@@ -58,7 +58,7 @@
 set_ui_prefix
 
 proc extract_init {args} {
-    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_zip workpath
+    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_zip use_dmg workpath
 
     # should the distfiles be extracted to worksrcpath instead?
     if {[tbool extract.mkdir]} {
@@ -74,6 +74,14 @@
 	option extract.cmd [binaryInPath "unzip"]
 	option extract.pre_args -q
 	option extract.post_args "-d [option extract.dir]"
+    } elseif {[tbool use_dmg]} {
+        global worksrcdir
+        set dmg_tmp_dir [exec mktemp -d -q "/tmp/mports.XXXXXXXX"]
+        set dmg_mount ${dmg_tmp_dir}/${worksrcdir}
+        file mkdir ${dmg_mount}
+        option extract.cmd [binaryInPath "hdiutil"]
+        option extract.pre_args attach
+        option extract.post_args "-private -readonly -nobrowse -mountpoint ${dmg_mount} && [binaryInPath "cp"] -Rp ${dmg_mount} ${extract.dir} && ${extract.cmd} detach ${dmg_mount} && [binaryInPath "rmdir"] ${dmg_mount} ${dmg_tmp_dir}"
     }
 }
 

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2008-05-13 03:11:06 UTC (rev 36707)
+++ trunk/base/src/port1.0/portfetch.tcl	2008-05-13 03:27:25 UTC (rev 36708)
@@ -41,7 +41,7 @@
 target_prerun ${org.macports.fetch} fetch_start
 
 # define options: distname master_sites
-options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 dist_subdir \
+options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 use_dmg dist_subdir \
 	fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
 	master_sites.mirror_subdir patch_sites.mirror_subdir portname \
 	cvs.module cvs.root cvs.password cvs.date cvs.tag \
@@ -98,6 +98,7 @@
 # Option-executed procedures
 option_proc use_bzip2 fix_extract_suffix
 option_proc use_zip fix_extract_suffix
+option_proc use_dmg fix_extract_suffix
 
 proc fix_extract_suffix {option action args} {
     global extract.suffix
@@ -109,6 +110,9 @@
             use_zip {
                 set extract.suffix .zip
             }
+            use_dmg {
+                set extract.suffix .dmg
+            }
         }
     }
 }
@@ -119,7 +123,7 @@
 
 set_ui_prefix
 
-# Given a distname, return a suffix based on the use_zip / use_bzip2 / extract.suffix options
+# Given a distname, return a suffix based on the use_zip / use_bzip2 / use_dmg / extract.suffix options
 proc suffix {distname} {
     global extract.suffix fetch.type
     switch -- "${fetch.type}" {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080512/151cea0e/attachment-0001.html


More information about the macports-changes mailing list