diff options
author | Elio Maldonado <emaldona@redhat.com> | 2013-09-27 14:14:01 -0700 |
---|---|---|
committer | Elio Maldonado <emaldona@redhat.com> | 2013-09-27 14:14:01 -0700 |
commit | c10a849100db72a667a417939cb2b073706cc689 (patch) | |
tree | 926ce82d24af3d19f4b0e3156df87377b856ae87 | |
parent | aa3beac07f1cbededa5910ff1b4f0f0a0401dad5 (diff) | |
download | nssmockbuilds4fedora-c10a849100db72a667a417939cb2b073706cc689.tar.gz nssmockbuilds4fedora-c10a849100db72a667a417939cb2b073706cc689.tar.xz nssmockbuilds4fedora-c10a849100db72a667a417939cb2b073706cc689.zip |
Various fixes
- replace varuious conditionals with if then else fi statements
- reorder the list of client packages to build
-rw-r--r-- | Makefile | 17 | ||||
-rwxr-xr-x | build-nss.py | 12 | ||||
-rw-r--r-- | build_all_nss_packages_inside_mock.sh | 40 | ||||
-rwxr-xr-x | build_functions.py | 2 | ||||
-rwxr-xr-x | build_nss.sh | 61 | ||||
-rwxr-xr-x | build_nss_inside_mock.sh | 28 | ||||
-rwxr-xr-x | build_nss_rawhide_i686.sh | 58 | ||||
-rwxr-xr-x | build_several_inside_mock.sh | 33 | ||||
-rwxr-xr-x | checkout-all-packages.sh | 47 | ||||
-rwxr-xr-x | prepare-all-srpms.sh | 47 |
10 files changed, 280 insertions, 65 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5700d37 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +all: use-defaults + +use-defaults: + (export dist=rawhide; export arch=i386; \ + export nss_pkgs="nspr nss-util nss-softokn nss"; \ + export clients="mod_nss mod_revocator curl libreswan xulrunner evolution-data-server"; \ + sh ./build_nss.sh) + +build-for-rawhide-i386: + (dist=rawhide arch=i386 \ + nss_pkgs="nspr nss-util nss-softokn nss" clients="" ./build_nss.sh) + +build-for-rawhide-x86_64: + (dist=rawhide arch=x86_64 \ + nss_pkgs="nspr nss-util nss-softokn nss" clients="" ./build_nss.sh) + + diff --git a/build-nss.py b/build-nss.py index b8b05ff..1eb0208 100755 --- a/build-nss.py +++ b/build-nss.py @@ -76,7 +76,7 @@ parser.add_argument('-sw', '--skipwget', parser.add_argument('-b', '--build', action='store', dest='nssPackageList', nargs='+', - default=['nspr', 'nss-util', 'nss-softokn', 'nss', 'curl', 'xulrunner' ], + default=['nspr', 'nss-util', 'nss-softokn', 'nss' ], help='specify a list of one of more builds to perform. ', choices=('nspr', 'nss-util', 'nss-softokn', 'nss')) @@ -84,7 +84,7 @@ parser.add_argument('-c', '--clients', action='store', dest='clientPackageList', nargs='+', default=[ 'xulrunner' ], help='specify a list of one of more builds to perform. ', - choices=('curl', 'evolution-data-server', 'mod_nss', 'mod_revocator', 'openswan', 'xulrunner')) + choices=('mod_nss', 'mod_revocator', 'curl', 'evolution-data-server', 'libreswan', 'xulrunner')) parser.add_argument('-m', '--mock_cfg', action="store", dest="mockCfgList", nargs='+', @@ -92,6 +92,10 @@ parser.add_argument('-m', '--mock_cfg', help='specify a list of one or more mock configs to use. [default = fedora-rawhide-i386", "fedora-rawhide-x86_64]', choices=("fedora-rawhide-i386", "fedora-rawhide-x86_64")) +parser.add_argument("-nc", "--no-clean", + action='store_true', dest="noClean", default= "True", + help="don't cleanup the buildroot first") + options = parser.parse_args() #if args.servername is None and not args.dry_run: @@ -132,6 +136,8 @@ print_debug("skipWget = %s " % options.skipWget) print_debug("nssPackageList = %s " % options.nssPackageList) print_debug("clientPackageList = %s " % options.clientPackageList) print_debug("mockCfgList = %s " % options.mockCfgList) +print_debug("noClean = %s " % options.noClean) + ####################################################### mockCfgList=[] for mock_cfg in options.mockCfgList: @@ -245,7 +251,7 @@ for mock_cfg in mockCfgList: skipCopy=True print "ERROR: skipCopy is %s (enabled) due to a failure of package %s on %s. The repo will NOT be created)" % (skipCopy, package, mock_cfg) #TODO Add the code here to copy the build logs over possibly only for the packages the failed? - + if options.skipCopy is True: message = "Subject: INFO: skipCopy was enabled from the commandline. Skipping copying to and/or creating the repo.\n\nThe build directory is %s." % (buildDir) print message diff --git a/build_all_nss_packages_inside_mock.sh b/build_all_nss_packages_inside_mock.sh new file mode 100644 index 0000000..839bb20 --- /dev/null +++ b/build_all_nss_packages_inside_mock.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Build a package inside mock + + +# Ignore these warnings +# Installing /builddir/build/RPMS +# error: not an rpm package +# error: /builddir/build/RPMS cannot be installed +cd /builddir/build/RPMS/ + +# build a client package and install all the produced rpm's +default="nss" +pkg=${pkg:-$default} + +# build and install the nss packages +rpmbuild --rebuild /tmp/${pkg}-*.src.rpm +cd /builddir/build/RPMS +all_rpms=`ls *.rpm` +new_rpms=() +# build up the array of the ones not installed yet +for file in $all_rpms; do + notInstalled=`rpm -q ${file} | grep "not installed"` + if [ -n "${notInstalled}" ]; then + new_rpms+=($file) + fi +done +# Must use force in incremental builds as sometines an older version is still +# installed and we end up with conflicts. In real life this shoudn't happen +# and neither have I seen this on koji builds. +rpm --force -ihv *.rpm + +# tLen=${#NAMESERVERS[@]} +#if [ ${#new_rpms[@]} -gt 0 ]; then +# rpm --force -ihv ${new_rpms[@]} +# echo "Force-installed: ${new_rpms[@]}"; +#else +# rpm --force -ihv *.rpm +# echo "Force-installed: ${all_rpms}"; +#fi + diff --git a/build_functions.py b/build_functions.py index 8cd1419..51a4184 100755 --- a/build_functions.py +++ b/build_functions.py @@ -340,7 +340,7 @@ def build_nss_pkgs( logFilePath = os.path.join(buildLogs, package + ".log") logFile = open(logFilePath, "w") status = 0 - for line in runProcess(['mock', '-v', '-r', mock_cfg, '--shell', 'build_nss.sh']): + for line in runProcess(['mock', '--no-clean --no-cleanup-after', '-v', '-r', mock_cfg, '--shell', 'build_nss.sh']): logFile.write(line,) print line, print "Build status = %s for %s " % (status, package) diff --git a/build_nss.sh b/build_nss.sh index aad12bb..6b4781f 100755 --- a/build_nss.sh +++ b/build_nss.sh @@ -9,13 +9,16 @@ # # This script is meant to be invoked by build_nss.py -dist=rawhide -DIST=${DIST:-$dist} -if [ $DIST = "rawhide" ]; then - DIST="19" +default_dist=rawhide +dist=${dist:-$default_dist} +default_arch=x86_64 +arch=${arch:-$default_arch} +#arch2=[ "${arch}" = "x86_64" ] && x86_64 || i386 +if [ "${arch}" = "x86_64" ]; then +arch2=x86_64 +else +arch2=i386 fi -arch=x86_64 -ARCH=${ARCH:-$arch} # prepare for build # initialize the mock environment and install @@ -23,36 +26,40 @@ ARCH=${ARCH:-$arch} mock -r fedora-${dist}-${arch} --init nss_pkgs="nspr nss-util nss-softokn nss" -NSS_PKGS=${NSS_PKGS:-$nss_pkgs} - -client_pkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator openswan xulrunner" -CLIENT_PKGS=${CLIENT_PKGS:-$client_pkgs} +nss_pkgs=${nss_pkgs:-$nss_pkgs} +# listed in rough order of importance and dependencies fisrt +all_clients="mod_nss mod_revocator curl evolution-data-server freeswan xulrunner crontabs crypto-utils " +clients=${clients:-$all_clients} workdir=`pwd` -for pkg in $NSS_PKGS; do - cd ${pkg} +for pkg in ${nss_pkgs}; do fedpkg srpm - mock -r fedora-${dist}-${arch} --installdeps ${pkg}-*.src.rpm - mock -r fedora-${dist}-${arch} --copyin ${pkg}-*.src.rpm /tmp - cd ${workdir} + mock -r fedora-${dist}-${arch2} --copyin ${pkg}/${pkg}-*.src.rpm /tmp done - -for pkg in $CLIENT_PKGS; do - cd ${pkg} +# repeat for client packages +for client in ${clients}; do fedpkg srpm - mock -r fedora-${dist}-${arch} --installdeps ${pkg}-*.src.rpm - mock -r fedora-${dist}-${arch} --copyin ${pkg}-*.src.rpm /tmp - cd ${workdir} + mock -r fedora-${dist}-${arch2} --copyin ${client}/${client}-*.src.rpm /tmp done - # copy the build script into mock mock -r fedora-${dist}-${arch} --copyin ./build_nss_inside_mock.sh /usr/bin -# create a mock shell and execute a build script thre -mock -r fedora-rawhide-x86_64 --shell NSS_PKGS=\"${NSS_PKGS}\" CLIENT_PKGS=\"${CLIENT_PKGS}\" build_nss_inside_mock.sh +# create a mock shell and execute a build script there package by package +# Previously built and installed packages upon which current one depends are kept +# in the buildroot with via the --no-clean and --no-cleanup-after options. +# This guarantees that all the srpm dependencies will be met. +for pkg in $nss_pkgs; do + mock -r fedora-${dist}-i386 --installdeps ${pkg}/${pkg}-*.src.rpm + mock -r fedora-${dist}-i386 --shell pkg=${pkg} --no-clean --no-cleanup-after build_nss_inside_mock.sh +done + +for client in $clients; do + mock -r fedora-${dist}-${arch2} --installdeps ${client}/${client}-*.src.rpm + mock -r fedora-${dist}-${arch2} --shell --no-clean --no-cleanup-after pkg=${client} build_nss_inside_mock.sh +done -#---------------------------------------------------------------------- -# Inside mock we will execute build_nss_inside_mock.sh -#------------------------------------------------------------------------- +#---------------------------------------------------------------------------------------- +# If needed for debugging we can shell into mock and build and install package by package +#---------------------------------------------------------------------------------------- diff --git a/build_nss_inside_mock.sh b/build_nss_inside_mock.sh index 3e2bed3..5d3c6b1 100755 --- a/build_nss_inside_mock.sh +++ b/build_nss_inside_mock.sh @@ -1,8 +1,6 @@ #!/bin/bash -# Build the nss package set and some nss clients inside mock +# Build package inside mock -#dist=19 -#arch=x86_64 # Ignore these warnings # Installing /builddir/build/RPMS @@ -10,24 +8,12 @@ # error: /builddir/build/RPMS cannot be installed cd /builddir/build/RPMS/ -# build and install the nss packages -nss_pkgs="nspr nss-util nss-softokn nss" -NSS_PKGS=${NSS_PKGS:-$nss_pkgs} - -client_pkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator openswan xulrunner" -CLIENT_PKGS=${CLIENT_PKGS:-$client_pkgs} +# build a client package and install all the produced rpm's +default="nss" +pkg=${pkg:-$default} # build and install the nss packages -for pkg in $NSS_PKGS; do - rpmbuild --rebuild /tmp/${pkg}-*.src.rpm - package=`rpm -qp /tmp/${pkg}-*.src.rpm` - notInstalled=`rpm -q $package | grep "not installed"` - if [ -n "${notInstalled}" ]; then - rpm -ihv /builddir/build/RPMS/${pkg}-* - fi -done -# build the client packages -for pkg in $CLIENT_PKGS; do - rpmbuild --rebuild /tmp/${pkg}-*.src.rpm -done +rpmbuild --rebuild /tmp/${pkg}-*.src.rpm +cd /builddir/build/RPMS +rpm --force -ihv *.rpm diff --git a/build_nss_rawhide_i686.sh b/build_nss_rawhide_i686.sh new file mode 100755 index 0000000..116a5dc --- /dev/null +++ b/build_nss_rawhide_i686.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Build the nss package set and some nss clients inside mock +# +# 1. prepare for building: initialize the mock environment and +# install # packages we will need later when building nss +# 2. create a mock shell to build nss packages +# 3. build the nss related packages inside mock installing +# the newly built ones as we go along +# +# This script is meant to be invoked by build_nss.py + +default_dist=rawhide +dist=rawhide +arch=i686 +arch2=i386 + +# prepare for build +# initialize the mock environment and install +# packages we will need later when building nss +mock -r fedora-${dist}-${arch} --init + +nss_pkgs="nspr nss-util nss-softokn nss" +nss_pkgs=${nss_pkgs:-$nss_pkgs} + +all_clients="" +clients=${clients:-$all_clients} +workdir=`pwd` +for pkg in ${nss_pkgs}; do + fedpkg srpm + mock -r fedora-${dist}-${arch2} --copyin ${pkg}/${pkg}-*.src.rpm /tmp +done +# repeat for client packages +for client in ${clients}; do + fedpkg srpm + mock -r fedora-${dist}-${arch2} --copyin ${client}/${client}-*.src.rpm /tmp +done + +# copy the build script into mock +mock -r fedora-${dist}-${arch} --copyin ./build_nss_inside_mock.sh /usr/bin + +# create a mock shell and execute a build script there package by package +# Previously built and installed packages upon which current one depends are kept +# in the buildroot with via the --no-clean and --no-cleanup-after options. +# This guarantees that all the srpm dependencies will be met. +for pkg in $nss_pkgs; do + mock -r fedora-${dist}-i386 --installdeps ${pkg}/${pkg}-*.src.rpm + mock -r fedora-${dist}-i386 --shell pkg=${pkg} --no-clean --no-cleanup-after build_nss_inside_mock.sh +done + +for client in $clients; do + mock -r fedora-${dist}-${arch2} --installdeps ${client}/${client}-*.src.rpm + mock -r fedora-${dist}-${arch2} --shell --no-clean --no-cleanup-after pkg=${client} build_nss_inside_mock.sh +done + +#---------------------------------------------------------------------------------------- +# If needed for debugging we can shell into mock and build and install package by package +#---------------------------------------------------------------------------------------- + diff --git a/build_several_inside_mock.sh b/build_several_inside_mock.sh new file mode 100755 index 0000000..1b59373 --- /dev/null +++ b/build_several_inside_mock.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Build the nss package set and some nss clients inside mock + +dist=rawhide +arch=x86_64 + +# Ignore these warnings +# Installing /builddir/build/RPMS +# error: not an rpm package +# error: /builddir/build/RPMS cannot be installed +cd /builddir/build/RPMS/ + +# build and install the nss packages +nss_pkgs="nspr nss-util nss-softokn nss" +NSS_PKGS=${NSS_PKGS:-$nss_pkgs} + +client_pkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator freswan xulrunner" +CLIENT_PKGS=${CLIENT_PKGS:-$client_pkgs} + +# build and install the nss packages +for pkg in $NSS_PKGS; do + rpmbuild --rebuild /tmp/${pkg}-*.src.rpm + package=`rpm -qp /tmp/${pkg}-*.src.rpm` + notInstalled=`rpm -q $package | grep "not installed"` + if [ -n "${notInstalled}" ]; then + rpm -ihv /builddir/build/RPMS/${pkg}-* + fi +done +# build the client packages +#for pkg in $CLIENT_PKGS; do +# rpmbuild --rebuild /tmp/${pkg}-*.src.rpm +#done + diff --git a/checkout-all-packages.sh b/checkout-all-packages.sh new file mode 100755 index 0000000..f48c52a --- /dev/null +++ b/checkout-all-packages.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# checks out nspr, nss-util, nss-softokn, nss, and client pacakges +# creates their srpms and copies them where build-nss.py expects them +# Usage: prepare-all-srpms [-b branch], defaults to master +# +# TODO: Pass the package names as arguments + +checkout_pkgs() { + if [ -n "$2" ] ; then + OPT_BRANCH="--branch $2" + else + OPT_BRANCH="" + fi + for p in $1; do + fedpkg clone $p ${OPT_BRANCH} -a + done +} + +remove_pkgs() { + for p in $1; do + rm -fr $p + done +} + +#---------------------------------------------------------- +nssPkgs="nspr nss-util nss-softokn nss" +clientPkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator nss_compat_ossl libreswan xulrunner" + +# default +branch=master +while getopts b:s: opt +do + case $opt in + b) export branch="$OPTARG";; + ?) printf "Usage: %s: [-b branch]\n defaults to master" $0 + exit 2;; + esac +done + +echo "branch = ${branch}" + +remove_pkgs "${nssPkgs}" +remove_pkgs "${clientPkgs}" +checkout_pkgs "${nssPkgs}" "${branch}" +checkout_pkgs "${clientPkgs}" "${branch}" + diff --git a/prepare-all-srpms.sh b/prepare-all-srpms.sh index 73e9e3f..8c4abe4 100755 --- a/prepare-all-srpms.sh +++ b/prepare-all-srpms.sh @@ -6,10 +6,19 @@ # # TODO: Pass the package names as arguments -checkout_and_srpm_pkgs() { - OPTION_BRANCH = [ -n "$2" ] ? "--branch $2" : "" +remove_pkgs() { + for p in $1; do + rm -fr $p + done +} + +srpm_pkgs() { + if [ -n "$2" ]; then + export OPTION_BRANCH="--branch $2" + else + export OPTION_BRANCH="" + fi for p in $1; do - fedpkg clone $p ${OPTION_BRANCH} --anonymous pushd $p fedpkg srpm cp -p $p-*.src.rpm ../packages/SRPMS @@ -17,21 +26,32 @@ checkout_and_srpm_pkgs() { done } -remove_pkgs() { +checkout_and_srpm_pkgs() { + if [ -n "$2" ]; then + export OPTION_BRANCH="--branch $2" + else + export OPTION_BRANCH="" + fi for p in $1; do - rm -fr $p + fedpkg clone $p ${OPTION_BRANCH} --anonymous + pushd $p + fedpkg srpm + cp -p $p-*.src.rpm ../packages/SRPMS + popd done } #---------------------------------------------------------- nssPkgs="nspr nss-util nss-softokn nss" -clientPkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator nss_compat_ossl openswan xulrunner" +clientPkgs="crypto-utils curl evolution-data-server mod_nss mod_revocator nss_compat_ossl libreswan xulrunner" +# default +branch=master while getopts b:s: opt do case $opt in b) export branch="$OPTARG";; - ?) printf "Usage: %s: [-b branch]\n defauls to master" $0 + ?) printf "Usage: %s: [-b branch]\n defaults to master" $0 exit 2;; esac done @@ -41,11 +61,12 @@ echo "branch = ${branch}" if [ -e packages/SRPMS ]; then rm -rf packages/SRPMS fi -mkdir packages/SRPMS +mkdir -p packages/SRPMS -remove_pkgs "${nssPkgs}" -remove_pkgs "${clientPkgs}" -checkout_and_srpm_pkgs "${nssPkgs}" "${branch}" -checkout_and_srpm_pkgs "${clientPkgs}" "${branch}" -cd .. +#remove_pkgs "${nssPkgs}" +#remove_pkgs "${clientPkgs}" +#checkout_and_ +srpm_pkgs "${nssPkgs}" "${branch}" +#checkout_and_ +srpm_pkgs "${clientPkgs}" "${branch}" |