Closed Bug 189501 Opened 17 years ago Closed 17 years ago

Build Linux RPMS

Categories

(NSPR :: NSPR, defect, P1)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kirk.erickson, Assigned: kirk.erickson)

Details

Attachments

(3 files, 6 obsolete files)

Create Makefile infrastructure to build RedHat Linux RPMs.
Use Solaris packages as a guide for what and where to install
a RedHat 7.2 build of NSPR.  

Bug 158704 added pkg/solaris. This bug adds pkg/linux.
Consider adding ./mozilla/nsprpub/pkg/Makefile.in, and removing
the 'solarispkg' target from ./mozilla/nsprpub/Makefile.in,
replacing it with a 'packages' target that does a publish in
the pkg directory.  The new Makefile would set DIRS to 'solaris'
or 'linux', or '' depending on $(OS_ARCH).
Note, building an RPM requires write access to the buildarea, 
so as root, you'll need to do something like:

	chown kirke.wheel /usr/src/redhat

The change consists of a patch (this attachment), and 
some new files (the next attachment is a tar file).
Go to your NSPR TIP workarea and apply the patch

	patch <whatever.patch

this changes:

	mozilla/nsprpub/Makefile.in
	mozilla/nsprpub/configure.in

Then extract the new files from the next attachment:

	tar xvf whatever.tar

this creates:

	mozilla/nsprpub/pkg/Makefile.in
	mozilla/nsprpub/pkg/linux/
	mozilla/nsprpub/pkg/linux/Makefile.in
	mozilla/nsprpub/pkg/linux/nspr.spec

Now, subsequent to building you can say:

	cd ${WORKAREA}/mozilla
	gmake package

from ANY machine.  The change introduces pkg/Makefile,
so we can publish there and descend into 'solaris' when OS_ARCH
is SunOS, or into 'linux' when its Linux.  Other architectures
are a noop.
This attachment goes with the previous (112171).
Its a tar file containing the new pkg/Makefile.in,
and pkg/linux.

I building and installing the Linux rpm on box (running RedHat 7.2)
Linux box 2.4.18-17.7.xsmp #1 SMP Tue Oct 8 12:37:04 EDT 2002 i686 unknown

I also applied the patch on kentuckyderby, a Solaris machine
SunOS kentuckyderby 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-5_10
to verify the new 'package' target works as the former 'solarispkg'
did under SunOS.
Updates:

	1. Changed pkg/Makefile.in to decide on DIRS based
		on OS_TARGET rather than OS_ARCH.

	2. Changed rpm name from 'nspr' to 'sun-nspr'.

The Mozilla 1.3a distribution includes mozilla-nspr built by
Chris Blizzard <blizzard@mozilla.org> or <blizzard@redhat.com>.

Chris wrote:
> > Also, I gather folks building need write access to
> > /usr/src/redhat (rpm  is harcoded to use this area), right?
> 
> No, you don't need access to /usr/src/redhat.  You just need
> a decent ~/.rpmrc, that's all.

Tried with ~/.rpmrc and supplying --rcfile, and got "bad option"
attempting to set "topdir" (saw this in Maximum RPM, p365, B.2.1).

[kirke@box workarea-nspr]$ cat ./mozilla/pkg/linux/rpmrc
topdir: /var/tmp/workarea-nspr/mozilla/pkg/linux

rpm --rcfile rpmrc -ba nspr.spec
error: bad option 'topdir' at rpmrc:1
Executing(%prep): %{___build_cmd} /var/tmp/rpm-tmp.56927

saw the same failure attempting with ~/.rpmrc.	Also tried
'_topdir'.  As a result, the proposed patch still builds in
/usr/src/redhat to which the builder needs write access.

I downloaded src and discovered mozilla/build, which is not
part of the nspr checkout houses

mozilla/build/package/rpm/SOURCES/mozilla-nspr-packages.patch
mozilla/build/package/rpm/SPECS/mozilla-DATE.spec.in

The mozilla-nspr rpm is generated by way of a patch to mozilla
in the above spec.  Reviewing these prompted changes to Copyright
and Group in sun-nspr.spec, but I didn't see a way to share
spec files generally.
Attachment #112171 - Attachment is obsolete: true
tar ball of new files:
./mozilla/nsprpub/pkg/Makefile.in
./mozilla/nsprpub/pkg/linux/
./mozilla/nsprpub/pkg/linux/Makefile.in
./mozilla/nsprpub/pkg/linux/sun-nspr.spec
Attachment #112172 - Attachment is obsolete: true
Priority: -- → P2
Target Milestone: --- → 4.3
Wan-Teh - my attempt to checkin this patch failed:

