Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
ca8861d5
Commit
ca8861d5
authored
5 years ago
by
Chris Lamb
Browse files
Options
Downloads
Patches
Plain Diff
Inline MissingFile's special handling of deb822 to prevent leaking through abstract layers.
parent
8f63a6fd
No related branches found
No related tags found
No related merge requests found
Pipeline
#138966
passed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diffoscope/comparators/debian.py
+29
-18
29 additions, 18 deletions
diffoscope/comparators/debian.py
diffoscope/comparators/missing_file.py
+1
-11
1 addition, 11 deletions
diffoscope/comparators/missing_file.py
with
30 additions
and
29 deletions
diffoscope/comparators/debian.py
+
29
−
18
View file @
ca8861d5
...
...
@@ -72,7 +72,7 @@ class DebControlContainer(Container):
@staticmethod
def
get_version_trimming_re
(
dcc
):
version
=
dcc
.
source
.
deb822
.
get
(
'
Version
'
)
version
=
dcc
.
source
.
_
deb822
.
get
(
'
Version
'
)
# Remove the epoch as it's not in the filename
version
=
re
.
sub
(
r
'
^\d+:
'
,
''
,
version
)
...
...
@@ -90,7 +90,7 @@ class DebControlContainer(Container):
yield
self
.
_trim_version_number
(
name
),
self
.
get_member
(
name
)
def
get_member_names
(
self
):
field
=
self
.
source
.
deb822
.
get
(
'
Files
'
)
or
self
.
source
.
deb822
.
get
(
field
=
self
.
source
.
_
deb822
.
get
(
'
Files
'
)
or
self
.
source
.
_
deb822
.
get
(
'
Checksums-Sha256
'
)
...
...
@@ -112,28 +112,37 @@ class DebControlContainer(Container):
class
DebControlFile
(
File
):
CONTAINER_CLASSES
=
[
DebControlContainer
]
@property
def
deb822
(
self
):
# Be nicer to .changes and .dsc comparisons; see
# diffoscope.comparators.missing_file.MissingFile.deb822
return
self
.
_deb822
@staticmethod
def
_get_deb822
(
file
):
# Be nice to .changes and .dsc comparison in the MissingFile case
if
isinstance
(
file
,
DebControlFile
):
return
file
.
_deb822
class
DummyChanges
(
dict
):
def
get_as_string
(
self
,
_
):
return
""
return
DummyChanges
(
Files
=
[],
Version
=
''
)
def
compare_details
(
self
,
other
,
source
=
None
):
differences
=
[]
other_deb822
=
self
.
_get_deb822
(
other
)
for
field
in
sorted
(
set
(
self
.
deb822
.
keys
()).
union
(
set
(
other
.
deb822
.
keys
()))
set
(
self
.
_
deb822
.
keys
()).
union
(
set
(
other
_
deb822
.
keys
()))
):
if
field
.
startswith
(
'
Checksums-
'
)
or
field
==
'
Files
'
:
continue
my_value
=
""
if
field
in
self
.
deb822
:
my_value
=
self
.
deb822
.
get_as_string
(
field
).
lstrip
()
if
field
in
self
.
_
deb822
:
my_value
=
self
.
_
deb822
.
get_as_string
(
field
).
lstrip
()
other_value
=
""
if
field
in
other
.
deb822
:
other_value
=
other
.
deb822
.
get_as_string
(
field
).
lstrip
()
if
field
in
other
_
deb822
:
other_value
=
other
_
deb822
.
get_as_string
(
field
).
lstrip
()
differences
.
append
(
Difference
.
from_text
(
...
...
@@ -142,11 +151,11 @@ class DebControlFile(File):
)
# Compare Files as string
if
self
.
deb822
.
get
(
'
Files
'
):
if
self
.
_
deb822
.
get
(
'
Files
'
):
differences
.
append
(
Difference
.
from_text
(
self
.
deb822
.
get_as_string
(
'
Files
'
),
other
.
deb822
.
get_as_string
(
'
Files
'
),
self
.
_
deb822
.
get_as_string
(
'
Files
'
),
other
_
deb822
.
get_as_string
(
'
Files
'
),
self
.
path
,
other
.
path
,
source
=
'
Files
'
,
...
...
@@ -155,8 +164,8 @@ class DebControlFile(File):
else
:
differences
.
append
(
Difference
.
from_text
(
self
.
deb822
.
get_as_string
(
'
Checksums-Sha256
'
),
other
.
deb822
.
get_as_string
(
'
Checksums-Sha256
'
),
self
.
_
deb822
.
get_as_string
(
'
Checksums-Sha256
'
),
other
_
deb822
.
get_as_string
(
'
Checksums-Sha256
'
),
self
.
path
,
other
.
path
,
source
=
'
Checksums-Sha256
'
,
...
...
@@ -193,7 +202,9 @@ class DotChangesFile(DebControlFile):
if
differences
is
None
:
return
None
files
=
zip
(
self
.
deb822
.
get
(
'
Files
'
),
other
.
deb822
.
get
(
'
Files
'
))
other_deb822
=
self
.
_get_deb822
(
other
)
files
=
zip
(
self
.
_deb822
.
get
(
'
Files
'
),
other_deb822
.
get
(
'
Files
'
))
files_identical
=
all
(
x
==
y
for
x
,
y
in
files
if
not
x
[
'
name
'
].
endswith
(
'
.buildinfo
'
)
...
...
This diff is collapsed.
Click to expand it.
diffoscope/comparators/missing_file.py
+
1
−
11
View file @
ca8861d5
...
...
@@ -2,7 +2,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2016-2017, 2019 Chris Lamb <lamby@debian.org>
# Copyright © 2016-2017, 2019
-2020
Chris Lamb <lamby@debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -103,13 +103,3 @@ class MissingFile(File):
@property
def
magic_file_type
(
self
):
return
self
.
_other_file
.
magic_file_type
# Be nice to .changes and .dsc comparisons; see
# diffoscope.comparators.debian.DebControlFile.deb822
@property
def
deb822
(
self
):
class
DummyChanges
(
dict
):
def
get_as_string
(
self
,
_
):
return
''
return
DummyChanges
(
Files
=
[],
Version
=
''
)
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