Skip to content

Commit

Permalink
support multiple repos in one .repo file for zypp:// expandsion
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Mar 24, 2014
1 parent 1a14d04 commit 6948bbc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
29 changes: 29 additions & 0 deletions createzyppdeps
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,40 @@ use strict;
Getopt::Long::Configure("no_ignore_case");

my $cachedir = "/var/cache/build";
my $opt_listrepos;

GetOptions(
"cachedir=s" => \$cachedir,
"listrepos" => \$opt_listrepos,
) or exit(1);

if ($opt_listrepos) {
die("createzyppdeps --listrepos does not take an argument\n") if @ARGV;
opendir(D, "/etc/zypp/repos.d") || exit(0);
my @r = grep {!/^\./ && /.repo$/} readdir(D);
closedir D;
@r = sort @r;
for my $r (@r) {
open(F, '<', "/etc/zypp/repos.d/$r") || next;
my $reponame;
my $enabled;
while(<F>) {
chomp;
next if /^\s*#/;
s/\s+$//;
if (/^\[(.*)\]$/) {
print "$reponame\n" if defined($reponame) && $enabled;
$reponame = $1;
$enabled = undef;
} elsif (/enabled=\s*(\S+)/) {
$enabled = $1;
}
}
print "$reponame\n" if defined($reponame) && $enabled;
close F;
}
exit(0);
}
die("createzyppdeps needs exactly one argument\n") if @ARGV != 1;
my $url = $ARGV[0];

Expand Down
7 changes: 3 additions & 4 deletions init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,9 @@ expand_plain_zypp_repo() {
r=()
for i in "${repos[@]}"; do
if test "$i" = "zypp://" ; then
while read j; do
j="${j#/etc/zypp/repos.d/}"
r=("${r[@]}" "zypp://${j%.repo}")
done < <(grep -l enabled=1 /etc/zypp/repos.d/*.repo)
for j in $($BUILD_DIR/createzyppdeps --listrepos) ; do
r=("${r[@]}" "zypp://$j")
done
else
r=("${r[@]}" "$i")
fi
Expand Down

0 comments on commit 6948bbc

Please sign in to comment.