mirror of
https://git.centos.org/centos-git-common.git
synced 2025-02-23 08:12:56 +00:00
update logic for SCLs
This commit is contained in:
parent
e9e1669c14
commit
3a0ccf9afb
2 changed files with 45 additions and 33 deletions
51
into_srpm.sh
51
into_srpm.sh
|
@ -174,26 +174,6 @@ fi
|
||||||
|
|
||||||
SPECFILE=$(cd SPECS; ls *.spec)
|
SPECFILE=$(cd SPECS; ls *.spec)
|
||||||
|
|
||||||
# Determine if we are an SCL
|
|
||||||
ISSCL=0
|
|
||||||
if [[ ${ALLOWSCL} -eq 1 ]]; then
|
|
||||||
mytestsclname='DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'
|
|
||||||
mysclcheck=$(rpm --define "dist el" --define "scl ${mytestsclname}" -q --specfile "SPECS/${SPECFILE}" --qf '%{n}-%{v}-%{r}\n' 2>/dev/null | head -n 1)
|
|
||||||
echo ${mysclcheck} | grep -q ${mytestsclname}
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
ISSCL=1
|
|
||||||
SCLNAME=$(show_possible_srpms.sh | cut -d'-' -f1 | sort -u)
|
|
||||||
if [[ $(echo ${SCLNAME} | wc -l) -ne 1 ]]; then
|
|
||||||
echo "$0 failed to determine unique SCL name" >&2
|
|
||||||
echo "Found:" >&2
|
|
||||||
echo "${SCLNAME}" >&2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# build our rpmopts list
|
|
||||||
RPMOPTS="-bs --nodeps"
|
|
||||||
|
|
||||||
# determine automatically unless we've got one set
|
# determine automatically unless we've got one set
|
||||||
if [[ "x${DIST}" == 'x' ]]; then
|
if [[ "x${DIST}" == 'x' ]]; then
|
||||||
if [[ ${QUIET} -eq 1 ]]; then
|
if [[ ${QUIET} -eq 1 ]]; then
|
||||||
|
@ -203,6 +183,37 @@ if [[ "x${DIST}" == 'x' ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Determine if we are an SCL
|
||||||
|
ISSCL=0
|
||||||
|
if [[ ${ALLOWSCL} -eq 1 ]]; then
|
||||||
|
mytestsclname='DA39A3EE5E6B4B0D3255BFEF95601890AFD80709'
|
||||||
|
mysclcheck=$(rpm --define "dist ${DIST}" --define "scl ${mytestsclname}" -q --specfile "SPECS/${SPECFILE}" --qf '%{n}-%{v}-%{r}\n' 2>/dev/null | head -n 1)
|
||||||
|
echo ${mysclcheck} | grep -q ${mytestsclname}
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
ISSCL=1
|
||||||
|
BASENAME=$(echo ${mysclcheck} | sed -e 's/DA39A3EE5E6B4B0D3255BFEF95601890AFD80709//')
|
||||||
|
RPMNAME=$(show_possible_srpms.sh | head -1)
|
||||||
|
SCLNAME=$(echo ${RPMNAME} | sed -e "s/${BASENAME}.src.rpm//")
|
||||||
|
if [[ $(echo ${SCLNAME} | wc -l) -ne 1 ]]; then
|
||||||
|
echo "$0 failed to determine unique SCL name" >&2
|
||||||
|
echo "Found:" >&2
|
||||||
|
echo "${SCLNAME}" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
scl_check=$(rpm --define "dist ${DIST}" --define "scl ${SCLNAME}" -q --specfile "SPECS/${SPECFILE}" --qf '%{n}-%{v}-%{r}.src.rpm\n' 2>/dev/null | head -n 1)
|
||||||
|
if [[ "${RPMNAME}" != "${scl_check}" ]]; then
|
||||||
|
echo "$0 failed to verify SCL name" >&2
|
||||||
|
echo "Found:" >&2
|
||||||
|
echo "${SCLNAME}" >&2
|
||||||
|
echo "made: ${scl_check}" >&2
|
||||||
|
echo "expected: ${RPMNAME}" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# build our rpmopts list
|
||||||
|
RPMOPTS="-bs --nodeps"
|
||||||
|
|
||||||
# put it all together
|
# put it all together
|
||||||
if [[ ${ISSCL} -eq 1 ]]; then
|
if [[ ${ISSCL} -eq 1 ]]; then
|
||||||
rpmbuild --define "%_topdir `pwd`" ${RPMOPTS} --define "%dist ${DIST}" --define "%scl ${SCLNAME}" SPECS/${SPECFILE}
|
rpmbuild --define "%_topdir `pwd`" ${RPMOPTS} --define "%dist ${DIST}" --define "%scl ${SCLNAME}" SPECS/${SPECFILE}
|
||||||
|
|
|
@ -122,37 +122,38 @@ SPEC=$(cd SPECS; ls *.spec)
|
||||||
|
|
||||||
#now get nvr from spec with placeholder dist
|
#now get nvr from spec with placeholder dist
|
||||||
mydist="XXXjsdf9ur7qlkasdh4gygXXX"
|
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_nodist=$(echo ${test_nvr} | sed -e 's/-[a-zA-Z0-9\.]*$//')
|
||||||
test_name=$(echo ${testnvr} | cut -d '-' -f 1)
|
git_nodist=$(echo ${git_nvr} | sed -e 's/-[a-zA-Z0-9\._]*$//')
|
||||||
|
|
||||||
if [[ "${git_name}" != "${test_name}" ]]; then
|
if [[ "${git_nodist}" != "${test_nodist}" ]]; then
|
||||||
warn "Warning: ${git_name} != ${test_name}"
|
warn "Warning: ${git_nvr} != ${test_nvr}"
|
||||||
warn "Warning: Trying as a Software Collection"
|
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
|
fi
|
||||||
|
|
||||||
test_name=$(echo ${testnvr} | cut -d '-' -f 1)
|
if [[ "${git_nodist}" != "${test_nodist}" ]]; then
|
||||||
if [[ "${git_name}" != "${test_name}" ]]; 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}"
|
warn "Warning: ${git_name} != ${test_name}"
|
||||||
echo "Warning: Couldn't match srpm name" >&2
|
echo "Warning: Couldn't match srpm name" >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
scl=${git_name}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#use our placeholder dist to split the nvr
|
#use our placeholder dist to split the nvr
|
||||||
head=${testnvr%$mydist*}
|
head=${test_nvr%$mydist*}
|
||||||
|
|
||||||
if [ ".$head" = ".$testnvr" ]
|
if [ ".$head" = ".$test_nvr" ]
|
||||||
then
|
then
|
||||||
#no dist tag
|
#no dist tag
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tail=${testnvr#*$mydist}
|
tail=${test_nvr#*$mydist}
|
||||||
|
|
||||||
frag=${git_nvr#$head}
|
frag=${git_nvr#$head}
|
||||||
dist=${frag%$tail}
|
dist=${frag%$tail}
|
||||||
|
|
Loading…
Add table
Reference in a new issue