mirror of
https://github.com/ryantm/nixpkgs-update.git
synced 2025-01-05 19:15:59 +03:00
add tests for check-attrpath-version.sh and fix some bugs in it
This commit is contained in:
parent
f867437f7d
commit
05133143f0
15
check-attrpath-version-test.sh
Executable file
15
check-attrpath-version-test.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#set -euxo pipefail
|
||||||
|
|
||||||
|
./check-attrpath-version.sh "libgit2_0_25" "0.25.3"
|
||||||
|
|
||||||
|
./check-attrpath-version.sh "owncloud90" "9.0.3"
|
||||||
|
|
||||||
|
if ./check-attrpath-version.sh "owncloud90" "9.1.3"
|
||||||
|
then
|
||||||
|
echo "fail"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "All tests passed"
|
@ -4,7 +4,11 @@ set -euxo pipefail
|
|||||||
ATTR_PATH=$1
|
ATTR_PATH=$1
|
||||||
NEW_VERSION=$2
|
NEW_VERSION=$2
|
||||||
|
|
||||||
ATTR_VERSION_PART=$(echo "$ATTR_PATH" | sed -n 's/^[^0-9]*\([0-9_]*\)$/\1/p')
|
HAS_UNDERSCORES=$(echo "$ATTR_PATH" | grep "_")
|
||||||
|
|
||||||
|
if [ -n "$HAS_UNDERSCORES" ]
|
||||||
|
then
|
||||||
|
ATTR_VERSION_PART=$(echo "$ATTR_PATH" | sed -n 's/^[^_]*_\([0-9_]*\)$/\1/p')
|
||||||
|
|
||||||
# If we don't find version numbers in the attr path, exit success.
|
# If we don't find version numbers in the attr path, exit success.
|
||||||
if [ -z "$ATTR_VERSION_PART" ]
|
if [ -z "$ATTR_VERSION_PART" ]
|
||||||
@ -22,6 +26,14 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
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 is the prefix of the version with dots
|
# Check assuming version part is the prefix of the version with dots
|
||||||
# removed. For example, 91 => "9.1"
|
# removed. For example, 91 => "9.1"
|
||||||
@ -34,5 +46,6 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user