From 0c5eb3c5059407533b7829476ebe6f21101b0028 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 14 Jan 2005 13:37:06 +0000 Subject: Make the parsing of "descriptions" file a bit better --- rpmdrake | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/rpmdrake b/rpmdrake index ca73c7d9..57c9f505 100755 --- a/rpmdrake +++ b/rpmdrake @@ -1197,20 +1197,22 @@ Then, restart %s.", $rpmdrake::myname_update)), myexit(-1); my ($cur, $section); #- parse the description file foreach (map { cat_("$statedir/descriptions.$_->{name}"), '%package dummy' } @update_medias) { - /^%package (.+)/ and do { - exists $cur->{importance} && !member($cur->{importance}, qw(security bugfix)) and $cur->{importance} = 'normal'; - $update_descr{$_} = $cur foreach @{$cur->{pkgs}}; + /^%package +(.+)/ and do { + my @pkg_list = split /\s+/, $1; + exists $cur->{importance} && $cur->{importance} !~ /^(?:security|bugfix)\z/ + and $cur->{importance} = 'normal'; + $descriptions{$_} = $cur foreach @{$cur->{pkgs} || []}; $cur = {}; - $cur->{pkgs} = [ split /\s/, $1 ]; + $cur->{pkgs} = [ @pkg_list ]; $section = 'pkg'; next; }; - /^Updated?: (.+)/ && $section eq 'pkg' and $cur->{update} = $1; - /^Importance: (.+)/ && $section eq 'pkg' and $cur->{importance} = $1; - /^%pre/ and do { $section = 'pre'; next }; - /^%description/ and do { $section = 'description'; next }; - $section eq 'pre' and $cur->{pre} .= $_; - $section eq 'description' and $cur->{description} .= $_; + /^%(pre|description)/ and do { $section = $1; next }; + /^Updated?: +(.+)/ && $section eq 'pkg' + and do { $cur->{update} = $1; next }; + /^Importance: +(.+)/ && $section eq 'pkg' + and do { $cur->{importance} = $1; next }; + $section =~ /^(pre|description)\z/ and $cur->{$1} .= $_; } } my $wait = wait_msg_(N("Please wait, finding available packages...")); -- cgit v1.2.1