3 ################################################################
5 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 or 3 as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program (see the file COPYING); if not, write to the
18 # Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 ################################################################
24 unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
32 Getopt::Long::Configure("no_ignore_case");
34 my $cachedir = "/var/cache/build";
38 "cachedir=s" => \$cachedir,
39 "listrepos" => \$opt_listrepos,
43 die("createzyppdeps --listrepos does not take an argument\n") if @ARGV;
44 for my $r (Build::Zypp::parseallrepos()) {
45 print "$r->{'name'}\n" if $r->{'enabled'};
49 die("createzyppdeps needs exactly one argument\n") if @ARGV != 1;
52 die("createzyppdeps argument must start with 'zypp://'\n") unless $url =~ /^zypp:\/\/([^\/]*)/;
53 my $repo = Build::Zypp::parserepo($1);
55 my $type = $repo->{'type'};
56 my $zyppcachedir = "/var/cache/zypp/raw/$repo->{'name'}";
58 if($type eq 'rpm-md') {
59 exec ("$INC[0]/createrepomddeps", '--cachedir', $cachedir, '--zypp', $zyppcachedir, $url);
60 } elsif ($type eq 'yast2') {
61 exec ("$INC[0]/createyastdeps", '--cachedir', $cachedir, '--zypp', $zyppcachedir, $url);
63 die "unsupported repo type: $type\n";