Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:adrianSuSE
build
queryobs
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File queryobs of Package build
#!/usr/bin/perl -w ################################################################ # # Copyright (c) 2021 SUSE Linux GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program (see the file COPYING); if not, write to the # Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # ################################################################ # obs: repo support BEGIN { unshift @INC, ($::ENV{"BUILD_DIR"} || "/usr/lib/build"); } use strict; use Digest::MD5 (); use File::Path (); use Build ':rpm'; use Build::Options; use PBuild::OBS; my $cachedir = "/var/cache/build"; my $cmd = shift @ARGV; die("please specify a query command\n") unless defined $cmd; if ($cmd eq 'expandpath') { my $options = { 'obs' => ':', 'reverse' => '', }; my ($opts, @args) = Build::Options::parse_options($options, @ARGV); my $obsurl = $opts->{'obs'}; die("please specify a obs url with the --obs option\n") unless $obsurl; $obsurl =~ s/\/$//; for my $url (@args) { die("$url: not a valid obs: repo") unless $url =~ /^obs:\/{1,3}([^\/]+\/[^\/]+)\/?$/; my $prp = $1; $prp =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/sge; my @prps = PBuild::OBS::expand_path($prp, "$obsurl/"); @prps = reverse(@prps) if $opts->{'reverse'}; for (@prps) { s/([\000-\040<>;\"#\?&\+=%[\177-\377])/sprintf("%%%02X",ord($1))/sge; print "obs:/$_\n"; } } exit; } if ($cmd eq 'config') { my $options = { 'obs' => ':', 'reverse' => '', 'noexpand' => '', }; my ($opts, @args) = Build::Options::parse_options($options, @ARGV); my $obsurl = $opts->{'obs'}; die("please specify a obs url with the --obs option\n") unless $obsurl; $obsurl =~ s/\/$//; my @configs; my $distcnt = 0; for my $url (@args) { $distcnt++; my $doexpand = $distcnt == @args && !$opts->{'noexpand'} ? 1 : 0; my ($obsconfigs) = PBuild::OBS::fetch_all_configs($url, { 'obs' => $obsurl }, $doexpand); @$obsconfigs = reverse @$obsconfigs unless $opts->{'reverse'}; push @configs, @$obsconfigs; } my $config = Build::combine_configs(@configs); $config =~ s/\n?$/\n/s if $config ne ''; print $config; exit; } die("unknown query command '$cmd'\n") unless $cmd eq 'repo'; my $options = { 'obs' => ':', 'arch' => ':', 'cachedir' => ':', }; my ($opts, @args) = Build::Options::parse_options($options, @ARGV); my $obsurl = $opts->{'obs'}; die("please specify a obs url with the --obs option\n") unless $obsurl; $obsurl =~ s/\/$//; my $arch = $opts->{'arch'}; die("please specify a scheduler architecture with the --arch option\n") unless $arch; $arch =~ s/:.*//; $cachedir = $opts->{'cachedir'} if $opts->{'cachedir'}; for my $url (@args) { die("$url: not a valid obs: repo") unless $url =~ /^obs:\/{1,3}([^\/]+\/[^\/]+)\/?$/; my $prp = $1; my $repoid = Digest::MD5::md5_hex("$obsurl/build/$prp/$arch"); my $dir = "$cachedir/$repoid"; File::Path::mkpath($dir); my $bins = PBuild::OBS::fetch_repodata($url, $dir, $arch, { 'obs' => $opts->{'obs'} }); @$bins = sort {$a->{'name'} cmp $b->{'name'}} @$bins; for (@$bins) { delete $_->{'filename'}; # just in case delete $_->{'packid'}; # just in case Build::writedeps(\*STDOUT, $_); } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor