File: fix-spec

package info (click to toggle)
cockpit 355-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,568 kB
  • sloc: javascript: 774,787; python: 40,655; ansic: 35,157; cpp: 11,141; sh: 3,512; makefile: 580; xml: 261
file content (13 lines) | stat: -rwxr-xr-x 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# patch given spec file to have the correct version and declare bundled NPM dependencies
# Usage: fix-spec <spec-file> <version>
set -eu

spec="$1"
version="$2"

ROOT_DIR=$(realpath "$(dirname "$0")/..")

PROVIDES=$(awk '{print "Provides: bundled(npm(" $1 ")) = " $2}' "${ROOT_DIR}/runtime-npm-modules.txt")
awk -v p="$PROVIDES" '/Version/ { gsub(/0/, "'$version'") }; gsub(/#NPM_PROVIDES/, p) 1' "$spec" > "$spec".new
mv -f "$spec".new "$spec"