From 55fb50fc9669acb3dc6bb61f61969336b3e31b6a Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 22 Nov 2011 14:36:27 +0100 Subject: [PATCH] check download_files --- osc-checker.py | 4 +--- source-checker.pl | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/osc-checker.py b/osc-checker.py index 034e1b25..39b89710 100644 --- a/osc-checker.py +++ b/osc-checker.py @@ -239,9 +239,7 @@ def _checker_one_request(self, rq, cmd, opts): checked = p.stdout.readlines() output = ' '.join(checked).translate(None, '\033') os.chdir("/tmp") - shutil.rmtree(dir) - - print ret + #shutil.rmtree(dir) if ret != 0: msg = "Output of check script:\n" + output diff --git a/source-checker.pl b/source-checker.pl index d6f8a761..2343d1bc 100644 --- a/source-checker.pl +++ b/source-checker.pl @@ -1,6 +1,7 @@ #! /usr/bin/perl use File::Basename; +use File::Temp qw/ :mktemp /; my $old = $ARGV[0]; my $dir = $ARGV[1]; @@ -20,7 +21,7 @@ open(SPEC, "$dir/$bname.spec"); my $spec = join("", ); close(SPEC); my $sname = ''; -if ($spec =~ m/\nName:\s*(\w+)\s*/) { +if ($spec =~ m/\nName:\s*(\S+)\s*/) { $sname = $1; } @@ -50,7 +51,21 @@ 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 ($spec !~ m/(#[^\n]*license)/i) { + print "$bname.spec does not appear to have a license, the file needs to contain a free software license\n"; + print "Suggestion: use `osc service localrun format_spec_file` to get our default license or\n"; + print "the minimal license:\n\n"; + print "# This file is under MIT license\n"; + exit(1); +} + +my $odir = getcwd; +chdir($dir); +my $tmpdir = mkdtemp("/tmp/obs-XXXXXXX"); +exit(1) if system("/usr/lib/obs/service/download_files","--enforceupstream","--enforcelocal","--outdir", $tmpdir) != 0; +chdir($odir); + exit(1) if system("/work/src/bin/check_if_valid_source_dir --batchmode --dest _old $dir < /dev/null 2>&1 | grep -v '##ASK'") != 0; -