Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
175
Issue boards
Milestones
Wiki
Code
Merge requests
15
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
ad9100f9
Commit
ad9100f9
authored
4 years ago
by
Chris Lamb
Browse files
Options
Downloads
Patches
Plain Diff
Move special-casing of returncodes in zip to use Command.VALID_RETURNCODES.
parent
dd233275
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diffoscope/comparators/zip.py
+8
-19
8 additions, 19 deletions
diffoscope/comparators/zip.py
with
8 additions
and
19 deletions
diffoscope/comparators/zip.py
+
8
−
19
View file @
ad9100f9
...
...
@@ -36,6 +36,11 @@ from .utils.command import Command
class
Zipinfo
(
Command
):
# zipinfo returns with an exit code of 1 or 2 when reading
# Mozilla-optimized or Java "jmod" ZIPs as they have non-standard headers
# which are safe to ignore.
VALID_RETURNCODES
=
{
0
,
1
,
2
}
@tool_required
(
'
zipinfo
'
)
def
cmdline
(
self
):
# zipinfo (without -v) puts warning messages (some of which contain
...
...
@@ -43,18 +48,6 @@ class Zipinfo(Command):
# to work around it, we run it on /dev/stdin instead, seems to work ok.
return
[
'
zipinfo
'
,
'
/dev/stdin
'
]
@property
def
returncode
(
self
):
returncode
=
super
().
returncode
# zipinfo returns with an exit code of 1 or 2 when reading
# Mozilla-optimized or Java "jmod" ZIPs as they have non-standard
# headers which are safe to ignore.
if
returncode
in
(
1
,
2
):
returncode
=
0
return
returncode
def
stdin
(
self
):
return
open
(
self
.
path
,
'
rb
'
)
...
...
@@ -72,6 +65,9 @@ class ZipinfoVerbose(Zipinfo):
class
Zipnote
(
Command
):
# zipnote returns with an exit code of 3 for invalid archives
VALID_RETURNCODES
=
{
0
,
3
}
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -85,13 +81,6 @@ class Zipnote(Command):
shutil
.
copy
(
self
.
path
,
path
)
return
[
'
zipnote
'
,
path
]
@property
def
returncode
(
self
):
returncode
=
super
().
returncode
# zipnote returns with an exit code of 3 for invalid archives
return
0
if
returncode
==
3
else
returncode
def
filter
(
self
,
line
):
"""
Example output from zipnote(1):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment