File obs-service-product_converter-1.5.6.obscpio of Package obs-service-product_converter
07070100000000000081A400000000000000000000000164D603BC00002291000000000000000000000000000000000000003100000000obs-service-product_converter-1.5.6/BSKiwiXML.pm#
# Copyright (c) 2008 Adrian Schroeter, Novell Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 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
#
################################################################
#
# XML templates for the BuildService. See XML/Structured.
#
package BSKiwiXML;
use strict;
#
# an explained example entry of this file
#
#our $pack = [ creates <package name="" project=""> space
# 'package' =>
# 'name',
# 'project',
# [], before the [] all strings become attributes to <package>
# 'title', from here on all strings become children like <title> </title>
# 'description',
# [[ 'person' => creates <person> children, the [[ ]] syntax allows any number of them including zero
# 'role', again role and userid attributes, both are required
# 'userid',
# ]], this block describes a <person role="defeatist" userid="statler" /> construct
# @flags, copies in the block of possible flag definitions
# [ $repo ], refers to the repository construct and allows again any number of them (0-X)
#]; closes the <package> child with </package>
our $kiwidesc = [
'image' =>
'name',
'schemeversion', # for kiwi version until 3.74
'schemaversion', # for kiwi after 3.74
'displayname',
'id',
'kiwirevision',
[],
[ 'description' =>
'type',
[],
'author',
'contact',
'specification',
],
[ 'preferences' =>
[[ 'type' =>
'baseroot',
'boot',
'bootfilesystem',
'bootkernel',
'bootloader',
'bootpartsize',
'bootprofile',
'boottimeout',
'checkprebuilt',
'compressed',
'container',
'devicepersistency',
'editbootconfig',
'editbootinstall',
'flags',
'filesystem',
'firmware',
'fsnocheck',
'fsreadonly',
'fsreadwrite',
'fsmountoptions',
'format',
'hybrid',
'hybridpersistent',
'image',
'installboot',
'installiso',
'installstick',
'installpxe',
'installprovidefailsafe',
'luks',
'luksOS',
'kernelcmdline',
'mdraid',
'primary',
'ramonly',
'ec2accountnr',
'ec2privatekeyfile',
'ec2certfile',
'vga',
'vhdfixedtag',
'volid',
'zfsoptions',
[ 'machine' =>
'HWversion',
'arch',
'domain',
'guestOS',
'max_cpu',
'max_memory',
'memory',
'min_cpu',
'minx_memory',
'ncpus',
'ovftype',
[],
'vmconfig-entry',
[ 'vmdisk' =>
'id',
'controller',
'device',
'diskmode',
'disktype',
],
[ 'vmdvd' =>
'id',
'controller'
],
[ 'vmnic' =>
'driver',
'interface',
'mac',
'mode',
],
],
[ 'oemconfig' =>
[],
'oem-ataraid-scan',
'oem-multipath-scan',
'oem-boot-title',
'oem-bootwait',
'oem-inplace-recovery',
'oem-kiwi-initrd',
'oem-partition-install',
'oem-reboot',
'oem-reboot-interactive',
'oem-recovery',
'oem-recoveryID',
'oem-recovery-part-size',
'oem-shutdown',
'oem-shutdown-interactive',
'oem-silent-boot',
'oem-silent-install',
'oem-silent-verify',
'oem-skip-verify',
'oem-swap',
'oem-swapsize',
'oem-systemsize',
'oem-unattended',
'oem-unattended-id',
],
[ 'pxedeploy' =>
'blocksize',
'server',
[],
'timeout',
'kernel',
'initrd',
[ 'partitions' =>
'device',
[[ 'partition' =>
'mountpoint',
'number',
'size',
'target',
'type',
]],
],
[ 'union' =>
'ro',
'rw',
'type',
],
[ 'configuration' =>
'arch',
'dest',
'source',
],
],
[ 'size' =>
'unit',
'additive',
'_content',
],
[ 'split' =>
[ 'temporary' =>
[[ 'except' => 'name' ]],
[[ 'file' => 'name' ]],
],
[ 'persistent' =>
[[ 'except' => 'name' ]],
[[ 'file' => 'name' ]],
],
],
[ 'systemdisk' =>
'name',
[[ 'volume' =>
'freespace',
'mountpoint',
'name',
'size',
]],
],
[ 'vagrantconfig' =>
'provider',
'virtualsize',
],
'_content',
]],
'version',
[ 'size' =>
'unit',
'_content',
],
'boot-theme',
'compressed',
'defaultbaseroot',
'defaultdestination',
'defaultroot',
'packagemanager',
'rpm-check-signatures',
'rpm-excludedocs',
'rpm-force',
'locale',
'keytable',
'oem-home',
'oem-reboot',
'oem-recovery',
'oem-swap',
'oem-boot-title',
'timezone',
'bootsplash-theme',
'bootloader-theme',
'defaultprebuilt',
'hwclock',
'partitioner',
'showlicense',
],
[ 'instsource' =>
[],
[ 'architectures' =>
[[ 'arch' =>
'id',
'name',
'fallback',
]],
[[ 'requiredarch' =>
'ref',
]],
],
[ 'productoptions' =>
[[ 'productvar' =>
'name',
'_content'
]],
[[ 'productinfo' =>
'name',
'_content'
]],
[[ 'productoption' =>
'name',
'_content'
]]
],
[[ 'instrepo' =>
'name',
'priority',
'username',
'pwd',
'local',
[],
[ 'source' =>
'path'
],
]],
[ 'metadata' =>
[[ 'repopackage' =>
'name',
'medium',
'arch',
'addarch',
'removearch',
'onlyarch',
]],
],
[[ 'repopackages' =>
[[ 'repopackage' =>
'name',
'addarch', 'arch', 'baselibs_arch',
'forcearch','removearch', 'onlyarch', 'source', 'script', 'medium', 'module', 'priority'
]],
]],
[ 'driverupdate' =>
[[ 'target' =>
'arch',
'_content'
]],
[[ 'install' =>
[[ 'repopackage' =>
'name',
'addarch', 'arch', 'baselibs_arch',
'forcearch','removearch', 'onlyarch', 'source', 'script', 'medium', 'priority'
]],
]],
[[ 'modules' =>
[[ 'repopackage' =>
'name',
'addarch', 'arch', 'baselibs_arch',
'forcearch','removearch', 'onlyarch', 'source', 'script', 'medium', 'priority'
]],
]],
[[ 'instsys' =>
[[ 'repopackage' =>
'name',
'addarch', 'arch', 'baselibs_arch',
'forcearch','removearch', 'onlyarch', 'source', 'script', 'medium', 'priority'
]],
]]
]
],
[[ 'users' =>
'group',
'id',
'profiles',
[],
[[ 'user' =>
'name', 'id', 'pwd', 'home', 'pwdformat', 'realname', 'shell', 'password',
]],
]],
[ 'split' =>
[ 'temporary' =>
[[ 'except' => 'name' ]],
[[ 'file' => 'name' ]],
],
[ 'persistent' =>
[[ 'except' => 'name' ]],
[[ 'file' => 'name' ]],
],
],
[ 'profiles' =>
[[ 'profile' =>
'name',
'description',
'import',
]],
],
[[ 'drivers' =>
'type',
'profiles',
[],
[[ 'file' => 'name' ]],
]],
[[ 'strip' =>
'type',
'profiles',
[],
[[ 'file' => 'name' ]],
]],
[[ 'repository' =>
'type',
'status',
'priority',
'alias',
'components',
'distribution',
'imageinclude',
'username',
'password',
'prefer-license',
'profiles',
[],
[ 'source' => 'path' ],
]],
[[ 'deploy' =>
'server',
'blocksize',
[],
[[ 'partitions' =>
'device',
[],
[[ 'partition' =>
'type',
'number',
'size',
'mountpoint',
'target',
]],
]],
[[ 'configuration' =>
'source',
'dest',
]],
]],
[[ 'packages' =>
'type',
'profiles',
'patternType',
'patternPackageType',
'memory',
'disk',
[],
[[ 'product' =>
'name',
'arch',
]],
[[ 'package' =>
'name',
'arch',
'bootinclude',
'bootdelete',
'replaces',
]],
[[ 'opensusePattern' =>
'name',
'arch',
]],
[[ 'namedCollection' =>
'name',
'arch',
]],
[[ 'ignore' =>
'name',
]],
[[ 'archive' =>
'name',
'bootinclude',
]],
]],
[ 'vmwareconfig' =>
'memory',
'guestOS',
'HWversion',
[],
[[ 'vmwaredisk' => 'controller', 'id' ]],
[[ 'vmwarenic' => 'driver', 'interface', 'mode' ]],
],
[ 'xenconfig' =>
'memory',
[],
[[ 'xendisk' => 'device' ]],
],
];
1;
07070100000001000081A400000000000000000000000164D603BC000035EC000000000000000000000000000000000000003400000000obs-service-product_converter-1.5.6/BSProductXML.pm#
# Copyright (c) 2008 Adrian Schroeter, Novell Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 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
#
################################################################
#
# XML templates and parser for the BuildService. See XML/Structured.
#
package BSProductXML;
use strict;
use Data::Dumper;
use BSUtil;
#
# an explained example entry of this file
#
#our $pack = [ creates <package name="" project=""> space
# 'package' =>
# 'name',
# 'project',
# [], before the [] all strings become attributes to <package>
# 'title', from here on all strings become children like <title> </title>
# 'description',
# [[ 'person' => creates <person> children, the [[ ]] syntax allows any number of them including zero
# 'role', again role and userid attributes, both are required
# 'userid',
# ]], this block describes a <person role="defeatist" userid="statler" /> construct
# @flags, copies in the block of possible flag definitions
# [ $repo ], refers to the repository construct and allows again any number of them (0-X)
#]; closes the <package> child with </package>
our $group = [
'group' =>
'name',
'version',
'release',
[],
[[ 'conditional' => 'name' ]],
[[ 'include' => 'group' ]],
[ 'pattern' =>
'ordernumber',
[],
[ 'name' => '_content' ],
[ 'icon' => '_content' ],
[ 'visible' => '_content' ],
[ 'category' => 'language', [], '_content' ],
[ 'summary' => 'language', [], '_content' ],
[ 'description' => 'language', [], '_content' ],
[ 'relationships' =>
[],
[[ 'pattern' => 'name', 'relationship' ]],
],
],
[[ 'packagelist' =>
'relationship',
'supportstatus',
'id',
[],
[[ 'package' =>
'name',
'supportstatus',
[[ 'conditional' => 'name' ]],
]],
]],
];
# private zypp element definition
our $zypp = [ 'zypp' =>
'name',
'alias',
[],
'disable', # repo should be added, but not enabled by default
],
# Defines a single product, will be used in installed system to indentify it
our $product = [
'product' =>
'id', # obsolete, do not use anymore
'schemeversion',
[],
'vendor',
'name',
'version', # shall not be used, if baseversion is used. It is baseversion.patchlevel than.
'baseversion',
'patchlevel',
'migrationtarget',
[ 'predecessor' ], # former name of product(s) replaced by this.
'release',
'endoflife', # in ISO 8601 format (YYYY-MM-DD), valid for this patchlevel
'arch',
'cpeid', # generated, not for input
'productline',
'purl_distro', # the distro string of spdx to be used with this product
'releasepkgname', # defaults to $name-release
[ 'codestream' =>
[],
'name', # code stream name, often similar to summary, but may differ on falvours
'endoflife', # in ISO 8601 format (YYYY-MM-DD), may need an update to a future patchlevel
],
[ 'register' =>
[],
'target', # distro-target for NCC, only for .prod files since SLE 12
'release',
'flavor',
# following is for support tools
[ 'pool' =>
[[ 'repository' =>
'project', # input
'name',
'medium',
'url', # this conflicts with project/name/medium
'arch', # for arch specific definitions
$zypp,
]],
],
[ 'updates' =>
[[ 'distrotarget' => # for SMT update service
'arch', # for arch specific definitions
[],
'_content'
]],
[[ 'repository' =>
'project', # input
'name',
'repoid', # output for .prod file
'url', # this conflicts with project/name/medium
'arch', # for arch specific definitions
$zypp,
]],
],
[ 'repositories' =>
[[ 'repository' =>
'path',
]],
], # this is for prod file export only, not used for SLE 12/openSUSE 13.2 media style anymore
],
[ 'repositories' =>
[[ 'repository' =>
'type',
'repoid',
]],
], # this is for prod file export only since Leap 15
[ 'upgrades' => # to announce service pack releases
[[ 'upgrade' =>
[],
'name',
'summary',
'repository',
'product',
'notify',
'status',
]],
],
'updaterepokey', # obsolete
[[ 'summary' =>
'language',
[],
'_content'
]],
[[ 'shortsummary' =>
'language',
[],
'_content'
]],
[[ 'description' =>
'language',
[],
'_content'
]],
[ 'linguas' =>
[],
[[ 'language' => '_content' ]],
],
[ 'urls' =>
[],
[[ 'url' =>
'name',
'arch',
[],
'_content',
]],
],
[ 'buildconfig' =>
[],
'producttheme',
'betaversion',
'milestone', # alternative to betaversion, not causing a beta warning
'mainproduct',
'create_flavors',
'sync_build_counter',
[ 'linguas' =>
[],
[[ 'language' => '_content' ]],
],
'allowresolving',
'packagemanager',
],
[ 'installconfig' =>
[],
'defaultlang',
'datadir',
'descriptiondir',
'default_obs_repository_name', # needs to be a sync with the name in /distributions
'default_obs_download_url', # contains %_download_url
[ 'releasepackage' => 'name', 'flag', 'version', 'release' ],
'distribution',
[[ 'obsoletepackage' => '_content' ]],
],
[ 'runtimeconfig' =>
[],
'allowresolving',
],
[[ 'productdependency' =>
'relationship',
'name',
'version',
'baseversion',
'patchlevel',
'release',
'flavor',
'flag',
]],
];
# Complete product definition. Defines how a media is setup
# and which products are available.
our $productdesc = [
'productdefinition' =>
'xmlns:xi',
'schemeversion',
[],
[ 'products' =>
[ $product ],
],
[ 'conditionals' =>
[[ 'conditional' =>
'name',
[[ 'platform' =>
'excludearch',
'onlyarch',
'arch',
'baselibs_arch',
'addarch',
'replace_native'
]],
[ 'media' =>
'number',
],
]],
],
[ 'repositories' =>
[[ 'repository' =>
'path',
'build',
'product_file',
]],
],
[ 'archsets' =>
[[ 'archset' =>
'name',
'productarch',
[],
[[ 'arch' => '_content' ]],
]],
],
[ 'mediasets' =>
[[ 'media' =>
'type',
'product', # obsolete, should not be used anymore
'name',
'flavor',
'repo_only', # do not create iso files
'drop_repo', # remove trees, just having iso files as result
'mediastyle',
'volumeid', # non standard volume id inside of iso files
'firmware',
'registration',
'create_repomd', # old format only
'sourcemedia',
'debugmedia',
'separate',
'create_pattern',
'download_mirror_policy', # may be "true" when content is delivered via download redirector
'ignore_missing_packages', # may be "true", default for mediastyle 11.3 and before
'ignore_missing_meta_packages', # may be "true", default for mediastyle 11.3 and before
'skip_release_package', # skip adding the release packages to the media
'run_media_check',
'run_hybridiso',
'run_make_listings',
'use_recommended',
'use_suggested',
'use_required',
'use_undecided', # take all packages, even the ungrouped ones
'use_newest_version', # rpm version compare instead of repository priority
'run_dependency_check', # set either to "warn" or "error"
'allow_overflow',
'next_media_in_set',
'separate',
'size',
'datadir', # old format only
'descriptiondir', # old format only
[[ 'preselected_patterns' =>
[[ 'pattern' =>
'name',
]]
]],
[[ 'archsets' =>
[[ 'archset' =>
'ref',
]],
]],
[[ 'use' =>
'group',
'use_recommended',
'use_suggested',
'use_required',
'create_pattern',
[[ 'package' => 'name', 'medium', 'module', 'relationship', 'arch', 'addarch' ]],
[[ 'include' => 'group', 'relationship' ]],
]],
# product dependency got moved to product definition
[[ 'productdependency' =>
'relationship',
'name',
'version',
'patchlevel',
'release',
'flavor',
'flag',
]],
[ 'metadata' =>
[[ 'package' => 'name', 'medium', 'arch', 'addarch', 'onlyarch', 'removearch' ]],
[[ 'file' => 'name' ]],
],
]],
],
[ $group ],
];
# list of product definitions
our $products = [
'productlist' =>
[ $productdesc ],
];
our $productrepositories = [
'product' =>
'name',
[[
'distrotarget' =>
'arch', # optional
[],
'_content',
]],
[[
'repository' =>
'path', # eith path or url is set
'url',
'arch', # optional
[],
$zypp,
'debug', # optional flags
'update',
]],
];
our $productlistrepositories = [
'productrepositories' =>
[ $productrepositories ],
];
sub mergexmlfiles {
my ($dir, $file, $seen, $debug) = @_;
if ($seen->{$file}) {
print "ERROR: cyclic file include ($file)!\n";
return undef;
}
my $str = ref($dir) ? $dir->($file) : readstr("$dir/$file", 1);
return undef unless defined $str;
writestr("/tmp/naked.xml", undef, $str) if $debug;
while ($str =~ /<xi:include href="(.+?)".*?>/s) {
my $ref = $1;
if ($ref =~ /^obs:.+/) {
print "ERROR: obs: references are not handled yet!\n";
return undef;
}
if ($ref =~ /^\./ || $ref =~ /\//) {
print "ERROR: obs: reference to illegal file!\n";
return undef;
}
$seen->{$file} = 1;
my $replace = mergexmlfiles($dir, $ref, $seen, $debug);
delete $seen->{$file};
if (! defined $replace) {
print "ERROR: Unable to read $ref!\n";
return undef;
}
# This is a subfile, so wipe out the xml header.
$replace =~ s/<\?xml .+\?>//;
$str =~ s/<xi:include href=".+?".*?>/$replace/s;
}
writestr("/tmp/naked_all.xml", undef, $str) if $debug;
return $str;
}
sub readproductxml {
my ($file, $nonfatal, $debug) = @_;
my $dir = '.';
if (ref($file)) {
$dir = $file->[0];
$file = $file->[1];
} elsif ($file =~ /^(.*)\/([^\/]*)$/s) {
$dir = $1;
$file = $2;
}
my $str = mergexmlfiles($dir, $file, {}, $debug);
return undef unless $str;
return BSUtil::fromxml($str, $productdesc, $nonfatal);
}
1;
07070100000002000081A400000000000000000000000164D603BC00004777000000000000000000000000000000000000002E00000000obs-service-product_converter-1.5.6/BSUtil.pm#
# Copyright (c) 2006, 2007 Michael Schroeder, Novell Inc.
# Copyright (c) 2016 Frank Schreiner, SUSE LLC
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 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
#
################################################################
package BSUtil;
=head1 NAME
BSUtil - collection of useful functions
=cut
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw{writexml writestr readxml readstr ls mkdir_p xfork str2utf8 data2utf8 str2utf8xml data2utf8xml};
use XML::Structured;
use POSIX;
use Fcntl qw(:DEFAULT :flock);
use Encode;
use Storable ();
use IO::Handle;
use strict;
# should we do a slow fdatasync?
our $fdatasync_before_rename;
# the current debug level
my $debuglevel;
=head1 FUNCTIONS / METHODS
=cut
sub set_fdatasync_before_rename {
$fdatasync_before_rename = 1;
if (!defined(&File::Sync::fdatasync_fd)) {
eval {
require File::Sync;
};
warn($@) if $@;
*File::Sync::fdatasync_fd = sub {} unless defined &File::Sync::fdatasync_fd;
}
}
sub do_fdatasync {
my ($fd) = @_;
set_fdatasync_before_rename() unless defined &File::Sync::fdatasync_fd;
File::Sync::fdatasync_fd($fd);
}
sub writexml {
my ($fn, $fnf, $dd, $dtd) = @_;
my $d = XMLout($dtd, $dd);
local *F;
open(F, '>', $fn) || die("$fn: $!\n");
(syswrite(F, $d) || 0) == length($d) || die("$fn write: $!\n");
do_fdatasync(fileno(F)) if defined($fnf) && $fdatasync_before_rename;
close(F) || die("$fn close: $!\n");
return unless defined $fnf;
$! = 0;
rename($fn, $fnf) || die("rename $fn $fnf: $!\n");
}
sub writestr {
my ($fn, $fnf, $d) = @_;
local *F;
open(F, '>', $fn) || die("$fn: $!\n");
if (length($d)) {
(syswrite(F, $d) || 0) == length($d) || die("$fn write: $!\n");
}
do_fdatasync(fileno(F)) if defined($fnf) && $fdatasync_before_rename;
close(F) || die("$fn close: $!\n");
return unless defined $fnf;
rename($fn, $fnf) || die("rename $fn $fnf: $!\n");
}
sub appendstr {
my ($fn, $d) = @_;
local *F;
open(F, '>>', $fn) || die("$fn: $!\n");
if (length($d)) {
(syswrite(F, $d) || 0) == length($d) || die("$fn write: $!\n");
}
close(F) || die("$fn close: $!\n");
}
sub readstr {
my ($fn, $nonfatal) = @_;
local *F;
if (!open(F, '<', $fn)) {
die("$fn: $!\n") unless $nonfatal;
return undef;
}
my $d = '';
1 while sysread(F, $d, 8192, length($d));
close F;
return $d;
}
sub readxml {
my ($fn, $dtd, $nonfatal) = @_;
my $d = readstr($fn, $nonfatal);
return $d unless defined $d;
if ($d !~ /<.*?>/s) {
die("$fn: not xml\n") unless $nonfatal;
return undef;
}
return XMLin($dtd, $d) unless $nonfatal;
eval { $d = XMLin($dtd, $d); };
return $@ ? undef : $d;
}
sub fromxml {
my ($d, $dtd, $nonfatal) = @_;
return XMLin($dtd, $d) unless $nonfatal;
eval { $d = XMLin($dtd, $d); };
return $@ ? undef : $d;
}
sub toxml {
my ($d, $dtd) = @_;
return XMLout($dtd, $d);
}
sub touch($) {
my ($file) = @_;
if (-e $file) {
utime(time, time, $file);
} else {
# create new file, mtime is anyway current
local *F;
open(F, '>>', $file) || die("$file: $!\n");
close(F) || die("$file close: $!\n");
}
}
sub ls {
local *D;
opendir(D, $_[0]) || return ();
my @r = grep {$_ ne '.' && $_ ne '..'} readdir(D);
closedir D;
return @r;
}
sub mkdir_p {
my ($dir) = @_;
return 1 if -d $dir;
my $pdir;
if ($dir =~ /^(.+)\//) {
$pdir = $1;
mkdir_p($pdir) || return undef;
}
while (!mkdir($dir, 0777)) {
my $e = $!;
return 1 if -d $dir;
if (defined($pdir) && ! -d $pdir) {
mkdir_p($pdir) || return undef;
next;
}
$! = $e;
warn("mkdir: $dir: $!\n");
return undef;
}
return 1;
}
=head2 mkdir_p_chown - create directory recursivly and change ownership
calls mkdir_p and changes ownership of the created directory to the
supplied user and group if provided.
=cut
sub mkdir_p_chown {
my ($dir, $user, $group) = @_;
if (!(-d $dir)) {
mkdir_p($dir) || return undef;
}
return 1 unless defined($user) || defined($group);
$user = -1 unless defined $user;
$group = -1 unless defined $group;
my $ouser = $user;
my $ogroup = $group;
if ($user !~ /^-?\d+$/ && !defined($user = getpwnam($user))) {
warn "user $ouser unknown\n"; return undef
}
if ($group !~ /^-?\d+$/ && !defined($group = getgrnam($group))) {
warn "group $ogroup unknown\n"; return undef
}
my @s = stat($dir);
if ($s[4] != $user || $s[5] != $group) {
if (!chown $user, $group, $dir) {
warn "failed to chown $dir to $user:$group\n"; return undef;
}
}
return 1;
}
sub drop_privs_to {
my ($user, $group) = @_;
if (defined($group)) {
BSUtil::printlog("Drop privileges to group '$group'", 1);
$group = getgrnam($group) unless $group =~ /^\d+$/;
die("unknown group\n") unless defined $group;
if ($) != $group || $( != $group) {
($), $() = ($group, $group);
die("setgid: $!\n") if $) != $group;
}
}
if (defined($user)) {
BSUtil::printlog("Drop privileges to user '$user'", 1);
$user = getpwnam($user) unless $user =~ /^\d+$/;
die("unknown user\n") unless defined $user;
if ($> != $user || $< != $user) {
($>, $<) = ($user, $user);
die("setuid: $!\n") if $> != $user;
}
}
}
sub cleandir {
my ($dir) = @_;
my $ret = 1;
return 1 unless -d $dir;
for my $c (ls($dir)) {
if (! -l "$dir/$c" && -d _) {
cleandir("$dir/$c");
$ret = undef unless rmdir("$dir/$c");
} else {
$ret = undef unless unlink("$dir/$c");
}
}
return $ret;
}
sub linktree {
my ($from, $to) = @_;
return unless -d $from;
mkdir_p($to);
my @todo = sort(ls($from));
while (@todo) {
my $f = shift @todo;
if (! -l "$from/$f" && -d _) {
mkdir_p("$to/$f");
unshift @todo, map {"$f/$_"} ls("$from/$f");
} else {
link("$from/$f", "$to/$f") || die("link $from/$f $to/$f: $!\n");
}
}
}
sub treeinfo {
my ($dir) = @_;
my @info;
my @todo = sort(ls($dir));
while (@todo) {
my $f = shift @todo;
my @s = lstat("$dir/$f");
next unless @s;
if (-d _) {
push @info, "$f";
unshift @todo, map {"$f/$_"} ls("$dir/$f");
} else {
push @info, "$f $s[9]/$s[7]/$s[1]";
}
}
return \@info;
}
sub xfork {
my $pid;
while (1) {
$pid = fork();
last if defined $pid;
die("fork: $!\n") if $! != POSIX::EAGAIN;
sleep(5);
}
return $pid;
}
sub cp {
my ($from, $to, $tof) = @_;
local *F;
local *T;
open(F, '<', $from) || die("$from: $!\n");
open(T, '>', $to) || die("$to: $!\n");
my $buf;
while (sysread(F, $buf, 8192)) {
(syswrite(T, $buf) || 0) == length($buf) || die("$to write: $!\n");
}
close(F);
close(T) || die("$to: $!\n");
if (defined($tof)) {
rename($to, $tof) || die("rename $to $tof: $!\n");
}
}
sub checkutf8 {
my ($oct) = @_;
Encode::_utf8_off($oct);
return 1 unless defined $oct;
return 1 unless $oct =~ /[\200-\377]/;
eval {
Encode::_utf8_on($oct);
encode('UTF-8', $oct, Encode::FB_CROAK);
};
return $@ ? 0 : 1;
}
sub str2utf8 {
my ($oct) = @_;
return $oct unless defined $oct;
return $oct unless $oct =~ /[^\011\012\015\040-\176]/s;
eval {
Encode::_utf8_on($oct);
$oct = encode('UTF-8', $oct, Encode::FB_CROAK);
};
if ($@) {
# assume iso-8859-1
eval {
Encode::_utf8_off($oct);
$oct = encode('UTF-8', $oct, Encode::FB_CROAK);
};
if ($@) {
Encode::_utf8_on($oct);
$oct = encode('UTF-8', $oct, Encode::FB_XMLCREF);
}
}
Encode::_utf8_off($oct); # just in case...
return $oct;
}
sub data2utf8 {
my ($d) = @_;
if (ref($d) eq 'ARRAY') {
for my $dd (@$d) {
if (ref($dd) eq '') {
$dd = str2utf8($dd);
} else {
data2utf8($dd);
}
}
} elsif (ref($d) eq 'HASH') {
for my $dd (keys %$d) {
if (ref($d->{$dd}) eq '') {
$d->{$dd} = str2utf8($d->{$dd});
} else {
data2utf8($d->{$dd});
}
}
}
}
sub str2utf8xml {
my ($oct) = @_;
return $oct unless defined $oct;
return $oct unless $oct =~ /[^\011\012\015\040-\176]/s;
$oct = str2utf8($oct);
Encode::_utf8_on($oct);
# xml does not accept all utf8 chars, escape the illegal
$oct =~ s/([\000-\010\013\014\016-\037\177])/sprintf("&#x%x;",ord($1))/sge;
$oct =~ s/([\x{d800}-\x{dfff}\x{fffe}\x{ffff}])/sprintf("&#x%x;",ord($1))/sge;
Encode::_utf8_off($oct);
return $oct;
}
sub data2utf8xml {
my ($d) = @_;
if (ref($d) eq 'ARRAY') {
for my $dd (@$d) {
if (ref($dd) eq '') {
$dd = str2utf8xml($dd);
} else {
data2utf8xml($dd);
}
}
} elsif (ref($d) eq 'HASH') {
for my $dd (keys %$d) {
if (ref($d->{$dd}) eq '') {
$d->{$dd} = str2utf8xml($d->{$dd});
} else {
data2utf8xml($d->{$dd});
}
}
}
}
sub waituntilgone {
my ($fn, $timeout) = @_;
while (1) {
return 1 unless -e $fn;
return 0 if defined($timeout) && $timeout <= 0;
select(undef, undef, undef, .1);
$timeout -= .1 if defined $timeout;
}
}
sub lockopen {
my ($fg, $op, $fn, $nonfatal) = @_;
local *F = $fg;
while (1) {
if (!open(F, $op, $fn)) {
return undef if $nonfatal;
die("$fn: $!\n");
}
flock(F, LOCK_EX) || die("flock $fn: $!\n");
my @s = stat(F);
return 1 if @s && $s[3];
close F;
}
}
sub lockcheck {
my ($op, $fn) = @_;
local *F;
while (1) {
if (!open(F, $op, $fn)) {
return -1;
}
if (!flock(F, LOCK_EX | LOCK_NB)) {
close(F);
return 0;
}
my @s = stat(F);
close F;
return 1 if @s && $s[3];
}
}
sub lockopenxml {
my ($fg, $op, $fn, $dtd, $nonfatal) = @_;
if (!lockopen($fg, $op, $fn, $nonfatal)) {
die("$fn: $!\n") unless $nonfatal;
return undef;
}
my $d = readxml($fn, $dtd, $nonfatal);
if (!$d) {
local *F = $fg;
close F;
}
return $d;
}
sub lockcreatexml {
my ($fg, $fn, $fnf, $dd, $dtd) = @_;
local *F = $fg;
writexml($fn, undef, $dd, $dtd);
open(F, '<', $fn) || die("$fn: $!\n");
flock(F, LOCK_EX | LOCK_NB) || die("lock: $!\n");
if (!link($fn, $fnf)) {
unlink($fn);
close F;
return undef;
}
unlink($fn);
return 1;
}
# XXX: does that really belong here?
#
=head2 enabled
Algorithm:
each enable/disable has a score:
+1 if it's a disable
+2 if the arch matches
+4 if the repo matches
=cut
sub enabled {
my ($repoid, $disen, $default, $arch) = @_;
# filter matching elements, check for shortcuts
return $default unless $disen;
my @dis = grep { (!defined($_->{'arch'}) || $_->{'arch'} eq $arch) &&
(!defined($_->{'repository'}) || $_->{'repository'} eq $repoid)
} @{$disen->{'disable'} || []};
return 1 if !@dis && $default;
my @ena = grep { (!defined($_->{'arch'}) || $_->{'arch'} eq $arch) &&
(!defined($_->{'repository'}) || $_->{'repository'} eq $repoid)
} @{$disen->{'enable'} || []};
return @dis ? 0 : $default unless @ena;
return @ena ? 1 : $default unless @dis;
# have @dis and @ena, need to do score thing...
my $disscore = 0;
for (@dis) {
my $score = 1;
$score += 2 if defined($_->{'arch'});
$score += 4 if defined($_->{'repository'});
if ($score > $disscore) {
return 0 if $score == 7; # can't max this!
$disscore = $score;
}
}
my $enascore = 0;
for (@ena) {
my $score = 0;
$score += 2 if defined($_->{'arch'});
$score += 4 if defined($_->{'repository'});
if ($score > $enascore) {
return 1 if $score > $disscore;
$enascore = $score;
}
}
return $enascore > $disscore ? 1 : 0;
}
sub store {
my ($fn, $fnf, $dd) = @_;
if ($fdatasync_before_rename && defined($fnf)) {
local *F;
open(F, '>', $fn) || die("$fn: $!\n");
if (!Storable::nstore_fd($dd, \*F)) {
die("nstore_fd $fn: $!\n");
}
(\*F)->flush();
do_fdatasync(fileno(F));
close(F) || die("$fn close: $!\n");
} else {
if (!Storable::nstore($dd, $fn)) {
die("nstore $fn: $!\n");
}
}
return unless defined $fnf;
$! = 0;
rename($fn, $fnf) || die("rename $fn $fnf: $!\n");
}
sub retrieve {
my ($fn, $nonfatal) = @_;
my $dd;
if (!$nonfatal) {
$dd = ref($fn) ? Storable::fd_retrieve($fn) : Storable::retrieve($fn);
die("retrieve $fn: $!\n") unless $dd;
} else {
eval {
$dd = ref($fn) ? Storable::fd_retrieve($fn) : Storable::retrieve($fn);
};
if (!$dd && $nonfatal == 2) {
if ($@) {
warn($@);
} else {
warn("retrieve $fn: $!\n");
}
}
}
return $dd;
}
sub tostorable {
my ($d) = @_;
return 'pst0'.Storable::nfreeze($d);
}
sub fromstorable {
my ($d, $nonfatal) = @_;
return Storable::thaw(substr($d, 4)) unless $nonfatal;
eval { $d = Storable::thaw(substr($d, 4)); };
if ($@) {
warn($@) if $nonfatal == 2;
return undef;
}
return $d;
}
sub ping {
my ($pingfile) = @_;
local *F;
if (sysopen(F, $pingfile, POSIX::O_WRONLY|POSIX::O_NONBLOCK)) {
syswrite(F, 'x');
close(F);
}
}
sub restartexit {
my ($arg, $name, $runfile, $pingfile) = @_;
return unless $arg;
if ($arg eq '--stop' || $arg eq '--exit') {
if (!(-e "$runfile.lock") || lockcheck('>>', "$runfile.lock")) {
print "$name not running.\n";
exit 0;
}
print "exiting $name...\n";
BSUtil::touch("$runfile.exit");
ping($pingfile) if $pingfile;
BSUtil::waituntilgone("$runfile.exit");
exit(0);
}
if ($ARGV[0] eq '--restart') {
die("$name not running.\n") if !(-e "$runfile.lock") || BSUtil::lockcheck('>>', "$runfile.lock");
print "restarting $name...\n";
BSUtil::touch("$runfile.restart");
ping($pingfile) if $pingfile;
BSUtil::waituntilgone("$runfile.restart");
exit(0);
}
}
sub xsystem {
my ($in, @args) = @_;
local (*RIN, *WIN);
local (*RERR, *WERR);
local *P;
if (defined($in)) {
pipe(RIN, WIN) || die("stdin pipe: $!\n");
}
pipe(RERR, WERR) || die("stderr pipe: $!\n");
my $pid;
$pid = open(P, '-|');
die("fork: $!\n") unless defined $pid;
if (!$pid) {
close WIN if defined $in;
close RERR;
open(STDIN, defined($in) ? "<&RIN" : "</dev/null");
open(STDERR, ">&WERR");
eval {
exec(@args);
die("$args[0]: $!\n");
};
warn($@) if $@;
exit 1;
}
close RIN if defined $in;
close WERR;
my ($indead, $outdead, $errdead);
$indead = 1 unless defined $in;
my ($out, $err) = ('', '');
my $stat;
while (!($outdead && $errdead)) {
my ($rin, $win) = ('', '');
vec($win, fileno(WIN), 1) = 1 unless $indead;
vec($rin, fileno(P), 1) = 1 unless $outdead;
vec($rin, fileno(RERR), 1) = 1 unless $errdead;
my $nfound = select($rin, $win, undef, undef);
if (!defined($nfound) || $nfound == -1) {
next if $! == POSIX::EINTR;
die("select: $!\n");
}
next unless $nfound;
if (!$indead && vec($win, fileno(WIN), 1)) {
my $l = syswrite(WIN, $in);
if (!defined($l) || $l < 0) {
next if $! == POSIX::EINTR || $! == POSIX::EWOULDBLOCK;
close(WIN);
$indead = 1;
} else {
$in = substr($in, $l);
if (length($in) <= 0) {
close(WIN);
$indead = 1;
}
}
}
if (!$outdead && vec($rin, fileno(P), 1)) {
my $l = sysread(P, $out, 4096, length($out));
if (!defined($l) || $l <= 0) {
next if !defined($l) && ($! == POSIX::EINTR || $! == POSIX::EWOULDBLOCK);
$stat = close(P);
$outdead = 1;
}
}
if (!$errdead && vec($rin, fileno(RERR), 1)) {
my $l = sysread(RERR, $err, 4096, length($err));
if (!defined($l) || $l <= 0) {
next if !defined($l) && ($! == POSIX::EINTR || $! == POSIX::EWOULDBLOCK);
close(RERR);
$errdead = 1;
}
}
}
close WIN unless $indead;
if (!$stat) {
chomp $err;
die(($err || "$args[0]: $?") . "\n");
}
if (!wantarray) {
chomp $err;
warn("$err\n") if $err;
return $out;
} else {
return ($out, $err);
}
}
sub unify {
my %h = map {$_ => 1} @_;
return grep(delete($h{$_}), @_);
}
sub identical {
my ($d1, $d2, $except, $subexcept) = @_;
if (!defined($d1)) {
return defined($d2) ? 0 : 1;
}
return 0 unless defined($d2);
my $r = ref($d1);
return 0 if $r ne ref($d2);
if ($r eq '') {
return 0 if $d1 ne $d2;
} elsif ($r eq 'HASH') {
my %k = (%$d1, %$d2);
for my $k (keys %k) {
next if $except && $except->{$k};
return 0 unless identical($d1->{$k}, $d2->{$k}, $subexcept, $subexcept);
}
} elsif ($r eq 'ARRAY') {
return 0 unless @$d1 == @$d2;
for (my $i = 0; $i < @$d1; $i++) {
return 0 unless identical($d1->[$i], $d2->[$i], $subexcept, $subexcept);
}
} else {
return 0;
}
return 1;
}
=head2 isotime - convert time to iso format
BSUtil::isotime($time);
=cut
sub isotime {
my ($t) = @_;
my @lt = localtime($t || time());
return sprintf "%04d-%02d-%02d %02d:%02d:%02d", $lt[5] + 1900, $lt[4] + 1, @lt[3,2,1,0];
}
=head2 setdebuglevel - set the current debug level
BSUtil::setdebuglevel($newlevel);
=cut
sub setdebuglevel {
my ($level) = @_;
my $oldlevel = $debuglevel;
$debuglevel = $level;
return $oldlevel;
}
=head2 printlog - print unified log messages
BSUtil::printlog($message [, $level]);
FORMAT: "YYYY-MM-DD hh:mm:ss [$pid] $message"
=cut
sub printlog {
my ($msg, $level) = @_;
return if $level && !($debuglevel && $debuglevel >= $level);
$msg = "[debug $level] $msg" if $level;
printf "%s: %-7s %s\n", isotime(time), "[$$]", $msg;
}
1;
07070100000003000081A400000000000000000000000164D603BC000079B9000000000000000000000000000000000000002D00000000obs-service-product_converter-1.5.6/BSXML.pm#
# Copyright (c) 2006, 2007 Michael Schroeder, Novell Inc.
# Copyright (c) 2008 Adrian Schroeter, Novell Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 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
#
################################################################
#
# XML templates for the BuildService. See XML/Structured.
#
package BSXML;
use strict;
#
# an explained example entry of this file
#
#our $pack = [ creates <package name="" project=""> space
# 'package' =>
# 'name',
# 'project',
# [], before the [] all strings become attributes to <package>
# 'title', from here on all strings become children like <title> </title>
# 'description',
# [[ 'person' => creates <person> children, the [[ ]] syntax allows any number of them including zero
# 'role', again role and userid attributes, both are required
# 'userid',
# ]], this block describes a <person role="defeatist" userid="statler" /> construct
# @flags, copies in the block of possible flag definitions
# [ $repo ], refers to the repository construct and allows again any number of them (0-X)
#]; closes the <package> child with </package>
our $download = [
'download' =>
'arch',
'repotype',
'url',
[],
'archfilter',
[ 'master' =>
'url',
'sslfingerprint',
],
'pubkey',
];
# same as download, but with project/repository
our $doddata = [
'doddata' =>
'project',
'repository',
@$download[1 .. $#$download],
];
our $repo = [
'repository' =>
'name',
'rebuild',
'block',
'linkedbuild',
[ $download ],
[[ 'releasetarget' =>
'project',
'repository',
'trigger',
]],
[[ 'path' =>
'project',
'repository',
]],
[ 'hostsystem' =>
'project',
'repository',
],
[ 'base' => # expanded repo only!
'project',
'repository',
],
[ 'arch' ],
'status',
];
our @disableenable = (
[[ 'disable' =>
'arch',
'repository',
]],
[[ 'enable' =>
'arch',
'repository',
]],
);
our @flags = (
[ 'lock' => @disableenable ],
[ 'build' => @disableenable ],
[ 'publish' => @disableenable ],
[ 'debuginfo' => @disableenable ],
[ 'useforbuild' => @disableenable ],
[ 'binarydownload' => @disableenable ],
[ 'sourceaccess' => @disableenable ],
[ 'access' => @disableenable ],
);
our @roles = (
[[ 'person' =>
'userid',
'role',
]],
[[ 'group' =>
'groupid',
'role',
]],
);
our $maintenance = [
'maintenance' =>
[[ 'maintains' =>
'project',
]],
];
our $proj = [
'project' =>
'name',
'kind',
[],
'title',
'description',
[[ 'link' =>
'project',
]],
'remoteurl',
'remoteproject',
'mountproject',
[ 'devel' =>
'project',
],
@roles,
$maintenance,
@flags,
[ $repo ],
];
our $pack = [
'package' =>
'name',
'project',
[],
'title',
'description',
'releasename',
[ 'devel' =>
'project',
'package',
],
@roles,
@disableenable,
@flags,
'url',
'bcntsynctag',
];
our $packinfo = [
'info' =>
'repository',
'name',
'file',
'error',
[ 'dep' ],
[ 'prereq' ],
[ 'imagetype' ], # kiwi
[ 'imagearch' ], # kiwi
'nodbgpkgs', # kiwi
'nosrcpkgs', # kiwi
[[ 'path' =>
'project',
'repository',
]],
[[ 'extrasource' =>
'project',
'package',
'srcmd5',
'file',
]],
];
our $linked = [
'linked' =>
'project',
'package',
];
our $aggregatelist = [
'aggregatelist' =>
[[ 'aggregate' =>
'project',
[],
'nosources',
[ 'package' ],
[ 'binary' ],
[[ 'repository' =>
'target',
'source',
]],
]],
];
# former: kernel - 123 - 1 123: incident
# now: sec-123 - 1 -1
our $patchinfo = [
'patchinfo' =>
'incident', # optional, gets replaced on with updateinfoid on release
'version', # optional, defaults to 1
[],
[ 'package' ],# optional
[ 'binary' ], # optional
[[ 'releasetarget' => # optional
'project',
'repository',
]],
[[ 'issue' =>
'tracker',
'id',
'documented',
[],
'_content',
]],
'category',
'rating',
'name', # optional, old patchinfo name which will become part of incident string
'summary',
'description',
'message', # optional pop-up message
'swampid', # obsolete
'packager',
'stopped',
'zypp_restart_needed',
'reboot_needed',
'relogin_needed',
];
our $channel = [
'channel' =>
[ 'product' =>
'project',
'name',
],
[[ 'target' =>
'project',
'repository',
'id_template', # optional
'requires_issue', # optional
[],
'disabled', # optional
]],
[[ 'binaries' =>
'project',
'repository',
'arch',
[[ 'binary' =>
'name',
'binaryarch',
'project',
'repository',
'package',
'arch',
'supportstatus',
]],
]],
];
our $projpack = [
'projpack' =>
'repoid',
[[ 'project' =>
'name',
'kind',
[],
'title',
'description',
'config',
'patternmd5',
[[ 'link' =>
'project',
]],
'remoteurl',
'remoteproject',
@flags,
@roles,
[ $repo ],
[[ 'package' =>
'name',
'rev',
'srcmd5', # commit id
'versrel',
'verifymd5', # tree id
'originproject',
'revtime',
'constraintsmd5', # md5sum of constraints file in srcmd5
[ $linked ],
'error',
[ $packinfo ],
$aggregatelist,
$patchinfo,
'channelmd5',
@flags,
'bcntsynctag',
'hasbuildenv',
]],
'missingpackages',
]],
[[ 'remotemap' =>
'project',
'kind',
'root',
'remoteurl',
'remoteproject',
'remoteroot',
'partition',
'proto', # project data not included
[],
'config',
@flags,
@roles,
[ $repo ],
'error',
]],
[[ 'channeldata' =>
'md5',
$channel,
]],
];
our $linkinfo = [
'linkinfo' =>
# information from link
'project',
'package',
'rev',
'srcmd5',
'baserev',
'missingok',
# expanded / unexpanded srcmd5
'xsrcmd5',
'lsrcmd5',
'error',
'lastworking',
[ $linked ],
];
our $serviceinfo = [
'serviceinfo' =>
# information in case a source service is part of package
'code', # can be "running", "failed", "succeeded"
'xsrcmd5',
'lsrcmd5',
[],
'error', # contains error message (with new lines) in case of error
];
our $dir = [
'directory' =>
'name',
'count', # obsolete, the API sets this for some requests
'rev',
'vrev',
'srcmd5',
'tproject', # obsolete, use linkinfo
'tpackage', # obsolete, use linkinfo
'trev', # obsolete, use linkinfo
'tsrcmd5', # obsolete, use linkinfo
'lsrcmd5', # obsolete, use linkinfo
'error',
'xsrcmd5', # obsolete, use linkinfo
$linkinfo,
$serviceinfo,
[[ 'entry' =>
'name',
'md5',
'size',
'mtime',
'error',
'id',
'originproject', # for package listing
'originpackage', # for package listing
]]
];
our $fileinfo = [
'fileinfo' =>
'filename',
[],
'name',
'epoch',
'version',
'release',
'arch',
'source',
'summary',
'description',
'size',
'mtime',
[ 'provides' ],
[ 'requires' ],
[ 'prerequires' ],
[ 'conflicts' ],
[ 'obsoletes' ],
[ 'recommends' ],
[ 'supplements' ],
[ 'suggests' ],
[ 'enhances' ],
[[ 'provides_ext' =>
'dep',
[[ 'requiredby' =>
'name',
'epoch',
'version',
'release',
'arch',
'project',
'repository',
]],
]],
[[ 'requires_ext' =>
'dep',
[[ 'providedby' =>
'name',
'epoch',
'version',
'release',
'arch',
'project',
'repository',
]],
]],
];
our $sourceinfo = [
'sourceinfo' =>
'package',
'rev',
'vrev',
'srcmd5',
'lsrcmd5',
'verifymd5',
[],
'filename',
'error',
'originproject',
'originpackage',
[ $linked ],
'revtime',
'changesmd5',
'name',
'version',
'release',
[ 'subpacks' ],
[ 'deps' ],
[ 'prereqs' ],
[ 'exclarch' ],
[ 'badarch' ],
];
our $sourceinfolist = [
'sourceinfolist' =>
[ $sourceinfo ],
];
our $buildinfo = [
'buildinfo' =>
'project',
'repository',
'package',
'srcserver',
'reposerver',
'downloadurl',
[],
'job',
'arch',
'hostarch', # for cross build
'error',
'srcmd5',
'verifymd5',
'rev',
'disturl',
'reason', # just for the explain string of a build reason
'needed', # number of blocked
'revtime', # time of last commit
'readytime',
'specfile', # obsolete
'file',
'versrel',
'bcnt',
'release',
'debuginfo',
'constraintsmd5',
[ 'prjconfconstraint' ],
[ 'subpack' ],
[ 'imagetype' ], # kiwi
'nodbgpkgs', # kiwi
'nosrcpkgs', # kiwi
[ 'dep' ],
[[ 'bdep' =>
'name',
'preinstall',
'vminstall',
'cbpreinstall',
'cbinstall',
'runscripts',
'notmeta',
'noinstall',
'installonly',
'epoch',
'version',
'release',
'arch',
'hdrmd5',
'project',
'repository',
'repoarch',
'binary', # filename
'package',
'srcmd5',
]],
[ 'pdep' ], # obsolete
[[ 'path' =>
'project',
'repository',
'server', # internal
'url', # external
]],
[[ 'syspath' =>
'project',
'repository',
'server', # internal
'url', # external
]],
'expanddebug',
'followupfile', # for two-stage builds
'masterdispatched', # dispatched through a master dispatcher
'nounchanged', # do not check for "unchanged" builds
[ 'preinstallimage' =>
'project',
'repository',
'repoarch',
'package',
'filename',
'hdrmd5',
[ 'binary' ],
'url', # external
],
];
our $jobstatus = [
'jobstatus' =>
'code',
'result', # succeeded, failed or unchanged
'details',
[],
'starttime',
'endtime',
'lastduration', # optional
'workerid',
'hostarch',
'uri', # uri to reach worker
'arch', # our architecture
'job', # our jobname
'jobid', # md5 of job info file
'attempt', # number of attempts to build the job
];
our $buildreason = [
'reason' =>
[],
'explain', # Readable reason
'time', # unix time from start build
'oldsource', # last build source md5 sum, if a source change was the reason
[[ 'packagechange' => # list changed files which are used for building
'change', # kind of change (content/meta change, additional file or removed file)
'key', # file name
]],
];
our $buildstatus = [
'status' =>
'package',
'code',
'status', # obsolete, now code
'error', # obsolete, now details
'versrel', # for withversrel result call
[],
'details',
'workerid', # last build data
'hostarch',
'readytime',
'starttime',
'endtime',
'job', # internal, job when building
'uri', # obsolete
'arch', # obsolete
];
our $builddepinfo = [
'builddepinfo' =>
[[ 'package' =>
'name',
[],
'source',
[ 'pkgdep' ],
[ 'subpkg' ],
]],
[[ 'cycle' =>
[ 'package' ],
]],
];
our $event = [
'event' =>
'type',
[],
'project',
'repository',
'arch',
'package',
'job',
'worker',
'due',
'srcmd5', # for type=servicedispatch
'rev', # for type=servicedispatch
'linksrcmd5', # for type=servicedispatch
'projectservicesmd5', # for type=servicedispatch
'oldsrcmd5', # for type=servicedispatch
'details', # for type=dispatchdetails
];
our $events = [
'events' =>
'next',
'sync',
[ $event ],
];
our $revision = [
'revision' =>
'rev',
'vrev',
[],
'srcmd5',
'version',
'time',
'user',
'comment',
'requestid',
];
our $revision_acceptinfo = [
@$revision,
[ 'acceptinfo' =>
'rev',
'srcmd5',
'osrcmd5',
'xsrcmd5',
'oxsrcmd5',
],
];
our $revisionlist = [
'revisionlist' =>
[ $revision ]
];
our $buildhist = [
'buildhistory' =>
[[ 'entry' =>
'rev',
'srcmd5',
'versrel',
'bcnt',
'time',
'duration',
]],
];
our $binaryversionlist = [
'binaryversionlist' =>
[[ 'binary' =>
'name', # should be filename instead. sigh.
'sizek',
'error',
'hdrmd5',
'metamd5',
'leadsigmd5',
]],
];
our $packagebinaryversionlist = [
'packagebinaryversionlist' =>
[[ 'binaryversionlist' =>
'package',
'code',
[[ 'binary' =>
'name',
'sizek',
'error',
'hdrmd5',
'metamd5',
'leadsigmd5',
]],
]],
];
our $worker = [
'worker' =>
'hostarch',
'ip',
'port',
'registerserver',
'workerid',
[ 'buildarch' ],
[ 'hostlabel' ],
'sandbox',
[ 'linux' =>
[],
'version',
'flavor'
],
[ 'hardware' =>
[ 'cpu' =>
[ 'flag' ],
],
'processors',
'jobs',
'nativeonly', # don't allow usage via the helper script
'memory', # in MBytes
'swap', # in MBytes
'disk', # in MBytes
],
'owner',
'tellnojob',
'job', # set when worker is busy
'arch', # set when worker is busy
'jobid', # set when worker is busy
'reposerver', # set when worker is busy and job was masterdispatched
];
our $packstatuslist = [
'packstatuslist' =>
'project',
'repository',
'arch',
[[ 'packstatus' =>
'name',
'status',
'error',
]],
[[ 'packstatussummary' =>
'status',
'count',
]],
];
our $linkpatch = [
'' =>
[ 'add' =>
'name',
'type',
'after',
'popt',
'dir',
],
[ 'apply' =>
'name',
],
[ 'delete' =>
'name',
],
'branch',
'topadd',
];
our $link = [
'link' =>
'project',
'package',
'rev',
'vrev',
'cicount',
'baserev',
'missingok',
[ 'patches' =>
[ $linkpatch ],
],
];
our $workerstatus = [
'workerstatus' =>
'clients',
[[ 'idle' =>
'uri',
'workerid',
'hostarch',
]],
[[ 'building' =>
'uri',
'workerid',
'hostarch',
'project',
'repository',
'package',
'arch',
'starttime',
]],
[[ 'down' =>
'workerid',
'hostarch',
]],
[[ 'dead' =>
'workerid',
'hostarch',
]],
[[ 'away' =>
'workerid',
'hostarch',
]],
[[ 'waiting' =>
'arch',
'jobs',
]],
[[ 'blocked' =>
'arch',
'jobs',
]],
[[ 'buildavg' =>
'arch',
'buildavg',
]],
[[ 'partition' =>
'name',
[[ 'daemon' =>
'type', # scheduler/dispatcher/signer/publisher/warden
'arch', # scheduler only
'state',
'starttime',
[ 'queue' => # scheduler only
'high',
'med',
'low',
'next',
],
]],
]],
];
our $workerstate = [
'workerstate' =>
'state',
'nextstate', # for exit/restart
'jobid',
'pid', # pid of building worker process
];
our $jobhistlay = [
'package',
'rev',
'srcmd5',
'versrel',
'bcnt',
'readytime',
'starttime',
'endtime',
'code',
'uri',
'workerid',
'hostarch',
'reason',
'verifymd5',
];
our $jobhist = [
'jobhist' =>
@$jobhistlay,
];
our $jobhistlist = [
'jobhistlist' =>
[ $jobhist ],
];
our $ajaxjob = [
'job' =>
'ev',
'fd',
'starttime',
'peer',
'request',
'state',
];
our $ajaxstatus = [
'ajaxstatus' =>
'starttime',
'ev',
[[ 'watcher' =>
'filename',
'state',
[ $ajaxjob ],
]],
[[ 'rpc' =>
'uri',
'state',
'ev',
'fd',
'starttime',
[ $ajaxjob ],
]],
[[ 'serialize' =>
'filename',
[ $ajaxjob ],
]],
[ 'joblist' =>
[ $ajaxjob ],
],
];
our $serverstatus = [
'serverstatus' =>
'starttime',
[[ 'job' =>
'id',
'starttime',
'pid',
'peer',
'request',
'group',
]],
];
##################### new api stuff
our $binarylist = [
'binarylist' =>
'package',
[[ 'binary' =>
'filename',
'md5',
'size',
'mtime',
]],
];
our $summary = [
'summary' =>
[[ 'statuscount' =>
'code',
'count',
]],
];
our $schedulerstats = [
'stats' =>
'lastchecked',
'checktime',
'lastfinished',
'lastpublished',
];
our $result = [
'result' =>
'project',
'repository',
'arch',
'code', # pra state, can be "unknown", "broken", "scheduling", "blocked", "building", "finished", "publishing", "published" or "unpublished"
'state', # old name of 'code', to be removed
'details',
'dirty', # marked for re-scheduling if element exists, state might not be correct anymore
[ $buildstatus ],
[ $binarylist ],
$summary,
$schedulerstats,
];
our $resultlist = [
'resultlist' =>
'state',
'retryafter',
[ $result ],
];
our $opstatus = [
'status' =>
'code',
'origin',
[],
'summary',
'details',
[[ 'data' =>
'name',
'_content',
]],
[ 'exception' =>
'type',
'message',
[ 'backtrace' =>
[ 'line' ],
],
],
];
my $rpm_entry = [
'rpm:entry' =>
'kind',
'name',
'epoch',
'ver',
'rel',
'flags',
];
our $pattern = [
'pattern' =>
'xmlns', # obsolete, moved to patterns
'xmlns:rpm', # obsolete, moved to patterns
[],
'name',
'arch',
[[ 'version' =>
'epoch',
'ver',
'rel',
]],
[[ 'summary' =>
'lang',
'_content',
]],
[[ 'description' =>
'lang',
'_content',
]],
'default',
'uservisible',
[[ 'category' =>
'lang',
'_content',
]],
'icon',
'script',
[ 'rpm:provides' => [ $rpm_entry ], ],
[ 'rpm:conflicts' => [ $rpm_entry ], ],
[ 'rpm:obsoletes' => [ $rpm_entry ], ],
[ 'rpm:requires' => [ $rpm_entry ], ],
[ 'rpm:suggests' => [ $rpm_entry ], ],
[ 'rpm:enhances' => [ $rpm_entry ], ],
[ 'rpm:supplements' => [ $rpm_entry ], ],
[ 'rpm:recommends' => [ $rpm_entry ], ],
];
our $patterns = [
'patterns' =>
'count',
'xmlns',
'xmlns:rpm',
[],
[ $pattern ],
];
our $ymp = [
'metapackage' =>
'xmlns:os',
'xmlns',
[],
[[ 'group' =>
'recommended',
'distversion',
[],
'name',
'summary',
'description',
'remainSubscribed',
[ 'repositories' =>
[[ 'repository' =>
'recommended',
'format',
'producturi',
[],
'name',
'summary',
'description',
'url',
]],
],
[ 'software' =>
[[ 'item' =>
'type',
'recommended',
'architectures',
'action',
[],
'name',
'summary',
'description',
]],
],
]],
];
our $binary_id = [
'binary' =>
'name',
'project',
'package',
'repository',
'version',
'release',
'arch',
'filename',
'filepath',
'baseproject',
'type',
];
our $pattern_id = [
'pattern' =>
'name',
'project',
'repository',
'arch',
'filename',
'filepath',
'baseproject',
'type',
];
our $request = [
'request' =>
'id',
'creator',
'type', # obsolete, still here to handle OBS pre-1.5 requests
'key', # cache key, not really in request
'retryafter', # timed out waiting for a key change
[[ 'action' =>
'type', # currently submit, delete, change_devel, add_role, maintenance_release, maintenance_incident, set_bugowner
[ 'source' =>
'project',
'package',
'rev', # belongs to package attribute
'repository', # for merge request
],
[ 'target' =>
'project',
'package',
'releaseproject', # for incident request
'repository', # for release and delete request
],
[ 'person' =>
'name',
'role',
],
[ 'group' =>
'name',
'role',
],
[ 'options' =>
[],
'sourceupdate', # can be cleanup, update or noupdate
'updatelink', # can be true or false
'makeoriginolder', # can be true or false
],
[ 'acceptinfo' =>
'rev',
'srcmd5',
'osrcmd5',
'xsrcmd5',
'oxsrcmd5',
],
]],
[ 'submit' => # this is old style, obsolete by request, but still supported
[ 'source' =>
'project',
'package',
'rev',
],
[ 'target' =>
'project',
'package',
],
],
'priority',
[ 'state' =>
'name',
'who',
'when',
'superseded_by', # set when state.name is "superseded"
[],
'comment',
],
[[ 'review' =>
'state', # review state (new/accepted or declined)
'by_user', # this user shall review it
'by_group', # one of this groupd shall review it
# either user or group must be used, never both
'by_project', # any maintainer of this project can review it
'by_package', # any maintainer of this package can review it (requires by_project)
'who', # this user has reviewed it
'when',
[],
'comment',
[[ 'history' =>
'who',
'when',
[],
'comment',
'description',
]],
]],
[[ 'history' =>
'name',
'who',
'when',
'superseded_by',
[],
'comment',
'description',
]],
'accept_at',
'title',
'description',
];
our $repositorystate = [
'repositorystate' =>
[ 'blocked' ],
];
our $collection = [
'collection' =>
'matches',
'limited',
[ $request ],
[ $proj ],
[ $pack ],
[ $binary_id ],
[ $pattern_id ],
[ 'value' ],
];
our $quota = [
'quota' =>
'packages',
[[ 'project' =>
'name',
'packages',
]],
];
our $schedulerinfo = [
'schedulerinfo' =>
'arch',
'started',
'time',
[],
'slept',
'notready',
[ 'queue' =>
'high',
'med',
'low',
'next',
],
'projects',
'repositories',
[[ 'worst' =>
'project',
'repository',
'packages',
'time',
]],
'buildavg',
'avg',
'variance',
];
our $person = [
'person' =>
'login',
'email',
'realname',
'state',
[ 'globalrole' ],
[ 'watchlist' =>
[[ 'project' =>
'name',
]],
],
];
our $comps = [
'comps' =>
[[ 'group' =>
[],
'id',
[[ 'description' =>
'xml:lang',
'_content',
]],
[[ 'name' =>
'xml:lang',
'_content',
]],
[ 'packagelist' =>
[[ 'packagereq' =>
'type',
'_content',
]],
],
]],
];
our $dispatchprios = [
'dispatchprios' =>
[[ 'prio' =>
'project',
'repository',
'arch',
'adjust',
]],
];
# list of used services for a package or project
our $services = [
'services' =>
[[ 'service' =>
'name',
'mode', # "localonly" is skipping this service on server side, "trylocal" is trying to merge changes directly in local files, "disabled" is just skipping it
[[ 'param' =>
'name',
'_content'
]],
]],
];
# service type definitions
our $servicetype = [
'service' =>
'name',
'hidden', # "true" to suppress it from service list in GUIs
[],
'summary',
'description',
[[ 'parameter' =>
'name',
[],
'description',
'required', # don't run without this parameter
'allowmultiple', # This parameter can be used multiple times
[ 'allowedvalue' ], # list of possible values
]],
];
our $servicelist = [
'servicelist' =>
[ $servicetype ],
];
our $updateinfoitem = [
'update' =>
'from',
'status',
'type',
'version',
[],
'id',
'title',
'severity',
'release',
[ 'issued' =>
'date',
],
[ 'updated' =>
'date',
],
'reboot_suggested',
[ 'references' =>
[[ 'reference' =>
'href',
'id',
'title',
'type',
]],
],
'description',
'message', #optional popup message
[ 'pkglist',
[[ 'collection' =>
'short',
[],
'name',
[[ 'package' =>
'name',
'epoch',
'version',
'release',
'arch',
'src',
'supportstatus', # extension
[],
'filename',
[ 'sum' => # obsolete?
'type',
'_content',
],
'reboot_suggested',
'restart_suggested',
'relogin_suggested',
]],
]],
],
'patchinforef', # extension, "project/package"
];
our $updateinfo = [
'updates' =>
'xmlns',
[ $updateinfoitem ],
];
our $deltapackage = [
'newpackage' =>
'name',
'epoch',
'version',
'release',
'arch',
[[ 'delta' =>
'oldepoch',
'oldversion',
'oldrelease',
[],
'filename',
'sequence',
'size',
[ 'checksum' =>
'type',
'_content',
],
]],
];
our $deltainfo = [
'deltainfo' =>
[ $deltapackage ],
];
our $prestodelta = [
'prestodelta' =>
[ $deltapackage ],
];
our $sourcediff = [
'sourcediff' =>
'key',
[ 'old' =>
'project',
'package',
'rev',
'srcmd5',
],
[ 'new' =>
'project',
'package',
'rev',
'srcmd5',
],
[ 'files' =>
[[ 'file' =>
'state', # added, deleted, changed
[ 'old' =>
'name',
'md5',
'size',
'mtime',
],
[ 'new' =>
'name',
'md5',
'size',
'mtime',
],
[ 'diff' =>
'binary',
'lines',
'shown',
'_content',
],
]],
],
[ 'issues' =>
[[ 'issue' =>
'state',
'tracker',
'name',
'label',
'url',
]]
],
];
our $configuration = [
'configuration' =>
[],
'title', #webui only
'description', #webui only
'name', #obsname
'anonymous',
'registration',
'default_access_disabled',
'default_tracker',
'allow_user_to_create_home_project',
'multiaction_notify_support',
'disallow_group_creation',
'change_password',
'cleanup_after_days',
'hide_private_options',
'gravatar',
'enforce_project_keys',
'download_on_demand',
'download_url',
'obs_url',
'api_url',
'ymp_url',
'errbit_url',
'bugzilla_url',
'http_proxy',
'no_proxy',
'admin_email',
'theme',
'cleanup_empty_projects',
'disable_publish_for_branches',
[ 'schedulers' =>
[ 'arch' ],
],
];
our $issue_trackers = [
'issue-trackers' =>
[[ 'issue-tracker' =>
[],
'name',
'description',
'kind',
'label',
'enable-fetch',
'regex',
'user',
# 'password', commented out on purpose, should not reach backend
'show-url',
'url',
'issues-updated',
]],
];
our $appdataitem = [
'application' =>
[ 'id' =>
'type',
'_content'
],
'pkgname',
'name',
'summary',
[ 'icon' =>
'type',
[],
'name',
[[ 'filecontent' =>
'file',
'_content'
]],
],
[ 'appcategories' =>
[ 'appcategory' ]
],
[ 'mimetypes' =>
[ 'mimetype' ]
],
[ 'keywords' =>
[ 'keyword' ]
],
[ 'url' =>
'type',
'_content'
]
];
our $appdata = [
'applications' =>
'version',
[ $appdataitem ]
];
our $attribute = [
'attribute' =>
'namespace',
'name',
'binary',
[ 'value' ],
[[ 'issue' =>
'name',
'tracker'
]],
];
our $attributes = [
'attributes' =>
[ $attribute ],
];
our $size = [
'size' =>
'unit',
[],
'_content',
];
our $time = [
'time' =>
'unit',
[],
'_content',
];
# define constraints for build jobs in packages or projects.
our @constraint = (
[[ 'hostlabel' =>
'exclude', # true or false. default is false.
[],
'_content' # workers might get labels defined by admin, for example for benchmarking.
]],
[ 'sandbox' =>
'exclude', # true or false. default is false.
[],
'_content' # xen/kvm/zvm/lxc/emulator/chroot/secure
],
[ 'linux' =>
[ 'version' =>
[],
'max' ,
'min' ,
],
'flavor',
],
[ 'hardware' =>
[ 'cpu' =>
[ 'flag' ],
],
'processors',
'jobs',
[ 'disk' => $size ],
[ 'memory' => $size ],
[ 'physicalmemory' => $size ],
]
);
our $constraints = [
'constraints' =>
@constraint,
[[ 'overwrite' =>
[ 'conditions' =>
[ 'arch' ],
[ 'package' ],
],
@constraint,
]]
];
our $buildstatistics = [
'buildstatistics' =>
[ 'disk' =>
[ 'usage' =>
[ 'size' =>
'unit',
[],
'_content',
],
'io_requests',
'io_sectors',
],
],
[ 'memory' =>
[ 'usage' => $size ],
],
[ 'times' =>
[ 'total' => $time ],
[ 'preinstall' => $time ],
[ 'install' => $time ],
[ 'main' => $time ],
[ 'download' => $time ],
],
[ 'download' =>
[],
$size,
'binaries',
'cachehits',
'preinstallimage',
],
];
our $notifications = [
'notifications' =>
'next',
'sync',
'limit_reached',
[[ 'notification' =>
'type',
'time',
[[ 'data' =>
'key',
'_content',
]],
]],
];
our $frozenlinks = [
'frozenlinks' =>
[[ 'frozenlink' =>
'project',
[[ 'package' =>
'name',
'srcmd5',
'vrev',
]],
]],
];
our $report = [
'report' =>
[[ 'binary' =>
'name',
'epoch',
'version',
'release',
'binaryarch',
'buildtime',
'disturl',
'supportstatus',
'project',
'repository',
'package',
'arch', # schedulerarch
'_content',
]],
];
our $publishedpath = [
'publishedpath' =>
'project',
'repository',
'medium',
[],
'path',
'url',
];
our $multibuild = [
'multibuild' =>
[ 'package' ],
];
1;
07070100000004000081A400000000000000000000000164D603BC000046AC000000000000000000000000000000000000002C00000000obs-service-product_converter-1.5.6/COPYING GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
07070100000005000081ED00000000000000000000000164D603BC0000E8E5000000000000000000000000000000000000003A00000000obs-service-product_converter-1.5.6/create_single_product#!/usr/bin/perl -w
#
# Copyright (c) 2008-2016 Adrian Schroeter, Novell Inc.
# Copyright (c) 2008 Klaas Freitag, Novell Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 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
#
################################################################
#
# Converter to create Kiwi- and Spec files from product definition
#
BEGIN {
my ($wd) = $0 =~ m-(.*)/- ;
$wd ||= '.';
chdir($wd);
unshift @INC, "$wd/build";
unshift @INC, "$wd";
}
use strict;
use Getopt::Std;
use Data::Dumper;
use File::Basename;
use Storable;
use XML::Structured ':bytes';
use BSUtil;
use BSXML;
use BSProductXML;
use BSKiwiXML;
use BSXML;
my $bsdir;
my $obsname;
my $project;
# hardcoded for now
$obsname = $::ENV{'OBS_NAME'} || "build.o.o";
# read the product xml file
use vars qw ($opt_h $opt_d $opt_m
@errors %conditionals %repositories %groupRefs %archSets $indir);
my %product_requires;
sub usage()
{
print<<END
create_single_product product_file output_directory [project_name]
convert a product definition file to a spec- and a kiwi source file.
Options:
-h: help, print this text.
-d: debug, create debug output and files
-m: mediaset, build only for the given mediaset, identify by name
END
;
exit;
}
sub readProductFile( $ )
{
my ($filename) = @_;
print "parsing product definition... ";
my $xml = BSProductXML::readproductxml( "$filename", 1, $opt_d );
if( defined($xml) ) {
print "success!\n";
} else {
die("FAILED: Unable to parse $filename: $@");
}
return $xml;
}
sub createDescription( $ )
{
my( $prodRef ) = @_;
my $re;
$re->{type} = "system";
$re->{author} = "The SUSE Team";
$re->{contact} = "build\@opensuse.org";
$re->{specification} = $prodRef->{summary}[0]->{_content}; # FIXME: lang dependent
return $re;
}
sub convertFlags( $ ){
my ($flag)=@_;
$flag =~ s/GT/>/sg;
$flag =~ s/EQ/=/sg;
$flag =~ s/LT/</sg;
$flag =~ s/NE/!=/sg;
$flag =~ s/GE/>=/sg;
$flag =~ s/LE/<=/sg;
return $flag;
}
sub convertRelationship( $ ){
my ( $relationship ) = @_;
$relationship =~ s/suggests/Suggests/sg;
$relationship =~ s/recommends/Recommends/sg;
$relationship =~ s/requires/Requires/sg;
$relationship =~ s/provides/Provides/sg;
$relationship =~ s/conflicts/Conflicts/sg;
$relationship =~ s/obsoletes/Obsoletes/sg;
return $relationship;
}
#
# The conditionals are kind of macros which are used all over the product definition.
# The conditionals part of the product def is parsed into the global conditionalhash
# with the conditional name as key.
#
sub parseConditionals( $ )
{
my ($conditionalRef) = @_;
# print Dumper $conditionalRef;
return unless( $conditionalRef );
foreach my $condRef (@{$conditionalRef}) {
my $name = $condRef->{name};
# print "Parsed conditional $name\n";
# print Dumper $condRef;
$conditionals{$name} = $condRef;
}
}
sub parseArchsets( $ )
{
my ($archSetsRef ) = @_;
foreach my $archSet ( @{$archSetsRef } ) {
# print "Parsing Archset $archSet->{name}\n";
# print "XXXX " . Dumper( $archSet ) . "\n";
if( $archSet->{name} ) {
my %h;
$h{productarch} = $archSet->{productarch};
my @a;
foreach my $cRef ( @{$archSet->{arch}} ) {
push @a, $cRef->{_content};
}
$h{archList} = \@a;
$archSets{$archSet->{name}} = \%h;
}
}
# print Dumper %archSets;
}
sub getUrl( $$$ ){
my ($product,$arch,$searchstring) = @_;
my $resulturl="";
foreach my $url ( @{$product->{'urls'}->{'url'}} ){
if ( "$url->{'name'}" eq "$searchstring" ){
if ( exists $url->{'arch'} && "$url->{'arch'}" eq "$arch" ) {
my $u = $url->{'_content'};
$u =~ s/%\{_target_cpu}/$arch/g;
return $u;
} elsif (exists $url->{'arch'}) {
next;
} else {
my $u = $url->{'_content'};
$u =~ s/%\{_target_cpu}/$arch/g;
$resulturl = $u;
# Continue searching, in case we find an architecture match
}
}
}
return $resulturl;
}
sub createArchitectures( $ )
{
my ($archSetList) = @_;
my $re = {};
my @archs;
my %reqArchs;
my %archMatrix;
foreach my $requiredArch( @{$archSetList} ) {
my $ref = $requiredArch->{ref};
die ( "ERROR: No such archset $ref\n" ) unless $archSets{$ref} ;
my @archis = @{ $archSets{$ref}->{archList} };
my $border = @archis; # the amount of entries
print "WARN: last arch in archset must be noarch\n" unless( $archis[$border-1] eq "noarch" );
$reqArchs{ $archSets{$ref}->{productarch} } = 1; # will be requiredarch in kiwi
for( my $i = 0; $i < $border; $i++ ) {
$archMatrix{ $archis[$i] } = { fallback => $archis[$i+1] };
}
}
foreach my $arch ( sort keys %archMatrix ) {
my %h;
$h{id} = $arch;
if( $archMatrix{$arch}->{name} ) {
$h{name} = $archMatrix{$arch}->{name};
} else {
$h{name} = "dummy"; # FIXME: should become optional
};
$h{fallback} = $archMatrix{$arch}->{fallback} if( $archMatrix{$arch}->{fallback});
push @archs, \%h;
}
my @reqXml;
foreach ( sort keys %reqArchs ) {
my %h;
$h{ref} = $_;
push @reqXml, \%h;
}
$re->{arch} = \@archs;
$re->{requiredarch} = \@reqXml;
return $re;
}
sub createProductOptions($$$)
{
my( $prodRef, $medium, $archSetList ) = @_;
my $mediaStyle = getMediaStyle($prodRef);
# General FIXME: this works only with a single product on media.
my $product = $prodRef->{products}{product}[0];
die( "Handling of multiple products on one media is currently not specified !\n" ) if $prodRef->{products}{product}[1];
my $re = {};
my %varsH;
# we need the "default" arch for
# - MEDIUM_NAME
# - releasenotesurl
my $arch="i586";
my @allarchs;
foreach my $ar ( @$archSetList ) {
$arch=$archSets{$ar->{ref}}->{productarch} if ($archSets{$ar->{ref}});
push @allarchs, $arch;
}
$varsH{MEDIUM_NAME} = $product->{'name'}."-".$product->{'version'}."-".join( "-", @allarchs );
if ( defined $medium->{'name'} ) {
$varsH{MEDIUM_NAME} = $medium->{'name'}."-".join( "-", @allarchs );
}
if ( defined $medium->{'volumeid'} ) {
$varsH{VOLUME_ID} = $medium->{'volumeid'};
}
$varsH{PRODUCT_THEME} = $product->{'buildconfig'}->{'producttheme'};
$varsH{SEPARATE_MEDIA} = "true" unless (defined($medium->{'separate'}) && $medium->{'separate'} eq 'false');
$varsH{MULTIPLE_MEDIA} = "false";
$varsH{MULTIPLE_MEDIA} = "true" if (defined($medium->{'sourcemedia'}) && $medium->{'sourcemedia'} > 1);
$varsH{MULTIPLE_MEDIA} = "true" if (defined($medium->{'debugmedia'}) && $medium->{'debugmedia'} > 1);
$varsH{RUN_MEDIA_CHECK} = "true" if (defined($medium->{'run_media_check'})) && $medium->{'run_media_check'} ne "no" && $medium->{'run_media_check'} eq "false";
$varsH{RUN_ISOHYBRID} = "true" if (defined($medium->{'run_hybridiso'})) && $medium->{'run_hybridiso'} eq "true";
$varsH{RUN_ISOHYBRID} = "rpi" if (defined($medium->{'run_hybridiso'})) && $medium->{'run_hybridiso'} eq "rpi";
$varsH{MAKE_LISTINGS} = 'true' if (defined($medium->{'run_make_listings'}) && $medium->{'run_make_listings'} eq "true");
$varsH{SHA1OPT} = "-x";
$varsH{REPO_ONLY} = "true" if (defined($medium->{'repo_only'})) && $medium->{'repo_only'} ne "no" && $medium->{'repo_only'} ne "false";
# explicit removal of additional tree
$varsH{DROP_REPOSITORY} = "true" if (defined($medium->{'drop_repo'})) && $medium->{'drop_repo'} ne "no" && $medium->{'drop_repo'} ne "false";
# remove tree for media style sle12/13.2 by default
$varsH{DROP_REPOSITORY} = "true" unless defined($medium->{'drop_repo'}) || $varsH{REPO_ONLY} || $varsH{DROP_REPOSITORY};
foreach my $shortsummary ( @{$product->{'shortsummary'}} ){
$varsH{PRODUCT_SUMMARY} = $shortsummary->{'_content'} if ( ! $shortsummary->{'language'} );
}
die("No short summary defined, but required for current media styles") unless $varsH{PRODUCT_SUMMARY};
$varsH{PRODUCT_RELEASE} = $product->{'release'} if defined($product->{'release'});
# switch to sha256 sums
$varsH{SHA1OPT} .= " -2";
$varsH{VENDOR} = $product->{'vendor'};
$varsH{DISTNAME} = $product->{'name'};
$varsH{VERSION} = $product->{'version'};
$varsH{FLAVOR} = $medium->{'flavor'};
$varsH{PRODUCT_DIR} = "/";
$varsH{PRODUCT_NAME} = '$DISTNAME-$FLAVOR';
$varsH{PRODUCT_VERSION} = '$VERSION';
my @vars;
foreach my $opt ( sort keys %varsH ) {
push @vars, { name => $opt, _content => $varsH{$opt} };
}
$re->{productvar} = \@vars;
my %options;
if (defined($medium->{'sourcemedia'})) {
$options{'SOURCEMEDIUM'} = $medium->{'sourcemedia'};
};
if (defined($medium->{'debugmedia'})) {
$options{'DEBUGMEDIUM'} = $medium->{'debugmedia'};
};
$options{'DOWNLOAD_MIRROR_POLICY'} = "false" if (defined($medium->{'download_mirror_policy'}) && $medium->{'download_mirror_policy'} eq "false");
$options{'IGNORE_MISSING_REPO_PACKAGES'} = "true" if (defined($medium->{'ignore_missing_packages'}) && $medium->{'ignore_missing_packages'} eq "true");
$options{'IGNORE_MISSING_META_PACKAGES'} = "true" if (defined($medium->{'ignore_missing_meta_packages'}) && $medium->{'ignore_missing_meta_packages'} eq "true");
$options{'USE_NEWEST_PACKAGE'} = "true" if (defined($medium->{'use_newest_version'}) && $medium->{'use_newest_version'} eq "true");
$options{'PLUGIN_DIR'} = "/usr/share/kiwi/modules/plugins/$mediaStyle";
$options{'INI_DIR'} = "/usr/share/kiwi/modules/plugins/$mediaStyle";
$options{'BETA_VERSION'} = $product->{'buildconfig'}->{'betaversion'} if (defined($product->{'buildconfig'}->{'betaversion'}));
$options{'MAIN_PRODUCT'} = $product->{'buildconfig'}->{'mainproduct'} if (defined($product->{'buildconfig'}->{'mainproduct'}));
$options{'RUN_DEPENDENCY_CHECK'} = $medium->{'run_dependency_check'} if defined($medium->{'run_dependency_check'});
my %info;
$info{'VENDOR'} = $product->{'vendor'};
if (defined($obsname) && (defined($project)) && ("$project" ne "")){
my @repoid;
foreach my $arch (@allarchs) {
push @repoid, "obsproduct://".$obsname."/".$project."/".$product->{'name'}."/".$product->{'version'}."/". $arch;
}
$info{'REPOID'} = join(" ", @repoid);
}
if (defined($medium->{'preselected_patterns'})){
$info{'PATTERNS'} .= join(' ',map( $_->{'name'},@{$medium->{'preselected_patterns'}->[0]->{'pattern'}}));
}
my $label="";
foreach my $shortsummary ( @{$product->{'summary'}} ){
$label = $shortsummary->{'_content'} if ( ! $shortsummary->{'language'} );
}
my $cpe = getCpeId($prodRef, $product);
$info{'DISTRO'} = "$cpe,$label";
$info{'PURL_DISTRO'} = $product->{'purl_distro'} if $product->{'purl_distro'};
$options{'REPO_LOCATION'} = getUrl($product,$arch,"repository");
$info{'LINGUAS'} = "";
foreach my $language ( @{$product->{'linguas'}->{'language'}} ){
$info{'LINGUAS'} .= "$language->{'_content'} ";
}
# Add REGISTERPRODUCT string - see: bnc#458340
if (defined($medium->{'registration'}) and $medium->{'registration'} eq "false") {
$info{'REGISTERPRODUCT'} .= "false"
} elsif (defined($medium->{'productdependency'}) || $product->{'productdependency'}) {
$info{'REGISTERPRODUCT'} .= "true" if (defined($product->{'register'}));
}
# Add Product Options
my @vars1;
foreach my $opt ( sort keys %options ) {
push @vars1, { name => $opt, _content => $options{$opt} };
}
$re->{productoption} = \@vars1;
# Add Product Info
my @info;
push @info, { name => 'CONTENTSTYLE', _content => '11' }; # Needs to be first !
foreach my $opt ( sort keys %info) {
push @info, { name => $opt, _content => $info{$opt} };
}
$re->{productinfo} = \@info;
return $re;
}
sub createMetadata( $$$ )
{
my( $prodRef, $medium, $archSetList ) = @_;
return undef unless( $medium->{'metadata'} );
my $re = {};
# print "> " . Dumper $medium->{metadata};
my @packages;
my @files;
my $metadata_medium = "0";
# $metadata_medium = "1" if (defined($medium->{'sourcemedia'}) && $medium->{'sourcemedia'} > 1);
foreach my $pack ( @{ $medium->{metadata}->{package} } ) {
my @onlyarch;
my $removearch;
if ($pack->{removearch}){
next if containsMyArch( $prodRef, $archSetList, $pack->{removearch} );
$removearch = "$pack->{removearch},src,nosrc";
} else {
$removearch = "src,nosrc";
}
if (defined($pack->{onlyarch})) {
push @onlyarch, $pack->{onlyarch};
} else {
foreach my $requiredArch( @{$archSetList} ) {
my $ref = $requiredArch->{ref};
die( "ERROR: No such archset $ref\n" ) unless $archSets{$ref};
push @onlyarch, $archSets{$ref}->{productarch} unless grep { $_ eq $archSets{$ref}->{productarch} } @onlyarch;
}
}
my $h = { name => $pack->{name},
medium => $metadata_medium,
removearch => $removearch,
onlyarch => join(",",@onlyarch) };
$h->{'arch'} = $pack->{'arch'} if defined($pack->{'arch'});
$h->{'addarch'} = $pack->{addarch} if defined($pack->{addarch});
push @packages, $h;
}
my @a;
return { repopackage => \@packages };
# my @files;
# foreach my $file ( @{ $medium->{metadata}->{file} } ) {
# push @files, { name => $file->{name} };
# }
# # push @a, { file => \@files }; CHECK: Needed?
#
# return \@a;
}
sub containsMyArch( $$$ )
{
my ($prodRef, $archSetList, $archList ) = @_;
foreach my $s( split( /\s*,\s*/, $archList ) ){
foreach my $requiredArch( @{$archSetList} ) {
my $ref = $requiredArch->{ref};
die( "ERROR: No such archset $ref\n" ) unless $archSets{$ref};
return 1 if ( $s eq $archSets{$ref}->{productarch} );
}
}
return 0;
}
sub useToPackages( $$$ )
{
my ($prodRef, $medium, $archSetList ) = @_;
return unless $medium;
my @packages;
my %supportstates;
if (defined($medium->{use_undecided}) && $medium->{use_undecided} eq "true" ) {
# Simply take all packages ?
push @packages, { name => "*" };
};
return unless $medium->{use};
my @useStatements = @{$medium->{use} };
# print "Use Required: <$useRequired>, Suggested: <$useSuggested>, Recommended: <$useRecommended>\n";
foreach my $useState ( @useStatements ) {
my $useRequired;
my $useRecommended;
my $useSuggested;
# Media default settings
$useRequired = $medium->{'use_required'}
if ( defined($medium->{'use_required'}) && $medium->{'use_required'} eq "true" );
$useRecommended = $medium->{'use_recommended'}
if ( defined($medium->{'use_recommended'}) && $medium->{'use_recommended'} eq "true" );
$useSuggested = $medium->{'use_suggested'}
if ( defined($medium->{'use_suggested'}) && $medium->{'use_suggested'} eq "true" );
# can get overriden by "use group" settings
$useRequired = $useState->{'use_required'}
if ( defined($useState->{'use_required'}) && $useState->{'use_required'} eq "true" );
$useRecommended = $useState->{'use_recommended'}
if ( defined($useState->{'use_recommended'}) && $useState->{'use_recommended'} eq "true" );
$useSuggested = $useState->{'use_suggested'}
if ( defined($useState->{'use_suggested'}) && $useState->{'use_suggested'} eq "true" );
if( $useState->{group} ) {
# print "Handling use of group $useState->{group}\n";
my ($packs, $supports) = groupToPackages( $prodRef, $archSetList,
$useState->{group},
$useRequired,
$useRecommended,
$useSuggested );
push @packages, @{$packs} if $packs;
if ($supports && keys %$supports > 0) {
%supportstates = (%supportstates, %$supports);
};
# there might be additional packages listed in the group.
if( $useState->{package} ) {
foreach my $addPack ( @{$useState->{package} } ) {
my $relType = $addPack->{relationship};
die( "ERROR: Unknown relation type string for package add!\n" ) unless( $relType eq "requires" || $relType eq "recommends" || $relType eq "suggests" );
if( ( $useRequired && $addPack->{relationship} eq "requires") ||
( $useRecommended && $addPack->{relationship} eq "recommends" ) ||
( $useSuggested && $addPack->{relationship} eq "suggests" ) ) {
my %tmp;
$tmp{name} = $addPack->{name};
$tmp{medium} = $addPack->{medium} if (defined($addPack->{medium}));
$tmp{module} = $addPack->{module} if (defined($addPack->{module}));
if ($addPack->{removearch}) {
next if containsMyArch( $prodRef, $archSetList, $addPack->{removearch} );
$tmp{removearch} = $addPack->{removearch};
}
push @packages, \%tmp;
# separate list of supportstatus values if defined
if (defined($addPack->{supportstatus})) {
my %stmp;
$stmp{$addPack->{name}} = $addPack->{supportstatus};
%supportstates = %stmp;
}
}
}
}
} elsif( $useState->{pattern} ) {
die( "ERROR: Patterns are not supported for repopackages!\n" );
}
}
# sort package list by name
@packages = sort { lc($a->{name}) cmp lc($b->{name}) } @packages;
return (\@packages, \%supportstates);
}
sub groupToPackages( $$$$$ )
{
my ($prodRef, $archSetList, $group, $useReq, $useRec, $useSug ) = @_;
# generate the list of current architectures out of the archSetList
# FIXME: In all product configs I saw so far, there is only one entry
# in the archsetlist.
# What does it mean if there are more? The following code takes all
# and allows all.
my @validArchs;
foreach my $archHashRef (@$archSetList) {
my $archSetRef = $archSets{$archHashRef->{ref}};
push @validArchs, $archSetRef->{productarch};
}
my @groups = @{$prodRef->{group} || {}};
my $groupRef;
# search for the group we should convert here.
foreach my $gl( @groups ) {
if( $gl->{name} eq $group ) {
$groupRef = $gl;
last;
}
}
unless( $groupRef ) {
die( "ERROR: Group <$group> not found!\n" );
}
unless( $groupRef->{packagelist} ) {
die( "ERROR: Group <$group> has no package lists!\n" );
}
# ok, here we have a valid group reference.
# print " * resolving group <$groupRef->{name}>\n";
my @packagelists = @{$groupRef->{packagelist}};
my %conditionTemplate;
foreach my $condList( @{$groupRef->{conditional} } ) {
# print "Handling group conditional $condList->{name}\n";
my $cond = $conditionals{ $condList->{name} };
die( "ERROR: Unknown condition is used: $condList->{name}\n" ) unless $cond;
if( $cond->{platform} ) {
my @platforms = @{$cond->{platform}};
# the condition only becomes a template
foreach my $p ( @platforms ) {
my @condArchs;
@condArchs = split( /\s*,\s*/, $p->{arch} ) if( $p->{arch} );
#
my $takeIt = 1; # Take all condition tags if no arch-tag is there
if( $p->{arch} ) {
$takeIt = 0;
foreach my $validArch( @validArchs ) {
if( grep( /\b$validArch\b/, @condArchs ) ) {
$takeIt = 1;
last;
}
}
}
if( $takeIt ) {
%conditionTemplate = (%conditionTemplate, %{$p});
} else {
# This condition does not match, so drop it
}
}
}
}
# Drop this group, if condition(s) exist for it, but none matches for this platform
return () if ( @{$groupRef->{conditional}} > 0 && !keys %conditionTemplate );
my $useFlags = { requires => $useReq || 0, recommends => $useRec || 0, suggests => $useSug || 0 };
my @resultList;
my %supportStates;
foreach my $packList ( @packagelists ) {
my $relation = $packList->{relationship} || 'requires';
# print "Relation: $relation\n";
if( $useFlags->{$relation} && $packList->{package} ) {
# parse the package in
my @packs = @{$packList->{package}};
foreach my $pack ( @packs ) {
my %h = %conditionTemplate;
my $takeIt = 1;
$takeIt = 0 unless $pack->{conditional};
# print Dumper $pack;
foreach my $condList( @{$pack->{conditional} } ) {
my $name = $condList->{name};
my $cond = $conditionals{$name};
next unless defined $h{$name};
$takeIt = 1;
print "Handling package conditional $name\n";
# print Dumper "Conditional: ". $cond . "\n";
if( $cond->{platform} ) {
my @platforms = @{$cond->{platform}};
foreach my $p ( @platforms ) {
%h= (%h, %{$p});
}
}
if( $cond->{media} ) {
$h{medium} = $cond->{media}->{number};
}
}
$h{name} = $pack->{name};
push @resultList, \%h;
if( $pack->{supportstatus} || $packList->{supportstatus} ) {
$supportStates{$pack->{name}} = ($pack->{supportstatus}||$packList->{supportstatus});
}
}
}
}
return (\@resultList, \%supportStates);
}
#
# This sub expands the patterns
sub expandPackages( $ )
{
my ($groupRef) = @_;
my $name = $groupRef->{name};
print "Working on group $name\n";
my @patterns = @{$groupRef->{pattern}};
my $pat = @{$groupRef->{pattern}}[0];
$groupRef->{_pattern} = $pat;
foreach my $pack ( @{$groupRef->{group}} ) {
my $packListRef = $pack->{package};
my $relation = $pack->{relationship};
my @resultPacks;
foreach my $packRef ( @${packListRef} ) {
# print "Pushing $packRef->{name}\n";
my %packValues;
$packValues{name} = $packRef->{name};
if( $groupRef->{platform} ) {
# forcerepo??
foreach my $tag ('forcearch', 'addarch', 'onlyarch', 'removearch', 'source', 'script', 'medium', 'module' ) {
$packValues{$tag} = $groupRef->{platform}->{$tag} if $groupRef->{platform}->{$tag};
}
}
push @resultPacks, \%packValues;
}
my $keyname = "_" . lc $relation;
print "Keyname of package list: $keyname\n";
$groupRef->{$keyname} = \@resultPacks;
}
}
#
# Creation of the instsource part of the kiwi file
#
# note that the product spec contains a list of archsets. For each of these archsets and
# for each of the media must be a separate kiwi file.
#
# 1. parameter: the reference on the product datastructure
# 2. parameter: the reference on the current media datastructure
# 3. parameter: list of the archs for this kiwi file.
#
sub createInstsource( $$$ )
{
my( $prodRef, $medium, $archSetList ) = @_;
my $re = {};
$re->{architectures} = createArchitectures( $archSetList );
$re->{productoptions} = createProductOptions( $prodRef, $medium, $archSetList );
my @r;
my $count = 0;
foreach my $repo ( @{$prodRef->{repositories}{repository} } ) {
my %h;
my $kiwipath;
next if defined($repo->{build}) && $repo->{build} eq "ignore";
$count = $count + 1;
$h{priority} = $count;
$h{name} = "repository_".$count;
if ($repo->{path} =~ /^obs:\/\/([^\/]*)\/([^\/]*)$/ ) { #old format without obsname
$h{local} = "true";
$kiwipath = "obs://$1/$2";
} elsif ($repo->{path} =~ /^obs:\/\/([^\/]*)\/([^\/]*)\/([^\/]*)$/ ) {
$h{local} = "true";
$kiwipath = "obs://$2/$3";
} elsif ($repo->{path} =~ /^obsrepositories:/ ) {
$h{local} = "true";
$kiwipath = "obsrepositories:/";
} else {
die( "ERROR: Non obs:// url as repository: $repo->{path} !\n" );
};
$h{source} = { path => $kiwipath };
push @r, \%h;
}
$re->{instrepo} = \@r;
# metadata, media dependant
my $ref = createMetadata( $prodRef, $medium, $archSetList );
if( $ref ) {
$re->{metadata} = createMetadata( $prodRef, $medium, $archSetList );
}
# repopackages
my @packages;
my ($useToPacks, $supportStates) = useToPackages( $prodRef, $medium, $archSetList );
if( $useToPacks ) {
push @packages, { repopackage => $useToPacks };
}
# print "Packlist: " . Dumper \@packages;
$re->{repopackages} = \@packages;
return ($re, \%$supportStates);
}
sub createFlavorReadme( $$ ){
my($prodRef,$product)=@_;
my $reame_file = "";
my %seen;
foreach my $flavor ( @{$prodRef->{mediasets}->{media}} ){
next if !defined($flavor->{'flavor'}) || $flavor->{'flavor'} eq '' || $seen{$flavor->{flavor}};
$seen{$flavor->{flavor}} = 1;
my $readmedir = "%{buildroot}%{_defaultdocdir}/$product->{releasepkgname}-$flavor->{flavor}";
$reame_file .= "mkdir -p $readmedir\n";
$reame_file .= "cat >$readmedir/README << EOF\n";
$reame_file .= "This package only exists for providing the product flavor \'$flavor->{flavor}\'.\n";
$reame_file .= "\nEOF\n\n";
}
return $reame_file;
}
sub escapeProvides($)
{
my( $string ) = @_;
# :- must be escaped for createrepo
$string =~ s/([^a-zA-Z0-9_%{}\.])/sprintf("%%%02X", ord($1))/ge;
return $string;
}
sub getMediaStyle($)
{
my( $prodRef ) = @_;
my $mediaStyle = "suse-tumbleweed"; # fallback value, always latest style so it may break
my $medium = $prodRef->{mediasets}->{media}[0];
$mediaStyle = $medium->{'mediastyle'} if (defined($medium->{'mediastyle'}));
return $mediaStyle;
}
sub writeProductSPECfile( $$$$ )
{
my( $file, $infile, $prodRef, $product ) = @_;
my $product_flavors="";
# take media style from first media. not nice, but we can only have one product package for all of them.
my $medium = $prodRef->{mediasets}->{media}[0];
### A product may obsolete packages.
my $obsoletepackage="";
for my $p ( @{$product->{'installconfig'}->{'obsoletepackage'}} ) {
$obsoletepackage .= "\nProvides: weakremover(".$p->{'_content'}.")";
}
$obsoletepackage .= "\n";
# My product provides
my $productprovides="";
$productprovides.="Provides: %name-%version\n";
$productprovides.="Provides: $prodRef->{'project'}->{'name'}\n" if ((defined($prodRef->{'project'}->{'name'})) && ("$prodRef->{'project'}->{'name'}" ne ""));
my $productdependencies="";
$productdependencies=createProductDependencyLines($product->{'productdependency'}) if defined($product->{'productdependency'});
my $mediaStyle = getMediaStyle($prodRef);
# openSUSE 13.2 and SLE 12 case
die("product register release is obsolete") if defined($product->{register}->{release}); # was used for OEM products on SLE 10
# Note: was also used for OEM products on SLE 10 in a different way
die("product register flavor with invalid content") if defined($product->{register}->{flavor}) &&
$product->{register}->{flavor} ne 'module' && $product->{register}->{flavor} ne 'extension';
die("product release is not set but required") unless defined($product->{release}) and $product->{release} ne "";
if ($product->{name} =~ /.*-.*-.*/) {
# it should be always encoded that way, but ..
$productprovides.="Provides: product() = ".escapeProvides($product->{name})."\n";
} else {
# ... to stay backward compatible
$productprovides.="Provides: product() = $product->{name}\n";
}
$productprovides.="Provides: product(".$product->{name}.") = $product->{version}-$product->{release}\n";
foreach my $r ( @{$product->{register}->{pool}->{repository}} ) {
if ($r->{'url'}) {
die("conflicting values url<>project") if defined($r->{'project'});
die("conflicting values url<>name") if defined($r->{'name'});
die("conflicting values url<>medium") if defined($r->{'medium'});
} else {
die("missing project in pool repository") unless defined($r->{'project'});
die("missing name in pool repository") unless defined($r->{'name'});
die("missing medium in pool repository") unless defined($r->{'medium'});
}
}
foreach my $dt ( @{$product->{register}->{updates}->{distrotarget}} ) {
$productprovides.="%ifarch $dt->{arch}\n" if $dt->{'arch'};
$productprovides.="Provides: product-register-target() = ".escapeProvides($dt->{'_content'})."\n";
$productprovides.="%endif\n" if $dt->{'arch'};
next;
}
foreach my $shortsummary ( @{$product->{'shortsummary'}} ){
$productprovides.="Provides: product-label() = ".escapeProvides($shortsummary->{'_content'})."\n" if ( ! $shortsummary->{'language'} );
}
my $cpe = getCpeId($prodRef, $product);
$productprovides.="Provides: product-cpeid() = ".escapeProvides($cpe)."\n" if $cpe;
foreach my $url ( @{$product->{'urls'}->{'url'}} ){
$productprovides.="Provides: product-url(".escapeProvides($url->{'name'}).") = ".escapeProvides($url->{'_content'})."\n";
}
foreach my $repo ( @{$product->{register}->{updates}->{repository}} ) {
$productprovides.="%ifarch $repo->{arch}\n" if $repo->{arch};
$productprovides.="Provides: product-updates-repoid() = ".escapeProvides("obsrepository://$obsname/$repo->{project}/$repo->{name}")."\n";
$productprovides.="%endif\n" if $repo->{arch};
}
foreach my $predecessor ( @{$product->{'predecessor'}} ){
$productprovides.="Obsoletes: product:$predecessor\n";
}
if (defined($product->{'endoflife'})) {
if ($product->{'endoflife'} eq '') {
$productprovides.="Provides: product-endoflife()\n";
} else {
$productprovides.="Provides: product-endoflife() = ".escapeProvides($product->{'endoflife'})."\n";
}
}
if (defined($product->{'patchlevel'}) && $product->{'patchlevel'} ne '0') {
$productprovides.="Provides: product($product->{'name'}-SP$product->{'patchlevel'}) = %version-%release\n";
}
# Create product file to be packaged
my $zypp_product_file = createProductFile($prodRef,$product);
my $os_release_file = createOsReleaseFile($prodRef,$product);
#
# Create product flavors for each medium
#
my $create_flavors = $product->{'buildconfig'}->{'create_flavors'};
if (defined($create_flavors) && $create_flavors eq 'true') {
if ($product->{register}->{flavor}) {
$productprovides.="Provides: product-register-flavor() = ";
$productprovides.=escapeProvides($product->{register}->{flavor})."\n";
}
$productprovides.="Requires: product_flavor($product->{name})\n";
$product_flavors.=createSPECfileFlavors($prodRef,$product);
$zypp_product_file.= createFlavorReadme($prodRef,$product);
}
#
# Create spec file
#
my $str;
if ("$infile" eq ""){
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst)=localtime();
$year += 1900;
# write the specfile header
$str="#
# spec file for package $product->{releasepkgname} (Version $product->{version})
#
# Copyright (c) $year $product->{'vendor'}.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An \"Open Source License\" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
";
my $bugtracker=getUrl($product,"i586","bugtracker");
$str.="\n# Please submit bugfixes or comments via $bugtracker\n#\n\n" if ("$bugtracker" ne "");
$str.="\n\n";
$str.="Name: $product->{releasepkgname}\n";
$str.="%define product $product->{name}\n";
if (defined ($product->{'buildconfig'}->{'betaversion'})){
$str.="%define betaversion $product->{'buildconfig'}->{'betaversion'}\n";
}
foreach my $summary ( @{$product->{'summary'}} ){
$str.="Summary: $summary->{_content}%{?betaversion: %{betaversion}}\n" if ( ! $summary->{'language'} );
}
$str.="Version: ".$product->{version}."\n";
$str.="#!BcntSyncTag: $product->{name}\n" unless $product->{'buildconfig'}->{'sync_build_counter'} && $product->{'buildconfig'}->{'sync_build_counter'} eq 'false';
$str.="Release: 0\n";
$str.="License: BSD-3-Clause\n";
$str.="Group: System/Fhs\n";
$str.="%global debug_package %{nil}\n";
$str.=$obsoletepackage;
$str.=$productprovides;
$str.="\n___PRODUCT_DEPENDENCIES___\n";
$str.="AutoReqProv: on\n";
if (defined($product->{register}->{updates}->{distrotarget}[0])) {
$str.="# this package should only be available for the \"basearchs\" of a product\nExclusiveArch:";
foreach my $dt ( @{$product->{register}->{updates}->{distrotarget}} ) {
$str.=" $dt->{arch}";
}
}
$str.="\n%description\n";
for my $description ( @{$product->{'description'} || []} ){
$str.="$description->{_content}\n" if ( ! $description->{'description'} );
}
$str.="\n\n";
$str.="___FLAVOR_PACKAGES___\n";
$str.="\n%prep\n";
$str.="\n%build\n\n";
$str.="\n%install\n";
$str.="___CREATE_PRODUCT_FILES___\n";
# we could do this by default for base products
# $str.="___CREATE_OS_RELEASE_FILE___\n";
$str.="\n%files\n";
$str.="%defattr(644,root,root,755)\n";
$str.="%dir %{_sysconfdir}/products.d\n";
$str.="%{_sysconfdir}/products.d/*.prod\n";
# $str.="%{_sysconfdir}/os-release\n";
$str.="\n%changelog\n";
} else {
$str = readstr($infile);
}
# replace all strings
$str =~ s/___DISTNAME___/$product->{name}/g;
$str =~ s/___BASE_VERSION___/$product->{baseversion}/g;
$str =~ s/___VERSION___/$product->{version}/g;
if ( defined $product->{buildconfig}->{betaversion} ) {
$str =~ s/___BETA_VERSION___/$product->{buildconfig}->{betaversion}/g;
} else {
$str =~ s/___BETA_VERSION___//g;
}
# product release is not really used so far, but defined in zypp stack. So let's
# support it. But it is so far 0 on all our products
$str =~ s/___RELEASE___/$product->{release}/g;
$str =~ s/___PATCH_LEVEL___/$product->{'patchlevel'}/g;
$str =~ s/___PACKAGE_NAME___/$product->{releasepkgname}/g;
$str =~ s/___PRODUCT_NAME___/$product->{name}/g;
$str =~ s/___SUMMARY___/$product->{summary}[0]->{_content}/g; # FIXME: find the non-lang one
$str =~ s/___DESCRIPTION___/$product->{description}[0]->{_content}/g; # FIXME: find the non-lang one
$str =~ s/___FLAVOR_PACKAGES___/$product_flavors/g;
$str =~ s/___CREATE_PRODUCT_FILES___/$zypp_product_file/g;
$str =~ s/___PRODUCT_DEPENDENCIES___/$productdependencies/g;
$str =~ s/___CREATE_OS_RELEASE_FILE___/$os_release_file/g;
$str =~ s/___PRODUCT_PROVIDES___/$productprovides/g;
$str =~ s/___OBSOLETE_PACKAGES___/$obsoletepackage/g;
# write out the modified file.
writestr($file, undef, $str);
}
sub createPreSelectPatternDeps ( $ ) {
my ( $patterns ) = @_;
my $pattern_lines="";
foreach my $pattern (@{$patterns->[0]->{'pattern'}}){
$pattern_lines.="Provides: defaultpattern($pattern->{'name'})\n";
}
return $pattern_lines;
}
sub createProductDependencyLines ( $ ) {
my ( $productDependency ) = @_;
my $product_dependencies;
foreach my $dependency (@{$productDependency}){
my ($relship, $version, $flavor, $flag);
$relship = convertRelationship($dependency->{'relationship'});
$version = $dependency->{'version'} if defined($dependency->{'version'}); #old style
if (defined($dependency->{'baseversion'})) {
$version = $dependency->{'baseversion'};
$version .= ".".$dependency->{'patchlevel'} if (defined($dependency->{'patchlevel'}) && $dependency->{'patchlevel'} ne '0');
$version .= "-".$dependency->{'release'} if defined($dependency->{'release'});
}
$flavor = "-".$dependency->{'flavor'} if defined($dependency->{'flavor'});
$flag = convertFlags($dependency->{'flag'}) if defined($dependency->{'flag'});
if (!$flag && ($version ne "")) { # avoid something like Requires: sles 11
$flag = "=";
}
$flavor = "" unless defined($flavor);
$product_dependencies.="$relship: product(".$dependency->{'name'}."$flavor) $flag $version\n";
}
return $product_dependencies;
}
sub createSPECfileFlavors ( $$ ) {
my ( $prodRef,$product ) = @_;
my $product_flavors = '';
my %seen;
# take media style from first media. not nice, but we can only have one product package for all of them.
my $defaultmedium = $prodRef->{mediasets}->{media}[0];
foreach my $flavor ( @{$prodRef->{mediasets}->{media}} ){
next if !defined($flavor->{'flavor'}) || $flavor->{'flavor'} eq '' || $seen{$flavor->{flavor}};
$seen{$flavor->{flavor}} = 1;
# not using $product->{releasepkgname} since it always be initialed
if (defined($prodRef->{'products'}->{'product'}[0]->{'releasepkgname'}) && $prodRef->{'products'}->{'product'}[0]->{'releasepkgname'} ne '') {
$product_flavors.="%package -n $prodRef->{'products'}->{'product'}[0]->{'releasepkgname'}-$flavor->{flavor}\n";
} else {
$product_flavors.="%package $flavor->{flavor}\n";
}
$product_flavors.="License: BSD-3-Clause\n";
$product_flavors.="Group: System/Fhs\n";
if ((defined($prodRef->{'project'}->{'name'})) && ("$prodRef->{'project'}->{'name'}" ne "")){
# TODO: - split between ":" -> Provides: SUSE \n Provides: SUSE:Factory ...
# - add plattform
$product_flavors.="Provides: $prodRef->{'project'}->{'name'}\n";
}
$product_flavors.="Provides: product_flavor()\n";
$product_flavors.="Provides: flavor($flavor->{flavor})\n";
foreach my $predecessor ( @{$product->{'predecessor'}} ){
$product_flavors.="Obsoletes: $predecessor-release-$flavor->{flavor}\n";
$product_flavors.="Conflicts: $predecessor-release-$flavor->{flavor}\n";
}
if (defined($flavor->{'preselected_patterns'})){
$product_flavors.=createPreSelectPatternDeps($flavor->{'preselected_patterns'});
}
# this is the product version and release, not a package release.
my $release = $product->{release};
$release ||= "0";
$product_flavors.="Provides: product_flavor($product->{name}) = $product->{version}-$release\n";
if (defined($flavor->{'productdependency'})){
$product_flavors.=createProductDependencyLines($flavor->{'productdependency'});
}
foreach my $summary ( @{$product->{'summary'}} ){
$product_flavors.="Summary: $summary->{_content}%{?betaversion: %{betaversion}}\n" if ( ! $summary->{'language'} );
}
$product_flavors.="\n";
$product_flavors.="%description $flavor->{flavor}\n";
foreach my $description ( @{$product->{'description'}} ){
$product_flavors.="$description->{_content}\n" if ( ! $description->{'description'} );
}
$product_flavors.="\n";
$product_flavors.="%files $flavor->{flavor}\n";
$product_flavors.="%defattr(-,root,root)\n";
$product_flavors.="%doc %{_defaultdocdir}/$product->{releasepkgname}-$flavor->{flavor}\n";
$product_flavors.="\n"
}
return $product_flavors;
}
sub createSPECfileInstallSection ( $ ) {
my ($product) = @_;
my $content="";
my $is_main_product=0;
if ( $is_main_product ){
my $greeting = $product->{'name'}." ".$product->{'version'};
foreach my $summary ( @{$product->{'summary'}} ){
$greeting = $summary->{'_content'} if ( ! $summary->{'language'} );
}
my $content="mkdir -p %{buildroot}%{_sysconfdir}
echo -e 'Welcome to ".$greeting." %{?betaversion:%{betaversion} }- Kernel \\r (\\l).\n\n' > %{buildroot}%{_sysconfdir}/issue
echo \"Welcome to ".$greeting." %{?betaversion:%{betaversion} }- Kernel %%r (%%t).\" > %{buildroot}%{_sysconfdir}/issue.net
echo \"#".$greeting." %{?betaversion:%{betaversion} }(%{_target_cpu})\" > %{buildroot}%{_sysconfdir}/SuSE-release
echo \"VERSION = %{version}\" >> %{buildroot}%{_sysconfdir}/SuSE-release\n";
$content.="PATCHLEVEL = ".$product->{'patchlevel'}."\n" if (defined($product->{'patchlevel'}));
$content.="mkdir -p %{buildroot}%{_sysconfdir}
echo \"Have a lot of fun...\" > %{buildroot}%{_sysconfdir}/motd
# Bug 404141 - %{_sysconfdir}/YaST/control.xml should be owned by some package
mkdir -p %{buildroot}%{_sysconfdir}/YaST2/
install -m 644 /CD1/control.xml %{buildroot}%{_sysconfdir}/YaST2/
install -m 644 -D /CD1/EULA.txt %{buildroot}%{_docdir}/%{name}/%{product}-EULA.txt
";
}
$content="mkdir -p %{buildroot}%{_sysconfdir}/products.d";
return $content;
}
sub writekwd ( $$$ ) {
my ($file, $kwdhash, $prefix) = @_;
my %kh = %{$kwdhash};
my $str = "";
foreach my $key( sort keys %kh ) {
$str .= $key.": +Kwd:\\n".$prefix.$kh{$key}."\\n-Kwd:\n";
}
writestr($file, undef, $str);
}
sub getCpeId ($$) {
my ($prodRef, $product) = @_;
my $mediaStyle = getMediaStyle($prodRef);
my $tag = "/o"; # operating system
# is this an add-on product?
foreach my $flavor ( @{$prodRef->{mediasets}->{media}} ){
# application add-on
$tag = "/a" if (defined($flavor->{'productdependency'}));
}
my $vendor = $product->{vendor};
# SLE people wants sometime short, sometime long version
$vendor = "suse" if $product->{vendor} =~ /^SUSE LINUX/;
die("Vendor contains non valid chars") if $vendor =~ /[^\-+=\.,0-9:%{}\@#%A-Z_a-z~\200-\377]/s;
die("Vendor contains non valid chars") if $vendor =~ /[\/:\.\000-\037]/;
my $cpeid_uri = "cpe:".$tag.":".$vendor.":".$product->{name};
if (defined($product->{baseversion})) {
$cpeid_uri.=":$product->{baseversion}";
$cpeid_uri.=":sp$product->{patchlevel}" if (defined($product->{patchlevel}) && $product->{patchlevel} ne "0");
} else {
$cpeid_uri.=":".$product->{version};
}
return lc($cpeid_uri);
}
sub createOsReleaseFile ($) {
my ($prodRef, $product) = @_;
my $bugtracker=getUrl($product,"i586","bugtracker");
my $rfile = "%{buildroot}%{_sysconfdir}/os-release";
my $os_release_file = "mkdir -p %{buildroot}%{_sysconfdir}\n";
$os_release_file .= "cat >$rfile << EOF\n";
my $name = $product->{'name'};
# shall we strip ^SUSE_ here or better modify the name in SLE 12?
$os_release_file .= "NAME=\"".$name."\"\n";
if (defined($product->{baseversion})) {
$os_release_file .= "VERSION=\"".$product->{baseversion};
$os_release_file .= "-SP".$product->{patchlevel} if (defined($product->{patchlevel}) && $product->{patchlevel} ne "0");
} else {
$os_release_file .= "VERSION=\"%{version}";
}
$os_release_file .= "%{?betaversion: %{betaversion}}\"\n";
$os_release_file .= "VERSION_ID=\"%{version}\"\n";
$os_release_file .= "PRETTY_NAME=\"".$product->{'summary'}[0]->{_content}."%{?betaversion: (%{betaversion})}\"\n" if $product->{'summary'};
$os_release_file .= "BUG_REPORT_URL=\"".$bugtracker."\"\n" if $bugtracker;
$os_release_file .= "ID=\"".lc($name)."\"\n";
$os_release_file .= "ID_LIKE=\"suse\"\n"; # We assume that the system is SuSE like when you use this converter
$os_release_file .= "ANSI_COLOR=\"0;32\"\n";
my $cpe = getCpeId($prodRef, $product);
$os_release_file .= "CPE_NAME=\"$cpe\"\n" if $cpe;
$os_release_file .= "EOF\n";
}
sub createProductFile ( $$ ) {
my ($prodRef, $product) = @_;
my $zypp_product_file = "";
my $zypp_product = Storable::dclone($product);
# not wanted there
delete $zypp_product->{'releasepkgname'};
my $d;
my $pfile = "%{buildroot}%{_sysconfdir}/products.d/$product->{name}.prod";
if (defined($product->{'endoflife'})&& $product->{'endoflife'} ne ""
&& !($product->{'endoflife'} =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/)) {
die("400 endoflife not in ISO 8601 format (YYYY-MM-DD)");
}
my $mediaStyle = getMediaStyle($prodRef);
$zypp_product_file = "mkdir -p %{buildroot}%{_sysconfdir}/products.d\n";
$zypp_product->{'arch'} = '%{_target_cpu}'; # write product architecture during rpm build
$zypp_product->{'schemeversion'} = "0";
my $cpe = getCpeId($prodRef, $product);
$zypp_product->{'cpeid'} = $cpe if $cpe;
$d->{"target"} = $product->{'register'}->{'target'};
$d->{"release"} = $product->{'register'}->{'release'} if defined($product->{'register'}->{'release'}); # < SLE 12
my $special_arch_repo;
my $special_arch_update_ncc;
if ($mediaStyle =~ /^suse-sle1[25]/) {
# SLE SCC repositry register section
die("Define NCC targets instead of target") if $product->{'register'}->{'target'};
die("400 endoflife not defined") unless defined($product->{'endoflife'});
foreach my $dt ( @{$product->{register}->{updates}->{distrotarget}} ) {
$d->{"target"} = "___INTERNAL_NCC_MARKER___";
$special_arch_update_ncc.="%ifarch $dt->{arch}\n" if $dt->{'arch'};
$special_arch_update_ncc.=" <target>$dt->{'_content'}</target>\n";
$special_arch_update_ncc.="%endif\n" if $dt->{'arch'};
next;
}
$d->{flavor} = $product->{register}->{flavor} if defined($product->{register}->{flavor});
$zypp_product->{'register'} = $d;
}
# convert them to repoids
my @r;
foreach my $repo ( @{$product->{register}->{updates}->{repository}} ) {
my $obsurl = "obsrepository://$obsname/$repo->{project}/$repo->{name}";
if ($repo->{zypp}) {
die("400 zypp lacks alias attribute") unless $repo->{zypp}->{alias};
die("400 zypp lacks name attribute") unless $repo->{zypp}->{name};
}
if ($repo->{arch}) {
push @r, { "repoid" => "___INTERNAL_MARKER___" } unless $special_arch_repo;
$special_arch_repo.="%ifarch $repo->{arch}\n";
$special_arch_repo.=" <repository type=\"update\" repoid=\"$obsurl\" />\n";
$special_arch_repo.="%endif\n";
next;
}
push @r, { 'type' => 'update', "repoid" => $obsurl };
};
my %seen_obsurl;
foreach my $repo ( @{$product->{register}->{pool}->{repository}} ) {
next unless defined($repo->{name});
my $obsurl = "obsproduct://$obsname/$repo->{project}/$product->{name}/$product->{version}/%{_target_cpu}";
my $uniq_obsurl = $obsurl . ($repo->{arch}? "$repo->{arch}" : "");
next if defined($seen_obsurl{$uniq_obsurl});
$seen_obsurl{$uniq_obsurl} = 1;
if ($repo->{zypp}) {
die("400 zypp lacks alias attribute") unless $repo->{zypp}->{alias};
die("400 zypp lacks name attribute") unless $repo->{zypp}->{name};
}
if ($repo->{arch}) {
push @r, { "repoid" => "___INTERNAL_MARKER___" } unless $special_arch_repo;
$special_arch_repo.="%ifarch $repo->{arch}\n";
$special_arch_repo.=" <repository type=\"pool\" repoid=\"$obsurl\" />\n";
$special_arch_repo.="%endif\n";
next;
}
push @r, { 'type' => 'pool', "repoid" => $obsurl };
};
$zypp_product->{'repositories'}{'repository'} = \@r;
# Release package number shall go with the package release
$zypp_product->{'release'} = $product->{release};
my $xml = XMLout( $BSProductXML::product, $zypp_product );
die ( "ERROR: Unable to create xml for $product->{name} !" ) unless $xml;
# replace arch specific parts
$xml =~ s/.*___INTERNAL_MARKER___.*\n/$special_arch_repo/ if $special_arch_repo;
$xml =~ s/.*___INTERNAL_NCC_MARKER___.*\n/$special_arch_update_ncc/ if $special_arch_update_ncc;
# add header
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n$xml";
$zypp_product_file .= "cat >$pfile << EOF\n";
$zypp_product_file .= "$xml\nEOF\n\n";
}
# Process the commandline arguments.
getopts('dhm:');
usage() if $opt_h;
my ($infile, $outdir, $_project) = @ARGV;
$project = $_project;
die( "Please specify input file, output directory (and project name)\n" ) unless $infile;
die( "Please specify output directory (and project) name\n" ) unless $outdir;
my $d;
# global indir
($d, $indir) = fileparse( $infile );
my $prodRef = readProductFile( $infile );
#
# Sanity checks
#
die("product definition contains no products\n") unless $prodRef->{'products'};
die("product definition contains multiple products, this is not yet supported \n") if @{$prodRef->{'products'}->{'product'}} > 1;
my $product = $prodRef->{'products'}->{'product'}[0];
die("no product name set\n") unless $product->{'name'};
die("illegal product name: $product->{'name'}\n") if $product->{'name'} =~ /^[_\.]/;
die("illegal product name: $product->{'name'}\n") if $product->{'name'} =~ /[\/\000-\037]/;
die("ERROR: File name does not match to product name ($infile/$prodRef->{'products'}->{'product'}[0]->{'name'}.product)\n") if not $infile =~ /.*\/$prodRef->{'products'}->{'product'}[0]->{'name'}.product$/;
die("no support for multi product definitions\n") if $prodRef->{'products'}->{'product'}[1];
my $mediaStyle = getMediaStyle($prodRef);
die("Do not set id attribute in product anymore.\n") if $prodRef->{'products'}->{'product'}[0]->{'id'};
$product->{'releasepkgname'} ||= "$product->{'name'}-release";
#
# Calculate version strings
#
die ("It is not allowed to specify baseversion and version.") if (defined($product->{'baseversion'}) && defined($product->{'version'}) );
die("You must use baseversion instead of version when using a patchlevel definition") if (defined($product->{'version'}) && defined($product->{'patchlevel'}));
if (defined($product->{'baseversion'})) {
$product->{'version'} = $product->{'baseversion'};
$product->{'version'} .= ".".$product->{'patchlevel'} if (defined($product->{'patchlevel'}) && $product->{'patchlevel'} ne '0');
};
#
# Check missing information of release package requirement and set defaults if neeeded.
#
$product->{'installconfig'}->{'releasepackage'} = { 'flag' => "EQ" }
if ( not defined($product->{'installconfig'}->{'releasepackage'}) );
$product->{'installconfig'}->{'releasepackage'}->{'flag'} = 'EQ'
if ( not defined($product->{'installconfig'}->{'releasepackage'}->{'flag'}) );
$product->{'installconfig'}->{'releasepackage'}->{'name'} = '%{name}'
if ( not defined($product->{'installconfig'}->{'releasepackage'}->{'name'}) );
$product->{'installconfig'}->{'releasepackage'}->{'version'} = '%{version}'
if ( not defined($product->{'installconfig'}->{'releasepackage'}->{'version'}) );
$product->{'installconfig'}->{'releasepackage'}->{'release'} = '%{release}'
if ( not defined($product->{'installconfig'}->{'releasepackage'}->{'release'}) );
if (defined($product->{'installconfig'}->{'default_obs_repository_name'})) {
# only for newer product files where a default name has been configured
$product->{'installconfig'}->{'default_obs_download_url'} = '%{_download_url}'
if ( not defined($product->{'installconfig'}->{'default_obs_download_url'}) );
};
#
# Create a kiwi configuration for each distribution flavor
#
my $productRef = $prodRef->{products}->{product}->[0]; # FIXME: Support multiple products.
my $kiwiImage = {};
my $name = sprintf( "OBS__%s___%s",
$product->{name},
$product->{version} );
$kiwiImage->{name} = $name;
$kiwiImage->{description} = createDescription( $productRef );
# so far for all media types identical. Now loop over the media types
# to create media type specific versions;
parseConditionals( $prodRef->{conditionals}->{conditional} );
parseArchsets( $prodRef->{archsets}{archset} );
#
# Create $product-release packages
#
my $SPECtemplateFile;
if ($infile =~ /(.*\/)(.+)$/) {
# not using $product->{releasepkgname} for compatibility reasons
# instead only using this inside the specfile
$SPECtemplateFile = $1."/".$product->{name}."-release.spec";
};
if ( !$SPECtemplateFile || ! -e $SPECtemplateFile ) {
if ($infile =~ /(.*\/)(.+)$/) {
$SPECtemplateFile = "$1/release.spec";
};
};
if ( ! $SPECtemplateFile || ! -e $SPECtemplateFile ) {
$SPECtemplateFile="";
print "No release template file $SPECtemplateFile exists --> generating SPEC file $product->{name}-release.spec automatically\n";
}
writeProductSPECfile( "$outdir/$product->{name}-release.spec", $SPECtemplateFile, $prodRef, $product );
my $ChangesFile;
if ($infile =~ /(.*\/)(.+)$/) {
$ChangesFile = $1."/".$product->{name}."-release.changes";
};
if ( !$ChangesFile || ! -e $ChangesFile ) {
if ($infile =~ /(.*\/)(.+)$/) {
$ChangesFile = "$1/release.changes";
};
};
if ( defined($ChangesFile) && -e $ChangesFile ) {
my $fn="$outdir/$product->{name}-release.changes";
system( "cp", $ChangesFile, $fn) && die ("Unable to copy changes file $ChangesFile to $fn");
}
#
# Create kiwi images
#
my %generalImage = %{$kiwiImage};
my $media = $prodRef->{mediasets}->{media};
if( $opt_m ) {
print "Generating only media set $opt_m, due to commandline switch\n";
}
my $create_flavors = $product->{'buildconfig'}->{'create_flavors'};
foreach my $medium ( @$media ){
my $type = $medium->{type};
my $flavor = $medium->{flavor};
my $productname;
my $releasepkgname;
my $name = $medium->{name};
if ($medium->{product}) {
$productname = $medium->{product};
$releasepkgname = "$medium->{product}-release";
} else {
# use global name as fallback
$productname = $prodRef->{'products'}->{'product'}[0]->{'name'};
$releasepkgname = $prodRef->{'products'}->{'product'}[0]->{'releasepkgname'};
}
next if( $opt_m && $name ne $opt_m );
# create one kiwi file each for every of the archsets
if (defined($medium->{archsets})) {
my %supportstates;
my @archSets = @{$medium->{archsets}};
foreach my $arch ( @archSets ) {
my @archs;
my $supportstates;
my $kiwi = Storable::dclone(\%generalImage);
$kiwi->{schemaversion} = "4.1"; # new kiwi requires exact this version
my $attrs = {image => "product"};
$attrs->{'firmware'} = $medium->{'firmware'} if $medium->{'firmware'};
$attrs->{'hybrid'} = 'true' if (defined($medium->{'run_hybridiso'})) && $medium->{'run_hybridiso'} ne "false";
$kiwi->{preferences}->{type} = [$attrs];
$kiwi->{preferences}->{version} = "1.0.0"; # hardcoded to fullfill kiwi scheme, real version is defined elsewhere
$kiwi->{preferences}->{packagemanager} = "zypper" ; # hardcoded since no other support exist yet.
($kiwi->{instsource}, $supportstates) = createInstsource ( $prodRef, $medium, $arch->{archset} );
if (keys %$supportstates > 0){
%supportstates = %{$supportstates};
foreach my $key( sort keys %supportstates ) {
die("Illegal support key $supportstates{$key} for $key\n") unless grep { /^$supportstates{$key}$/ } ( "l3", "l2", "acc", "unsupported" );
}
}
my $archStr;
my @archsets = @{$arch->{archset}};
my @productarch;
foreach my $ar ( @archsets ) {
if( $archSets{$ar->{'ref'}} ) {
my $architecture = "$archSets{$ar->{'ref'}}->{'productarch'}";
$archStr .= "_" if $archStr;
$archStr .= "$architecture";
# enable this architecture in scheduler
# FIXME: the scheduler arch may have a different name than the rpm archs !
push @archs, { 'arch' => $architecture };
push @productarch, $architecture;
push @archs, { 'arch' => 'i586' } if ( $architecture eq "x86_64" );
push @archs, { 'arch' => 'i586' } if ( $architecture eq "ia64" );
push @archs, { 'arch' => 'ppc' } if ( $architecture eq "ppc64" );
push @archs, { 'arch' => 'ppc64' } if ( $architecture eq "ppc" ); # ppc is using ppc64 stuff in openSUSE
push @archs, { 'arch' => 's390' } if ( $architecture eq "s390x" );
}
}
# add implicit the release packages to media
if (!defined($medium->{'skip_release_package'}) || $medium->{'skip_release_package'} ne "true"){
my $addarch = join( ",", @productarch );
$kiwi->{instsource}->{repopackages}[0] ||= { "repopackage" => [] };
push @{$kiwi->{instsource}->{repopackages}[0]->{repopackage}}, { "name" => $releasepkgname, addarch => $addarch };
if (defined($create_flavors) && $create_flavors eq 'true') {
# add the flavor package
push @{$kiwi->{instsource}->{repopackages}[0]->{repopackage}}, { "name" => "$releasepkgname-$flavor", addarch => $addarch };
}
if (%supportstates) {
$supportstates{$releasepkgname} ||= 'l3';
$supportstates{"$releasepkgname-$flavor"} ||= 'l3';
}
}
my $file = "$productname-$type";
$file .= "-$flavor" if $flavor;
$file .= "-$archStr";
die("illegal kiwi product: $file\n") if $file =~ /^[_\.]/;
die("illegal kiwi product: $file\n") if $file =~ /[\/\000-\037]/;
my $outFile = "$outdir/$file.kiwi";
my $supportFile= "$outdir/$file.kwd";
writexml( "$outFile$$", $outFile, $kiwi, $BSKiwiXML::kiwidesc );
if ( defined($product->{buildconfig}->{milestone}) ) {
open(FH, ">>", $outFile) or die "Unable to open file $outFile";
print FH "\n<!-- OBS-Milestone: $product->{buildconfig}->{milestone} -->\n";
close FH;
}
if ( !$product->{'buildconfig'}->{'sync_build_counter'} || $product->{'buildconfig'}->{'sync_build_counter'} ne 'false' ) {
open(FH, ">>", $outFile) or die "Unable to open file $outFile";
print FH "\n<!-- OBS-BcntSyncTag: $product->{name} -->\n";
close FH;
}
writekwd( $supportFile, \%supportstates, "support_" ) if keys %supportstates > 0;
}
}
}
# end
07070100000006000081ED00000000000000000000000164D603BC00000694000000000000000000000000000000000000003600000000obs-service-product_converter-1.5.6/product_converter#!/bin/bash
# Super simple wrapper just to run over all prodct files
if [ "$1" != "--outdir" -o ! -d "$2" ]; then
echo "no directory specified via --outdir parameter"
exit 1
fi
outdir="$2"
# Ugly hack to workaround evil wrapper scripts
if [ -z "$OBS_NAME" ]; then
if [ -x /usr/bin/osc ]; then
echo
echo "WARNING: OBS_NAME not set, trying request the server via osc ..."
export OBS_NAME=`osc api /configuration | sed -n 's,.*<name>\(.*\)</name>.*,\1,p'`
echo " We got $OBS_NAME as return"
echo
fi
fi
if [ -z "$OBS_NAME" ]; then
echo "WARNING: OBS_NAME not set, identifiers will not match with server config!"
echo " This is fine for debugging, but not for production media!"
fi
if [ -n "$OSC_VERSION" ]; then
echo
echo "WARNING"
echo "WARNING Manual run using osc is *NOT* updating existing release spec files!"
echo "WARNING"
echo
fi
# create all build descriptions
for file in *.product; do
if [ ! -r "$file" ]; then
echo "ERROR: $file is not readable"
exit 1
fi
${0%/*}/create_single_product "$PWD/$file" "$outdir" "$OBS_SERVICE_PROJECT" || exit 1
done
# create _multibuild, except user provided one already
if [ -e "_multibuild" ]; then
echo "SKIPPING _multibuild generation due to provided file"
exit 0
fi
echo "<multibuild>" > "$outdir/_multibuild"
for file in "$outdir"/*.spec "$outdir/"*.kiwi; do
if [ ! -e "$file" ]; then
echo "File not readable: $i"
exit 1
fi
container="${file##*/}"
container="${container%.kiwi}"
container="${container%.spec}"
echo " <package>${container}</package>" >> "$outdir/_multibuild"
done
echo "</multibuild>" >> "$outdir/_multibuild"
exit 0
07070100000007000081A400000000000000000000000164D603BC000000BF000000000000000000000000000000000000003E00000000obs-service-product_converter-1.5.6/product_converter.service<service name="product_converter">
<summary>Create all product build descriptions</summary>
<description>This service the successor of the OBS product converter.</description>
</service>
07070100000008000041ED00000000000000000000000364D603BC00000000000000000000000000000000000000000000002900000000obs-service-product_converter-1.5.6/test07070100000009000041ED00000000000000000000000264D603BC00000000000000000000000000000000000000000000003800000000obs-service-product_converter-1.5.6/test/simple_product0707010000000A000081A400000000000000000000000164D603BC0000027F000000000000000000000000000000000000005200000000obs-service-product_converter-1.5.6/test/simple_product/defaults-archsets.include
<archsets>
<archset name="ix86" productarch="i586">
<arch>i586</arch>
<arch>noarch</arch>
</archset>
<archset name="x86_64" productarch="x86_64">
<arch>x86_64</arch>
<arch>noarch</arch>
</archset>
<archset name="ppc64" productarch="ppc64">
<arch>ppc64</arch>
<arch>noarch</arch>
</archset>
<archset name="s390x" productarch="s390x">
<arch>s390x</arch>
<arch>noarch</arch>
</archset>
<archset name="ia64" productarch="ia64">
<arch>ia64</arch>
<arch>noarch</arch>
</archset>
</archsets>
0707010000000B000081A400000000000000000000000164D603BC0000081F000000000000000000000000000000000000005600000000obs-service-product_converter-1.5.6/test/simple_product/defaults-conditionals.include
<conditionals>
<!-- BASELIBS handling -->
<conditional name="baselibs_only_ia64">
<platform arch="ia64" onlyarch="ia64" />
</conditional>
<conditional name="baselibs_only_x86_64">
<platform arch="x86_64" onlyarch="x86_64"/>
</conditional>
<conditional name="baselibs_only_ppc64">
<platform arch="ppc64" onlyarch="ppc64"/>
</conditional>
<conditional name="baselibs_only_s390x">
<platform arch="s390x" onlyarch="s390x"/>
</conditional>
<conditional name="s390_special">
<platform arch="s390x" addarch="s390" />
</conditional>
<conditional name="s390_special_noarch">
<platform arch="s390x" addarch="noarch" />
</conditional>
<conditional name="additonal_i686">
<platform arch="i586" addarch="i686" />
</conditional>
<conditional name="i586_on_x86_64">
<platform arch="x86_64" onlyarch="i586" />
</conditional>
<conditional name="i586_only">
<platform arch="i586" onlyarch="i586" />
</conditional>
<conditional name="ppc_special">
<platform arch="ppc64" addarch="ppc" />
</conditional>
<conditional name="only_ppc">
<platform arch="ppc" />
</conditional>
<conditional name="only_i586">
<platform arch="i586" />
</conditional>
<conditional name="only_ia64">
<platform arch="ia64" />
</conditional>
<conditional name="only_ppc64">
<platform arch="ppc64" />
</conditional>
<conditional name="only_s390x">
<platform arch="s390x" />
</conditional>
<conditional name="only_x86_64">
<platform arch="x86_64" />
</conditional>
<conditional name="only_i586_and_x86_64">
<platform arch="i586" />
<platform arch="x86_64" />
</conditional>
<conditional name="FROZEN">
<platform onlyarch="skipit" /> <!-- drop it in any case -->
</conditional>
</conditionals>
0707010000000C000081A400000000000000000000000164D603BC00000059000000000000000000000000000000000000005600000000obs-service-product_converter-1.5.6/test/simple_product/defaults-repositories.include
<repositories>
<repository path="obs://home:Iggy/10.2"/>
</repositories>
0707010000000D000081A400000000000000000000000164D603BC0000031D000000000000000000000000000000000000004900000000obs-service-product_converter-1.5.6/test/simple_product/obs-release.spec
Name: obs-release
%define product obs
%define betaversion Beta2
Summary: OBS
Version: ___VERSION___
Release: 0
License: BSD 3-Clause
Group: System/Fhs
Provides: obs-release
___PRODUCT_PROVIDES___
AutoReqProv: on
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
___DESCRIPTION___
___FLAVOR_PACKAGES___
%prep
%build
%install
mkdir -p $RPM_BUILD_ROOT/etc
echo "OBS %{version} (%{_target_cpu})" > $RPM_BUILD_ROOT/etc/obs-release
echo VERSION = 11 >> $RPM_BUILD_ROOT/etc/obs-release
echo PATCHLEVEL = 2 >> $RPM_BUILD_ROOT/etc/obs-release
___CREATE_PRODUCT_FILES___
%clean
rm -rf %buildroot
%files
%defattr(644,root,root,755)
%dir /etc/products.d
/etc/products.d/*.prod
/etc/obs-release
%changelog
0707010000000E000081A400000000000000000000000164D603BC0000020C000000000000000000000000000000000000004200000000obs-service-product_converter-1.5.6/test/simple_product/obs.group<?xml version="1.0" encoding="UTF-8"?>
<group name="obs" version="11" release="0.1">
<pattern ordernumber="2030">
<category>OBS Extension</category>
<description>Simple OBS list</description>
<icon>OBS</icon>
<summary>Blah
Blub</summary>
<visible>true</visible>
<relationships>
<pattern name="OBS" relationship="requires" />
</relationships>
</pattern>
<packagelist>
<package name="obs-server" supportstatus="l3" />
</packagelist>
</group>
0707010000000F000081A400000000000000000000000164D603BC00000B3A000000000000000000000000000000000000004700000000obs-service-product_converter-1.5.6/test/simple_product/simple.product<?xml version="1.0" encoding="UTF-8"?>
<productdefinition xmlns:xi="http://www.w3.org/2001/XInclude">
<products>
<product>
<vendor>OBS_Fuzzies</vendor>
<name>simple</name>
<predecessor>too_complex</predecessor>
<predecessor>silly_fork</predecessor>
<version>13.1</version>
<release>0</release>
<register>
<target>sle-11-%{_target_cpu}</target>
<pool>
<repository project="BaseDistro" name="BaseDistro_repo" medium="DVD" />
<repository url="http://external.url/to.some.one" />
</pool>
<updates>
<repository project="BaseDistro2.0:LinkedUpdateProject" name="BaseDistro2LinkedUpdateProject_repo" />
</updates>
</register>
<shortsummary>SimpleProduct</shortsummary>
<summary>Simple OBS Product</summary>
<description>Some text
in multiple
lines
</description>
<urls>
<url name="bugtracker">https://bugzilla.novell.com/</url>
</urls>
<buildconfig>
<!-- This section is needed to generate the installation media -->
<producttheme>openSUSE</producttheme>
<betaversion>Beta2</betaversion>
</buildconfig>
<installconfig>
<!-- All flags needed during installation -->
<defaultlang>en_US</defaultlang>
<datadir>suse</datadir>
<descriptiondir>suse/setup/descr</descriptiondir>
<releasepackage name="simple-release" version="13.1" flag="EQ"/>
<distribution>openSUSE</distribution>
</installconfig>
<!-- All Flags needed in the running system -->
<runtimeconfig />
</product>
</products>
<xi:include href="defaults-conditionals.include" />
<xi:include href="defaults-archsets.include" />
<xi:include href="defaults-repositories.include" />
<mediasets>
<media type="cd"
flavor="cd"
name="OBS-CD"
sourcemedia="1"
create_pattern="false"
ignore_missing_meta_packages="true"
mediastyle="sle-13"
use_required="true"
use_suggested="false"
use_recommended="true">
<preselected_patterns>
<pattern name="OBS" />
</preselected_patterns>
<archsets>
<archset ref="ix86" />
<archset ref="x86_64" />
</archsets>
<metadata>
<package name="skelcd-obs"/>
<package name="patterns-obs"/>
</metadata>
<use group="obs">
<package name="package" relationship="requires" />
<!--
<package name="obs-release" relationship="requires" />
<package name="obs-release-cd" relationship="requires" />
-->
</use>
</media>
</mediasets>
<xi:include href="obs.group"/>
</productdefinition>
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!316 blocks