-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check *_source.changes if they are valid debian source change files
Without this commit all *.changes files are checked like changelog files With this commit 40-sequence-changes checks if the file is a valid debian source changes file when the filename matches *_source.changes, by searching for all mandatory keywords in the file. If it is a valid debian source changes file, further changelog checks are ommitted Fixes #42
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package DebianSourceChangesValidator; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
sub validate { | ||
my ($fname) = @_; | ||
my @mandatory = qw/Format Date Source Binary Architecture Version Distribution Maintainer Description Changes Checksums-Sha1 Checksums-Sha256 Files/; | ||
my $re = '^('.join('|',@mandatory).'):.*'; | ||
my $result = {}; | ||
|
||
open(my $fh,$fname) || die "Could not open '$fname': $!\n"; | ||
while (my $line = <$fh>) { $line =~ m/$re/ && $result->{$1}++ } | ||
close $fh; | ||
|
||
for my $key (@mandatory) { return 1 if (! $result->{$key} ) } | ||
|
||
return 0 | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
BEGIN { unshift(@::INC,'/usr/lib/obs/service/source_validators/helpers/') } | ||
|
||
use DebianSourceChangesValidator; | ||
|
||
my $ev = DebianSourceChangesValidator::validate($ARGV[0]); | ||
|
||
exit $ev; |
Empty file.