SPECS: template.spec - cleanup backups

Andrzej Krzysztofowicz ankry at green.mif.pg.gda.pl
Tue May 30 23:23:42 CEST 2006


Elan =?utf-8?q?Ruusam=C3=A4e?= wrote:
> On Tuesday 30 May 2006 22:59, Paweł Gołaszewski wrote:
> > > +# you'll need this if you cp -a complete dir in source
> > > +# cleanup backups after patching
> > > +find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512
> > > rm -f
> >
> > Maybe it should be made in every spec? some default rpm-macro?
> > These files (some *.bak, *~ an many more) are not needed almoust always.
> i was thinking maybe it would be possible to hook into %prep macro like 'unset
> DISPLAY' and friends are done. but it needs to be _last_ in %prep section. i
> don't know how to do that.
> 
> otherwise macro would be called how?
> - %clean_junk
> - %remove_unwanted
> - %clean_backups ~ .bak
> 
> also would have useful macro to undos sources
> %undos_sources .php .inc
> 
> here's some samples what kind of cleanups are done in existing specs:
> 
> find -regex '.*\.\(php\|inc\|html\|txt\|js\)$' -print0 | xargs -0 sed -i -e 's,\r$,,'
> find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
> find '(' -name '*.js' -o -name '*.css' -o -name '*.txt' ')' -print0 | xargs -0 sed -i -e 's,\r$,,'
> find '(' -name '*.cpp' -o -name '*.h' ')' -print0 | xargs -0 sed -i -e 's,\r$,,'
> find -regex '.*\.\(php\|inc\|html\|txt\|js\|properties\)$' -print0 | xargs -0 sed -i -e 's,\r$,,'
> find $RPM_BUILD_ROOT%{_sysconfdir} -type f -print0 | xargs -0 perl -pi -e "s#/usr/lib#/usr/%{_lib}#"
> 
> i think the new macro should provide solution for all of them ;)
> altho should be kept mind to keep macro simple otherwise it won't be used...

Be careful for some perl-* CPAN packages.
I remember at least one that attempts to verify checksum for a .orig file.

-- 
=======================================================================
  Andrzej M. Krzysztofowicz                  ankry at mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology


More information about the pld-devel-en mailing list