mirror of
https://git.freebsd.org/ports.git
synced 2025-04-29 18:16:48 -04:00
Tools/scripts: Improve update-rust-port.sh
* use strict shell mode * check dependencies * update PORTREVISION Suggested by: mikael@ (use of portedit)
This commit is contained in:
parent
391873c7b9
commit
39a98a35c1
1 changed files with 20 additions and 2 deletions
|
@ -2,12 +2,25 @@
|
||||||
#
|
#
|
||||||
# MAINTAINER: yuri@FreeBSD.org
|
# MAINTAINER: yuri@FreeBSD.org
|
||||||
|
|
||||||
|
# CAVEAT: ports with Makefile.crates are not yet supported
|
||||||
|
|
||||||
## args
|
## args
|
||||||
|
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
|
|
||||||
|
## set strict mode
|
||||||
|
|
||||||
|
STRICT="set -euo pipefail"
|
||||||
|
$STRICT
|
||||||
|
|
||||||
## checks
|
## checks
|
||||||
|
|
||||||
|
for dep in portedit rustc; do
|
||||||
|
if ! which -s $dep; then
|
||||||
|
echo "error: $dep dependency is missing, $0 requires lang/rust and ports-mgmt/portfmt to be installed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "Usage: $0 <new-version>"
|
echo "Usage: $0 <new-version>"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -22,8 +35,13 @@ fi
|
||||||
# copy Makefile
|
# copy Makefile
|
||||||
cp Makefile Makefile.new
|
cp Makefile Makefile.new
|
||||||
|
|
||||||
# substitute version
|
# substitute version tag PORTVERSION or DISTVERSION
|
||||||
sed -i '' -E "s/(VERSION=[\t ]*)[0-9.]+/\1${VERSION}/" Makefile.new
|
sed -i '' -E "s/^(PORT|DIST)(VERSION=[\t ]*)[0-9.-]+/\1\2${VERSION}/" Makefile.new
|
||||||
|
|
||||||
|
# reset PORTREVISION if present
|
||||||
|
if grep -q "PORTREVISION=" Makefile; then
|
||||||
|
echo PORTREVISION=0 | portedit merge -i Makefile.new
|
||||||
|
fi
|
||||||
|
|
||||||
# replace CARGO_CRATES with a placeholder
|
# replace CARGO_CRATES with a placeholder
|
||||||
/usr/bin/awk '
|
/usr/bin/awk '
|
||||||
|
|
Loading…
Add table
Reference in a new issue