pcp
[Top] [All Lists]

Re: [pcp] "config" file in RPM packages

To: Martin Hicks <mort@xxxxxxx>
Subject: Re: [pcp] "config" file in RPM packages
From: Mark Goodwin <goodwinos@xxxxxxxxx>
Date: Fri, 30 Oct 2009 11:12:20 +1100
Cc: pcp@xxxxxxxxxxx
In-reply-to: <20091026171426.GE12534@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <4AE13C27.3080208@xxxxxxxxx> <20091026171426.GE12534@xxxxxxxxxxxxxxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Martin Hicks wrote:
On Fri, Oct 23, 2009 at 04:16:23PM +1100, Mark Goodwin wrote:
Just seeking some feedback on RPM config files in the PCP RPM packages.
>> ...
The current RPM packages built using the pcp_fedora spec
has a shorter list of just the stuff you're actually likely
to edit :

I agree with this.  I think a lot of these above are more like
templates than config files.  It would be a lot smarter for a user to
make a copy and then edit if they want to modify a pmchart template.

OK, the attached patch for review trims the config files to just
the following list, which is now the same as in the Fedora spec :

/etc/bash_completion.d/pcp
/etc/pcp.env
/var/lib/pcp/config/pmcd/pmcd.conf
/var/lib/pcp/config/pmcd/pmcd.options
/var/lib/pcp/config/pmcd/rc.local
/var/lib/pcp/config/pmie/config.default
/var/lib/pcp/config/pmie/control
/var/lib/pcp/config/pmie/crontab
/var/lib/pcp/config/pmlogger/config.default
/var/lib/pcp/config/pmlogger/control
/var/lib/pcp/config/pmlogger/crontab
/var/lib/pcp/config/pmproxy/pmproxy.options
/etc/pcp.conf


I also don't like having two RPM specs (and presumably,
there will be yet another one for OpenSuSE et al).

I think we're somewhat stuck with this.

grumble, yeah ok we can live with it for now.


Another question I have is why pmcd.conf gets install 444.  This is a
config file that can be edited.  The general standard for config files
is 644.


Ken answered, so I'll commit a fix for this to my tree later
today, along with the attached patch if I can get an ack.

Cheers
-- Mark

diff --git a/GNUmakefile b/GNUmakefile
index 0fb43f0..0252f4e 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -55,7 +55,7 @@ LDIRT = config.cache config.status config.log files.rpm 
pro_files.rpm \
        root-*/include root-*/lib root-*/*.rpm root-*/default_pro \
        autom4te.cache install.manifest install_pro.manifest \
        debug*.list devel_files libs_files base_files.rpm libs_files.rpm \
-       devel_files.rpm perl-pcp*.list*
+       devel_files.rpm perl-pcp*.list* conf_files
 
 SUBDIRS = src man build debian
 ifeq "$(MAKECMDGOALS)" "clobber"
diff --git a/build/rpm/pcp.spec.in b/build/rpm/pcp.spec.in
index 08aab01..97bb741 100644
--- a/build/rpm/pcp.spec.in
+++ b/build/rpm/pcp.spec.in
@@ -175,11 +175,31 @@ sed -i -e 's/usr\/lib\//usr\/lib64\//' devel_files
 awk '{print $NF}' $DIST_MANIFEST |\
 egrep 'pcp\/(examples|demos)|pmdas\/(sample|simple|trivial|txmon)' 
>>devel_files
 
+#
+# Patterns for files to be marked %config(noreplace).
+# Note: /etc/pcp.conf is %config, but not noreplace
+# and is treated specially below.
+cat >conf_files <<EOFEOF
+etc/pcp.env
+pmcd/pmcd.conf
+pmcd/pmcd.options
+pmcd/rc.local
+pmie/config.default
+pmie/control
+pmie/crontab
+pmlogger/config.default
+pmlogger/control
+pmlogger/crontab
+pmproxy/pmproxy.options
+bash_completion.d/pcp
+EOFEOF
+
 rm -f devel_files.rpm libs_files.rpm base_files.rpm
 sort -u $DIST_MANIFEST | $PCP_AWK_PROG ' 
 BEGIN {
     while( getline < "libs_files") lib[$0]=1;
     while( getline < "devel_files") dev[$0]=1;
+    while( getline < "conf_files") conf[nconf++]=$0;
 }
 {
     if (lib[$NF]) f="libs_files.rpm";
@@ -187,9 +207,14 @@ BEGIN {
     else f="base_files.rpm"
 }
 $1 == "d" { printf ("%%%%dir %%%%attr(%s,root,root) %s\n", $2, $5) >> f } 
-$1 == "f" { if ( match ($6, "'$PCP_VAR_DIR'/config") ||
-                match ($6, "'$PCP_SYSCONFIG_DIR'") ) {
-              printf ("%%%%config(noreplace) ") >> f;
+
+$1 == "f" && $6 ~ "etc/pcp.conf" { printf ("%%%%config ") >> f; }
+$1 == "f" {
+           for (i=0; i < nconf; i++) {
+               if ($6 ~ conf[i]) {
+                   printf ("%%%%config(noreplace) ") >> f;
+                   break;
+               }
            }
            if (match ($6, "'$PCP_MAN_DIR'") || match ($6, "'$PCP_DOC_DIR'")) {
                printf ("%%%%doc ") >> f;
<Prev in Thread] Current Thread [Next in Thread>