more checks

This commit is contained in:
Stephan Kulow 2011-11-22 13:55:12 +01:00
parent 57eaa90aa9
commit 90cac6da88
2 changed files with 36 additions and 8 deletions

View File

@ -241,6 +241,8 @@ def _checker_one_request(self, rq, cmd, opts):
os.chdir("/tmp")
shutil.rmtree(dir)
print ret
if ret != 0:
msg = "Output of check script:\n" + output
sys.exit(1)

View File

@ -2,7 +2,8 @@
use File::Basename;
my $dir = $ARGV[0];
my $old = $ARGV[0];
my $dir = $ARGV[1];
my $bname = basename($dir);
if (! -f "$dir/$bname.changes") {
@ -15,16 +16,41 @@ if (! -f "$dir/$bname.spec") {
exit(1);
}
open(SPEC, "grep ^Name: $dir/$bname.spec| head -n 1");
my $line = <SPEC>;
open(SPEC, "$dir/$bname.spec");
my $spec = join("", <SPEC>);
close(SPEC);
chomp $line;
$line =~ s,Name:\s*,,;
if ($bname ne $line) {
print "$bname.spec needs to contain Name: $bname\n";
my $sname = '';
if ($spec =~ m/\nName:\s*(\w+)\s*/) {
$sname = $1;
}
if ($bname ne $sname) {
print "$bname.spec needs to contain Name: $bname, found '$sname'\n";
exit(1);
}
close(SPEC);
if ($spec =~ m/\nVendor:/) {
print "$bname.spec contains a Vendor line, this is forbidden.\n";
exit(1);
}
if (-f "$old/$bname.changes") {
if (!system("cmp -s $old/$bname.changes $dir/$bname.changes")) {
print "$bname.changes didn't change. Please use osc vc\n";
exit(1);
}
}
if ($spec !~ m/\n%changelog\s/) {
print "$bname.spec does not contain a %changelog line. We don't want a changelog in the spec file, but the %changelog section needs to be present\n";
exit(1);
}
if ($spec !~ m/#\s+Copyright\s/) {
print "$bname.spec does not appear to contain a Copyright comment. Please stick to the format\n\n";
print "# Copyright (c) 2011 Stephan Kulow\n\n";
print "or use osc service localrun format_spec_file\n";
}
exit(1) if system("/work/src/bin/check_if_valid_source_dir --batchmode --dest _old $dir < /dev/null 2>&1 | grep -v '##ASK'") != 0;