Created
April 16, 2025 09:04
-
-
Save liweinan/4258fb819ec205976bd8bf27eeb3264b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -x | |
| . ./functions.sh | |
| pwdir="$(dirname '$0')" | |
| ip='download.eng.bos.redhat.com' | |
| alias wget='wget -nc' | |
| # Stop the script if any errors occur. | |
| errhandler() | |
| { | |
| errcode=$? | |
| # wget returns 8 for not found | |
| if [[ ($errcode -eq 8) ]] ; then | |
| : | |
| elif [[ ($errcode -eq 4) ]] ; then | |
| # unable to resolve host address | |
| # this is for rhel and windows builds only | |
| # solaris platform has stable ip address | |
| prefix="wget: unable to resolve host address" | |
| host=`grep "${prefix}" wget.out` | |
| host=${host#${prefix}} | |
| host=`echo ${host} | tr -cd '[[:alnum:]]._-'` | |
| ip=`dig +short @127.0.0.1 -p 8053 ${host} | tail -1` | |
| download_packages | |
| else | |
| echo "LINE $1: command exited with status $errcode." | |
| exit $errcode | |
| fi | |
| } | |
| trap 'errhandler $LINENO' ERR | |
| # DON'T EDIT ME, IT'S AUTOMATED! | |
| my_sunrel_src='' | |
| my_sunrel_appserver='43.sun10' | |
| my_winrel_src='' | |
| my_winrel_appserver='43.win6' | |
| my_el6_ver='51.ep7.el6' | |
| my_el7_ver='51.ep7.el7' | |
| my_hibernate_ver='4.2.23' | |
| my_hibernate_rel='1.Final_redhat_1.1.ep6.el6' | |
| my_hibernate_zip='hibernate4-zip-4.2.23-1.Final_redhat_1.1.ep6.el6.noarch.rpm' | |
| my_tomcat_vault_ver='1.1.6' | |
| my_tomcat_vault_rel='1.Final_redhat_1.1.ep7.el7' | |
| # END OF AUTOMATION | |
| # RHEL Packages | |
| function download_packages { | |
| trap 'errhandler $LINENO' ERR | |
| el_zip="${pkg_name}-zip-${pkg_ver}-${pkg_rel}.${arch}.rpm" | |
| el_link="http://${ip}/brewroot/packages/${pkg_name}/${pkg_ver}/${pkg_rel}/${arch}/${el_zip}" | |
| wget $el_link 2> wget.out | |
| if [ -f "${el_zip}" ]; then | |
| rpm2cpio ${el_zip} | cpio -idv | |
| else | |
| el_link="http://${ip}/brewroot/vol/rhel-6/packages/${pkg_name}/${pkg_ver}/${pkg_rel}/${arch}/${el_zip}" | |
| wget $el_link 2> wget.out | |
| if [ -f "${el_zip}" ]; then | |
| rpm2cpio ${el_zip} | cpio -idv | |
| fi | |
| fi | |
| } | |
| # el7 | |
| pkg_archs=("ppc64" "x86_64") | |
| pkg_ver="${jws_ver}" | |
| pkg_rel="${my_el7_ver}" | |
| pkg_name="${el_pkg_name}" | |
| # first run is just to get ip | |
| arch=${pkg_archs[0]} | |
| download_packages # get host name | |
| download_packages # get cache server ip | |
| for arch in "${pkg_archs[@]}" | |
| do | |
| download_packages | |
| done | |
| # el6 | |
| pkg_archs=("i686" "x86_64" "ppc64") | |
| pkg_ver="${jws_ver}" | |
| pkg_rel="${my_el6_ver}" | |
| pkg_name="${el_pkg_name}" | |
| for arch in "${pkg_archs[@]}" | |
| do | |
| download_packages | |
| done | |
| # tomcat-vault | |
| arch="noarch" | |
| pkg_ver="${my_tomcat_vault_ver}" | |
| pkg_rel="${my_tomcat_vault_rel}" | |
| pkg_name="tomcat-vault" | |
| download_packages | |
| # Hibernate | |
| wget "http://${ip}/brewroot/packages/hibernate4/${my_hibernate_ver}/${my_hibernate_rel}/noarch/${my_hibernate_zip}" 2> wget.out | |
| rpm2cpio ${my_hibernate_zip} | cpio -idv | |
| mv -f ./usr/share/java/hibernate4-fordev/*.zip . | |
| # Windows Packages | |
| winrel_src=${my_winrel_src} | |
| winrel_src_zip="${win_pkg_name}-${jws_ver}-${winrel_src}.src.zip" | |
| winrel_src_link="http://${ip}/brewroot/packages/${win_pkg_name}/${jws_ver}/${winrel_src}/win/${winrel_src_zip}" | |
| wget $winrel_src_link 2> wget.out | |
| winrel_archs=("i686" "x86_64") | |
| winrel_components=("application-servers") | |
| winrel_appserver=${my_winrel_appserver} | |
| for component in "${winrel_components[@]}" | |
| do | |
| case "$component" in | |
| "application-servers" ) winrel_component_ver="${winrel_appserver}";; | |
| esac | |
| for arch in "${winrel_archs[@]}" | |
| do | |
| winrel_component_zip="${win_pkg_name}-${component}-${jws_ver}-${winrel_component_ver}.${arch}.zip" | |
| winrel_component_link="http://${ip}/brewroot/packages/${win_pkg_name}-${component}/${jws_ver}/${winrel_component_ver}/win/${winrel_component_zip}" | |
| wget $winrel_component_link 2> wget.out | |
| done | |
| done | |
| # Solaris Packages | |
| # FIXME: we don't have jws-src yet, the 'sunrel_src_link' may need to be adjusted after we have it. | |
| sunrel_src=${my_sunrel_src} | |
| sunrel_src_zip="${sun_pkg_name}-${jws_ver}-${sunrel_src}.src.zip" | |
| sunrel_src_link="${sunrel_link_base}-src/${jws_ver}/${sunrel_src}/src/${sunrel_src_zip}" | |
| wget $sunrel_src_link 2> wget.out | |
| sunrel_archs=("i386" "sparc64" "x86_64") | |
| sunrel_components=("application-servers") | |
| sunrel_appserver=${my_sunrel_appserver} | |
| for component in "${sunrel_components[@]}" | |
| do | |
| case "$component" in | |
| "application-servers" ) sunrel_component_ver="${sunrel_appserver}";; | |
| esac | |
| for arch in "${sunrel_archs[@]}" | |
| do | |
| sunrel_component_zip="jws-${component}-${jws_ver}-${sunrel_component_ver}.${arch}.zip" | |
| sunrel_component_link="${sunrel_link_base}-${component}/${jws_ver}/${sunrel_component_ver}/${arch}/${sunrel_component_zip}" | |
| wget $sunrel_component_link 2> wget.out | |
| done | |
| done | |
| # Cleanup | |
| if [ -d ./usr/share/java/tomcat-vault-fordev ]; then | |
| mv -f ./usr/share/java/tomcat-vault-fordev/*.zip . | |
| fi | |
| mv -f ./usr/share/java/jbossas-fordev/*.zip . |
Author
Author
download.sh:
#!/bin/sh
set -x
. ./functions.sh
pwdir="$(dirname '$0')"
ip='download.eng.bos.redhat.com'
alias wget='wget -nc'
# Stop the script if any errors occur.
errhandler()
{
errcode=$?
# wget returns 8 for not found
if [[ ($errcode -eq 8) ]] ; then
:
elif [[ ($errcode -eq 4) ]] ; then
# unable to resolve host address
# this is for rhel and windows builds only
# solaris platform has stable ip address
prefix="wget: unable to resolve host address"
host=`grep "${prefix}" wget.out`
host=${host#${prefix}}
host=`echo ${host} | tr -cd '[[:alnum:]]._-'`
ip=`dig +short @127.0.0.1 -p 8053 ${host} | tail -1`
download_packages
else
echo "LINE $1: command exited with status $errcode."
exit $errcode
fi
}
trap 'errhandler $LINENO' ERR
# DON'T EDIT ME, IT'S AUTOMATED!
my_sunrel_src=''
my_sunrel_appserver='43.sun10'
my_winrel_src=''
my_winrel_appserver='43.win6'
my_el6_ver='51.ep7.el6'
my_el7_ver='51.ep7.el7'
my_hibernate_ver='4.2.23'
my_hibernate_rel='1.Final_redhat_1.1.ep6.el6'
my_hibernate_zip='hibernate4-zip-4.2.23-1.Final_redhat_1.1.ep6.el6.noarch.rpm'
my_tomcat_vault_ver='1.1.6'
my_tomcat_vault_rel='1.Final_redhat_1.1.ep7.el7'
# END OF AUTOMATION
# RHEL Packages
function download_packages {
trap 'errhandler $LINENO' ERR
el_zip="${pkg_name}-zip-${pkg_ver}-${pkg_rel}.${arch}.rpm"
el_link="http://${ip}/brewroot/packages/${pkg_name}/${pkg_ver}/${pkg_rel}/${arch}/${el_zip}"
wget $el_link 2> wget.out
if [ -f "${el_zip}" ]; then
rpm2cpio ${el_zip} | cpio -idv
else
el_link="http://${ip}/brewroot/vol/rhel-6/packages/${pkg_name}/${pkg_ver}/${pkg_rel}/${arch}/${el_zip}"
wget $el_link 2> wget.out
if [ -f "${el_zip}" ]; then
rpm2cpio ${el_zip} | cpio -idv
fi
fi
}
# el7
pkg_archs=("ppc64" "x86_64")
pkg_ver="${jws_ver}"
pkg_rel="${my_el7_ver}"
pkg_name="${el_pkg_name}"
# first run is just to get ip
arch=${pkg_archs[0]}
download_packages # get host name
download_packages # get cache server ip
for arch in "${pkg_archs[@]}"
do
download_packages
done
# el6
pkg_archs=("i686" "x86_64" "ppc64")
pkg_ver="${jws_ver}"
pkg_rel="${my_el6_ver}"
pkg_name="${el_pkg_name}"
for arch in "${pkg_archs[@]}"
do
download_packages
done
# tomcat-vault
arch="noarch"
pkg_ver="${my_tomcat_vault_ver}"
pkg_rel="${my_tomcat_vault_rel}"
pkg_name="tomcat-vault"
download_packages
# Hibernate
wget "http://${ip}/brewroot/packages/hibernate4/${my_hibernate_ver}/${my_hibernate_rel}/noarch/${my_hibernate_zip}" 2> wget.out
rpm2cpio ${my_hibernate_zip} | cpio -idv
mv -f ./usr/share/java/hibernate4-fordev/*.zip .
# Windows Packages
winrel_src=${my_winrel_src}
winrel_src_zip="${win_pkg_name}-${jws_ver}-${winrel_src}.src.zip"
winrel_src_link="http://${ip}/brewroot/packages/${win_pkg_name}/${jws_ver}/${winrel_src}/win/${winrel_src_zip}"
wget $winrel_src_link 2> wget.out
winrel_archs=("i686" "x86_64")
winrel_components=("application-servers")
winrel_appserver=${my_winrel_appserver}
for component in "${winrel_components[@]}"
do
case "$component" in
"application-servers" ) winrel_component_ver="${winrel_appserver}";;
esac
for arch in "${winrel_archs[@]}"
do
winrel_component_zip="${win_pkg_name}-${component}-${jws_ver}-${winrel_component_ver}.${arch}.zip"
winrel_component_link="http://${ip}/brewroot/packages/${win_pkg_name}-${component}/${jws_ver}/${winrel_component_ver}/win/${winrel_component_zip}"
wget $winrel_component_link 2> wget.out
done
done
# Solaris Packages
# FIXME: we don't have jws-src yet, the 'sunrel_src_link' may need to be adjusted after we have it.
sunrel_src=${my_sunrel_src}
sunrel_src_zip="${sun_pkg_name}-${jws_ver}-${sunrel_src}.src.zip"
sunrel_src_link="${sunrel_link_base}-src/${jws_ver}/${sunrel_src}/src/${sunrel_src_zip}"
wget $sunrel_src_link 2> wget.out
sunrel_archs=("i386" "sparc64" "x86_64")
sunrel_components=("application-servers")
sunrel_appserver=${my_sunrel_appserver}
for component in "${sunrel_components[@]}"
do
case "$component" in
"application-servers" ) sunrel_component_ver="${sunrel_appserver}";;
esac
for arch in "${sunrel_archs[@]}"
do
sunrel_component_zip="jws-${component}-${jws_ver}-${sunrel_component_ver}.${arch}.zip"
sunrel_component_link="${sunrel_link_base}-${component}/${jws_ver}/${sunrel_component_ver}/${arch}/${sunrel_component_zip}"
wget $sunrel_component_link 2> wget.out
done
done
# Cleanup
if [ -d ./usr/share/java/tomcat-vault-fordev ]; then
mv -f ./usr/share/java/tomcat-vault-fordev/*.zip .
fi
mv -f ./usr/share/java/jbossas-fordev/*.zip .
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spec file:
%global version_major 3 %global version_minor 1 %global version_micro 0 %global version_release SP5_CR3 %global serial 79 %global meadalpha %{nil} %global meadrel %{nil} %global _binaries_in_noarch_packages_terminate_build 0 %define _jarsign_opts --nocopy --skip=%{_javadir}/jbossas-fordev %define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} %define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} %define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} %define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} #build with patch zip %bcond_without patch_zip %define jws_major %{version_major} %define jws_minor %{version_minor} %define jws_rev %{version_micro} %define jws_ver %{jws_major}.%{jws_minor}.%{jws_rev} %define subrel %{version_release} Summary: JBoss EWS content Name: jws-dist Version: %{jws_ver} Release: %{serial}.%{subrel}%{?dist} Epoch: 0 License: LGPL Group: Development URL: http://www.redhat.org/ Source0: download.sh Source1: functions.sh Source2: dnsmasq.conf Source3: patched_files Source4: appserver_readme.txt Source5: createzipinfo.sh Source10: jws-application-servers.sun10.i386.lst Source11: jws-application-servers.sun10.sparc64.lst Source12: jws-application-servers.sun10.x86_64.lst Source13: jws-application-servers.win6.i686.lst Source14: jws-application-servers.win6.x86_64.lst Source15: jws-application-servers.RHEL6.i386.lst Source16: jws-application-servers.RHEL6.ppc64.lst Source17: jws-application-servers.RHEL6.x86_64.lst Source18: jws-application-servers.RHEL7.ppc64.lst Source19: jws-application-servers.RHEL7.x86_64.lst Source20: tomcat7.embed.lst Source21: tomcat8.embed.lst Source22: tomcat.vault.lst BuildRequires: jpackage-utils BuildRequires: wget BuildRequires: dnsmasq BuildRequires: bind-utils BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch %description This package is a container for the JBoss EWS content %prep dnsmasq --conf-file=%{SOURCE2} %build install -m 755 %{SOURCE0} . install -m 755 %{SOURCE1} . install -m 755 %{SOURCE10} . install -m 755 %{SOURCE11} . install -m 755 %{SOURCE12} . install -m 755 %{SOURCE13} . install -m 755 %{SOURCE14} . install -m 755 %{SOURCE15} . install -m 755 %{SOURCE16} . install -m 755 %{SOURCE17} . install -m 755 %{SOURCE18} . install -m 755 %{SOURCE19} . install -m 755 %{SOURCE20} . install -m 755 %{SOURCE21} . install -m 755 %{SOURCE22} . cp %{_specdir}/jws-dist.spec . ./download.sh -i unzip -q hibernate*.zip bash %{SOURCE5} hibernate*.zip rm -f hibernate*.zip HIBERNATE_DIR=`find . hibernate* -maxdepth 0 -type d ! -path .` rm -rf $HIBERNATE_DIR/lib/optional/proxool rm -rf $HIBERNATE_DIR/lib/optional/infinispan rm -rf $HIBERNATE_DIR/lib/optional/ehcache rm -rf $HIBERNATE_DIR/lib/osgi zip -z -q -r hibernate-dist-%{jws_ver}-%{subrel}.zip $HIBERNATE_DIR < /tmp/.zipinfo rm -rf $HIBERNATE_DIR # tomcat-vault TOMCAT_VAULT_NAME=`ls -t -1 tomcat-vault*.zip | head -n 1` if [ -f "$TOMCAT_VAULT_NAME" ]; then mv $TOMCAT_VAULT_NAME tomcat-vault-%{jws_ver}-%{subrel}.zip fi %install rm -rf $RPM_BUILD_ROOT install -dm 755 $RPM_BUILD_ROOT/%{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} cp $RPM_BUILD_DIR/*.zip $RPM_BUILD_ROOT/%{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} %if %with patch_zip create_readme () { cat < %{SOURCE4} > jws-%{jws_major}.%{jws_minor}/README } rebundle () { unzip -q $1 bash %{SOURCE5} $1 rm $1 create_readme # create patch bundle zipname=$(basename $1) for conf_file in `find jws-%{jws_major}.%{jws_minor}/ -name "*.properties" -or -name "*.policy" -or -name "*.xml"` do mv $conf_file $conf_file.zipnew done # Update file list with new file names sed -i -e "s/\.properties/\.properties\.zipnew/" -e "s/\.xml/\.xml\.zipnew/" -e "s/\.policy/\.policy\.zipnew/" $2 zip -z -q -r -y -i@$2 ${zipname} jws-%{jws_major}.%{jws_minor} < /tmp/.zipinfo rm -rf jws-%{jws_major}.%{jws_minor} } # get the zip file name from 'patched_files' or '*.lst' filenames zip_name () { local p1=`echo $1 | cut -d'.' -f 1` local p2=`echo $1 | cut -d'.' -f 2` local p3=`echo $1 | cut -d'.' -f 3` # some of the file names possible here only have two '.'s if [ "$p3" == "lst" ]; then zip=$p1*$p2*.zip else zip=$p1*$p2*$p3*.zip fi } cp %{_sourcedir}/*.lst $RPM_BUILD_ROOT/%{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} pushd $RPM_BUILD_ROOT/%{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} for f in `ls *.lst` do if [[ ! $f == *"embed"* && ! $f == *"vault"* && -s $f ]]; then zip_name $f rebundle $zip $f fi done # tomcat-embed jars are from tomcat7 and tomcat8, and they have different # directory structures. So we have to treat them separately in one-off process. tc_vers=("7" "8") for tc_ver in "${tc_vers[@]}" do tc_embed_zip=`ls -1 tomcat${tc_ver}*embed*zip` unzip $tc_embed_zip bash %{SOURCE5} $tc_embed_zip tc_embed_dir=`ls -1d apache-tomcat-${tc_ver}*` rm $tc_embed_zip zip -z -q -r -y -i@tomcat${tc_ver}.embed.lst $tc_embed_zip $tc_embed_dir < /tmp/.zipinfo rm -rf $tc_embed_dir done # tomcat-vault also follows a different directory structure tc_vault_zip=`ls -1 tomcat-vault*zip` unzip $tc_vault_zip bash %{SOURCE5} $tc_vault_zip tc_vault_dir=`ls -1d tomcat-vault-* | grep -v zip$` rm $tc_vault_zip zip -z -q -r -y [email protected] $tc_vault_zip $tc_vault_dir < /tmp/.zipinfo rm -rf $tc_vault_dir rm *.lst popd %endif pushd $RPM_BUILD_ROOT/%{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} for i in `ls [^hibernate]*.zip` # not hibernate zip do mv $i `echo $i|sed "s/%{version}/%{version}-%{subrel}/"` done for i in `ls *.sun*.zip` do mv $i `echo $i|sed "s/[0-9]\+.sun/sun/g"` done for i in `ls *.win*.zip` do mv $i `echo $i|sed "s/[0-9]\+.win/win/"` done %if %with patch_zip # Now we should delete the not shipped packages while IFS='' read -r line || [[ -n "$line" ]]; do trimmed=`echo $line | tr -d '[:space:]'` if [ "${trimmed:0:1}" = "#" ] ; then file_to_be_deleted=`echo $trimmed | cut -d'#' -f2` zip_name $file_to_be_deleted for f in $zip ; do if [ -e "${f}" ] ; then rm $f fi done fi done < "%{SOURCE3}" %endif popd %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %dir %{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel} %{_javadir}/jbossas-fordev/JWS-%{version}-%{subrel}/* %changelog * Fri Aug 31 2018 Jean-Frederic Clere <[email protected]> - 3.1.0-78 - JWS_3.1.0.SP5_CR3 * Mon Aug 27 2018 Hui Wang <[email protected]> - 3.1.0-77 - JWS_3.1.0.SP5_CR2 * Thu Mar 29 2018 Coty Sutherland <[email protected]> - 3.1.0-63 - Building JWS_3.1.0.SP3_CR1 * Fri Mar 02 2018 Sokratis Zappis <[email protected]> - 3.1.0-61 - Building CR1 * Thu Mar 01 2018 Coty Sutherland <[email protected]> - 3.1.0-61 - Resolves: JWS-902 Differences in decompiled classes in various JAR files - Resolves: JWS-907 JWS SPs may overwrite configuration files * Thu Jan 18 2018 Sokratis Zappis <[email protected]> - 3.1.0-60 - Adding sparc for JWS_3.1.0.SP2.DR2 * Tue Jan 16 2018 Sokratis Zappis <[email protected]> - 3.1.0-58 - Fix for JWS-875 * Fri Nov 17 2017 Coty Sutherland <[email protected]> - 3.1.0-4 - Build for JWS_3.1.0.SP2.DR1 * Thu Aug 18 2016 Weinan <[email protected]> 3.1.0-3 - Add webconnector * Tue Aug 16 2016 Weinan <[email protected]> 3.1.0-2 - Improve the build process * Mon Aug 15 2016 Hui Wang <[email protected]> 3.1.0-1 - Update for JWS 3.1.x