#!/usr/bin/perl -w # SPDX-License-Identifier: AGPL-3.0-or-later # 2011-2015 by Bernhard M. Wiedemann use strict; use CGI; my @distris=("openSUSE Tumbleweed", "openSUSE Factory", "openSUSE Leap 15.6", "openSUSE Leap 15.5", "openSUSE Leap 15.4", "openSUSE Leap 15.3", "SLE 12", "SLE 15", "SLE 15 SP3"); #my @distris=("openSUSE Tumbleweed", "openSUSE Factory", "openSUSE Leap 15.5", "openSUSE Leap 15.4", "openSUSE Leap 15.3", "openSUSE Leap 15.2", "openSUSE Leap 15.1", "openSUSE Leap 15.0", "openSUSE Leap 42.3", "openSUSE Leap 42.2", "openSUSE Leap 42.1", "openSUSE 13.2", "openSUSE 13.1", "openSUSE 12.3", "openSUSE 12.2", "openSUSE 12.1", "openSUSE 11.4", "openSUSE 11.3", "openSUSE 11.2", "openSUSE 11.1", "SLE 11 SP4", "SLE 12", "SLE 15", "SLE 15 SP3"); our $factoryregexp="openSUSE_Factory"; sub guessurl($$) { my($baserepo, $v)=@_; if($baserepo=~m/distribution/) { $v=~s{openSUSE_([0-9.]+)}{$1/repo/oss}; if($v=~s{$factoryregexp}{}) { $baserepo=~s{distribution/}{tumbleweed/repo/oss}; } } return "$baserepo$v/"; } sub groupblock($$$) { my ($pkgname, $url, $distver)=@_; my $dv=qq( distversion="$distver"); $url =~ s/openSUSE_Leap_15.[3-9]/\$releasever/; $url =~ s/15\.[0-9]/\$releasever/; $dv="" if $distver =~ m/openSUSE Factory|Tumbleweed/; # make Factory the default because versions are updated many times a week my $repo=qq( reponame-$pkgname $url rpm-md ); qq( $repo $pkgname ) } sub resultxml($) { my $groups=shift; } our $q=CGI->new; if($q->param("src")) { open(my $f, "<", $0) or die; print $q->header("text/plain"),<$f>; exit 0; } my $pkgname=$ENV{PATH_INFO}; my $baserepo=$q->param("base"); if(!$baserepo && $pkgname=~s{^/([a-zA-Z0-9:._-]+)/}{}) { $baserepo=$1; } $pkgname=~s/[^a-zA-Z0-9._-]//g; # sanitize $pkgname||=$q->param("pkg")||""; $pkgname=~s/[^a-zA-Z0-9._-]//g; # sanitize $baserepo||=""; if($baserepo && $baserepo!~m{/}) { # assume OBS repo $baserepo=~s{:}{:/}g; $baserepo="https://download.opensuse.org/repositories/$baserepo/"; } $baserepo=~s/[^a-zA-Z0-9._,:\/\$-]//g; # sanitize $baserepo=~s{[^/]$}{$&/}; # make sure we have a slash at the end if($pkgname eq "") { print $q->header("text/html").$q->start_html(-title=>"multiymp").qq{
base repo url
pkg

View CGI source \n}; exit 0; } print $q->header("text/x-suse-ymp"); my @groups; if($baserepo) { foreach my $d(@distris) { my $v=$d; $v=~s/ /_/g; my $url=guessurl($baserepo, $v); # adjust for SLE $d=~s/SLE (\d+)( SP\d+)?/SUSE Linux Enterprise Server $1/; push @groups, groupblock($pkgname, $url, $d); } } else { push @groups, " $pkgname "; } my $groups=join("",@groups); print qq{ $groups };