base repo url
pkg

View CGI source
This CGI's Source:
#!/usr/bin/perl -w
# 2011-2015 by Bernhard M. Wiedemann
# licensed under AGPL 3.0
use strict;
use CGI;
my @distris=("openSUSE Tumbleweed", "openSUSE Factory", "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 SP3", "SLE 12", "SLE 12 SP1");

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");
	$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
      
    );
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="http://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}; if($q->param("source")) { print "
This CGI's Source:
".
			`cat $ENV{SCRIPT_FILENAME}`.
			"
"; } print "\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 (11)( SP\d+)?/SUSE Linux Enterprise Server $1/; $d=~s/SLE (12)/SUSE Linux Enterprise Server $1/; push @groups, groupblock($pkgname, $url, $d); } } else { push @groups, " $pkgname "; } my $groups=join("",@groups); print qq{ $groups };