Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#13509 closed enhancement (fixed)

Support .dmg disk images as distfiles with new use_dmg option

Reported by: ryandesign (Ryan Schmidt) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version: 1.6.0
Keywords: Cc: boeyms@…


We support several kinds distfile formats, including .tar.gz, .tar.bz2 and .zip. The former is the default; the others can be achieved by setting use_bzip2 or use_zip, respectively, to "yes". It would be nice to also support disk images with the .dmg extension via a new option use_dmg.

I will attach a patch for base to implement this which seems to work for me, but this is my first "major" bit of base hacking, so please scrutinize it extra carefully and point out any problems.

I'll also attach a patch for the isightcapture portfile, which currently has to do the disk image manipulation manually, to show how this simplifies the portfile. This is also the portfile I tested this feature with.

Attachments (2)

use_dmg.diff (2.8 KB) - added by ryandesign (Ryan Schmidt) 13 years ago.
base patch to implement the use_dmg option
isightcapture-use_dmg.diff (1.1 KB) - added by ryandesign (Ryan Schmidt) 13 years ago.
updated patch for isightcapture

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by ryandesign (Ryan Schmidt)

Attachment: use_dmg.diff added

base patch to implement the use_dmg option

comment:1 Changed 13 years ago by boeyms@…

Cc: boeyms@… added

I haven't tested it yet, but it looks good. One small suggestion, though: if it's not too much effort, it'd be nice to wrap this bit in a test for the platform that the user is running on so that fails more gracefully if MacPorts is not installed on Mac OS X.

For other platforms, there's a Java program called DMGExtractor, but it doesn't fail gracefully when it doesn't succeed, it's not really designed for command-line use (though it can be used that way), and it only works for some UDIF dmgs (those that have been successfully reverse-engineered, since it seems that Apple is not releasing the specs).

comment:2 Changed 13 years ago by ryandesign (Ryan Schmidt)

Bear in mind that my knowledge of Tcl and MacPorts base is still very limited, so I don't know how to wrap what I've done in a Mac OS X platform test. Is there existing code in other parts of base that I could look at?

I think it would be ok to commit the functionality now, and add support for non-Mac platforms--or beautify the error messages on those platforms--later. I wouldn't expect dmg-based extraction to be used on platforms other than Mac OS X anyway, since dmg is a Mac OS X format. Or rather, I wouldn't expect developers to distribute things on a dmg unless they intended it to be used exclusively on Mac OS X. To that end, I would expect any port using dmg-based extraction to declare only "platforms macosx", and I would further expect MacPorts to prevent installation of the port on platforms that are not macosx.

Changed 13 years ago by ryandesign (Ryan Schmidt)

Attachment: isightcapture-use_dmg.diff added

updated patch for isightcapture

comment:3 Changed 13 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: newclosed

Committed my patch to base in r36708. Updated the ChangeLog in r36711.

comment:4 Changed 12 years ago by blb@…

Milestone: MacPorts base enhancementsMacPorts 1.7.0
Note: See TracTickets for help on using tickets.