Hey,
In case others hit similar issues w/ RPMS on RH9.0 / RPM 4.2, I thought I'd
Cc: this to the list.
On RH9.0 when building the modules-oscar rpm the following issues were hit.
1. The new debug_package stuff that's added to RPM 4.2 causes a problem.
[see also: http://www.gurulabs.com/RedHatLinux9-review.html,
section 'Debuginfo RPMs' or google for error string :)]
For user level builds, (i.e., in $HOME/redhat) it worked to put the
following in $HOME/.rpmmacros
%debug_package %{nil}
As root, I had to add the following to the .spec
%define debug_package %{nil}
2. The fix for number once causes further problems... :)
It detects other instances of %install & %prep, (even comments)
so I had to add a space, e.g., % install & % prep
3. The modules-oscar SRPM doesn't build entirely in BUILD_ROOT-dom
(at least under RH9.0 for a std user, /opt/modules, etc.)
So, I had to build as root and it compiled all fine & moved files
to the necessary spots, but hit a snag at the end. The following
message was generated,
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
getOutputFrom(): Broken pipe
Firstly, it looks like it's passing a var name and not the interpolated
value. Regardless, I tracked this down to another macro that is... yep
a new feature of 4.x and is fixable by commenting out line 308 the
global macro file (/usr/lib/rpm/macros) or by defining a macro as nil
like in #1 above,
FROM File: modules-oscar.spec
%define __check_files %{nil}
FROM File: /usr/lib/rpm/macros
304 # Script gets packaged file list on input and buildroot as first parameter.
305 # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
306 #
307 # Note: Disable (by commenting out) for legacy compatibility.
308 %__check_files /usr/lib/rpm/check-files %{buildroot}
Then things build just fine! ;) Simple.
I've attached the modified .spec for perusal.
--tjn
PS It appears that RPM is pretty stupid when it comes to parsing the .spec,
several times items in comments are observed and change behaviour! :)
ya' gotta' love it!
_________________________________________________________________________
Thomas Naughton [EMAIL PROTECTED]
Research Associate (865) 576-4184
#
# Copyright (c) 2002 The Trustees of Indiana University.
# All rights reserved.
#
# This file is part of the modules-oscar software package. For
# license information, see the LICENSE file in the top-level directory
# of the modules-oscar source distribution.
#
# $Id: modules-oscar.spec,v 1.13 2002/10/27 13:23:35 jsquyres Exp $
#
#############################################################################
#
# Helpful Defines
#
#############################################################################
# TJN: Addded to get around RPM 4.2 debugging additions (default in RH9.0)
%define debug_package %{nil}
%define __check_files %{nil}
%define _moddir /opt/modules
%define _profiledir /etc/profile.d
#############################################################################
#
# Preamble Section
#
#############################################################################
Summary: Modules package
Name: modules-oscar
Version: 3.1.6
Release: 3
License: GPL
Group: Applications/Environment
Source0: modules-oscar-1.0.4.tar.gz
Source1: modules-%{version}.tar.gz
URL: http://modules.sourceforge.net/
Packager: Open Cluster Group / OSCAR working group
AutoReqProv: no
Requires: tcl
Requires: %__mv %__rm %__cp %__cat %__mkdir %__chmod %__grep %__make
Requires: /bin/ed
Requires: /usr/bin/test
%description
The Modules package provides for the dynamic modification of the
environment of the user via modulefiles. Each modulefile contains the
information needed to configure the shell for an application. Once the
Modules package is initialized, the environment can be modified on a
per-module basis using the module command which interprets
modulefiles. Typically modulefiles instruct the module command to
alter or set shell environment variables such as PATH, MANPATH, etc.
modulefiles may be shared by many users on a system and users may have
their own collection to supplement or replace the shared modulefiles.
This RPM is named "modules-oscar" to differentiate it from the Linux
kernel modules RPM. It includes a series of customiations of a
vanilla Modules install suitable for OSCAR clusters.
#############################################################################
#
# Prep Section
#
#############################################################################
%prep
%setup -q -n modules-oscar-1.0.4
cd ..
%setup -q -T -D -b 1 -n modules-%{version}
#############################################################################
#
# Build Section
#
#############################################################################
%build
# Essentially taken from the modules-supplied RKOConfigure script
# (took out the X stuff, and added --without-x because we don't use
# any of the extra X stuff); modified for OSCAR clusters. The
# @VERSION@ macro is part of the Modules configure process and is
# expanded DURING configure. If you instead specify
# /opt/modules/VERSION (or whatever version you are building), it
# seems that the configure process gets very confused. So we are just
# going to do what the modules people recommend. :)
CFLAGS="$RPM_OPT_FLAGS"
export CFLAGS
./configure \
--prefix=%{_moddir}/@VERSION@ \
--with-module-path=%{_moddir}/modulefiles \
--with-version-path=%{_moddir}/version \
--with-etc-path=/etc \
--with-skel-path=/etc/skel \
--with-split-size=960 \
--with-tcl-include=/usr/include \
--with-tcl-libraries=/usr/lib \
--without-x
make
#############################################################################
#
# Install Section
#
#############################################################################
%install
# it seems that modules does not support the ability to change the
# installation directory during 'make install'. Therefore, we need
# to install in the final resting spot, which could cause some
# problems with an existing install. Move the existing install for
# a couple minutes...
if [ -d %{_moddir} ]; then
%__rm -rf %{_moddir}.tmp
%__mv %{_moddir} %{_moddir}.tmp
%__rm -rf %{_moddir}
fi
# argh! The modules install process isn't the brightest in the world.
# It won't make directories before they are installed...
%__mkdir_p %{_moddir}
%__make install
# and it doesn't set the default symlink, which is used in modules...
%__ln_s %{_moddir}/%{version} %{_moddir}/default
# and it doesn't make the directory where people are supposed to
# install their own config files...
%__mkdir_p %{_moddir}/modulefiles
# Now make a directory where OSCAR-specific modulefiles will go
%__mkdir_p %{_moddir}/oscar-modulefiles
# Install the *.OSCAR files
srcdir="$RPM_BUILD_DIR/modules-oscar-1.0.4"
%__cp $srcdir/README.OSCAR .
%__cp $srcdir/LICENSE.OSCAR .
%__cp $srcdir/AUTHORS.OSCAR .
# Install the "oscar" module and set its default
destdir="%{_moddir}/modulefiles/oscar-modules"
%__mkdir_p $destdir
%__cp $srcdir/src/oscar.tcl $destdir/1.0.4
%__cat > $destdir/.version << EOF
#%Module
set ModulesVersion 1.0.4
EOF
unset destdir
# For the OSCAR RPM, we have to make some changes to the shell setup
# stuff that comes with the vanilla modules distribution. We:
#
# - discard most of the per-login make-empty-variables setup stuff
# that's in the modules distro in etc/global/csh.login and
# etc/global/profile.
# - keep the per-login modules init stuff from etc/global/csh.modules
# and etc/global/profile.modules.
# - keep the per-shell-invcation modules init stuff from
# etc/global/csh.cshrc and etc/global/bashrc.
#
# Additionally, we have to combine all three things into one file for
# each shell because this one file has to go into /etc/profile.d so
# that it can get run for every shell invocation. The per-login stuff
# is protected by statements that check for the existence of
# environment variables, so even though the script is run for every
# shell invocation, that stuff is only run once (for the first --
# login -- shell).
#
# The reason that this stuff is all combined into one file and is put
# in /etc/profile.d is because of Evilness in rsh/ssh (they both do
# the same thing). When a user executes "rsh somehost who", the shell
# that "who" runs in on the target machine is *not* a login shell. So
# all the login-setup stuff is not run (/etc/csh.login and
# /etc/profile). Only the per-shell-invcation stuff is run. Hence,
# we have to put everything into the per-shell-invocation stuff (i.e.,
# scripts in /etc/profile.d), and protect the only-run-once stuff with
# environment variable checking.
#
# BTW, this is all documented in the spec file in order to speed
# parsing/processing time of the scripts that are put in
# /etc/profile.d. Putting this many comments in those scripts --
# scripts that are run for *EVERY* shell invocation -- just seems like
# needless overhead.
# Save any original %{_profiledir}/00-modules.* files
for file in 00-modules.csh 00-modules.sh; do
if test -f %{_profiledir}/$file; then
cp %{_profiledir}/$file %{_profiledir}/$file.rpmbuild
fi
done
# Take our OSCAR-ized template files and insert the files from the
# modules distribution.
file=ed-commands.txt
# First, bash.
%__cat > $file <<EOF
/INSERT-PROFILE-MODULES-HERE
d
-
. r etc/global/profile.modules
/INSERT-BASHRC-HERE
d
-
. r etc/global/bashrc
w
q
EOF
ed $srcdir/src/00-modules.sh < ed-commands.txt
%__rm -f $file
# Copy the resulting file to %{_profiledir}.
%__cp $srcdir/src/00-modules.sh %{_profiledir}
%__chmod +x %{_profiledir}/00-modules.sh
# Now do the csh version.
%__cat > $file <<EOF
/INSERT-CSH-MODULES-HERE
d
-
. r etc/global/csh.modules
/INSERT-CSH-CSHRC-HERE
d
-
. r etc/global/csh.cshrc
w
q
EOF
ed $srcdir/src/00-modules.csh < ed-commands.txt
%__rm -f $file
# Copy the resulting file to the %{_profiledir}.
%__cp $srcdir/src/00-modules.csh %{_profiledir}
%__chmod +x %{_profiledir}/00-modules.csh
#############################################################################
#
# Post Section
#
#############################################################################
%post
# Now make /etc/bashrc source the %{_profiledir}/00-modules.sh files.
# Blech. We have to do this because some distros (e.g., RH 7.1) have
# a /etc/bashrc that doesn't run the scrips in /etc/profile.d for
# non-interactive shells (e.g., rsh somehost who). Sucks!!
# Summation of cases:
# - bash user logs in: /etc/profile is run, all /etc/profile.d/*.sh
# scripts are run
# - bash user invokes non-interactive shell (e.g., rsh somehost who):
# $HOME/.bashrc is run, which invokes /etc/bashrc, which manually
# invokes /etc/profile.d/00-modules.sh (because /etc/profile.d/*.sh
# scripts are *not* run)
# - user invokes "su" to root: $HOME/.bashrc is run, which invokes
# /etc/bashrc is run, and all /etc/profile.d/*.sh scripts are run
special_string="MODULES-%{version}-%{release}-RPM-ADDITION"
%__cp /etc/bashrc /etc/bashrc.rpmsave
%__cat >> /etc/bashrc <<EOF
if test "\$MODULE_OSCAR" = "" -a -f %{_profiledir}/00-modules.sh; then #
$special_string
. %{_profiledir}/00-modules.sh # $special_string
fi # $special_string
EOF
# We have to do essentially the same thing for /etc/csh.cshrc for
# essentially the same reasons. Sucks!!
%__cp /etc/csh.cshrc /etc/csh.cshrc.rpmsave
%__cat >> /etc/csh.cshrc <<EOF
if ("\$?MODULE_OSCAR" == "0" && -f %{_profiledir}/00-modules.csh) then #
$special_string
source %{_profiledir}/00-modules.csh # $special_string
endif # $special_string
EOF
unset special_string
#############################################################################
#
# Postun Section
#
#############################################################################
%postun
special_string="MODULES-%{version}-%{release}-RPM-ADDITION"
# Remove the addition that we put in the /etc/bashrc file in %post.
egrep -v '^.*# '$special_string /etc/bashrc > /etc/bashrc.tmp
%__cp /etc/bashrc.tmp /etc/bashrc
%__rm -f /etc/bashrc.tmp
# Ditto for /etc/csh.cshrc
egrep -v '^.*# '$special_string /etc/csh.cshrc > /etc/csh.cshrc.tmp
%__cp /etc/csh.cshrc.tmp /etc/csh.cshrc
%__rm -f /etc/csh.cshrc.tmp
#############################################################################
#
# Clean Section
#
#############################################################################
%clean
# Fix the hacks we did in % install to save an existing modules install...
%__rm -rf %{_moddir}
if [ -d %{_moddir}.tmp ]; then
%__mv %{_moddir}.tmp %{_moddir}
fi
# Restore any 00-modules files that may have previously existed
for file in 00-modules.csh 00-modules.sh; do
if test -f %{_profiledir}/$file.rpmbuild; then
%__cp %{_profiledir}/$file.rpmbuild %{_profiledir}/$file
%__rm %{_profiledir}/$file.rpmbuild
else
%__rm %{_profiledir}/$file
fi
done
#############################################################################
#
# Files Section
#
#############################################################################
%files
%defattr(-,root,root)
%doc doc/Modules-Paper.pdf ChangeLog INSTALL INSTALL.RH7x LICENSE.GPL
%doc MACHINES PROBLEMS README README.perl
%doc README.OSCAR AUTHORS.OSCAR LICENSE.OSCAR
%{_moddir}
%{_profiledir}/00-modules.*
#############################################################################
#
# ChangeLog
#
#############################################################################
%changelog
* Wed Jul 16 2003 21:02:42PM Thomas Naughton <[EMAIL PROTECTED]>
- Release 3.1.6-3
- Mods to work with new RPM 4.2 issues:
o defined debug_package=nil to override default Debuginfo which cased a bomb
o defined __check_files=nil to override default as suggested for legacy apps,
see also '/usr/lib/rpm/macros'
o if encounter section name twice (even in comments)
freaks out so i added a space btw % install and % prep in a few places.
* Sun Oct 27 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Added AUTHORS.OSCAR and LICENSE.OSCAR files to %doc
- Added IU copyrights to all the RPM-packaging and OSCAR-izations in this
RPM
- Clarified in README what exactly is copyrighted/licensed by IU --
everything else is copyrighted/licensed by the base modules package.
* Thu Aug 08 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Change the name of the RPM to modules-oscar so that we don't
conflict with the Linux modules RPM.
- Remove "oscar" from the release number, per new OSCAR standards.
* Sat Apr 27 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Use %__ kinds of builtin macros for common unix utilities
* Fri Apr 26 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Added "Requires" lines for bunches of unix utilities
* Sat Apr 13 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Fixed OSCAR bug 543153 by overriding RPM's auto-dependency analysis
and making this RPM only depend on "tcl" on the rationale that "the
friend of my friend is my friend" -- since tcl will have its own
dependencies, we'll implicitly depend on those as well. This was
done to make this RPM installable on multiple different flavors of
Linux (e.g., RH 7.2 has a different version of TCL than Mandrake
8.2).
- Fixed OSCAR bug 543155 where the SRPM wouldn't build because some
source files were missing. Made all the additional files into a
real tarball, so the SRPM contains two tarballs. Added additional
logic in % prep to make this all work properly.
- Ensure to save %{_profiledir}/00-modules.* if they already exist
while building this RPM.
- Cleaned up the OSCAR.README file; added more information about
exactly what this RPM does.
- Removed all references to $RPM_BUILD_ROOT because the modules
package doesn't support DESTDIR kinds of installs, so
$RPM_BUILD_ROOT was always "/" anyway. :-(
- Propogate the RPM architeture opt flags to the compile properly.
- Bumped the release number up to "2oscar"
* Tue Apr 9 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Added hacks for /etc/csh.cshrc analogous to what we do for
/etc/bashrc :-(
- Make /opt/modules/oscar-modulefiles for OSCAR-specific modules
- Install oscar module in oscar-modulefiles
* Sun Feb 17 2002 Jeff Squyres <[EMAIL PROTECTED]>
- Added use of %{_moddir} just in case we ever move the location of
where modules are installed
- Moved four scripts into separate files and added additional SourceN
lines in the preamble
- Added documentation files
- Merged all the shell initialization files into one file per shell
and put it into /etc/profile.d
* Sat Feb 16 2002 Brian William Barrett <[EMAIL PROTECTED]>
- Initial try at a SPEC file for modules.