Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Reproducible Builds
diffoscope
Compare revisions
7998aa035ddd6a989358e52f5c022cacf3b06c0b...45ac81bad59fc1b651e405339fa588026bbeffc2
Commits (2)
Factor out generating a human-readable comment when missing a Python module.
· 55742394
Chris Lamb
authored
May 01, 2023
55742394
If binwalk is not available, ensure the user knows they may be missing more info.
· 45ac81ba
Chris Lamb
authored
May 01, 2023
45ac81ba
Hide whitespace changes
Inline
Side-by-side
diffoscope/comparators/binwalk.py
View file @
45ac81ba
...
...
@@ -21,7 +21,10 @@ import re
import
glob
import
logging
from
diffoscope.tools
import
python_module_missing
from
diffoscope.tools
import
(
python_module_missing
,
get_comment_for_missing_python_module
,
)
from
diffoscope.tempfiles
import
get_temporary_directory
from
.utils.file
import
File
...
...
@@ -70,10 +73,11 @@ class BinwalkFile(File):
@classmethod
def
recognizes
(
cls
,
file
):
if
binwalk
is
None
:
if
not
super
().
recognizes
(
file
)
:
return
False
if
not
super
().
recognizes
(
file
):
if
binwalk
is
None
:
file
.
add_comment
(
get_comment_for_missing_python_module
(
"binwalk"
))
return
False
# RPM files are .cpio, but let's always leave it to the RPM comparator.
...
...
diffoscope/comparators/fsimage.py
View file @
45ac81ba
...
...
@@ -24,7 +24,7 @@ import os.path
from
diffoscope.difference
import
Difference
from
diffoscope.tools
import
python_module_missing
from
diffoscope.profiling
import
profile
from
diffoscope.tools
import
get_
package_provider
from
diffoscope.tools
import
get_
comment_for_missing_python_module
from
.utils.file
import
File
from
.utils.archive
import
Archive
...
...
@@ -129,9 +129,5 @@ class FsImageFile(File):
)
)
if
not
guestfs
:
pkg
=
get_package_provider
(
"guestfs"
)
infix
=
f
" from the '
{
pkg
}
' package "
if
pkg
else
" "
self
.
add_comment
(
f
"Installing the 'guestfs' Python module
{
infix
}
may produce a better output."
)
self
.
add_comment
(
get_comment_for_missing_python_module
(
"guestfs"
))
return
differences
diffoscope/tools.py
View file @
45ac81ba
...
...
@@ -191,4 +191,11 @@ def python_module_missing(name):
python_module_missing
.
modules
.
add
(
name
)
def
get_comment_for_missing_python_module
(
name
):
pkg
=
get_package_provider
(
name
)
infix
=
f
" from the '
{
pkg
}
' package "
if
pkg
else
" "
return
f
"Installing the '
{
name
}
' Python module
{
infix
}
may produce a better output."
python_module_missing
.
modules
=
set
()