From b6085c259fa28111019ab7914cfd753ed679305f Mon Sep 17 00:00:00 2001 From: Jan Vcelak Date: Tue, 25 Oct 2011 19:42:43 +0200 Subject: [PATCH] specfile: clean %files, drop defattr macros - %defattr is not needed since Fedora 14 - permissions are taken from installed files (removed chmod and added install where possible) - %attr was left only on places, where non-root owner is needed - removed slashes between: %{buildroot}%{_somedir} - files reordered by type - merged "%dir dir" and "dir/files*" --- openldap.spec | 140 ++++++++++++++++++++++++-------------------------- 1 file changed, 66 insertions(+), 74 deletions(-) diff --git a/openldap.spec b/openldap.spec index b2a03c6..dc47e03 100644 --- a/openldap.spec +++ b/openldap.spec @@ -282,7 +282,7 @@ rm -rf %{buildroot} libtool='%{_bindir}/libtool' export tagname=CC -mkdir -p %{buildroot}/%{_libdir}/ +mkdir -p %{buildroot}%{_libdir}/ # install servers pushd openldap-%{version}/build-servers @@ -300,7 +300,7 @@ make install DESTDIR=%{buildroot} \ LIBTOOL="$libtool" \ STRIP="" install -m 644 %SOURCE100 \ - %{buildroot}/%{evolution_connector_prefix}/ + %{buildroot}%{evolution_connector_prefix}/ popd # install clients @@ -316,67 +316,72 @@ mkdir -p %{buildroot}%{_sysconfdir}/openldap/cacerts mkdir -p %{buildroot}%{_sysconfdir}/pki/tls/certs # setup data and runtime directories -mkdir -p %{buildroot}/var/lib/ldap +mkdir -p %{buildroot}%{_sharedstatedir} +mkdir -p %{buildroot}%{_localstatedir} +install -m 0700 -d %{buildroot}%{_sharedstatedir}/ldap +install -m 0755 -d %{buildroot}%{_localstatedir}/run/openldap # setup autocreation of runtime directories on tmpfs mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d -install -m 644 %SOURCE3 %{buildroot}%{_sysconfdir}/tmpfiles.d/slapd.conf +install -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/tmpfiles.d/slapd.conf # setup maintainance scripts -mkdir -p %{buildroot}%{_libexecdir}/slapd +mkdir -p %{buildroot}%{_libexecdir} +install -m 0755 -d %{buildroot}%{_libexecdir}/slapd install -m 0644 %SOURCE50 %{buildroot}%{_libexecdir}/slapd/functions install -m 0755 %SOURCE51 %{buildroot}%{_libexecdir}/slapd/convert-config.sh install -m 0755 %SOURCE52 %{buildroot}%{_libexecdir}/slapd/check-config.sh install -m 0755 %SOURCE53 %{buildroot}%{_libexecdir}/slapd/upgrade-db.sh # remove build root from config files and manual pages -perl -pi -e "s|%{buildroot}||g" %{buildroot}/%{_sysconfdir}/openldap/*.conf +perl -pi -e "s|%{buildroot}||g" %{buildroot}%{_sysconfdir}/openldap/*.conf perl -pi -e "s|%{buildroot}||g" %{buildroot}%{_mandir}/*/*.* # we don't need the default files -- RPM handles changes -rm -f %{buildroot}/%{_sysconfdir}/openldap/*.default -rm -f %{buildroot}/%{_sysconfdir}/openldap/schema/*.default +rm -f %{buildroot}%{_sysconfdir}/openldap/*.default +rm -f %{buildroot}%{_sysconfdir}/openldap/schema/*.default # install an init script for the servers mkdir -p %{buildroot}%{_unitdir} -install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/ +install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/slapd.service # install syconfig/ldap mkdir -p %{buildroot}%{_sysconfdir}/sysconfig install -m 644 %SOURCE2 %{buildroot}%{_sysconfdir}/sysconfig/slapd # move slapd out of _libdir -mv %{buildroot}/%{_libdir}/slapd %{buildroot}/%{_sbindir}/ +mv %{buildroot}%{_libdir}/slapd %{buildroot}%{_sbindir}/ # setup tools as symlinks to slapd -rm -f %{buildroot}/%{_sbindir}/slap{acl,add,auth,cat,dn,index,passwd,test,schema} -rm -f %{buildroot}/%{_libdir}/slap{acl,add,auth,cat,dn,index,passwd,test,schema} -for X in acl add auth cat dn index passwd test schema; do ln -s slapd %{buildroot}/%{_sbindir}/slap$X ; done +rm -f %{buildroot}%{_sbindir}/slap{acl,add,auth,cat,dn,index,passwd,test,schema} +rm -f %{buildroot}%{_libdir}/slap{acl,add,auth,cat,dn,index,passwd,test,schema} +for X in acl add auth cat dn index passwd test schema; do ln -s slapd %{buildroot}%{_sbindir}/slap$X ; done # tweak permissions on the libraries to make sure they're correct -chmod 755 %{buildroot}/%{_libdir}/lib*.so* -chmod 644 %{buildroot}/%{_libdir}/lib*.*a +chmod 0755 %{buildroot}%{_libdir}/lib*.so* +chmod 0644 %{buildroot}%{_libdir}/lib*.*a # slapd.conf(5) is obsoleted since 2.3, see slapd-config(5) -# new configuration will be generated in %post -mkdir -p %{buildroot}/%{_datadir}/openldap-servers -mkdir %{buildroot}/%{_sysconfdir}/openldap/slapd.d -rm -f %{buildroot}/%{_sysconfdir}/openldap/slapd.conf -install -m 644 %SOURCE4 %{buildroot}/%{_datadir}/openldap-servers/slapd.conf.obsolete +# new configuration will be generated in %%post +mkdir -p %{buildroot}%{_datadir} +install -m 0755 -d %{buildroot}%{_datadir}/openldap-servers +install -m 0644 %SOURCE4 %{buildroot}%{_datadir}/openldap-servers/slapd.conf.obsolete +install -m 0700 -d %{buildroot}%{_sysconfdir}/openldap/slapd.d +rm -f %{buildroot}%{_sysconfdir}/openldap/slapd.conf # move doc files out of _sysconfdir mv %{buildroot}%{_sysconfdir}/openldap/schema/README README.schema -mv %{buildroot}%{_sysconfdir}/openldap/DB_CONFIG.example %{buildroot}/%{_datadir}/openldap-servers/DB_CONFIG.example +mv %{buildroot}%{_sysconfdir}/openldap/DB_CONFIG.example %{buildroot}%{_datadir}/openldap-servers/DB_CONFIG.example chmod 0644 openldap-%{version}/servers/slapd/back-sql/rdbms_depend/timesten/*.sh -chmod 0644 %{buildroot}/%{_datadir}/openldap-servers/DB_CONFIG.example +chmod 0644 %{buildroot}%{_datadir}/openldap-servers/DB_CONFIG.example # remove files which we don't want packaged -rm -f %{buildroot}/%{_libdir}/*.la -rm -f %{buildroot}/%{_libdir}/*.a -rm -f %{buildroot}/%{evolution_connector_libdir}/*.la -rm -f %{buildroot}/%{evolution_connector_libdir}/*.so* -rm -f %{buildroot}/%{_libdir}/openldap/*.a -rm -f %{buildroot}/%{_libdir}/openldap/*.so +rm -f %{buildroot}%{_libdir}/*.la +rm -f %{buildroot}%{_libdir}/*.a +rm -f %{buildroot}%{evolution_connector_libdir}/*.la +rm -f %{buildroot}%{evolution_connector_libdir}/*.so* +rm -f %{buildroot}%{_libdir}/openldap/*.a +rm -f %{buildroot}%{_libdir}/openldap/*.so rm -f %{buildroot}%{_localstatedir}/openldap-data/DB_CONFIG.example rmdir %{buildroot}%{_localstatedir}/openldap-data @@ -540,73 +545,60 @@ exit 0 %files -%defattr(-,root,root) %doc openldap-%{version}/ANNOUNCEMENT %doc openldap-%{version}/CHANGES %doc openldap-%{version}/COPYRIGHT %doc openldap-%{version}/LICENSE %doc openldap-%{version}/README -%attr(0755,root,root) %dir %{_sysconfdir}/openldap -%attr(0755,root,root) %dir %{_sysconfdir}/openldap/cacerts -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/ldap*.conf -%attr(0755,root,root) %{_libdir}/liblber-2.4*.so.* -%attr(0755,root,root) %{_libdir}/libldap-2.4*.so.* -%attr(0755,root,root) %{_libdir}/libldap_r-2.4*.so.* -%attr(0644,root,root) %{_mandir}/man5/ldif.5* -%attr(0644,root,root) %{_mandir}/man5/ldap.conf.5* +%dir %{_sysconfdir}/openldap +%dir %{_sysconfdir}/openldap/cacerts +%config(noreplace) %{_sysconfdir}/openldap/ldap.conf +%{_libdir}/liblber-2.4*.so.* +%{_libdir}/libldap-2.4*.so.* +%{_libdir}/libldap_r-2.4*.so.* +%{_mandir}/man5/ldif.5* +%{_mandir}/man5/ldap.conf.5* %files servers -%defattr(-,root,root) %doc openldap-%{version}/contrib/slapd-modules/smbk5pwd/README.smbk5pwd %doc openldap-%{version}/doc/guide/admin/*.html %doc openldap-%{version}/doc/guide/admin/*.png %doc README.schema -%attr(0640,root,ldap) %ghost %config(noreplace) %{_sysconfdir}/pki/tls/certs/slapd.pem -%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/slapd -%attr(0750,ldap,ldap) %dir %config(noreplace) %{_sysconfdir}/openldap/slapd.d -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/ldap -%attr(0755,root,root) %dir %config(noreplace) %{_sysconfdir}/openldap/schema -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/schema/*.schema* -%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/openldap/schema/*.ldif -%attr(0755,root,root) %{_sbindir}/sl* -%attr(0644,root,root) %{_mandir}/man8/* -%attr(0644,root,root) %{_mandir}/man5/slapd*.5* -%attr(0644,root,root) %{_mandir}/man5/slapo-*.5* -%attr(0700,ldap,ldap) %dir /var/lib/ldap -%attr(0755,ldap,ldap) %dir /var/run/openldap -%{_sysconfdir}/tmpfiles.d -%attr(0755,root,root) %dir %{_libdir}/openldap -%attr(0755,root,root) %{_libdir}/openldap/[^b]* -%attr(0755,root,root) %dir %{_datadir}/openldap-servers -%attr(0644,root,root) %{_datadir}/openldap-servers/* +%config(noreplace) %dir %attr(0750,ldap,ldap) %{_sysconfdir}/openldap/slapd.d +%config(noreplace) %{_sysconfdir}/openldap/schema +%config(noreplace) %{_sysconfdir}/sysconfig/slapd +%config(noreplace) %{_sysconfdir}/tmpfiles.d/slapd.conf +%config(noreplace) %ghost %attr(0640,root,ldap) %{_sysconfdir}/pki/tls/certs/slapd.pem +%dir %attr(0700,ldap,ldap) %{_sharedstatedir}/ldap +%dir %attr(-,ldap,ldap) %{_localstatedir}/run/openldap +%{_unitdir}/slapd.service +%{_datadir}/openldap-servers/ +%{_libdir}/openldap/[^b]* +%{_libexecdir}/slapd/ +%{_sbindir}/sl* +%{_mandir}/man8/* +%{_mandir}/man5/slapd*.5* +%{_mandir}/man5/slapo-*.5* # obsolete configuration -%attr(0640,ldap,ldap) %ghost %config(noreplace,missingok) %{_sysconfdir}/openldap/slapd.conf -%attr(0640,ldap,ldap) %ghost %config(noreplace,missingok) %{_sysconfdir}/openldap/slapd.conf.bak +%ghost %config(noreplace,missingok) %attr(0640,ldap,ldap) %{_sysconfdir}/openldap/slapd.conf +%ghost %config(noreplace,missingok) %attr(0640,ldap,ldap) %{_sysconfdir}/openldap/slapd.conf.bak %files servers-sql -%defattr(-,root,root) %doc openldap-%{version}/servers/slapd/back-sql/docs/* %doc openldap-%{version}/servers/slapd/back-sql/rdbms_depend -%attr(0755,root,root) %{_libdir}/openldap/back_sql*.so.* -%attr(0755,root,root) %{_libdir}/openldap/back_sql.la +%{_libdir}/openldap/back_sql*.so.* +%{_libdir}/openldap/back_sql.la %files clients -%defattr(-,root,root) -%attr(0755,root,root) %{_bindir}/* -%attr(0644,root,root) %{_mandir}/man1/* +%{_bindir}/* +%{_mandir}/man1/* %files devel -%defattr(-,root,root) %doc openldap-%{version}/doc/drafts openldap-%{version}/doc/rfc -%attr(0755,root,root) %{_libdir}/libl*.so -%attr(0644,root,root) %{_includedir}/* -%attr(0644,root,root) %{_mandir}/man3/* -%attr(0755,root,root) %dir %{evolution_connector_prefix} -%attr(0644,root,root) %{evolution_connector_prefix}/README* -%attr(0755,root,root) %dir %{evolution_connector_includedir} -%attr(0644,root,root) %{evolution_connector_includedir}/*.h -%attr(0755,root,root) %dir %{evolution_connector_libdir} -%attr(0644,root,root) %{evolution_connector_libdir}/*.a +%{_libdir}/libl*.so +%{_includedir}/* +%{_mandir}/man3/* +%{evolution_connector_prefix}/ %changelog * Thu Oct 06 2011 Jan Vcelak 2.4.26-5