Am Mittwoch, 21. September 2011, 14:03:33 schrieb Ruediger Oertel:
On Tuesday 20 September 2011 22:51:16 Jan Engelhardt wrote:
On Tuesday 2011-09-20 13:37, Stephan Kulow wrote:
Well, the simple things should be integrated into the format_spec thingy - either based on the current perl script or a stripped down spec-cleaner.
That should work..
well, this way you would make probably 80+ % of the specfiles in factory fail to pass the normal checks. Wouln'd it make more sense for at least the one-liner things below to fix it automatically in the spec-file formatter ?
Or we could just warn in first step without aborting. So users of osc would see it (and we could turn this into an error later on).
I'm simply afraid if we make all packages fail this way, developers will simply be annoyed and start ignoring/workarounding these checks instead of just fixing the specfile (which we could do automatically anyway).
I'm completely fine with such a script for the more questionable places like the "Authors" or "jobs" tasks, but on the other hand if we don't plan to fail these, I guess this could just as well live inside rpmlint, AFAIR it has some tests that run on the specfile anyway.
IMHO such thing are better handled in source-validator so there is no need to re-run entire builds just to fix it.
## /usr/lib/osc/source_validators/10-the-way-of-the-dodo #!/bin/bash
DIR_TO_CHECK="$1" if [[ -z "$DIR_TO_CHECK" ]]; then
DIR_TO_CHECK="$PWD";
fi; for i in "$DIR_TO_CHECK"/*.spec; do
if [[ ! -f "$i" ]]; then
continue;
fi; if pcregrep -iq '^autoreqprov\s*:\s*(?!off)(?!no)' "$i"; then
echo "*** $i: Undesired AutoReqProv tag"; fail=1;
fi; if pcregrep -iq '^#\*snorootforbuild' "$i"; then
echo "*** $i: Undesired norootforbuild tag"; fail=1;
fi; if pcregrep -iq '^#\*suseforbuild' "$i"; then
echo "*** $i: Undesired useforbuild tag"; fail=1;
fi; if pcregrep -iq '^Author(\(?s\))?:?' "$i"; then
echo "*** $i: Author list no longer desired"; # don't fail, could be false positive
fi; if pcregrep -q '^%clean\b' "$i"; then
echo "*** $i: %clean section no longer required"; fail=1;
fi; if pcregrep -q '%{\?jobs:\s*-j\s*%{?jobs}?}' "$i"; then
echo "*** $i: Consider replacing %{?jobs:-j%jobs} by %{?_smp_mflags} if possible."; # Don't fail; things like scons can also be told the number of # jobs, but naturally, scons does not know make's other options.
fi;
done; if [[ "$fail" -ne "" ]]; then
echo "*** Please see http://en.opensuse.org/openSUSE:Specfile_guidelines for details."; exit 1;
fi;h -- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de