Skip to content

Commit 5f3da53

Browse files
committed
ubports-click: Get rid of externally-supplied self
1 parent 65121a8 commit 5f3da53

File tree

1 file changed

+144
-139
lines changed

1 file changed

+144
-139
lines changed

pkgs/by-name/ub/ubports-click/package.nix

Lines changed: 144 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
lib,
66
stdenv,
77
testers,
8-
ubports-click,
98
autoreconfHook,
109
dbus,
1110
dbus-test-runner,
@@ -23,147 +22,153 @@
2322
wrapGAppsHook3,
2423
}:
2524

26-
python3Packages.buildPythonApplication rec {
27-
pname = "click";
28-
version = "0.5.2";
29-
format = "other";
25+
let
26+
self = python3Packages.buildPythonApplication rec {
27+
pname = "click";
28+
version = "0.5.2";
29+
format = "other";
30+
31+
src = fetchFromGitLab {
32+
owner = "ubports";
33+
repo = "development/core/click";
34+
rev = version;
35+
hash = "sha256-AV3n6tghvpV/6Ew6Lokf8QAGBIMbHFAnp6G4pefVn+8=";
36+
};
3037

31-
src = fetchFromGitLab {
32-
owner = "ubports";
33-
repo = "development/core/click";
34-
rev = version;
35-
hash = "sha256-AV3n6tghvpV/6Ew6Lokf8QAGBIMbHFAnp6G4pefVn+8=";
36-
};
38+
patches = [
39+
# Remove when version > 0.5.2
40+
(fetchpatch {
41+
name = "0001-click-fix-Wimplicit-function-declaration.patch";
42+
url = "https://gitlab.com/ubports/development/core/click/-/commit/8f654978a12e6f9a0b6ff64296ec5565e3ff5cd0.patch";
43+
hash = "sha256-kio+DdtuagUNYEosyQY3q3H+dJM3cLQRW9wUKUcpUTY=";
44+
})
45+
46+
# Remove when version > 0.5.2
47+
(fetchpatch {
48+
name = "0002-click-Add-uid_t-and-gid_t-to-the-ctypes-_typemap.patch";
49+
url = "https://gitlab.com/ubports/development/core/click/-/commit/cbcd23b08b02fa122434e1edd69c2b3dcb6a8793.patch";
50+
hash = "sha256-QaWRhxO61wAzULVqPLdJrLuBCr3+NhKmQlEPuYq843I=";
51+
})
52+
];
3753

38-
patches = [
39-
# Remove when version > 0.5.2
40-
(fetchpatch {
41-
name = "0001-click-fix-Wimplicit-function-declaration.patch";
42-
url = "https://gitlab.com/ubports/development/core/click/-/commit/8f654978a12e6f9a0b6ff64296ec5565e3ff5cd0.patch";
43-
hash = "sha256-kio+DdtuagUNYEosyQY3q3H+dJM3cLQRW9wUKUcpUTY=";
44-
})
45-
46-
# Remove when version > 0.5.2
47-
(fetchpatch {
48-
name = "0002-click-Add-uid_t-and-gid_t-to-the-ctypes-_typemap.patch";
49-
url = "https://gitlab.com/ubports/development/core/click/-/commit/cbcd23b08b02fa122434e1edd69c2b3dcb6a8793.patch";
50-
hash = "sha256-QaWRhxO61wAzULVqPLdJrLuBCr3+NhKmQlEPuYq843I=";
51-
})
52-
];
53-
54-
postPatch = ''
55-
# These should be proper Requires, using the header needs their headers
56-
substituteInPlace lib/click/click-*.pc.in \
57-
--replace-fail 'Requires.private' 'Requires'
58-
59-
# Don't completely override PKG_CONFIG_PATH
60-
substituteInPlace click_package/tests/Makefile.am \
61-
--replace-fail 'PKG_CONFIG_PATH=$(top_builddir)/lib/click' 'PKG_CONFIG_PATH=$(top_builddir)/lib/click:$(PKG_CONFIG_PATH)'
62-
63-
patchShebangs bin/click
64-
'';
65-
66-
strictDeps = true;
67-
68-
pkgsBuildBuild = [
69-
pkg-config
70-
];
71-
72-
nativeBuildInputs = [
73-
autoreconfHook
74-
dbus-test-runner # Always checking for this
75-
getopt
76-
gobject-introspection
77-
perl
78-
pkg-config
79-
vala
80-
wrapGAppsHook3
81-
];
82-
83-
buildInputs = [
84-
glib
85-
json-glib
86-
libgee
87-
properties-cpp
88-
];
89-
90-
propagatedBuildInputs = with python3Packages; [
91-
python-debian
92-
pygobject3
93-
setuptools
94-
];
95-
96-
nativeCheckInputs = [
97-
dbus
98-
dpkg
99-
python3Packages.unittestCheckHook
100-
];
101-
102-
checkInputs = with python3Packages; [
103-
python-apt
104-
six
105-
];
106-
107-
preConfigure = ''
108-
export click_cv_perl_vendorlib=$out/${perl.libPrefix}
109-
export PYTHON_INSTALL_FLAGS="--prefix=$out"
110-
'';
111-
112-
configureFlags = [
113-
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
114-
"--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user"
115-
];
116-
117-
enableParallelBuilding = true;
118-
119-
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
120-
121-
disabledTestPaths = [
122-
# From apt: Unable to determine a suitable packaging system type
123-
"click_package/tests/integration/test_signatures.py"
124-
"click_package/tests/test_build.py"
125-
"click_package/tests/test_install.py"
126-
"click_package/tests/test_scripts.py"
127-
];
128-
129-
preCheck = ''
130-
export HOME=$TMP
131-
132-
# tests recompile some files for loaded predefines, doesn't use any optimisation level for it
133-
# makes test output harder to read, so make the warning go away
134-
export NIX_CFLAGS_COMPILE+=" -U_FORTIFY_SOURCE"
135-
136-
# Haven'tbeen able to get them excluded via disabledTest{s,Paths}, just deleting them
137-
for path in $disabledTestPaths; do
138-
rm -v $path
139-
done
140-
'';
141-
142-
preFixup = ''
143-
makeWrapperArgs+=(
144-
--prefix LD_LIBRARY_PATH : "$out/lib"
145-
)
146-
'';
147-
148-
passthru = {
149-
tests.pkg-config = testers.hasPkgConfigModules {
150-
package = ubports-click;
151-
};
152-
updateScript = gitUpdater { };
153-
};
54+
postPatch = ''
55+
# These should be proper Requires, using the header needs their headers
56+
substituteInPlace lib/click/click-*.pc.in \
57+
--replace-fail 'Requires.private' 'Requires'
58+
59+
# Don't completely override PKG_CONFIG_PATH
60+
substituteInPlace click_package/tests/Makefile.am \
61+
--replace-fail 'PKG_CONFIG_PATH=$(top_builddir)/lib/click' 'PKG_CONFIG_PATH=$(top_builddir)/lib/click:$(PKG_CONFIG_PATH)'
62+
63+
patchShebangs bin/click
64+
'';
65+
66+
strictDeps = true;
67+
68+
pkgsBuildBuild = [
69+
pkg-config
70+
];
71+
72+
nativeBuildInputs = [
73+
autoreconfHook
74+
dbus-test-runner # Always checking for this
75+
getopt
76+
gobject-introspection
77+
perl
78+
pkg-config
79+
vala
80+
wrapGAppsHook3
81+
];
82+
83+
buildInputs = [
84+
glib
85+
json-glib
86+
libgee
87+
properties-cpp
88+
];
89+
90+
propagatedBuildInputs = with python3Packages; [
91+
python-debian
92+
pygobject3
93+
setuptools
94+
];
95+
96+
nativeCheckInputs = [
97+
dbus
98+
dpkg
99+
python3Packages.unittestCheckHook
100+
];
154101

155-
meta = {
156-
description = "Tool to build click packages, mainly used for Ubuntu Touch";
157-
homepage = "https://gitlab.com/ubports/development/core/click";
158-
changelog = "https://gitlab.com/ubports/development/core/click/-/blob/${version}/ChangeLog";
159-
license = lib.licenses.gpl3Only;
160-
mainProgram = "click";
161-
maintainers = with lib.maintainers; [
162-
ilyakooo0
163-
] ++ lib.teams.lomiri.members;
164-
platforms = lib.platforms.linux;
165-
pkgConfigModules = [
166-
"click-0.4"
102+
checkInputs = with python3Packages; [
103+
python-apt
104+
six
167105
];
106+
107+
preConfigure = ''
108+
export click_cv_perl_vendorlib=$out/${perl.libPrefix}
109+
export PYTHON_INSTALL_FLAGS="--prefix=$out"
110+
'';
111+
112+
configureFlags = [
113+
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
114+
"--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user"
115+
];
116+
117+
enableParallelBuilding = true;
118+
119+
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
120+
121+
disabledTestPaths = [
122+
# From apt: Unable to determine a suitable packaging system type
123+
"click_package/tests/integration/test_signatures.py"
124+
"click_package/tests/test_build.py"
125+
"click_package/tests/test_install.py"
126+
"click_package/tests/test_scripts.py"
127+
];
128+
129+
preCheck = ''
130+
export HOME=$TMP
131+
132+
# tests recompile some files for loaded predefines, doesn't use any optimisation level for it
133+
# makes test output harder to read, so make the warning go away
134+
export NIX_CFLAGS_COMPILE+=" -U_FORTIFY_SOURCE"
135+
136+
# Haven'tbeen able to get them excluded via disabledTest{s,Paths}, just deleting them
137+
for path in $disabledTestPaths; do
138+
rm -v $path
139+
done
140+
'';
141+
142+
preFixup = ''
143+
makeWrapperArgs+=(
144+
--prefix LD_LIBRARY_PATH : "$out/lib"
145+
)
146+
'';
147+
148+
passthru = {
149+
updateScript = gitUpdater { };
150+
};
151+
152+
meta = {
153+
description = "Tool to build click packages, mainly used for Ubuntu Touch";
154+
homepage = "https://gitlab.com/ubports/development/core/click";
155+
changelog = "https://gitlab.com/ubports/development/core/click/-/blob/${version}/ChangeLog";
156+
license = lib.licenses.gpl3Only;
157+
mainProgram = "click";
158+
maintainers = with lib.maintainers; [
159+
ilyakooo0
160+
] ++ lib.teams.lomiri.members;
161+
platforms = lib.platforms.linux;
162+
pkgConfigModules = [
163+
"click-0.4"
164+
];
165+
};
166+
};
167+
in
168+
self // {
169+
passthru = self.passthru // {
170+
tests.pkg-config = testers.hasPkgConfigModules {
171+
package = self;
172+
};
168173
};
169174
}

0 commit comments

Comments
 (0)