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
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -270,6 +270,7 @@ pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt
|
||||||
# GNOME
|
# GNOME
|
||||||
/pkgs/desktops/gnome @jtojnar
|
/pkgs/desktops/gnome @jtojnar
|
||||||
/pkgs/desktops/gnome/extensions @piegamesde @jtojnar
|
/pkgs/desktops/gnome/extensions @piegamesde @jtojnar
|
||||||
|
/pkgs/build-support/make-hardcode-gsettings-patch @jtojnar
|
||||||
|
|
||||||
# Cinnamon
|
# Cinnamon
|
||||||
/pkgs/desktops/cinnamon @mkg20001
|
/pkgs/desktops/cinnamon @mkg20001
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
, substituteAll
|
, substituteAll
|
||||||
, _experimental-update-script-combinators
|
, _experimental-update-script-combinators
|
||||||
, glib
|
, glib
|
||||||
|
, makeHardcodeGsettingsPatch
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -64,9 +65,9 @@ stdenv.mkDerivation rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch {
|
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
|
||||||
inherit src;
|
inherit src;
|
||||||
glib-schema-to-var = {
|
schemaIdToVariableMapping = {
|
||||||
"org.gnome.evolution.mail" = "evo";
|
"org.gnome.evolution.mail" = "evo";
|
||||||
"org.gnome.evolution.calendar" = "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
|
, boost
|
||||||
, protobuf
|
, protobuf
|
||||||
, libiconv
|
, libiconv
|
||||||
|
, makeHardcodeGsettingsPatch
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -150,8 +151,8 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch {
|
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
|
||||||
glib-schema-to-var = {
|
schemaIdToVariableMapping = {
|
||||||
"org.gnome.Evolution.DefaultSources" = "EDS";
|
"org.gnome.Evolution.DefaultSources" = "EDS";
|
||||||
"org.gnome.evolution.shell.network-config" = "EDS";
|
"org.gnome.evolution.shell.network-config" = "EDS";
|
||||||
"org.gnome.evolution-data-server.addressbook" = "EDS";
|
"org.gnome.evolution-data-server.addressbook" = "EDS";
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
, coreutils, dbus, libxml2, tzdata
|
, coreutils, dbus, libxml2, tzdata
|
||||||
, desktop-file-utils, shared-mime-info
|
, desktop-file-utils, shared-mime-info
|
||||||
, darwin
|
, darwin
|
||||||
# update script
|
, makeHardcodeGsettingsPatch
|
||||||
, runCommand, git, coccinelle
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert stdenv.isLinux -> util-linuxMinimal != null;
|
assert stdenv.isLinux -> util-linuxMinimal != null;
|
||||||
|
@ -271,55 +270,18 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
packageName = "glib";
|
packageName = "glib";
|
||||||
versionPolicy = "odd-unstable";
|
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 =
|
mkHardcodeGsettingsPatch =
|
||||||
let
|
{
|
||||||
updateSource = ...;
|
src,
|
||||||
patch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
|
glib-schema-to-var,
|
||||||
in
|
}:
|
||||||
_experimental-update-script-combinators.sequence [
|
builtins.trace
|
||||||
updateSource
|
"glib.mkHardcodeGsettingsPatch is deprecated, please use makeHardcodeGsettingsPatch instead"
|
||||||
patch
|
(makeHardcodeGsettingsPatch {
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
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"
|
|
||||||
{
|
|
||||||
inherit src;
|
inherit src;
|
||||||
nativeBuildInputs = [
|
schemaIdToVariableMapping = glib-schema-to-var;
|
||||||
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"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
|
@ -1085,6 +1085,8 @@ with pkgs;
|
||||||
{ deps = [ lcov enableGCOVInstrumentation ]; }
|
{ deps = [ lcov enableGCOVInstrumentation ]; }
|
||||||
../build-support/setup-hooks/make-coverage-analysis-report.sh;
|
../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'
|
# intended to be used like nix-build -E 'with import <nixpkgs> {}; enableDebugging fooPackage'
|
||||||
enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
|
enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue