mirror of
https://github.com/ryantm/nixpkgs-update.git
synced 2024-12-17 16:31:47 +03:00
check for attrpath version compatibility
protects against problems caused by #24
This commit is contained in:
parent
253052914f
commit
af13129cdd
38
check-attrpath-version.sh
Executable file
38
check-attrpath-version.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
ATTR_PATH=$1
|
||||
NEW_VERSION=$2
|
||||
|
||||
ATTR_VERSION_PART=$(echo "$ATTR_PATH" | sed -n 's/^[^0-9]*\([0-9_]*\)$/\1/p')
|
||||
|
||||
# If we don't find version numbers in the attr path, exit success.
|
||||
if [ -z "$ATTR_VERSION_PART" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check assuming version part has underscore separators
|
||||
ATTR_VERSION_PERIODS=$(echo "$ATTR_VERSION_PART" | sed -n 's/_/\./gp')
|
||||
|
||||
if [ -n "$ATTR_VERSION_PERIODS" ]
|
||||
then
|
||||
if [[ "$NEW_VERSION" == $ATTR_VERSION_PERIODS* ]]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check assuming version part is the prefix of the version with dots
|
||||
# removed. For example, 91 => "9.1"
|
||||
NO_PERIOD_NEW_VERSION=$(echo "$NEW_VERSION" | sed -n 's/\.//gp')
|
||||
|
||||
if [ -n "$NO_PERIOD_NEW_VERSION" ]
|
||||
then
|
||||
if [[ "$NO_PERIOD_NEW_VERSION" == $ATTR_VERSION_PART* ]]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
2
up.sh
2
up.sh
@ -133,6 +133,8 @@ then
|
||||
error_exit "Derivation contains buildPerlPackage."
|
||||
fi
|
||||
|
||||
$("$SCRIPT_DIR"/check-attrpath-version.sh "$ATTR_PATH" "$NEW_VERSION") || error_exit "$ATTR_PATH version not compatible with $NEW_VERSION"
|
||||
|
||||
# Make sure it hasn't been updated on master
|
||||
grep "$OLD_VERSION" "$DERIVATION_FILE" || error_exit "Old version not present in master derivation file."
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user