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

Fri Nov 7 22:41:04 UTC 2014
Pat Riehecky <riehecky at fnal.gov>

From: Pat Riehecky <riehecky at fnal.gov>

---
 return_disttag.sh |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/return_disttag.sh b/return_disttag.sh
index e846692..c92093a 100755
--- a/return_disttag.sh
+++ b/return_disttag.sh
@@ -122,37 +122,36 @@ 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)
-
-if [[ "${git_name}" != "${test_name}" ]]; then
-    warn "Warning: ${git_name} != ${test_name}"
+if [[ "${git_nvr}" != "${test_nvr}" ]]; then
+    warn "Warning: ${git_nvr} != ${test_nvr}"
     warn "Warning: Trying as a Software Collection"
-    testnvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist} ${git_name})
+    test_nodist=$(echo ${test_nvr} | sed -e 's/-[a-zA-Z0-9\.]*$//')
+    git_nodist=$(echo ${git_nvr} | sed -e 's/-[a-zA-Z0-9\.]*$//')
+    scl=$(echo ${git_nodist} |sed -e "s/-${test_nodist}//")
+    test_nvr=$(build_with_dist_scl "SPECS/${SPEC}" ${mydist} ${scl})
 fi
 
-test_name=$(echo ${testnvr} | cut -d '-' -f 1)
+git_name=$(echo ${git_nvr} | cut -d '-' -f 1)
+test_name=$(echo ${test_nvr} | cut -d '-' -f 1)
 if [[ "${git_name}" != "${test_name}" ]]; then
     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