cvs server: Pre-commit check failed
You may not check into partition NSPR
the file mozilla/nsprpub/pkg/linux/Makefile.in on branch HEAD
If you think you should be allowed to, send mail to
one of the below people:
  srinivas@netscape.com
  seawood@netscape.com
  wtc@netscape.com

It adds the sun-nspr-devel subpackage.	Now we generate:

./mozilla/pkg/linux/RPMS/sun-nspr-4.3.0-1.i386.rpm
./mozilla/pkg/linux/RPMS/sun-nspr-devel-4.3.0-1.i386.rpm
./mozilla/pkg/linux/SRPMS/sun-nspr-4.3.0-1.src.rpm

sun-nspr-devel requires sun-nspr of the same version, and adds
header files and static libraries.  I tested installing all
the RPMs, and building with the files installed by the src RPM.

Investigation of mozilla rpm prompted a protracted exploration of
implementations that would dynamically gather the file (%file)
and directory (%dir) lists that are hardcoded in the spec
(./mozilla/nsprpub/pkg/linux/sun-nspr.spec).

Files come and go less with NSPR, so I opted to go static with
NSPR and make the NSS spec generate the lists dynamically.
As a result we have two templates for stamping out RPMs for
other components.

The Mozilla 1.3a spec makes use of a perl script that can
be provided an "exclusion" list and much more.	The script
(mozilla-make-package.pl) is not checked into the mozilla tree
itself though, and is copyrighted by the author:

# Portions created by Christopher Blizzard are Copyright (C)
# Christopher Blizzard.  All Rights Reserved.

I balked, and decided it was more than we might like to adopt
and maintain anyway.  NSPR and NSS are simple in that they both
want to distribute the .so's with the main RPM, and whatever
header and perhaps statics left subordinate to dist/ in the
devel package.

For NSS RPM generation (bug 189504) I will generate the lists
dynamically using a pipeline of 'find' and 'sed' commands in
lieu of Chris's script , so we have a coupld templates to chose
from in doing other components down the road.  The idea is to
minimize the changes to the spec and Makefile release to release.

For NSPR, if a new file should appear or an old file disappear,
the lists need to be updateded by editing the spec.  Note, both
NSPR and NSS gather version information from make variables so
that much is dynamic in both.  For NSS the Makefile will have
a pipeline of 'find' and 'sed' commands generate the lists.
Attachment #112777 - Attachment is obsolete: true
Tar file to use with the previous attachment (113219).
Adds these new files:

mozilla/nsprpub/pkg/Makefile.in
mozilla/nsprpub/pkg/linux/Makefile.in
mozilla/nsprpub/pkg/linux/sun-nspr.spec
Attachment #112779 - Attachment is obsolete: true
Kirk,

I've checked in the patch and added the new files on
the NSPR trunk.  I made three changes.

1. In mozilla/nsprpub/Makefile.in, I removed the
unnecessary '/' after "pkg" in "$(MAKE) -C pkg/".

2. In mozilla/nsprpub/pkg/Makefile.in, I changed

ifeq ($(OS_TARGET),SunOS)
DIRS = $(OBJDIR)
endif

to

ifeq ($(OS_TARGET),SunOS)
DIRS = solaris
endif

I hope this is the right change.

