Mailinglist Archive: opensuse-buildservice (332 mails)

< Previous Next >
[opensuse-buildservice] rfc/patch: localmacros section in prjconf
  • From: Jan Engelhardt <jengelh@xxxxxxxxxx>
  • Date: Thu, 8 Jul 2010 20:18:18 +0200 (CEST)
  • Message-id: <alpine.LSU.2.01.1007082017440.13622@xxxxxxxxxxxxxxx>

Setting %_vendor in a prjconf affects all children projects (prjs
that link to/use it for building). The new localmacros section allows
to set macros without this side effect, so that childprjs get the
obs://server/project name as %_vendor.

# against bs_srcserver 2.0.1
--- bs_srcserver~ 2010-06-20 11:10:55.594135181 +0200
+++ bs_srcserver 2010-06-30 09:19:34.033798507 +0200
@@ -2569,6 +2569,7 @@ sub getconfig {
# unshift @path, "$projid/$repoid" unless @path && $path[0] eq
"$projid/$repoid";
}
my $config = "%define _project $projid\n";
+ my $local_macros;
my $macros = '';

#$macros .= "%vendor openSUSE Build Service\n";
@@ -2594,6 +2595,7 @@ sub getconfig {

for my $prp (reverse @path) {
if ($prp eq "$projid/$repoid") {
+ $macros .= "### automacros from $projid\n";
$macros .= "\n%distribution $distinfo\n";
$macros .= "%_project $projid\n";
}
@@ -2606,11 +2608,17 @@ sub getconfig {
$c = fetchremoteconfig($proj, $p);
}
next unless defined $c;
- $config .= "\n### from $p\n";
+ $config .= "\n### config from $p\n";
$config .= "%define _repository $r\n";
+ if ($c =~ /^(.*\n)?\s*localmacros:[^\n]*\n(.*)/si) {
+ $c = $1;
+ if ($p ne $projid) {
+ $local_macros = $2;
+ }
+ }
if ($c =~ /^(.*\n)?\s*macros:[^\n]*\n(.*)/si) {
$c = defined($1) ? $1 : '';
- $macros .= "\n### from $p\n";
+ $macros .= "\n### macros from $p\n";
$macros .= "%_repository $r\n";
$macros .= $2;
$lastr = $r;
@@ -2630,6 +2638,10 @@ sub getconfig {
$macros .= $BSConfig::extramacros->{$_} if $projid =~ /$_/;
}
}
+ if (defined($local_macros)) {
+ $macros .= "\n### localmacros from $projid\n";
+ $macros .= $local_macros;
+ }
$config .= "\nMacros:\n$macros" if $macros ne '';
return ($config, 'Content-Type: text/plain');
}
@@ -2720,7 +2732,14 @@ sub getfilelist_ajax {
'uri' => "$jev->{'remoteurl'}/source/$jev->{'remoteproject'}/$packid",
'proxy' => $proxy,
};
- $jev->{'filelist'} = BSWatcher::rpc($param, $BSXML::dir, "rev=$rev");
+ eval {
+ $jev->{'filelist'} = BSWatcher::rpc($param, $BSXML::dir, "rev=$rev");
+ };
+ if ($@) {
+ my $err = $@;
+ notify_repservers('package', $projid, $packid);
+ die($err);
+ }
return undef unless $jev->{'filelist'};
$jev = detach($BSStdServer::return_ok);
$jev->{'idstring'} = "$projid/$packid/$rev";
@@ -2732,6 +2751,7 @@ sub getfilelist_ajax {
for my $entry (@{$dir->{'entry'} || []}) {
next if -e "$srcrep/$packid/$entry->{'md5'}-$entry->{'name'}";
$serial ||= BSWatcher::serialize("$jev->{'remoteurl'}/source");
+ return undef unless $serial;
mkdir_p($uploaddir);
my $param = {
'uri' =>
"$jev->{'remoteurl'}/source/$jev->{'remoteproject'}/$packid/$entry->{'name'}",
@@ -2740,7 +2760,17 @@ sub getfilelist_ajax {
'receiver' => \&BSHTTP::file_receiver,
'proxy' => $proxy,
};
- my $res = BSWatcher::rpc($param, undef, "rev=$cgi->{'rev'}");
+ my $res;
+ eval {
+ $res = BSWatcher::rpc($param, undef, "rev=$cgi->{'rev'}");
+ };
+ if ($@) {
+ # notify scheduler that the download failed
+ my $err = $@;
+ BSWatcher::serialize_end($serial) if $serial;
+ notify_repservers('package', $projid, $packid);
+ die($err);
+ }
return undef unless $res;
die("file download failed\n") unless $res && $res->{'md5'} eq
$entry->{'md5'};
die unless -e "$uploaddir/$$-$jev->{'id'}";


--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages