Repository: dtrx-py/dtrx (language: python)

Issue:
Handle dmg files
7z can handle DMG files but dtrx doesn't know what they are.

https://twitter.com/garrett/status/1394330803346284546


Discussion / hints:

Fix patch:
diff --git a/scripts/dtrx b/scripts/dtrx
index d666039..6215c36 100755
--- a/scripts/dtrx
+++ b/scripts/dtrx
@@ -1077,6 +1077,13 @@ class ExtractorBuilder(object):
                              'mimetypes': ('x-msi', 'x-ole-storage'),
                              'extensions': ('msi',),
                              'magic': ('Application: Windows Installer',)},
+                     'dmg': {'extractors': (SevenExtractor,),
+                             'mimetypes': ('x-apple-diskimage',),
+                             'extensions': ('dmg',),
+                             'magic': (
+                                 'ISO 9660 CD-ROM filesystem data',
+                                 'zlib compressed data',
+                             )},
                      'compress': {'extractors': (CompressionExtractor,)}
                      }
 


Test patch:
diff --git a/test.sh b/test.sh
index bc87a63..394b412 100755
--- a/test.sh
+++ b/test.sh
@@ -25,10 +25,10 @@ case $RUN_JOB in
         # execute tox in the docker container. don't run in parallel; the test
         # script writes files to an in-tree location, so run serially to avoid
         # clobbering during the tests
-        docker run -v "$(pwd)":/mnt/workspace -t "$DOCKER_IMAGE_NAME" bash -c "tox $TOX_ARGS"
+        docker run --rm -v "$(pwd)":/mnt/workspace -t "$DOCKER_IMAGE_NAME" bash -c "tox $TOX_ARGS"
     ;;
     rst2man)
         # build man page from README
-        docker run -v "$(pwd)":/mnt/workspace -t "$DOCKER_IMAGE_NAME" bash gen-manpage.sh README dtrx.1
+        docker run --rm -v "$(pwd)":/mnt/workspace -t "$DOCKER_IMAGE_NAME" bash gen-manpage.sh README dtrx.1
     ;;
 esac
diff --git a/tests/test.compressed.dmg b/tests/test.compressed.dmg
new file mode 100644
index 0000000..481ecad
Binary files /dev/null and b/tests/test.compressed.dmg differ
diff --git a/tests/test.dmg b/tests/test.dmg
new file mode 100644
index 0000000..6bb0b78
Binary files /dev/null and b/tests/test.dmg differ
diff --git a/tests/tests.yml b/tests/tests.yml
index 8a100d6..304ae3d 100644
--- a/tests/tests.yml
+++ b/tests/tests.yml
@@ -805,3 +805,17 @@
     cd test-recursive-no-prompt
     tar -jxf ../$1
   antigrep: '.'
+
+- name: uncompressed dmg
+  filenames: test.dmg
+  baseline: |
+    mkdir test
+    cd test
+    7z x ../$1
+
+- name: compressed dmg
+  filenames: test.compressed.dmg
+  baseline: |
+    mkdir test.compressed
+    cd test.compressed
+    7z x ../$1