3. In mozilla/nsprpub/pkg/linux/sun-nspr.spec, I removed
all the /usr/include/mps/nspr/md/* lines.  None of the
files under mozilla/nsprpub/pr/include/md should be
exported.

Please let me know if the tip of NSPR works for you on
both Linux and Solaris.
Priority: P2 → P1
Thanks Wan-Teh.  You were right on all 3 corrections.
I found one additional flaw in my work:

Index: sun-nspr.spec
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pkg/linux/sun-nspr.spec,v
retrieving revision 1.1
diff -u -r1.1 sun-nspr.spec
--- sun-nspr.spec	4 Feb 2003 01:45:28 -0000	1.1
+++ sun-nspr.spec	4 Feb 2003 03:13:28 -0000
@@ -57,6 +57,9 @@
 %dir /usr
 %dir /usr/include
 %dir /usr/include/mps
+%dir /usr/include/mps/nspr
+%dir /usr/include/mps/nspr/obsolete
+%dir /usr/include/mps/nspr/private
 /usr/include/mps/nspr/private/pprio.h
 /usr/include/mps/nspr/private/pprthred.h
 /usr/include/mps/nspr/private/prpriv.h

Without these, /usr/include/mps isn't removed when the
sun-nspr-devel package is removed.

I tested building both solaris and linux, and building
and installing the src package.  All went well.
Status: NEW → ASSIGNED
Kirk, I checked in that patch.
This patch effects mozilla/nsprpub/pkg/linux/Makefile.in only.

1. Removed "SOURCE" variable.
2. Redefined "VERSION" to gather from prinit.h, rather than make env.
3. Qualified copy of RPMs from /usr/src/redhat.

Gathering from the include file is preferable in Wan-Teh's view,
Also, the make variable approach forces us to specify patch level even
when its zero (so we were getting '4.3.0' rather than '4.3').
Effects mozilla/nsprpub/pkg/linux/Makefile.in only.

In addition to items in previous version of this patch,
I removed the VERSION= line that used make variables.
We settled on parsing include files in NSS to match ident
output, so we're not likely to want the make variable
remnant.
Attachment #113757 - Attachment is obsolete: true
I integrated your simplifications for versioning under 
pkg/solaris into my previous patch.  I tested with this updated
version of my patch for the TIP of NSPR for RPMs.

Its identical to my previous patch, except we now use;
    $(dist_includedir). 

I tested building and installing RPMs with this combined
patch.
Attachment #113766 - Attachment is obsolete: true
Comment on attachment 113939 [details] [diff] [review]
Patch for TIP of NSPR (use prinit.h for version info)

I checked this patch into the TIP of NSPR.
(I ignored the changes to mozilla/nsprpub/configure
in this patch.)

Kirk, please pull the TIP of NSPR and verify my
checkin.
I pulled the TIP or NSPR, verified your checkin; version numbers
are correct (4.3), and I installed and removed the RPMs fine.

[root@box RPMS]# rpm -e sun-nspr sun-nspr-devel
[root@box RPMS]# cd /var/tmp/workarea-nspr/mozilla/pkg/linux/RPMS
[root@box RPMS]# rpm -ihv *
Preparing...                ########################################### [100%]
   1:sun-nspr               ########################################### [ 50%]
   2:sun-nspr-devel         ########################################### [100%]
[root@box RPMS]# rpm -q sun-nspr sun-nspr-devel
sun-nspr-4.3-1
sun-nspr-devel-4.3-1

Note, these RPMS won't be useful till Wan-Teh shifts
some functions from NSS 3.8 into NSPR 4.3, and makes
NSS 3.8 engage NSPR 4.3 (its still engaging 4.2.2).

The NSS 3.8 RPMs prereq NSPR 4.3 or greater.

But the  RPM building infrastructure is complete.
Closing.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Kirk, just curious, what does "-1" mean in the output of "rpm -q"?

sun-nspr-4.3-1
sun-nspr-devel-4.3-1
> what does "-1" mean in the output of "rpm -q"?

Its the "release number of the package".  Maximum RPM says:
"The release tag can be thought of as the package's version."

When a version is first packaged, its release is traditionally
"1".  If its necessary to repackage that software at the same
version, the release should be incremented.  When a new version
of the software becomes available, the release number drops
back to "1".

I provisioned the Makefile with a RELEASE variable we can
bump, but our releases will probably always be done just once.

glibc on box has been repackaged several times at the same version:

[kirke@box kirke]$ rpm -q glibc
glibc-2.2.4-30


Here's some additional information for your inspection:

[kirke@box linux]$ rpm -q -i sun-nspr
Name        : sun-nspr                     Relocations: (not relocateable)
Version     : 4.3                               Vendor: Sun Microsystems
Release     : 1                             Build Date: Wed 12 Feb 2003 07:05:50
PM PST
Install date: Wed 12 Feb 2003 08:03:36 PM PST      Build Host: box.red.iplanet.com
Group       : System Environment/Base       Source RPM: sun-nspr-4.3-1.src.rpm
Size        : 298035                           License: MPL
Summary     : Netscape Portable Runtime
Description :

NSPR provides platform independence for non-GUI operating system
facilities. These facilities include threads, thread synchronization,
normal file and network I/O, interval timing and calendar time, basic
memory management (malloc and free) and shared library linking.
Could you change "License: MPL" to "License: MPL/GPL"?
I guess you'll need to make the same change to the NSS
RPMs.
> Could you change "License: MPL" to "License: MPL/GPL"?
Done.  This effected the spec files:

cvs commit ./mozilla/nsprpub/pkg/linux/sun-nspr.spec
Checking in ./mozilla/nsprpub/pkg/linux/sun-nspr.spec;
/cvsroot/mozilla/nsprpub/pkg/linux/sun-nspr.spec,v  <--  sun-nspr.spec
new revision: 1.3; previous revision: 1.2
done

cvs commit ./mozilla/security/nss/pkg/linux/sun-nss.spec
Checking in ./mozilla/security/nss/pkg/linux/sun-nss.spec;
/cvsroot/mozilla/security/nss/pkg/linux/sun-nss.spec,v  <--  sun-nss.spec
new revision: 1.2; previous revision: 1.1
done
You need to log in before you can comment on or make changes to this bug.