Ticket #13509: use_dmg.diff

File use_dmg.diff, 2.8 KB (added by ryandesign (Ryan Carsten Schmidt), 17 years ago)

base patch to implement the use_dmg option

  • src/port1.0/portfetch.tcl

     
    4141target_prerun ${org.macports.fetch} fetch_start
    4242
    4343# define options: distname master_sites
    44 options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 dist_subdir \
     44options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 use_dmg dist_subdir \
    4545        fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
    4646        master_sites.mirror_subdir patch_sites.mirror_subdir portname \
    4747        cvs.module cvs.root cvs.password cvs.date cvs.tag \
     
    9494# Option-executed procedures
    9595option_proc use_bzip2 fix_extract_suffix
    9696option_proc use_zip fix_extract_suffix
     97option_proc use_dmg fix_extract_suffix
    9798
    9899proc fix_extract_suffix {option action args} {
    99100    global extract.suffix
     
    105106            use_zip {
    106107                set extract.suffix .zip
    107108            }
     109            use_dmg {
     110                set extract.suffix .dmg
     111            }
    108112        }
    109113    }
    110114}
     
    115119
    116120set_ui_prefix
    117121
    118 # Given a distname, return a suffix based on the use_zip / use_bzip2 / extract.suffix options
     122# Given a distname, return a suffix based on the use_zip / use_bzip2 / use_dmg / extract.suffix options
    119123proc suffix {distname} {
    120124    global extract.suffix fetch.type
    121125    switch -- "${fetch.type}" {
  • src/port1.0/portextract.tcl

     
    5858set_ui_prefix
    5959
    6060proc extract_init {args} {
    61     global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_zip workpath
     61    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_zip use_dmg workpath
    6262
    6363    # should the distfiles be extracted to worksrcpath instead?
    6464    if {[tbool extract.mkdir]} {
     
    7474        option extract.cmd [binaryInPath "unzip"]
    7575        option extract.pre_args -q
    7676        option extract.post_args "-d [option extract.dir]"
     77    } elseif {[tbool use_dmg]} {
     78        global worksrcdir
     79        set dmg_tmp_dir [exec mktemp -d -q "/tmp/mports.XXXXXXXX"]
     80        set dmg_mount ${dmg_tmp_dir}/${worksrcdir}
     81        file mkdir ${dmg_mount}
     82        option extract.cmd [binaryInPath "hdiutil"]
     83        option extract.pre_args attach
     84        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}"
    7785    }
    7886}
    7987