]> piware.de Git - bin.git/commitdiff
Add mockspec: start mock session with build deps from given .spec file
authorMartin Pitt <martin@piware.de>
Wed, 11 Jan 2017 10:18:10 +0000 (11:18 +0100)
committerMartin Pitt <martin@piware.de>
Sun, 22 Jan 2017 11:18:55 +0000 (12:18 +0100)
mockspec [new file with mode: 0755]

diff --git a/mockspec b/mockspec
new file mode 100755 (executable)
index 0000000..5308a37
--- /dev/null
+++ b/mockspec
@@ -0,0 +1,7 @@
+#!/bin/sh
+# start mock session with build deps from given .spec file
+set -eu
+[ -d "$(mock --print-root-path)" ] ||  mock --init
+specfile="$1"
+shift
+mock -i $(sed -n '/^BuildRequires:/ {s/^.*: //; s/>=.*$//; p}' "$specfile") $@