[Git][reproducible-builds/diffoscope][master] Always pass a filename with a ".zip" extension to zipnote, otherwise it will...

Chris Lamb gitlab at salsa.debian.org
Sat Dec 28 10:55:57 UTC 2019



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
a93aa33d by Chris Lamb at 2019-12-28T10:55:42Z
Always pass a filename with a ".zip" extension to zipnote, otherwise it will return with an exit code of 9 and revert to a binary diff for the entire file.

eg:

```
├── scrcpy-server_1.11+ds-1_all.deb
│ ├── data.tar.xz
│ │ ├── data.tar
│ │ │ ├── ./usr/share/scrcpy/scrcpy-server
│ │ │ │┄ Command `zipnote /srv/reproducible-results/rbuild-debian/tmp.nUXKuYqaZC/dbd-tmp-LUse4MQ/diffoscope_umwd1nq2/tmp0lwevy98/0/8` exited with exit code 9. Standard output:
│ │ │ │┄     zipnote error: Interrupted (aborting)
│ │ │ │ @@ -1,20 +1,20 @@
│ │ │ │ -00000000: 504b 0304 1400 0808 0800 a914 9b4f 0000  PK...........O..
│ │ │ │ +00000000: 504b 0304 1400 0808 0800 6558 3d52 0000  PK........eX=R..
│ │ │ │  00000010: 0000 0000 0000 0000 0000 0900 0400 4d45  ..............ME
```

- - - - -


1 changed file:

- diffoscope/comparators/zip.py


Changes:

=====================================
diffoscope/comparators/zip.py
=====================================
@@ -27,6 +27,7 @@ from diffoscope.config import Config
 from diffoscope.tools import tool_required
 from diffoscope.difference import Difference
 from diffoscope.exc import ContainerExtractionError
+from diffoscope.tempfiles import get_named_temporary_file
 
 from .utils.file import File
 from .directory import Directory
@@ -78,7 +79,11 @@ class Zipnote(Command):
 
     @tool_required('zipnote')
     def cmdline(self):
-        return ['zipnote', self.path]
+        path = self.path
+        if not path.endswith('.zip'):
+            path = get_named_temporary_file(suffix='.zip').name
+            shutil.copy(self.path, path)
+        return ['zipnote', path]
 
     @property
     def returncode(self):



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/a93aa33d1bd1e315add2ee3962d634e2caa4a814

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/a93aa33d1bd1e315add2ee3962d634e2caa4a814
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20191228/71962b2a/attachment.htm>


More information about the rb-commits mailing list