Bug 1075 - RPM build puts wrong path in the *.cf files
Summary: RPM build puts wrong path in the *.cf files
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Building & Packaging (show other bugs)
Version: 2.42
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Malte S. Stretz
URL:
Whiteboard:
Keywords:
: 1089 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-07 11:05 UTC by Wayne Davison
Modified: 2002-10-14 18:40 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
Filter the *.cf files patch None Wayne Davison [NoCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Davison 2002-10-07 11:05:19 UTC
I noticed that the RPM-build process puts the RPM_BUILD_ROOT into all the *.cf
files in the comment about where to find the local.cf file.

One solution is to add a command to the spamassassin.spec file that will filter
out this unwanted build-path prefix from the files.
Comment 1 Wayne Davison 2002-10-07 11:06:05 UTC
Created attachment 381 [details]
Filter the *.cf files
Comment 2 Theo Van Dinter 2002-10-07 11:50:56 UTC
Subject: Re: [SAdev]  New: RPM build puts wrong path in the *.cf files

On Mon, Oct 07, 2002 at 11:05:19AM -0700, bugzilla-daemon@hughes-family.org wrote:
> I noticed that the RPM-build process puts the RPM_BUILD_ROOT into all the *.cf
> files in the comment about where to find the local.cf file.
> 
> One solution is to add a command to the spamassassin.spec file that will filter
> out this unwanted build-path prefix from the files.

The problem is that build/preprocessor.pm replaces the @@LOCAL_RULES_DIR@@
macro with the setting given to "make".  It changes spamassassin, spamd,
and the rules files.  However, spamassassin and spamd get changed at
build time (proper paths), while the rules file get changed at install
time which is going into the buildroot path.

My solution was to modify Makefile.PL with a patch:

-         $(PERL) build/preprocessor $(FIXVARS) <rules/$$file >$(DEF_RULES_DIR)/$$file; \
+         $(PERL) build/preprocessor $(FIXVARS) <rules/$$file | sed -e "s,Use .*/local.cf,Use
/etc/mail/spamassassin/local.cf," >$(DEF_RULES_DIR)/$$file; \

Which is valid in the RPM building process, but not generic enough for
a patch to the Makefile.PL file itself.  I don't want to kluge in a fix
to the spec file (such as the perl command originally posted) since it's
a band-aid instead of an actual solution...
Comment 3 Malte S. Stretz 2002-10-08 04:16:52 UTC
I'm gonna fix this one. I think the best solution will be to copy the modified 
rules to blib and install them from there. Then the rules files will be 
changed on build time and not install time, too. 
Comment 4 Justin Mason 2002-10-09 07:35:09 UTC
actually, prob a better solution is to send in 2 settings for each one:

LOCAL_RULES_DIR = what the installed version should expect
BUILD_LOCAL_RULES_DIR = what it's being built with

then the latter contains RPM_BUILD_DIR as a prefix.  this is like what
you have to do when installed sw with AFS.

does that sound do-able?
Comment 5 Malte S. Stretz 2002-10-09 11:39:48 UTC
Hmmm... two things I noticed:  
  
1. The segmentation fault was the only time two parallel connections to the 
SQL server were established.  
  
2. In the logmsgs you find the uid of the user (eg. kids007:99). In your case  
it's always 99... 
Comment 6 Malte S. Stretz 2002-10-09 11:50:26 UTC
Eh? How did the last comment end in this bug? I typed it into 1087...? 
Comment 7 Justin Mason 2002-10-10 08:33:09 UTC
OK, I've just checked in a potential fix for this to b2_4_0.
(can't check it in on HEAD as I've hacked my copy of this extensively
and that code's not ready ;)

The new system works as follows -- cutting the comments from Makefile.PL:

# RPM builders, or people building in their home dirs:
# set PREFIX (default = /usr)
# set SYSCONFDIR (default = /etc)
# set INST_PREFIX (default = [same as PREFIX])
# set INST_SYSCONFDIR (default = [same as SYSCONFDIR])
#
# For example, to install in your home dir:
#
#   perl Makefile.PL PREFIX=/home/jm/sausr SYSCONFDIR=/home/jm/saetc
#
# Or to build a package in /tmp/build, but with its internal paths
# referring to /usr and /etc:
#
#   perl Makefile.PL PREFIX=/tmp/build/usr SYSCONFDIR=/tmp/build/etc \
#                       INST_PREFIX=/usr INST_SYSCONFDIR=/etc

I've rewritten the spamassassin.spec to use it, and it seems to work
nicely.  how does that sound?
Comment 8 Justin Mason 2002-10-10 08:33:13 UTC
*** Bug 1089 has been marked as a duplicate of this bug. ***
Comment 9 Duncan Findlay 2002-10-10 15:05:56 UTC
Subject: Re: [SAdev]  RPM build puts wrong path in the *.cf files

Thanks Justin.

Comment 10 Justin Mason 2002-10-15 02:40:51 UTC
marking this one fixed, since we can now use separate
build-time and install-time paths to Makefile.PL