From 536be8dbb27733521e3cbb312fbcbf6adbd36362 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sat, 29 Jul 2017 13:49:51 +0100 Subject: Use urpm to parse synthesis This allows it to work with xz compressed synthesis. --- NEWS | 1 + iurt | 32 +++++++++++--------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/NEWS b/NEWS index fecf79b..9845d05 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ - iurt: support resuming a full rebuild - ulri: improve handling of build failures - iurt: fix stale command detection when log is not created quickly enough +- iurt: use urpm to parse synthesis (fixes support for xz) 0.6.29 - iurt: support chroot tarballs with non gz compression diff --git a/iurt b/iurt index a379926..9f27e52 100755 --- a/iurt +++ b/iurt @@ -53,7 +53,7 @@ use Mkcd::Commandline qw(parseCommandLine usage); use MDK::Common; use Filesys::Df qw(df); use POSIX; - +use urpm; # copied from drakx' standalone: sub bug_handler { @@ -1285,28 +1285,18 @@ sub check_media { my $synthesis_file = "$config->{repository}/$run->{distro}/$run->{my_arch}/media/$m/$subdir/media_info/synthesis.hdlist.cz"; if (-f $synthesis_file) { plog("Parsing $synthesis_file"); - # FIXME: this is reinventing the wheel and will fail if default compressor change: - if (open my $syn, "zcat $synthesis_file |") { - local $_; - while (<$syn>) { - my @prov; - if (/^\@provides@(.*)/) { - foreach my $p (split '@', $1) { - if ($p =~ /([^[]+)(?:\[(.*)\])?/g) { - push @prov, $1; - $provides->{$1} = $2 || 1; - } - } - } elsif (/\@info\@([^@]+)@/) { - my $p = $1; - my ($name) = $p =~ /(.*)-[^-]+-[^-]+\./; - $provides->{$p} = 1; - $pack_provide->{$_} = $name foreach @prov; + my $urpm = urpm->new; + $urpm->parse_synthesis($synthesis_file, callback => sub { + my ($urpm, $pkg) = @_; + my $name = $pkg->name; + $provides->{$pkg->fullname} = 1; + foreach ($pkg->provides) { + if ($_ =~ /([^[]+)(?:\[(.*)\])?/g) { + $provides->{$1} = $2 || 1; + $pack_provide->{$1} = $name; } } - } else { - die "FATAL $program_name: Could not open $synthesis_file\n"; - } + }); } } } -- cgit v1.2.1