Finally I found the culprit.. in other occasions I have searched for it but I was not able to find.
Probably the correct google search combination today ;-)
"
The bit that implements %config(noreplace) maps to (from lib/rpmlib.h):
rpmlib.h: RPMFILE_NOREPLACE = (1 << 4), /*!< from %%config(noreplace) */
"
One way to check against a file (eg httpd.conf):
QFILE=/etc/httpd/conf/httpd.conf
BITSET=$(rpm -q --qf '[%{filenames}: %{fileflags}\n]' -f $QFILE | grep "^${QFILE}:" | cut -d ":" -f 2)
RESULT=$(echo $(($BITSET & 16)))
if [ $RESULT -eq 16 ]; then echo "NO replace"; else echo "REPLACE"; fi
For example in RH EL 6.5 with httpd-2.2.22-25.ep6.el6.x86_64 that has in its source rpm a line such as
%config %{_sysconfdir}/httpd/conf/httpd.conf
$ echo $QFILE
/etc/httpd/conf/httpd.conf
$ echo $BITSET
1
$ echo $RESULT
0
$ if [ $RESULT -eq 16 ]; then echo "NO replace"; else echo "REPLACE"; fi
REPLACE
While in Fedora 20 with httpd-2.4.9-2.fc20.x86_64 that comes instead in source rpm with:
%config(noreplace) %{_sysconfdir}/httpd/conf/httpd.conf
[g.cecchi@ope46 ~]$ QFILE=/etc/httpd/conf/httpd.conf
[g.cecchi@ope46 ~]$ BITSET=$(rpm -q --qf '[%{filenames}: %{fileflags}\n]' -f $QFILE | grep "^${QFILE}:" | cut -d ":" -f 2)
[g.cecchi@ope46 ~]$ RESULT=$(echo $(($BITSET & 16)))
[g.cecchi@ope46 ~]$ if [ $RESULT -eq 16 ]; then echo "NO replace"; else echo "REPLACE"; fi
NO replace
[g.cecchi@ope46 ~]$ echo $QFILE
/etc/httpd/conf/httpd.conf
[g.cecchi@ope46 ~]$ echo $BITSET
17
[g.cecchi@ope46 ~]$ echo $RESULT
16
And the thing works querying both the package and the rpm file (eg using in this last case
rpm -q --qf '[%{filenames}: %{fileflags}\n]' -p httpd-2.2.22-25.ep6.el6.x86_64.rpm | grep "^${QFILE}:" | cut -d ":" -f 2
)
Thanks anyway,
Gianluca
-- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org