ab01b57914
The canonical spec file is now upstream since: https://github.com/projectatomic/rpm-ostree/pull/1900 Add a script to make it trivial to import the spec file here and merge the changelog. There's a `--keep-v-r` flag one can use to keep the Version and Release tags of the existing spec file to deal with e.g. git snapshots (though ideally continuous builds will eventually be handled automatically).
55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
KEEP_V_R=
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-h | --help)
|
|
echo "Usage: $0 [--keep-v-r]" >&2
|
|
exit 0
|
|
;;
|
|
--keep-v-r)
|
|
KEEP_V_R=1
|
|
;;
|
|
*)
|
|
echo "$0: unrecognized option: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
main() {
|
|
local upstream
|
|
upstream=$(get_parsed_spec_field URL)
|
|
curl -Lo rpm-ostree.spec.new "$upstream/raw/master/packaging/rpm-ostree.spec.in"
|
|
sed -ne '/%changelog/,$ p' rpm-ostree.spec >> rpm-ostree.spec.new
|
|
|
|
if [ -n "${KEEP_V_R}" ]; then
|
|
local version release
|
|
version=$(get_raw_spec_field Version)
|
|
release=$(get_raw_spec_field Release)
|
|
|
|
sed -ie "s/^Version:.*/Version: $version/" rpm-ostree.spec.new
|
|
sed -ie "s/^Release:.*/Release: $release/" rpm-ostree.spec.new
|
|
fi
|
|
|
|
if git diff --quiet --exit-code rpm-ostree.spec; then
|
|
mv rpm-ostree.spec.new rpm-ostree.spec
|
|
echo "Updated rpm-ostree.spec" >&2
|
|
else
|
|
echo "Refusing to overwrite dirty rpm-ostree.spec" >&2
|
|
echo "Updated rpm-ostree.spec.new" >&2
|
|
fi
|
|
}
|
|
|
|
get_parsed_spec_field() {
|
|
rpmspec -P rpm-ostree.spec | grep "^${1}: " | head -n1 | cut -d ' ' -f 2
|
|
}
|
|
|
|
get_raw_spec_field() {
|
|
grep "^${1}: " rpm-ostree.spec | head -n1 | cut -d ' ' -f 2
|
|
}
|
|
|
|
main "$@"
|