File: fix-spec

package info (click to toggle)
cockpit 358-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 317,272 kB
  • sloc: javascript: 775,788; python: 41,626; ansic: 33,970; cpp: 11,141; sh: 3,566; makefile: 581; xml: 262
file content (18 lines) | stat: -rwxr-xr-x 505 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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" 'gsub(/#NPM_PROVIDES/, p) 1' "$spec" > "$spec".new

if [ -n "$version" ]; then
    sed -i '/Version/ s/0/'"$version"'/' "$spec".new
fi

mv -f "$spec".new "$spec"