[CentOS-devel] [PATCH] Updated for compat with devtoolset-3 software collection name

Mon Nov 10 14:43:23 UTC 2014
Pat Riehecky <riehecky at fnal.gov>

From: Pat Riehecky <riehecky at fnal.gov>

---
 return_disttag.sh |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/return_disttag.sh b/return_disttag.sh
index e846692..2c1e522 100755
--- a/return_disttag.sh
+++ b/return_disttag.sh
@@ -122,37 +122,38 @@ SPEC=$(cd SPECS; ls *.spec)
 
 #now get nvr from spec with placeholder dist
 mydist="XXXjsdf9ur7qlkasdh4gygXXX"
-testnvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist})
+test_nvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist})
 
-git_name=$(echo ${git_nvr} | cut -d '-' -f 1)
-test_name=$(echo ${testnvr} | cut -d '-' -f 1)
+test_nodist=$(echo ${test_nvr} | sed -e 's/-[a-zA-Z0-9\.]*$//')
+git_nodist=$(echo ${git_nvr} | sed -e 's/-[a-zA-Z0-9\._]*$//')
 
-if [[ "${git_name}" != "${test_name}" ]]; then
-    warn "Warning: ${git_name} != ${test_name}"
+if [[ "${git_nodist}" != "${test_nodist}" ]]; then
+    warn "Warning: ${git_nvr} != ${test_nvr}"
     warn "Warning: Trying as a Software Collection"
-    testnvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist} ${git_name})
+    scl=$(echo ${git_nodist} |sed -e "s/-${test_nodist}//")
+    test_nvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist} ${scl})
+    test_nodist=$(echo ${test_nvr} | sed -e 's/-[a-zA-Z0-9\.]*$//')
 fi
 
-test_name=$(echo ${testnvr} | cut -d '-' -f 1)
-if [[ "${git_name}" != "${test_name}" ]]; then
+if [[ "${git_nodist}" != "${test_nodist}" ]]; then
+    git_name=$(echo ${git_nvr} | cut -d '-' -f 1)
+    test_name=$(echo ${test_nvr} | cut -d '-' -f 1)
     warn "Warning: ${git_name} != ${test_name}"
     echo "Warning: Couldn't match srpm name" >&2
     exit 1
-else
-    scl=${git_name}
 fi
 
 #use our placeholder dist to split the nvr
-head=${testnvr%$mydist*}
+head=${test_nvr%$mydist*}
 
-if [ ".$head" = ".$testnvr" ]
+if [ ".$head" = ".$test_nvr" ]
 then
     #no dist tag
     echo ""
     exit
 fi
 
-tail=${testnvr#*$mydist}
+tail=${test_nvr#*$mydist}
 
 frag=${git_nvr#$head}
 dist=${frag%$tail}
-- 
1.7.1