diff options
Diffstat (limited to 'shell-scripts')
-rwxr-xr-x | shell-scripts/checkout-all-packages.sh | 41 | ||||
-rwxr-xr-x | shell-scripts/clean-all-packages.sh | 33 | ||||
-rwxr-xr-x | shell-scripts/install-clients-deps.sh | 31 | ||||
-rwxr-xr-x | shell-scripts/mock-build-inside.sh | 81 | ||||
-rwxr-xr-x | shell-scripts/mock-build-install-nss.sh | 47 | ||||
-rwxr-xr-x | shell-scripts/mock-build-prepare.sh | 105 | ||||
-rwxr-xr-x | shell-scripts/prepare-nss-clients.sh | 44 | ||||
-rwxr-xr-x | shell-scripts/top-script.sh | 87 |
8 files changed, 469 insertions, 0 deletions
diff --git a/shell-scripts/checkout-all-packages.sh b/shell-scripts/checkout-all-packages.sh new file mode 100755 index 0000000..73a70bf --- /dev/null +++ b/shell-scripts/checkout-all-packages.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# checks out nspr, nss-util, nss-softokn, and nss +# checks out also some clients of nss, xulrunner, etc. +# Usage: checkout-all-packages [-b branch], defaults to master +# +# TODO: Pass the package names as arguments + +checkout_pkgs() { + for p in $1; do + fedpkg clone $p + pushd $p + if [ -n "$2" ]; then + fedpkg switch-branch $2 + fi + popd + done +} + +#---------------------------------------------------------- +nssPkgs="nspr nss-util nss-softokn nss" +clientPkgs="crypto-utils curl xulrunner" + + +while getopts b: opt +do + case $opt in + b) export branch="$OPTARG";; + ?) printf "Usage: %s: [-b branch]\n defauls to master" $0 + exit 2;; + esac +done + +echo "branch = ${branch}" + +source ./clean-all-packages.sh + +checkout_pkgs "${nssPkgs}" "${branch}" +checkout_pkgs "${clientPkgs}" "${branch}" + + diff --git a/shell-scripts/clean-all-packages.sh b/shell-scripts/clean-all-packages.sh new file mode 100755 index 0000000..5a0be7b --- /dev/null +++ b/shell-scripts/clean-all-packages.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# check out nspr, nss-util, nss-softokn, and nss +# check out also some clients of nss + +remove_pkgs() { + for p in $1; do + rm -fr $p + done +} + +#---------------------------------------------------------- + +nssPkgs="nspr nss-util nss-softokn nss" +clientPkgs="crypto-utils curl xulrunner" + +# Defaults +TARGET=Rawhide + +while getopts i: opt +do + case $opt in + i) TARGET="$OPTARG";; + ?) printf "Usage: %s: [-i dist]\n" $0 + exit 2;; + esac +done + +export dist=${TARGET} + +remove_pkgs "${nssPkgs}" +remove_pkgs "${clientPkgs}" + diff --git a/shell-scripts/install-clients-deps.sh b/shell-scripts/install-clients-deps.sh new file mode 100755 index 0000000..5c31eb7 --- /dev/null +++ b/shell-scripts/install-clients-deps.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Defaults +TARGET=16 +ARCH=x86_64 + +while getopts i:j: opt +do + case $opt in + i) TARGET="$OPTARG";; + j) ARCH="$OPTARG";; + ?) printf "Usage: %s: [-i dist] [-j arch]\n" $0 + exit 2;; + esac +done + +export dist=${TARGET} +export arch=${ARCH} + +cc="crypto-utils curl xulrunner"; + +for c in $cc; do + pushd ${c} + fedpkg clean + fedpkg srpm + mock -r fedora-${dist}-${arch} --copyin ${c}-*.src.rpm /tmp + mock -r fedora-${dist}-${arch} --installdeps ${c}-*.src.rpm + popd +done + + diff --git a/shell-scripts/mock-build-inside.sh b/shell-scripts/mock-build-inside.sh new file mode 100755 index 0000000..8cadb37 --- /dev/null +++ b/shell-scripts/mock-build-inside.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# +# Rebase nss and nspr using mock to build nss and clients +# Using beta candidates +# +# --nspr=nspr-version +# --nss=nss-version +# --fedora=target +# --arch=arch or current + +export_tags() { +export nspr_v=${NSPR_V} +export nspr_r=${NSPR_R} +export nss_v=${NSS_V} +export nss_r=${NSS_R} +export nss_util_v=${NSS_UTIL_V} +export nss_util_r=${NSS_UTIL_R} +export nss_softokn_v=${NSS_SOFTOKN_V} +export nss_softokn_r=${NSS_SOFTOKN_R} +export target=${TARGET} +export dist=${DIST} +export arch=${ARCH} +export archalso=${ARCHALSO} +} + +#---------------------------------------------------------- +# Defaults to not building any package +# you must pass a {version,release} for it to be built +NSPR_V= +NSPR_R= +NSS_V= +NSS_R= +NSS_UTIL_V= +NSS_UTIL_R=1 +NSS_SOFTOKN_V= +NSS_SOFTOKN_R= +TARGET=16 +DIST=16 +ARCH=x86_64 +ARCHALSO=x86_64 + +while getopts :a:b:c:d:e:f:g:h:i:j: opt +do + case $opt in + a) NSPR_V="$OPTARG";; + b) NSPR_R="$OPTARG";; + c) NSS_V="$OPTARG";; + d) NSS_R="$OPTARG";; + e) NSS_UTIL_R="$OPTARG";; + f) NSS_UTIL_V="$OPTARG";; + g) NSS_SOFTOKN_R="$OPTARG";; + h) NSS_SOFTOKN_V="$OPTARG";; + i) TARGET="$OPTARG";; + j) ARCH="$OPTARG";; + ?) printf "Usage: %s: [-a nspr_version] [-b nspr_version] [-c nss_version] [-d nss_version] [-e dist] [-f arch]\n" $0 + exit 2;; + esac +done +if [ ${ARCH} eq "i386" ]; then + ARCHALSO="i686" +fi + +# set environment variables +export_tags + +# for ease of installing later +cd /builddir/build/RPMS/ + +# build and install the packages +nssPkgs="nspr nss-util nss_softokn nss" +for pkg in nssPkgs; do + ver=${pkg}_v + rel=${pkg}_r + if [ -n ${ver} ] && [ -n ${rel} ]; then + rpmbuild --rebuild /tmp/${pkg}-${ver}-${rel}.fc${target}.src.rpm + pm -ihv /builddir/build/RPMS/${pkg}-* + fi +done + + diff --git a/shell-scripts/mock-build-install-nss.sh b/shell-scripts/mock-build-install-nss.sh new file mode 100755 index 0000000..49d7bbb --- /dev/null +++ b/shell-scripts/mock-build-install-nss.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Installs nss in mock +# +export_tags() { +export nss_version=${NSS_V} +export nss_release=${NSS_R} +export target=${TARGET} +export dist=${DIST} +export arch=${ARCH} +export archalso=${ARCHALSO} +} + +# Defaults +NSS_V=3.12.9 +NSS_R=8 +TARGET=14 +DIST=rawhide +ARCH=x86_64 +ARCHALSO=x86_64 + +while getopts :c:d:i:j: opt +do + case $opt in + c) NSS_V="$OPTARG";; + d) NSS_R="$OPTARG";; + i) TARGET="$OPTARG";; + j) ARCH="$OPTARG";; + ?) printf "Usage: %s [-c nss_version] [-d nss_release] [-i dist] [-j arch]\n" $0 + exit 2;; + esac +done +if [ "${ARCH}" = "i386" ]; then + ARCHALSO="i686" +fi + +export_tags + +# install nss +rpm -Uhv \ +nss-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \ +nss-sysinit-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \ +nss-tools-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \ +nss-debuginfo-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \ +nss-devel-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \ +nss-pkcs11-devel-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm + diff --git a/shell-scripts/mock-build-prepare.sh b/shell-scripts/mock-build-prepare.sh new file mode 100755 index 0000000..d3b0d60 --- /dev/null +++ b/shell-scripts/mock-build-prepare.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# +# Rebase to nss and nspr using mock to build +# Using beta candidates +# + +export_tags() { +export nspr_v=${NSPR_V} +export nspr_r=${NSPR_R} +export nss_v=${NSS_V} +export nss_r=${NSS_R} +export nss_util_v=${NSS_UTIL_V} +export nss_util_r=${NSS_UTIL_R} +export nss_softokn_v=${NSS_SOFTOKN_V} +export nss_softokn_r=${NSS_SOFTOKN_R} +export target=${TARGET} +export dist=${DIST} +export arch=${ARCH} +export archalso=${ARCHALSO} +} + +#---------------------------------------------------------- + +# Defaults are mostly empty, so that package won't be built +# unless two values {version,release} are passed in +nspr_v= +nspr_r= +nss_v= +nss_r= +nss_util_v= +nss_util_r= +nss_softokn_v= +nss_softokn_r= + +target=16 +dist=f16 + +arch=x86_64 +archalso=x86_64 + +while getopts :a:b:c:d:e:f:g:h:i:j: opt +do + case $opt in + a) nspr_v="$OPTARG";; + b) nspr_r="$OPTARG";; + c) nss_v="$OPTARG";; + d) nss_r="$OPTARG";; + e) nss_util_v="$OPTARG";; + f) nss_util_r="$OPTARG";; + g) nss_softokn_v="$OPTARG";; + h) nss_softokn_r="$OPTARG";; + i) target="$OPTARG";; + j) arch="$OPTARG";; + ?) printf "Usage: %s [-a nspr_v] [-b nspr_r] [-c nss_version] [-d nss_r] [-e nss_util_v] [-f nss_util_r] [-g nss_softokn_v] [-h nss_softokn_r] [-i dist] [-j arch]\n" $0 + exit 2;; + esac +done + +if [ "${TARGET}" = "rawhide" ]; then + # change as we move along + TARGET = f17 + DIST="rawhide" +fi +if [ "${ARCH}" = "i386" ]; then + ARCHALSO="i686" +fi + +echo "nspr_v=${nspr_v}" +echo "nspr_r=${nspr_r}" +echo "nss_v=${nss_v}" +echo "nss_r=${nss_r}" +echo "nss_util_v=${nss_util_v}" +echo "nss_util_r=${nss_util_r}" +echo "nss_softokn_v=${nss_softokn_v}" +echo "nss_softokn_r=${nss_softokn_r}" +echo "target=${target}" +echo "dist=${dist}" +echo "arch=${arch}" +echo "archalso=${archalso}" + +# initialize the mock environment and install +# packages we will need later when building nss +mock -r fedora-${dist}-${arch} --init +mock -r fedora-${dist}-${arch} --install sqlite-devel zlib-devel pkgconfig gawk psmisc perl vim +mock -r fedora-${dist}-${arch} --install nspr-devel nss-util-devel nss-softokn-devel nss-devel + +nssPkgs="nspr nss-util nss_softokn nss" +for pkg in $nssPkgs; do + if [ -n ${pkg}_v} ] && [ -n ${pkg}_r ]; then + cd ${pkg}; fedpkg clean; fedpkg srpm + # mock -r fedora-${dist}-${arch} --installdeps ${pkg}-*.fc${target}.src.rpm + mock -r fedora-${dist}-${arch} --copyin ${pkg}-*.fc${target}.src.rpm /tmp + fi +done- + +# copy the build script into mock +mock -r fedora-${dist}-${arch} --copyin ./mock-build-inside.sh /usr/bin +mock -r fedora-${dist}-${arch} --copyin ./mock-build-install-nss.sh /usr/bin +mock -r fedora-${dist}-${arch} --copyin ./install-clients-deps.sh /usr/bin + +# create a mock shell +#mock -r fedora-${dist}-${arch} --shell +#exit +# mock-build-inside.sh -a ${nspr_v} -b ${nspr_r} -c ${nss_version} -d ${nss_r} -e ${dist} -f ${arch} diff --git a/shell-scripts/prepare-nss-clients.sh b/shell-scripts/prepare-nss-clients.sh new file mode 100755 index 0000000..02f5762 --- /dev/null +++ b/shell-scripts/prepare-nss-clients.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# + +# Defaults +TARGET=14 +ARCH=x86_64 + +#------------------------------------------------------------------------------ +# Testing: Having our new versions in the build root should not break +# the build of other packages that depend on nss. Two very important +# pacakges are curl and xulrunner. curl is a client of the PEM module +# and xulrunner is how Mozilla applications call nss. +# +# Install dependencies for those devel packages that depend on nss and +# verify that we don't break their builds. + +while getopts i:j: opt +do + case $opt in + i) TARGET="$OPTARG";; + j) ARCH="$OPTARG";; + ?) printf "Usage: %s: [-a nspr_version] [-b nspr_version] [-c nss_version] [-d nss_version] [-e dist] [-f arch]\n" $0 + exit 2;; + esac +done + +export dist=${TARGET} +export arch=${ARCH} + +cc="curl xulrunner" + +for c in $cc; do + pushd $c + fedpkg clean + fedpkg srpm + fedpkg local + push ${arch} + mock -r fedora-${dist}-${arch} --installdeps *.rpm + popd + mock -r fedora-${dist}-${arch} --copyin ${c}-*.src.rpm /tmp + popd +done + + diff --git a/shell-scripts/top-script.sh b/shell-scripts/top-script.sh new file mode 100755 index 0000000..a8320a0 --- /dev/null +++ b/shell-scripts/top-script.sh @@ -0,0 +1,87 @@ +# -- #!/bin/bash + +# This is not a real script. You must execute the steps by hand. +# We do use auxiliary scripts inside and outside mock. +# 1. prepare for building +# 2. create a mock shell to build nss packages +# 3. build the nss related packages inside mock +# and also install the newly bult ones for some testing +# 4. exit mock to install in mock the dependencies for +# building a few nss client packages, e.g.xumrunne +# 5. create a mock shell to build nss clients (the old environment remains) +# 6. build some nss client packages inside mock +# At this stage we at least know we don't break others +# 7. Optional: collect the packages for further testing in a suitable +# virtual machine +# +# TODO: Automate some some, perhaps using python + +# +# Build nspr, nss-util, nss-softokn, and nss using mock. +# +# These exports define what we want to build +export nspr_v=4.8.9; export nspr_r=2 +export nss_v=3.13.1; export nss_r=3 +export nss_util_v=3.13.1; export nss_util_r=1 +export nss_softokn_v=3.12.10; export nss_softokn_r=7 +export nss_softokn_v= +export nss_softokn_r= +export nss_softokn_v=; export nss_softokn_r= +export target=16; export dist=16 +export arch=x86_64; export archalso=x86_64 + +# prepare for build +./mock-build-prepare.sh -a ${nspr_v} -b ${nspr_r} -c ${nss_v} -d ${nss_r} -e ${nss_util_v} -f ${nss_util_r} -g ${nss_softokn_v} -h ${nss_softokn_r} -i ${target} -j ${arch} + +# create a mock shell +mock -r fedora-rawhide-x86_64 --shell + +#------------------------------------------------------------------------- +# Now we are inside mock +#------------------------------------------------------------------------- + +# Must export these again +export nspr_v=4.8.9; export nspr_r=2 +export nss_v=3.13.1; export nss_r=3 +export nss_util_r=3.13.1; export nss_util_r=1 +export nss_softokn_r=""; export nss_softokn_r="" +export target=16; export dist=16 +export arch=x86_64; export archalso=x86_64 + +# build the packages +mock-build-inside.sh -a ${nspr_v} -b ${nspr_r} -c ${nss_v} -d ${nss_r} -e ${nss_util_v} f ${nss_util_r} -g ${nss_softokn_v} -h ${nss_softokn_r} -i ${target} -j ${arch} + +#Ignore these warnings +#Installing /builddir/build/RPMS +#error: not an rpm package +#error: /builddir/build/RPMS cannot be installed +cd /builddir/build/RPMS/ + +#go back to the ouside shell and package the rpm's +exit + +#----------------------------------------------------------------------------- +# We are outside mock now +#----------------------------------------------------------------------------- + +#------------------------------------------------------------------------------ +# Testing 1: Having our new versions in the build root should not break +# the build of other packages that depend on nss. Two very important +# pacakges are curl and xulrunner. curl is a client of the PEM module +# and xulrunner is how Mozilla applications call nss. +# +# Install dependencies for those devel packages that depend on nss and +# verify that we don't break their builds. + +sh ./prepare-nss-clients.sh -i ${target} -j ${arch} + +# back to mock +mock -r fedora-${target}-${arch} --shell + +# build xulrunner +rpmbuild --rebuild /tmp/xulrunner-*.src.rpm + +# Testing 2: You may now collect the rpms and send them to a convenient +# location fromwhere you can download them, install them for doing more +# tests on a virtual machine. The rpm's can be found at +# /var/lib/mock/fedora-${target}-${arch}/root/builddir/build/RPMS |