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.

+80 -53
+1
.github/CODEOWNERS
··· 270 270 # GNOME 271 271 /pkgs/desktops/gnome @jtojnar 272 272 /pkgs/desktops/gnome/extensions @piegamesde @jtojnar 273 + /pkgs/build-support/make-hardcode-gsettings-patch @jtojnar 273 274 274 275 # Cinnamon 275 276 /pkgs/desktops/cinnamon @mkg20001
+3 -2
pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix
··· 17 17 , substituteAll 18 18 , _experimental-update-script-combinators 19 19 , glib 20 + , makeHardcodeGsettingsPatch 20 21 }: 21 22 22 23 stdenv.mkDerivation rec { ··· 64 65 ]; 65 66 66 67 passthru = { 67 - hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 68 + hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 68 69 inherit src; 69 - glib-schema-to-var = { 70 + schemaIdToVariableMapping = { 70 71 "org.gnome.evolution.mail" = "evo"; 71 72 "org.gnome.evolution.calendar" = "evo"; 72 73 };
+60
pkgs/build-support/make-hardcode-gsettings-patch/default.nix
··· 1 + { 2 + runCommand, 3 + git, 4 + coccinelle, 5 + python3, 6 + }: 7 + 8 + /* 9 + Can be used as part of an update script to automatically create a patch 10 + hardcoding the path of all GSettings schemas in C code. 11 + For example: 12 + passthru = { 13 + hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 14 + inherit src; 15 + schemaIdToVariableMapping = { 16 + ... 17 + }; 18 + }; 19 + 20 + updateScript = 21 + let 22 + updateSource = ...; 23 + updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 24 + in 25 + _experimental-update-script-combinators.sequence [ 26 + updateSource 27 + updatePatch 28 + ]; 29 + }; 30 + } 31 + takes as input a mapping from schema path to variable name. 32 + For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` 33 + hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. 34 + All schemas must be listed. 35 + */ 36 + { 37 + src, 38 + schemaIdToVariableMapping, 39 + }: 40 + 41 + runCommand 42 + "hardcode-gsettings.patch" 43 + { 44 + inherit src; 45 + nativeBuildInputs = [ 46 + git 47 + coccinelle 48 + python3 # For patch script 49 + ]; 50 + } 51 + '' 52 + unpackPhase 53 + cd "''${sourceRoot:-.}" 54 + set -x 55 + cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON schemaIdToVariableMapping)} ./glib-schema-to-var.json 56 + git init 57 + git add -A 58 + spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place 59 + git diff > "$out" 60 + ''
+3 -2
pkgs/desktops/gnome/core/evolution-data-server/default.nix
··· 45 45 , boost 46 46 , protobuf 47 47 , libiconv 48 + , makeHardcodeGsettingsPatch 48 49 }: 49 50 50 51 stdenv.mkDerivation rec { ··· 150 151 ''; 151 152 152 153 passthru = { 153 - hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 154 - glib-schema-to-var = { 154 + hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 155 + schemaIdToVariableMapping = { 155 156 "org.gnome.Evolution.DefaultSources" = "EDS"; 156 157 "org.gnome.evolution.shell.network-config" = "EDS"; 157 158 "org.gnome.evolution-data-server.addressbook" = "EDS";
+11 -49
pkgs/development/libraries/glib/default.nix
··· 18 18 , coreutils, dbus, libxml2, tzdata 19 19 , desktop-file-utils, shared-mime-info 20 20 , darwin 21 - # update script 22 - , runCommand, git, coccinelle 21 + , makeHardcodeGsettingsPatch 23 22 }: 24 23 25 24 assert stdenv.isLinux -> util-linuxMinimal != null; ··· 271 270 packageName = "glib"; 272 271 versionPolicy = "odd-unstable"; 273 272 }; 274 - /* 275 - can be used as part of an update script to automatically create a patch 276 - hardcoding the path of all gsettings schemas in C code. 277 - For example: 278 - passthru = { 279 - hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 280 - inherit src; 281 - glib-schema-to-var = { 282 - ... 283 - }; 284 - }; 285 273 286 - updateScript = 287 - let 288 - updateSource = ...; 289 - patch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 290 - in 291 - _experimental-update-script-combinators.sequence [ 292 - updateSource 293 - patch 294 - ]; 295 - }; 296 - } 297 - takes as input a mapping from schema path to variable name. 298 - For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` 299 - hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. 300 - All schemas must be listed. 301 - */ 302 - mkHardcodeGsettingsPatch = { src, glib-schema-to-var }: 303 - runCommand 304 - "hardcode-gsettings.patch" 305 - { 274 + mkHardcodeGsettingsPatch = 275 + { 276 + src, 277 + glib-schema-to-var, 278 + }: 279 + builtins.trace 280 + "glib.mkHardcodeGsettingsPatch is deprecated, please use makeHardcodeGsettingsPatch instead" 281 + (makeHardcodeGsettingsPatch { 306 282 inherit src; 307 - nativeBuildInputs = [ 308 - git 309 - coccinelle 310 - python3 # For patch script 311 - ]; 312 - } 313 - '' 314 - unpackPhase 315 - cd "''${sourceRoot:-.}" 316 - set -x 317 - cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON glib-schema-to-var)} ./glib-schema-to-var.json 318 - git init 319 - git add -A 320 - spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place 321 - git diff > "$out" 322 - ''; 283 + schemaIdToVariableMapping = glib-schema-to-var; 284 + }); 323 285 }; 324 286 325 287 meta = with lib; {
pkgs/development/libraries/glib/hardcode-gsettings.cocci pkgs/build-support/make-hardcode-gsettings-patch/hardcode-gsettings.cocci
+2
pkgs/top-level/all-packages.nix
··· 1085 1085 { deps = [ lcov enableGCOVInstrumentation ]; } 1086 1086 ../build-support/setup-hooks/make-coverage-analysis-report.sh; 1087 1087 1088 + makeHardcodeGsettingsPatch = callPackage ../build-support/make-hardcode-gsettings-patch { }; 1089 + 1088 1090 # intended to be used like nix-build -E 'with import <nixpkgs> {}; enableDebugging fooPackage' 1089 1091 enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; }; 1090 1092