about summary refs log tree commit diff
path: root/pkgs/build-support/plugins.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-06-14 11:29:31 +0200
committerJoachim Schiele <js@lastlog.de>2017-06-14 11:29:31 +0200
commit79dd4deda5a5ee44359a88cdcbbc22a15ba26224 (patch)
tree270e42ec5d33fa623f92e352fe9025d14e269bca /pkgs/build-support/plugins.nix
parentf6fbbabcb70a19428a7adde2e4f1ec477c439654 (diff)
Ultrastar (#26524)
* ultrastardx-beta: init at 1.3.5

* libbass, libbass_fx: init at 24

* ultrastar-creator: init at 2017-04-12

* buildSupport/plugins.nix: add diffPlugins

Helper function to compare expected plugin lists to the found plugins.

* ultrastar-manager: init at 2017-05-24

The plugins are built in their own derivations, speeding up (re-)compilation.
The `diffPlugins` function from `beets` is reused to test for changes in the
plugin list on updates.

* beets: switch to diffPlugins

The function is basically just extracted for better reusability.
Diffstat (limited to 'pkgs/build-support/plugins.nix')
-rw-r--r--pkgs/build-support/plugins.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/build-support/plugins.nix b/pkgs/build-support/plugins.nix
new file mode 100644
index 0000000000000..bf8a982a88f94
--- /dev/null
+++ b/pkgs/build-support/plugins.nix
@@ -0,0 +1,29 @@
+{ stdenv }:
+# helper functions for packaging programs with plugin systems
+{
+
+  /* Takes a list of expected plugin names
+   * and compares it to the found plugins given in the file,
+   * one plugin per line.
+   * If the lists differ, the build fails with a nice message.
+   *
+   * This is helpful to ensure maintainers don’t miss
+   * the addition or removal of a plugin.
+   */
+  diffPlugins = expectedPlugins: foundPluginsFilePath: ''
+     # sort both lists first
+     plugins_expected=$(mktemp)
+     (${stdenv.lib.concatMapStrings (s: "echo \"${s}\";") expectedPlugins}) \
+       | sort -u > "$plugins_expected"
+     plugins_found=$(mktemp)
+     sort -u "${foundPluginsFilePath}" > "$plugins_found"
+
+     if ! mismatches="$(diff -y "$plugins_expected" "$plugins_found")"; then
+       echo "The the list of expected plugins (left side) doesn't match" \
+           "the list of plugins we found (right side):" >&2
+       echo "$mismatches" >&2
+       exit 1
+     fi
+   '';
+
+}