Skip to content

Commit

Permalink
[backend] support BSXML::frozenlinks, add verifyer
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Jan 13, 2014
1 parent 9a25cf0 commit 5f58644
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 69 deletions.
20 changes: 18 additions & 2 deletions src/backend/BSVerify.pm
Expand Up @@ -421,7 +421,7 @@ sub verify_nevraquery {
}

sub verify_attribute {
my $attribute = $_;
my ($attribute) = @_;
die("no namespace defined\n") unless $attribute->{'namespace'};
die("no name defined\n") unless $attribute->{'name'};
verify_simple($attribute->{'namespace'});
Expand All @@ -433,12 +433,28 @@ sub verify_attribute {
}

sub verify_attributes {
my $attributes = $_;
my ($attributes) = @_;
for my $attribute (@{$attributes || []}) {
verify_attribute($attribute);
}
}

sub verify_frozenlinks {
my ($frozenlinks) = @_;
my %seen;
for my $fp (@{$frozenlinks->{'frozenlink'} || []}) {
my $xp = exists($fp->{'project'}) ? $fp->{'project'} : '/all';
verify_projid($fp->{'project'}) if exists $fp->{'project'};
die("project listed multiple times in frozenlinks\n") if $seen{$xp} || $seen{'/all'};
$seen{$xp} = 1;
for my $p (@{$fp->{'package'} || []}) {
verify_packid($p->{'name'});
verify_srcmd5($p->{'srcmd5'});
verify_simple($p->{'vrev'}) if defined $p->{'vrev'};
}
}
}

our $verifyers = {
'project' => \&verify_projid,
'package' => \&verify_packid,
Expand Down
146 changes: 79 additions & 67 deletions src/backend/BSXML.pm
Expand Up @@ -1538,94 +1538,94 @@ our $attribute = [
'name',
'binary',
[ 'value' ],
[[ 'issue' =>
'name',
'tracker'
]],
[[ 'issue' =>
'name',
'tracker'
]],
];

our $attributes = [
'attributes' =>
'attributes' =>
[ $attribute ],
];

our $size = [
'size' =>
'unit',
[],
'_content',
'size' =>
'unit',
[],
'_content',
];

our $time = [
'time' =>
'unit',
[],
'_content',
'time' =>
'unit',
[],
'_content',
];

# define constraints for build jobs in packages or projects.
our $constraints = [
'constraints' =>
[],
[[ 'hostlabel' =>
'exclude', # true or false. default is false.
[],
'_content' # workers might get labels defined by admin, for example for benchmarking.
]],
[ 'sandbox' =>
'exclude', # true or false. default is false.
[],
'_content' # xen/kvm/zvm/lxc/emulator/chroot/secure
],
[ 'linux' =>
[ 'version' =>
'constraints' =>
[],
[[ 'hostlabel' =>
'exclude', # true or false. default is false.
[],
'max' ,
'min' ,
'_content' # workers might get labels defined by admin, for example for benchmarking.
]],
[ 'sandbox' =>
'exclude', # true or false. default is false.
[],
'_content' # xen/kvm/zvm/lxc/emulator/chroot/secure
],
'flavor',
],
[ 'hardware' =>
[ 'cpu' =>
[ 'flag' ],
[ 'linux' =>
[ 'version' =>
[],
'max' ,
'min' ,
],
'flavor',
],
[ 'hardware' =>
[ 'cpu' =>
[ 'flag' ],
],
'processors',
[ 'disk' => $size ],
[ 'memory' => $size ],
[ 'physicalmemory' => $size ],
],
'processors',
[ 'disk' => $size ],
[ 'memory' => $size ],
[ 'physicalmemory' => $size ],
],
];

our $buildstatistics = [
'buildstatistics' =>
[ 'disk' =>
[ 'usage' =>
[ 'size' =>
'unit',
[],
'_content',
],
'io_requests',
'io_sectors',
],
],
[ 'memory' =>
[ 'usage' => $size ],
],
[ 'times' =>
[ 'total' => $time ],
[ 'preinstall' => $time ],
[ 'install' => $time ],
[ 'main' => $time ],
[ 'download' => $time ],
],
[ 'download' =>
[],
$size,
'binaries',
'cachehits',
'preinstallimage',
],
[ 'disk' =>
[ 'usage' =>
[ 'size' =>
'unit',
[],
'_content',
],
'io_requests',
'io_sectors',
],
],
[ 'memory' =>
[ 'usage' => $size ],
],
[ 'times' =>
[ 'total' => $time ],
[ 'preinstall' => $time ],
[ 'install' => $time ],
[ 'main' => $time ],
[ 'download' => $time ],
],
[ 'download' =>
[],
$size,
'binaries',
'cachehits',
'preinstallimage',
],
];

our $notifications = [
Expand All @@ -1642,4 +1642,16 @@ our $notifications = [
]],
];

our $frozenlinks = [
'frozenlinks' =>
[[ 'frozenlink' =>
'project',
[[ 'package' =>
'name',
'srcmd5',
'vrev',
]],
]],
];

1;

0 comments on commit 5f58644

Please sign in to comment.