uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
35
pkgs/development/python-modules/mat2/bubblewrap-path.patch
Normal file
35
pkgs/development/python-modules/mat2/bubblewrap-path.patch
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
diff --git a/libmat2/bubblewrap.py b/libmat2/bubblewrap.py
|
||||
index 970d5dd..5d3c0b7 100644
|
||||
--- a/libmat2/bubblewrap.py
|
||||
+++ b/libmat2/bubblewrap.py
|
||||
@@ -22,11 +22,7 @@ CalledProcessError = subprocess.CalledProcessError
|
||||
|
||||
|
||||
def _get_bwrap_path() -> str:
|
||||
- which_path = shutil.which('bwrap')
|
||||
- if which_path:
|
||||
- return which_path
|
||||
-
|
||||
- raise RuntimeError("Unable to find bwrap") # pragma: no cover
|
||||
+ return '@bwrap@'
|
||||
|
||||
|
||||
def _get_bwrap_args(tempdir: str,
|
||||
@@ -37,16 +33,11 @@ def _get_bwrap_args(tempdir: str,
|
||||
|
||||
# XXX: use --ro-bind-try once all supported platforms
|
||||
# have a bubblewrap recent enough to support it.
|
||||
- ro_bind_dirs = ['/usr', '/lib', '/lib64', '/bin', '/sbin', '/etc/alternatives', cwd]
|
||||
+ ro_bind_dirs = ['/nix/store', cwd]
|
||||
for bind_dir in ro_bind_dirs:
|
||||
if os.path.isdir(bind_dir): # pragma: no cover
|
||||
ro_bind_args.extend(['--ro-bind', bind_dir, bind_dir])
|
||||
|
||||
- ro_bind_files = ['/etc/ld.so.cache']
|
||||
- for bind_file in ro_bind_files:
|
||||
- if os.path.isfile(bind_file): # pragma: no cover
|
||||
- ro_bind_args.extend(['--ro-bind', bind_file, bind_file])
|
||||
-
|
||||
args = ro_bind_args + \
|
||||
['--dev', '/dev',
|
||||
'--proc', '/proc',
|
||||
106
pkgs/development/python-modules/mat2/default.nix
Normal file
106
pkgs/development/python-modules/mat2/default.nix
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, python
|
||||
, pythonOlder
|
||||
, fetchFromGitLab
|
||||
, substituteAll
|
||||
, bubblewrap
|
||||
, exiftool
|
||||
, ffmpeg
|
||||
, mailcap
|
||||
, wrapGAppsHook
|
||||
, gdk-pixbuf
|
||||
, gobject-introspection
|
||||
, librsvg
|
||||
, poppler_gi
|
||||
, mutagen
|
||||
, pygobject3
|
||||
, pycairo
|
||||
, dolphinIntegration ? false, plasma5Packages
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "mat2";
|
||||
version = "0.12.4";
|
||||
|
||||
disabled = pythonOlder "3.5";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "0xacab.org";
|
||||
owner = "jvoisin";
|
||||
repo = "mat2";
|
||||
rev = version;
|
||||
hash = "sha256-HjPr4pb0x2Sdq8ALaZeQRnGHmNAoEV8XUGbhOjY00jc=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# hardcode paths to some binaries
|
||||
(substituteAll ({
|
||||
src = ./paths.patch;
|
||||
exiftool = "${exiftool}/bin/exiftool";
|
||||
ffmpeg = "${ffmpeg}/bin/ffmpeg";
|
||||
} // lib.optionalAttrs dolphinIntegration {
|
||||
kdialog = "${plasma5Packages.kdialog}/bin/kdialog";
|
||||
}))
|
||||
# the executable shouldn't be called .mat2-wrapped
|
||||
./executable-name.patch
|
||||
# hardcode path to mat2 executable
|
||||
./tests.patch
|
||||
# fix gobject-introspection typelib path for Nautilus extension
|
||||
(substituteAll {
|
||||
src = ./fix_poppler.patch;
|
||||
poppler_path = "${poppler_gi}/lib/girepository-1.0";
|
||||
})
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isLinux) [
|
||||
(substituteAll {
|
||||
src = ./bubblewrap-path.patch;
|
||||
bwrap = "${bubblewrap}/bin/bwrap";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace dolphin/mat2.desktop \
|
||||
--replace "@mat2@" "$out/bin/mat2" \
|
||||
--replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
wrapGAppsHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gdk-pixbuf
|
||||
gobject-introspection
|
||||
librsvg
|
||||
poppler_gi
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
mutagen
|
||||
pygobject3
|
||||
pycairo
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps"
|
||||
install -Dm 444 doc/mat2.1 -t "$out/share/man/man1"
|
||||
install -Dm 444 nautilus/mat2.py -t "$out/share/nautilus-python/extensions"
|
||||
buildPythonPath "$out $pythonPath $propagatedBuildInputs"
|
||||
patchPythonScript "$out/share/nautilus-python/extensions/mat2.py"
|
||||
'' + lib.optionalString dolphinIntegration ''
|
||||
install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus"
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
${python.interpreter} -m unittest discover -v
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A handy tool to trash your metadata";
|
||||
homepage = "https://0xacab.org/jvoisin/mat2";
|
||||
changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md";
|
||||
license = licenses.lgpl3Plus;
|
||||
maintainers = with maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
||||
13
pkgs/development/python-modules/mat2/executable-name.patch
Normal file
13
pkgs/development/python-modules/mat2/executable-name.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/mat2 b/mat2
|
||||
index 3b77e1e..b99a633 100755
|
||||
--- a/mat2
|
||||
+++ b/mat2
|
||||
@@ -46,7 +46,7 @@ def __check_file(filename: str, mode: int = os.R_OK) -> bool:
|
||||
|
||||
|
||||
def create_arg_parser() -> argparse.ArgumentParser:
|
||||
- parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2')
|
||||
+ parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2', prog='mat2')
|
||||
|
||||
parser.add_argument('-V', '--verbose', action='store_true',
|
||||
help='show more verbose status information')
|
||||
14
pkgs/development/python-modules/mat2/fix_poppler.patch
Normal file
14
pkgs/development/python-modules/mat2/fix_poppler.patch
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/nautilus/mat2.py b/nautilus/mat2.py
|
||||
index 11e6986..5a0e68f 100644
|
||||
--- a/nautilus/mat2.py
|
||||
+++ b/nautilus/mat2.py
|
||||
@@ -22,6 +22,9 @@ import gi
|
||||
gi.require_version('Nautilus', '3.0')
|
||||
gi.require_version('Gtk', '3.0')
|
||||
gi.require_version('GdkPixbuf', '2.0')
|
||||
+gi.require_version('GIRepository', '2.0')
|
||||
+from gi.repository import GIRepository
|
||||
+GIRepository.Repository.prepend_search_path('@poppler_path@')
|
||||
from gi.repository import Nautilus, GObject, Gtk, Gio, GLib, GdkPixbuf
|
||||
|
||||
from libmat2 import parser_factory
|
||||
66
pkgs/development/python-modules/mat2/paths.patch
Normal file
66
pkgs/development/python-modules/mat2/paths.patch
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
diff --git a/dolphin/mat2.desktop b/dolphin/mat2.desktop
|
||||
index 41c8de4..11df258 100644
|
||||
--- a/dolphin/mat2.desktop
|
||||
+++ b/dolphin/mat2.desktop
|
||||
@@ -8,6 +8,6 @@ Type=Service
|
||||
Name=Clean metadata
|
||||
Name[de]=Metadaten löschen
|
||||
Name[es]=Limpiar metadatos
|
||||
-Icon=/usr/share/icons/hicolor/scalable/apps/mat2.svg
|
||||
-Exec=kdialog --yesno "$( mat2 -s %F )" --title "Clean Metadata?" && mat2 %U
|
||||
-Exec[de]=kdialog --yesno "$( mat2 -s %F )" --title "Metadaten löschen?" && mat2 %U
|
||||
+Icon=@mat2svg@
|
||||
+Exec=@kdialog@ --yesno "$( @mat2@ -s %F )" --title "Clean Metadata?" && @mat2@ %U
|
||||
+Exec[de]=@kdialog@ --yesno "$( @mat2@ -s %F )" --title "Metadaten löschen?" && @mat2@ %U
|
||||
diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py
|
||||
index eb65b2a..51a0fa1 100644
|
||||
--- a/libmat2/exiftool.py
|
||||
+++ b/libmat2/exiftool.py
|
||||
@@ -1,8 +1,6 @@
|
||||
-import functools
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
-import shutil
|
||||
import subprocess
|
||||
from typing import Dict, Union, Set
|
||||
|
||||
@@ -70,14 +68,5 @@ class ExiftoolParser(abstract.AbstractParser):
|
||||
return False
|
||||
return True
|
||||
|
||||
-@functools.lru_cache()
|
||||
def _get_exiftool_path() -> str: # pragma: no cover
|
||||
- which_path = shutil.which('exiftool')
|
||||
- if which_path:
|
||||
- return which_path
|
||||
-
|
||||
- # Exiftool on Arch Linux has a weird path
|
||||
- if os.access('/usr/bin/vendor_perl/exiftool', os.X_OK):
|
||||
- return '/usr/bin/vendor_perl/exiftool'
|
||||
-
|
||||
- raise RuntimeError("Unable to find exiftool")
|
||||
+ return '@exiftool@'
|
||||
diff --git a/libmat2/video.py b/libmat2/video.py
|
||||
index ae9e463..2acc65c 100644
|
||||
--- a/libmat2/video.py
|
||||
+++ b/libmat2/video.py
|
||||
@@ -1,6 +1,4 @@
|
||||
import subprocess
|
||||
-import functools
|
||||
-import shutil
|
||||
import logging
|
||||
|
||||
from typing import Dict, Union
|
||||
@@ -135,10 +133,5 @@ class MP4Parser(AbstractFFmpegParser):
|
||||
}
|
||||
|
||||
|
||||
-@functools.lru_cache()
|
||||
def _get_ffmpeg_path() -> str: # pragma: no cover
|
||||
- which_path = shutil.which('ffmpeg')
|
||||
- if which_path:
|
||||
- return which_path
|
||||
-
|
||||
- raise RuntimeError("Unable to find ffmpeg")
|
||||
+ return '@ffmpeg@'
|
||||
18
pkgs/development/python-modules/mat2/tests.patch
Normal file
18
pkgs/development/python-modules/mat2/tests.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
|
||||
index cede642..2d5ad77 100644
|
||||
--- a/tests/test_climat2.py
|
||||
+++ b/tests/test_climat2.py
|
||||
@@ -10,12 +10,7 @@ import glob
|
||||
from libmat2 import images, parser_factory
|
||||
|
||||
|
||||
-mat2_binary = ['./mat2']
|
||||
-
|
||||
-if 'MAT2_GLOBAL_PATH_TESTSUITE' in os.environ:
|
||||
- # Debian runs tests after installing the package
|
||||
- # https://0xacab.org/jvoisin/mat2/issues/16#note_153878
|
||||
- mat2_binary = ['/usr/bin/env', 'mat2']
|
||||
+mat2_binary = [os.environ['out'] + '/bin/mat2']
|
||||
|
||||
|
||||
class TestHelp(unittest.TestCase):
|
||||
Loading…
Add table
Add a link
Reference in a new issue