Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wangyang:branches:OBS:Server:2.10:15.5
obs-server
custom.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File custom.patch of Package obs-server
diff -Nur a/src/api/app/views/layouts/webui2/_footer.html.haml b/src/api/app/views/layouts/webui2/_footer.html.haml --- a/src/api/app/views/layouts/webui2/_footer.html.haml 2023-08-01 21:40:06.000000000 +0800 +++ b/src/api/app/views/layouts/webui2/_footer.html.haml 2024-01-07 15:27:47.834455910 +0800 @@ -42,3 +42,6 @@ is an = succeed '.' do = link_to('openSUSE project', 'http://www.opensuse.org') + .col + %p.text-center + = link_to('浙ICP备2022010568号-2','https://beian.miit.gov.cn/') diff -Nur a/src/api/app/views/webui/repositories/new.html.haml b/src/api/app/views/webui/repositories/new.html.haml --- a/src/api/app/views/webui/repositories/new.html.haml 2023-08-01 21:40:06.000000000 +0800 +++ b/src/api/app/views/webui/repositories/new.html.haml 2024-01-07 15:26:26.434295274 +0800 @@ -29,7 +29,7 @@ %strong Architectures: %br/ - Architecture.available.each do |architecture| - = check_box_tag "architectures[]", architecture.name, true, id: "architecture_#{architecture.name}" + = check_box_tag "architectures[]", architecture.name, false, id: "architecture_#{architecture.name}" = architecture.name %p - button_label = (params[:torepository] ? "Add path to repository #{params[:torepository]}" : "Add repository") diff -Nur a/src/backend/bs_dispatch b/src/backend/bs_dispatch --- a/src/backend/bs_dispatch 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/bs_dispatch 2024-01-07 14:52:19.197034033 +0800 @@ -237,10 +237,14 @@ } sub assignjob { - my ($job, $idlename, $arch) = @_; + my ($job, $idlename, $arch, $constraints) = @_; local *F; BSUtil::printlog("assignjob $arch/$job -> $idlename"); + #BSUtil::printlog("jobs=$constraints->{'hardware'}->{'jobs'}") if $constraints->{'hardware'}->{'jobs'}; + #BSUtil::printlog("disk=".BSDispatcher::Constraints::getmbsize($constraints->{'hardware'}->{'disk'})) if $constraints->{'hardware'}->{'disk'}; + #BSUtil::printlog("memory=".BSDispatcher::Constraints::getmbsize($constraints->{'hardware'}->{'memory'})) if $constraints->{'hardware'}->{'memory'}; + my $jobstatus = { 'code' => 'dispatching', }; @@ -282,6 +286,8 @@ # assign job to worker my @args = ("port=$port", "workercode=$workercode", "buildcode=$buildcode"); push @args, "registerserver=$worker->{'registerserver'}" if $worker->{'registerserver'}; + push @args, "workerid=$worker->{'workerid'}" if $worker->{'workerid'}; + push @args, "jobid=$jobid" if $jobid; my $attempt = 0; if ($badhost{"$info->{'arch'}/$job"}) { my $id = "$info->{'arch'}/$job"; @@ -290,6 +296,9 @@ my $msg = "gave up after $attempt failed build attempts..."; push @args, "nobadhost=$msg" if checkbadhost(@attempts); } + push @args, "jobs=$constraints->{'hardware'}->{'jobs'}" if $constraints->{'hardware'}->{'jobs'}; + push @args, "disk=".BSDispatcher::Constraints::getmbsize($constraints->{'hardware'}->{'disk'}) if $constraints->{'hardware'}->{'disk'}; + push @args, "memory=".BSDispatcher::Constraints::getmbsize($constraints->{'hardware'}->{'memory'}) if $constraints->{'hardware'}->{'memory'}; eval { BSRPC::rpc({ 'uri' => "http://$worker->{'ip'}:$worker->{'port'}/build", @@ -716,7 +725,7 @@ my ($info, $arch, $job, $constraints, $workercache) = @_; my @all_workers; - BSUtil::printlog("checkconstraints $arch/$job"); + #BSUtil::printlog("checkconstraints $arch/$job"); $workercache ||= {}; my $sumworkers = 0; my $downworkers = 0; @@ -1325,7 +1334,7 @@ next; # worker is not supporting the needed personality change } if ($constraints) { - my $ora = BSDispatcher::Constraints::oracle($worker, $constraints); + my $ora = BSDispatcher::Constraints::oracle($worker, $constraints, $info); next unless defined($ora) && $ora > 0; if ($ora < 1) { if ($lastoracleidle && $lastoracleidle eq '__lastoracle') { @@ -1349,7 +1358,7 @@ } last if $assigned && $tries >= 5; $tries++; - my $res = assignjob($job, $idle, $arch); + my $res = assignjob($job, $idle, $arch, $constraints); my $host = $idle; $host =~ s/:\d+$//; if (!$res) { diff -Nur a/src/backend/BSDispatcher/Constraints.pm b/src/backend/BSDispatcher/Constraints.pm --- a/src/backend/BSDispatcher/Constraints.pm 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/BSDispatcher/Constraints.pm 2024-01-07 14:29:40.977858779 +0800 @@ -37,7 +37,7 @@ } else { # we just define xen, kvm and zvm as entirely secure sandboxes atm # chroot, emulator, lxc are currently considered as not safe - $secure_sandboxes{$_} = 1 for qw{xen kvm zvm}; + $secure_sandboxes{$_} = 1 for qw{xen kvm zvm qemu docker}; } =head1 FUNCTIONS / METHODS @@ -75,7 +75,8 @@ =cut sub oracle { - my ($worker, $constraints) = @_; + my ($worker, $constraints) = @_; # $buildinfo + my $sb = 1; for my $l (@{$constraints->{'hostlabel'} || []}) { if ($l->{'exclude'} && $l->{'exclude'} eq 'true') { return 0 if grep {$_ eq $l->{'_content'}} @{$worker->{'hostlabel'} || []}; @@ -85,12 +86,13 @@ } if ($constraints->{'sandbox'} && $constraints->{'sandbox'}->{'_content'}) { if ($constraints->{'sandbox'}->{'exclude'} && $constraints->{'sandbox'}->{'exclude'} eq 'true') { - return 0 if $constraints->{'sandbox'}->{'_content'} eq ($worker->{'sandbox'} || ''); + $sb = 0 if $constraints->{'sandbox'}->{'_content'} eq ($worker->{'sandbox'} || ''); } else { if ($constraints->{'sandbox'}->{'_content'} eq 'secure') { - return 0 unless $secure_sandboxes{$worker->{'sandbox'} || ''}; + $sb = 0 unless $secure_sandboxes{$worker->{'sandbox'} || ''}; } else { - return 0 unless $constraints->{'sandbox'}->{'_content'} eq ($worker->{'sandbox'} || ''); + $sb = 0 unless $constraints->{'sandbox'}->{'_content'} eq ($worker->{'sandbox'} || ''); + $sb = 1 if $constraints->{'sandbox'}->{'_content'} eq ('lxc'); } } } @@ -124,6 +126,12 @@ } } } + if($bi->{'arch'} && $worker->{'hostarch'} eq $bi->{'arch'} && $bi->{'arch'} ne 'riscv64'){ + #BSUtil::printlog("$worker->{'hostarch'}"); + return 1; + }else{ + return $sb; + } return 1; } diff -Nur a/src/backend/bs_repserver b/src/backend/bs_repserver --- a/src/backend/bs_repserver 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/bs_repserver 2024-01-07 14:53:22.083821386 +0800 @@ -2194,14 +2194,14 @@ return $BSStdServer::return_ok; } - # check if worker time is "good enough" - if ($cgi->{'now'} && ($cgi->{'now'} > $now + 3600 || $cgi->{'now'} < $now - 3600)) { - sendbadhostevent($info, $idlename); - updateredisjobstatus($arch, $job, $info); - unlink("$jobsdir/$arch/$job:status"); - close(F); - die("time mismatch\n"); - } + #check if worker time is "good enough" + #if ($cgi->{'now'} && ($cgi->{'now'} > $now + 3600 || $cgi->{'now'} < $now - 3600)) { + # sendbadhostevent($info, $idlename); + # updateredisjobstatus($arch, $job, $info); + # unlink("$jobsdir/$arch/$job:status"); + # close(F); + # die("time mismatch\n"); + #} # now release lock and fetch everything close F; diff -Nur a/src/backend/BSRepServer/ProjPacks.pm b/src/backend/BSRepServer/ProjPacks.pm --- a/src/backend/BSRepServer/ProjPacks.pm 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/BSRepServer/ProjPacks.pm 2024-01-07 14:31:51.714777751 +0800 @@ -126,6 +126,11 @@ sub getconfig { my ($gctx, $projid, $repoid, $arch, $path) = @_; my $extraconfig = ''; + my $pj = $projid; + $pj =~ s/\:/\_/; + $pj =~ s/\./\_/; + my $config = "%define _project $pj\n"; + #my $config = "%define _project $projid\n"; my $config = "%define _project $projid\n"; if ($BSConfig::extraconfig) { for (sort keys %{$BSConfig::extraconfig}) { diff -Nur a/src/backend/BSSched/BuildJob/Package.pm b/src/backend/BSSched/BuildJob/Package.pm --- a/src/backend/BSSched/BuildJob/Package.pm 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/BSSched/BuildJob/Package.pm 2024-01-07 14:41:59.149225057 +0800 @@ -102,7 +102,7 @@ my @blocked = grep {$notready->{$dep2src->{$_}}} @$edeps; @blocked = () if $repo->{'block'} && $repo->{'block'} eq 'never'; # check if cycle builds are in progress - if ($incycle && $incycle == 3) { + if ($incycle && $incycle == 3 && @blocked) { push @blocked, 'cycle' unless @blocked; if ($ctx->{'verbose'}) { print " - $packid ($buildtype)\n"; diff -Nur a/src/backend/BSSched/ProjPacks.pm b/src/backend/BSSched/ProjPacks.pm --- a/src/backend/BSSched/ProjPacks.pm 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/BSSched/ProjPacks.pm 2024-01-07 14:34:56.295133874 +0800 @@ -1364,6 +1364,22 @@ my ($gctx, $projid, $repoid, $arch, $path) = @_; my $extraconfig = ''; my $config = "%define _project $projid\n"; + for my $prp (reverse @$path) { + my ($p, $r) = split('/', $prp, 2); + my $pj = $prp; + my $pi = $p; + $pi =~ s/\:/_/g; + $pi =~ s/\./_/g; + $pi =~ s/-/_/g; + $pj =~ s/\//_/g; + $pj =~ s/\:/_/g; + $pj =~ s/\./_/g; + $pj =~ s/-/_/g; + $config .= "%"."$pi 1\n"; + $config .= "%define $pi 1\n"; + $config .= "%"."$pj 1\n"; + $config .= "%define $pj 1\n"; + } if ($BSConfig::extraconfig) { for (sort keys %{$BSConfig::extraconfig}) { $extraconfig .= $BSConfig::extraconfig->{$_} if $projid =~ /$_/; diff -Nur a/src/backend/bs_srcserver b/src/backend/bs_srcserver --- a/src/backend/bs_srcserver 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/bs_srcserver 2024-01-07 14:54:52.623995371 +0800 @@ -2213,6 +2213,25 @@ $macros .= "%_download_url $BSConfig::repodownload\n" if $BSConfig::repodownload; $macros .= "%_project $projid\n"; + + my $pj = $projid; + my $pi; + for my $prp (reverse @path) { + my ($p, $r) = split('/', $prp, 2); + $pi = $p; + $pj = $prp; + $pi =~ s/\:/_/g; + $pi =~ s/\./_/g; + $pi =~ s/-/_/g; + $pj =~ s/\//_/g; + $pj =~ s/\:/_/g; + $pj =~ s/\./_/g; + $pj =~ s/-/_/g; + $macros .= "%"."$pj 1\n"; + $macros .= "%"."$pi 1\n"; + #$macros .= "%define $pj 1\n"; + } + my $lastr = ''; my $distinfo = "$projid / $repoid"; @@ -2226,6 +2245,15 @@ $macros .= "%_project $projid\n"; } my ($p, $r) = split('/', $prp, 2); + $pi = $p; + $pj = $prp; + $pi =~ s/\:/_/g; + $pi =~ s/\./_/g; + $pi =~ s/-/_/g; + $pj =~ s/\//_/g; + $pj =~ s/\:/_/g; + $pj =~ s/\./_/g; + $pj =~ s/-/_/g; my $c; if (-s "$projectsdir/$p.conf") { $c = readstr("$projectsdir/$p.conf"); @@ -2240,6 +2268,8 @@ next unless defined $c; $config .= "\n### from $p\n"; $config .= "%define _repository $r\n"; + $config .= "%define $pj 1\n"; + $config .= "%define $pi 1\n"; if ($c =~ /^\s*:macros\s*$/im) { # probably some multiple macro sections with %if statements diff -Nur a/src/backend/bs_worker b/src/backend/bs_worker --- a/src/backend/bs_worker 2023-08-01 21:40:06.000000000 +0800 +++ b/src/backend/bs_worker 2024-01-07 15:01:55.998140331 +0800 @@ -99,6 +99,7 @@ my $getbinariesproxy; my $hardstatus; +my $jobs_max; my $jobs; my $threads; my $cachedir; @@ -450,7 +451,7 @@ $testmode = 1; next; } - if ($ARGV[0] =~ /^--(kvm|xen|lxc|emulator|zvm|docker|pvm|openstack)$/) { + if ($ARGV[0] =~ /^--(kvm|xen|lxc|emulator|zvm|docker|pvm|openstack|qemu)$/) { $vm = $1; shift @ARGV; next; @@ -589,6 +590,7 @@ if ($ARGV[0] eq '--jobs') { shift @ARGV; $jobs = shift @ARGV; + $jobs_max = $jobs; next; } if ($ARGV[0] eq '--threads') { @@ -954,7 +956,7 @@ if ($dir eq 'worker') { symlink('.', "$ndir/XML") || die("symlink: $!\n"); chmod(0755, "$ndir/bs_worker"); - die("bs_worker selftest failed\n") if system("cd $ndir && ./bs_worker --selftest"); + die("bs_worker selftest failed\n") if system("cd $ndir && perl ./bs_worker --selftest"); } elsif ($dir eq 'build') { symlink('.', "$ndir/Date") || die("symlink: $!\n"); symlink('.', "$ndir/Time") || die("symlink: $!\n"); @@ -1013,16 +1015,16 @@ my $errors = readstr("$dir/.errors", 1); die("getsources: $errors"); } - # verify sources - my %res = map {$_->{'name'} => $_} @$res; - my $md5 = ''; - my @f = ls($dir); - for my $f (sort @f) { - die("unexpected file: $f") unless $res{$f}; - $md5 .= "$res{$f}->{'md5'} $f\n"; - } - $md5 = Digest::MD5::md5_hex($md5); - die("source verification fails: $md5 != $buildinfo->{'verifymd5'}\n") if $md5 ne $buildinfo->{'verifymd5'}; + ## verify sources + #my %res = map {$_->{'name'} => $_} @$res; + #my $md5 = ''; + #my @f = ls($dir); + #for my $f (sort @f) { + # die("unexpected file: $f") unless $res{$f}; + # $md5 .= "$res{$f}->{'md5'} $f\n"; + #} + #$md5 = Digest::MD5::md5_hex($md5); + #die("source verification fails: $md5 != $buildinfo->{'verifymd5'}\n") if $md5 ne $buildinfo->{'verifymd5'}; return @meta unless $buildinfo->{'file'} =~ /\.kiwi$/; @@ -3084,6 +3086,7 @@ patchproductkiwi($buildinfo, "$srcdir/$buildinfo->{'file'}", \@meta); } + push @args, "perl"; push @args, "$statedir/build/build"; if ($vm =~ /(xen|kvm|qemu|zvm|emulator|pvm)/) { mkdir("$buildroot/.mount") unless -d "$buildroot/.mount"; @@ -3461,6 +3464,10 @@ sub startbuild { my ($cgi, $jobid) = @_; + $vm_memory = $cgi->{'memory'} ? $cgi->{'memory'} : 2048; + $vmdisk_rootsize = $cgi->{'disk'} ? $cgi->{'disk'} : 20480; + $jobs = $cgi->{'jobs'} ? $cgi->{'jobs'} : $jobs_max; + print "memory=$vm_memory,disk=$vmdisk_rootsize,jobs=$jobs\n"; if ($vm eq 'xen' && $xenstore_maxsize && 0 + (-s '/var/lib/xenstored/tdb') > $xenstore_maxsize) { die("xenstore too big:".(-s '/var/lib/xenstored/tdb')."\n"); } @@ -3471,7 +3478,7 @@ my $req = $BSServer::request; if ($cgi->{'workercode'} && $cgi->{'port'} && $cgi->{'workercode'} ne $workercode && !$noworkercheck) { unlink("job.new.$$"); - my $peer = "$req->{'peer'}:$cgi->{'port'}"; + my $peer = $cgi->{'registerserver'} || "$req->{'peer'}:$cgi->{'port'}"; $workercode = getcode('worker', "http://$peer/getworkercode"); die("could not update worker code\n") unless $workercode; $state->{'state'} = 'rebooting'; @@ -3502,7 +3509,7 @@ $buildcode = codemd5('build'); if (!$nobuildcodecheck && $cgi->{'buildcode'} && $cgi->{'port'} && $cgi->{'buildcode'} ne $buildcode) { print "fetching new buildcode $cgi->{'buildcode'}, mine was $buildcode\n"; - my $peer = "$req->{'peer'}:$cgi->{'port'}"; + my $peer = $cgi->{'registerserver'} || "$req->{'peer'}:$cgi->{'port'}"; $buildcode = getcode('build', "http://$peer/getbuildcode"); die("could not update build code\n") unless $buildcode; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor