From 50e1f72c6f4a13d19fa70b897e08324112f7adb3 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 26 Aug 2013 10:09:35 -0700 Subject: [PATCH] Use "sort -V" for tags when building docs The docs script changes its behavior when running on the "latest release tag" -- it prepares to publish the docs at the primary location, rather than in a subdirectory. It used "sort -n", or a numeric sort, of all tags to determine whether the current tag was the latest. This would fail to sort "0.11.0" after "0.9.0". This changes the script to use a version number sort which recognizes that difference. As for comptability with other version number formats: it is compatible with year.date formats (though the script ignores those for client libraries). And versions with letters in them (ie, pre-release versions) are already filtered out (a pre-release can never be the latest released tag). Change-Id: I6bba9bbc97b8c8e635d1b88835129113485baf21 --- modules/jenkins/files/slave_scripts/run-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/jenkins/files/slave_scripts/run-docs.sh b/modules/jenkins/files/slave_scripts/run-docs.sh index a3e6fc5ad2..4150374ac5 100755 --- a/modules/jenkins/files/slave_scripts/run-docs.sh +++ b/modules/jenkins/files/slave_scripts/run-docs.sh @@ -41,11 +41,11 @@ elif `echo $ZUUL_REFNAME | grep refs/tags/ >/dev/null` ; then if echo $ZUUL_PROJECT | grep 'python-.*client' ; then # This is a hack to ignore the year.release tags in python-*client # projects. - LATEST=`git tag | sed -n -e '/^2012\..*$/d' -e '/^\([0-9]\+\.\?\)\+$/p' | sort -n | tail -1` + LATEST=`git tag | sed -n -e '/^2012\..*$/d' -e '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1` else # Take all tags of the form (number.)+, sort them, then take the # largest - LATEST=`git tag | sed -n '/^\([0-9]\+\.\?\)\+$/p' | sort -n | tail -1` + LATEST=`git tag | sed -n '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1` fi if [ "$TAG" = "$LATEST" ] ; then # Copy the docs into a subdir if this is a tagged build