import-upstream (949B)
1 #!/bin/sh 2 # Refresh the checked-in source manifest. 3 set -eu 4 5 if [ "$#" -ne 1 ]; then 6 printf 'usage: %s upstream-git-ref\n' "$0" >&2 7 exit 1 8 fi 9 10 cd "$(dirname "$0")/.." 11 ref=$1 12 tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/eiwd-import.XXXXXXXX") 13 trap 'rm -f "$tmpdir/Makefile.am" "$tmpdir/configure.ac" "$tmpdir/sources.mk"; rmdir "$tmpdir"' 0 14 trap 'exit 1' HUP INT TERM 15 16 git show "$ref:Makefile.am" > "$tmpdir/Makefile.am" 17 git show "$ref:configure.ac" > "$tmpdir/configure.ac" 18 version=$(sed -n 's/^AC_INIT(\[iwd\],\[\([^]]*\)\]).*/\1/p' "$tmpdir/configure.ac") 19 if [ -z "$version" ]; then 20 printf 'cannot read iwd version from %s\n' "$ref" >&2 21 exit 1 22 fi 23 24 awk -v version="$version" -f scripts/import-sources.awk \ 25 "$tmpdir/Makefile.am" > "$tmpdir/sources.mk" 26 if ! cmp -s "$tmpdir/sources.mk" mk/sources.mk; then 27 mv "$tmpdir/sources.mk" mk/sources.mk 28 fi 29 printf 'Imported iwd %s source lists from %s; review mk/sources.mk before building.\n' "$version" "$ref"