From Fedora Project Wiki

Line 71: Line 71:
</pre>
</pre>


=== Use Mock inside your git sandbox to build nss-softokn and nss ===
=== Use Mock inside your git sandbox to build nspr and nss ===
First, initialize the mock repository:


# set the environment variables
<pre>
<pre>
mock -r fedora-rawhide-x86_64 --init
export nspr_version=4.8.7
</pre>
export nspr_release=1
 
export nss_version=3.12.9
Install the packages needed to build nss-softokn and nss
export nss_release=1
(named in BuildRequires) from the yum repositories and local RPMs.  
export target=f15
 
export dist=rawhide
<pre>
export arch=x86_64     # or i386
mock -r fedora-rawhide-x86_64 --install \
export archalso=x886_64 # or i686
sqlite-devel zlib-devel pkgconfig gawk psmisc perl nss-devel
mock -r fedora-rawhide-x86_64 --install nss-util-{v}-{r}.fc15.rpm \
nss-util-devel-{v}-{r}.fc15.rpm
</pre>
 
Copy in the nss-softokn source RPM into /tmp
(we'll copy in and do a build inside the shell, to work around the checks that
detect that the packages aren't in the repository):
 
<pre>
<pre>
mock -r fedora-rawhide-x86_64 --copyin /PATH/TO/NSS_SOFTOKN_SRPM_NAME /tmp
mock -r fedora-rawhide-x86_64 --copyin /PATH/TO/NSS_SRPM_NAME /tmp
</pre>
Shell into the mock environment and perform the builds:


<pre>
<pre>
mock -r fedora-rawhide-x86_64 --shell
# For ease of installing later
cd
rpmbuild --rebuild /tmp/nss-softokn-{v}-{r}.fc15.src.rpm
</pre>
 
Prepare to Build nss
First add yourself as a user, password doesn't matter, to run the build (and test) as yourself not root.
If the system doesn't find you it will run as root and this will cause two tests
to fail.
 
<pre>
<pre>
userdd yourname
# build nspr, nss-util, and nss-softokn as root
cd /builddir/build/rpms
rpmbuild --rebuild /tmp/nspr-${nspr_version}-${nspr_release}.fc${target}.src.rpm
rpm -Uhv nss-softokn-{v}-{r}.fc15.rpm nss-softokn-freebl-{v}-{r}.fc15.rpm   nss-softokn-devel-{v}-{r}.fc15.rpm   nss-softokn-freebl-devel-{v}-{r}.fc15.rpm
rpm -Uhv nspr-*
rpmbuild --rebuild /tmp/nss-util-${nss_version}-${nss_release}.fc${target}.src.rpm
rpm -Uhv nss-util-*
rpmbuild --rebuild /tmp/nss-softokn-${nss_version}-${nss_release}.fc${target}.src.rpm
rpm -Uhv nss-softokn-*
# build nss as mockbuild
su mockbuild -c 'rpmbuild --rebuild /tmp/nss-${nss_version}-${nss_release}.fc${target}.src.rpm /builddir/build/RPMS'
</pre>
</pre>


QUESTION: Do we need this step?
The nss build will take some time because we run all tests.
 
Now we are ready to build nss


# install nss
<pre>
<pre>
cd
rpm -Uhv \
su yourname
nss-${nss_version}-${nss_release}.fc${target}.${archalso}.rpm \
rpmbuild --rebuild /tmp/nss-{v}-{r}.fc15.src.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
</pre>
</pre>


The nss build will take some time because we run all tests.
Once it succeeds and installs okay you could try a client application
Once it succeeds you can install it and try a client application
The results are in /home/yourname/rpmbuild/RPMS/x86_64
The results are in /home/yourname/rpmbuild/RPMS/x86_64
<pre>
<pre>
# back to being root
exit
cd /home/yourname/rpmbuild/RPMS/x86_64
rpm -Uhv {list-of-rpms}
su yourname
rpm -q curl will confirm that it is installed, use it to access a site
rpm -q curl will confirm that it is installed, use it to access a site
$ curl https://fedoraproject.org/wiki/Bodhi_Guide
$ curl https://fedoraproject.org/wiki/Bodhi_Guide
</pre>
</pre>


Now we are confident that the real builds will work. We can build another package that is a client of nss. crypto-utils is a simple client that we could build in our environment, curl is another.
Now we are confident that the real builds will work. We can build another package that is a client of nss.
crypto-utils is a simple client that we could build in our environment, curl is another.


The Koji builds should be done in reverse order starting with Rawhide.
The Koji builds should be done in reverse order starting with Rawhide.
In Rawhide we are lucky and can and should take advange of chained builds.
In Rawhide we are lucky, we can and should take advantage of chained builds.


<pre>
<pre>

Revision as of 00:57, 7 January 2011

Here we describe updates that are a rebase of NSS where all three packages need to be be updated. Most updates are simply new releases to incorporate downstream patches, usually for nss only, and may not require all the special precautions that are described here. The rationale for the split of softokn off from nss that occurred in 3.12.4 is described here https://fedoraproject.org/wiki/Features/SplitSoftoknFromNSS.

For a full update of three packages you will need to build them in this order: nss-util, nss-softokn, and nss. On some occassions nspr would be part of the bundle and must be built first.

In Rawhide the buildroot is updated frequently and we also have chained builds. This is not the case on the stable branches - or on the branch for the next fedora release after the alpha branching. In these cases one must wait for one package to be tagged into the buildroot before one can build the subsequent one. Often you will have some urgency. The procedures is to open a ticket asking that the package you built be added to the buildroot and wait until so to proceed to the next one.

WARNING 1: Don't try shortcuts. Do not introduce a BuildRequire that is lower than the Require just so to be able to build the next package right away. It may build but will likely cause breakage later on when you try to install and some package that depends on nss or any of its siblings will fail to install or to build. All three packages have devel sub-packages. The version used for BuildRequire must the one used for Requires.

One must coordinate with release engineering to progressively add packages to the buildroot. It takes waiting. Furthermore, before sending request to release engineering one must get some assurance that all builds will succeed and and will not cause conflicts and avoid repeated requests. Preflight and testing are necessary.

Scratch builds do not help in testing because they will not get installed into the buildroot and we are building several packages which depend on previous ones.

One approach could be to use multiple system builds and installs in various VM's. Once you have downloaded the packages, a 'yum --nogpgcheck localupdate packages-we-have-so-far' is one way to accomplish this. All dependencies must be satisfied and no conflicts shuould result.

A better way is to do mockbuilds and add the packages to our local buildroot as we go along. http://fedoraproject.org/wiki/Using_Mock_to_test_package_builds#Building_packages_that_depend_on_packages_not_in_a_repository

Let's expand on how we can follow the procedure outlined above for NSS.

Building nspr, nss-util, nss-sfotoken, and nss-util using mock

(If you haven't done so add ourself to the mock group usermod -a -G mock myusername)

Prepare mock outside your git sandbox to build all nss packges

Setup some environment variables

export nspr_version=4.8.7
export nspr_release=1
export nss_version=3.12.9
export nss_release=1
export target=15
export dist=rawhide
export arch=x86_64        # or i386
export archalso=x86_64    # or i686

Initialize the mock environment and install packages needed to build nss

mock -r fedora-${dist}-${arch} --init
mock -r fedora-${dist}-${arch} --install sqlite-devel zlib-devel pkgconfig gawk psmisc perl nss-devel nspr-devel

Build all the rpm's and copy them into mock

cd ./nspr
fedpkg srpm
mock -r fedora-${dist}-${arch} --copyin nspr-${nspr_version}-${nspr_release}.fc${target}.src.rpm /tmp

cd ../nss-util
fedpkg srpm
mock -r fedora-${dist}-${arch} --copyin nss-util-${nss_version}-${nss_release}.fc${target}.src.rpm /tmp

cd ../nss-softokn
fedpkg srpm
mock -r fedora-${dist}-${arch} --copyin nss-softokn-${nss_version}-${nss_release}.fc${target}.src.rpm /tmp

cd ../nss
fedpkg srpm
mock -r fedora-${dist}-${arch} --copyin nss-${nss_version}-${nss_release}.fc${target}.src.rpm /tmp

cd .. Create a mock shell

mock -r fedora-${dist}-${arch} --shell

Use Mock inside your git sandbox to build nspr and nss

  1. set the environment variables
export nspr_version=4.8.7
export nspr_release=1
export nss_version=3.12.9
export nss_release=1
export target=f15
export dist=rawhide
export arch=x86_64      # or i386
export archalso=x886_64 # or i686
<pre>

<pre>
# For ease of installing later
<pre>
# build nspr, nss-util, and nss-softokn as root
rpmbuild --rebuild /tmp/nspr-${nspr_version}-${nspr_release}.fc${target}.src.rpm
rpm -Uhv nspr-*
rpmbuild --rebuild /tmp/nss-util-${nss_version}-${nss_release}.fc${target}.src.rpm
rpm -Uhv nss-util-*
rpmbuild --rebuild /tmp/nss-softokn-${nss_version}-${nss_release}.fc${target}.src.rpm
rpm -Uhv nss-softokn-*
# build nss as mockbuild
su mockbuild -c 'rpmbuild --rebuild /tmp/nss-${nss_version}-${nss_release}.fc${target}.src.rpm /builddir/build/RPMS'

The nss build will take some time because we run all tests.

  1. 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

Once it succeeds and installs okay you could try a client application The results are in /home/yourname/rpmbuild/RPMS/x86_64

rpm -q curl will confirm that it is installed, use it to access a site
$ curl https://fedoraproject.org/wiki/Bodhi_Guide

Now we are confident that the real builds will work. We can build another package that is a client of nss. crypto-utils is a simple client that we could build in our environment, curl is another.

The Koji builds should be done in reverse order starting with Rawhide. In Rawhide we are lucky, we can and should take advantage of chained builds.

# Chained build of nss for Rawhide
fedpkg chain-build nss-util nss-softokn 

Once the build succeeds wait for all packages to be in the build root. Here one could do a verification that packages that dependd on nss would not be broken by our update. A scratch build of one of them is a good test. A scratch build of xulrunner would proceed as follows.

# Scratch build of xulrunner for Rawhide
fedkg clone xulrunner
fedpkg srpm
fedpkg scratch-build --srpm path_to_xulrunner_srpm

There should be no problems with xulrunner or any other package we try.

Now we can proceed to the stable branches. These will take longer as they must be done one by one.

Comments and Discussion