SPECS: template.spec - cleanup backups

Elan Ruusamäe glen at delfi.ee
Tue May 30 23:14:12 CEST 2006


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...

> P.S.: sure, it should be detachable :)

-- 
glen


More information about the pld-devel-en mailing list