makeHardcodeGsettingsPatch: Rename from glib.mkHardcodeGsettingsPatch
glib expression is messy enough as is. Also rename the `glib-schema-to-var` argument to `schemaIdToVariableMapping` to better match Nixpkgs coding style.
This commit is contained in:
parent
04f574a1c0
commit
35d24b51f5
7 changed files with 80 additions and 53 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -270,6 +270,7 @@ pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt
|
|||
# GNOME
|
||||
/pkgs/desktops/gnome @jtojnar
|
||||
/pkgs/desktops/gnome/extensions @piegamesde @jtojnar
|
||||
/pkgs/build-support/make-hardcode-gsettings-patch @jtojnar
|
||||
|
||||
# Cinnamon
|
||||
/pkgs/desktops/cinnamon @mkg20001
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
, substituteAll
|
||||
, _experimental-update-script-combinators
|
||||
, glib
|
||||
, makeHardcodeGsettingsPatch
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -64,9 +65,9 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
passthru = {
|
||||
hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch {
|
||||
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
|
||||
inherit src;
|
||||
glib-schema-to-var = {
|
||||
schemaIdToVariableMapping = {
|
||||
"org.gnome.evolution.mail" = "evo";
|
||||
"org.gnome.evolution.calendar" = "evo";
|
||||
};
|
||||
|
|
60
pkgs/build-support/make-hardcode-gsettings-patch/default.nix
Normal file
60
pkgs/build-support/make-hardcode-gsettings-patch/default.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
runCommand,
|
||||
git,
|
||||
coccinelle,
|
||||
python3,
|
||||
}:
|
||||
|
||||
/*
|
||||
Can be used as part of an update script to automatically create a patch
|
||||
hardcoding the path of all GSettings schemas in C code.
|
||||
For example:
|
||||
passthru = {
|
||||
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
|
||||
inherit src;
|
||||
schemaIdToVariableMapping = {
|
||||
...
|
||||
};
|
||||
};
|
||||
|
||||
updateScript =
|
||||
let
|
||||
updateSource = ...;
|
||||
updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
|
||||
in
|
||||
_experimental-update-script-combinators.sequence [
|
||||
updateSource
|
||||
updatePatch
|
||||
];
|
||||
};
|
||||
}
|
||||
takes as input a mapping from schema path to variable name.
|
||||
For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }`
|
||||
hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`.
|
||||
All schemas must be listed.
|
||||
*/
|
||||
{
|
||||
src,
|
||||
schemaIdToVariableMapping,
|
||||
}:
|
||||
|
||||
runCommand
|
||||
"hardcode-gsettings.patch"
|
||||
{
|
||||
inherit src;
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
coccinelle
|
||||
python3 # For patch script
|
||||
];
|
||||
}
|
||||
''
|
||||
unpackPhase
|
||||
cd "''${sourceRoot:-.}"
|
||||
set -x
|
||||
cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON schemaIdToVariableMapping)} ./glib-schema-to-var.json
|
||||
git init
|
||||
git add -A
|
||||
spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place
|
||||
git diff > "$out"
|
||||
''
|
|
@ -45,6 +45,7 @@
|
|||
, boost
|
||||
, protobuf
|
||||
, libiconv
|
||||
, makeHardcodeGsettingsPatch
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -150,8 +151,8 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
passthru = {
|
||||
hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch {
|
||||
glib-schema-to-var = {
|
||||
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
|
||||
schemaIdToVariableMapping = {
|
||||
"org.gnome.Evolution.DefaultSources" = "EDS";
|
||||
"org.gnome.evolution.shell.network-config" = "EDS";
|
||||
"org.gnome.evolution-data-server.addressbook" = "EDS";
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
, coreutils, dbus, libxml2, tzdata
|
||||
, desktop-file-utils, shared-mime-info
|
||||
, darwin
|
||||
# update script
|
||||
, runCommand, git, coccinelle
|
||||
, makeHardcodeGsettingsPatch
|
||||
}:
|
||||
|
||||
assert stdenv.isLinux -> util-linuxMinimal != null;
|
||||
|
@ -271,55 +270,18 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
packageName = "glib";
|
||||
versionPolicy = "odd-unstable";
|
||||
};
|
||||
/*
|
||||
can be used as part of an update script to automatically create a patch
|
||||
hardcoding the path of all gsettings schemas in C code.
|
||||
For example:
|
||||
passthru = {
|
||||
hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch {
|
||||
inherit src;
|
||||
glib-schema-to-var = {
|
||||
...
|
||||
};
|
||||
};
|
||||
|
||||
updateScript =
|
||||
let
|
||||
updateSource = ...;
|
||||
patch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
|
||||
in
|
||||
_experimental-update-script-combinators.sequence [
|
||||
updateSource
|
||||
patch
|
||||
];
|
||||
};
|
||||
}
|
||||
takes as input a mapping from schema path to variable name.
|
||||
For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }`
|
||||
hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`.
|
||||
All schemas must be listed.
|
||||
*/
|
||||
mkHardcodeGsettingsPatch = { src, glib-schema-to-var }:
|
||||
runCommand
|
||||
"hardcode-gsettings.patch"
|
||||
{
|
||||
mkHardcodeGsettingsPatch =
|
||||
{
|
||||
src,
|
||||
glib-schema-to-var,
|
||||
}:
|
||||
builtins.trace
|
||||
"glib.mkHardcodeGsettingsPatch is deprecated, please use makeHardcodeGsettingsPatch instead"
|
||||
(makeHardcodeGsettingsPatch {
|
||||
inherit src;
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
coccinelle
|
||||
python3 # For patch script
|
||||
];
|
||||
}
|
||||
''
|
||||
unpackPhase
|
||||
cd "''${sourceRoot:-.}"
|
||||
set -x
|
||||
cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON glib-schema-to-var)} ./glib-schema-to-var.json
|
||||
git init
|
||||
git add -A
|
||||
spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place
|
||||
git diff > "$out"
|
||||
'';
|
||||
schemaIdToVariableMapping = glib-schema-to-var;
|
||||
});
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
|
|
@ -1085,6 +1085,8 @@ with pkgs;
|
|||
{ deps = [ lcov enableGCOVInstrumentation ]; }
|
||||
../build-support/setup-hooks/make-coverage-analysis-report.sh;
|
||||
|
||||
makeHardcodeGsettingsPatch = callPackage ../build-support/make-hardcode-gsettings-patch { };
|
||||
|
||||
# intended to be used like nix-build -E 'with import <nixpkgs> {}; enableDebugging fooPackage'
|
||||
enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue