diff options
author | Robert Xu <robxu9@gmail.com> | 2011-11-12 18:13:39 -0500 |
---|---|---|
committer | Robert Xu <robxu9@gmail.com> | 2011-11-12 18:13:39 -0500 |
commit | cd1f97695be1245ab19058d4fbc34e5697cc5383 (patch) | |
tree | b265d96856632dc78e566d337f7eff254b6695f7 /opensuse/core/qt3/update_spec.pl | |
parent | 21fcfa3348213aa87f0e3aef62ca4720c6d31cb7 (diff) | |
download | tde-packaging-cd1f97695be1245ab19058d4fbc34e5697cc5383.tar.gz tde-packaging-cd1f97695be1245ab19058d4fbc34e5697cc5383.zip |
fix up tdebase and add qt3
Diffstat (limited to 'opensuse/core/qt3/update_spec.pl')
-rw-r--r-- | opensuse/core/qt3/update_spec.pl | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/opensuse/core/qt3/update_spec.pl b/opensuse/core/qt3/update_spec.pl new file mode 100644 index 000000000..8c67241dc --- /dev/null +++ b/opensuse/core/qt3/update_spec.pl @@ -0,0 +1,106 @@ +#! /usr/bin/perl + +my $name = $ARGV[0]; +$name =~ s,.*/,,; +$name =~ s,\.spec.*,,; + +my %attributes = (); +open(FILE, $ARGV[1]) || die 'no attributes'; +my $pack = undef; +my $text = undef; +while ( <FILE> ) { + if (/^\+(.*)$/) { $pack = $1; $text = ''; next } + if (/^-(.*)$/) { + if ($pack ne $1) { + die "$pack and $1 do not match"; + } + $text =~ s,^\s*,,; + $text =~ s,\s*$,,; + $attributes{$pack} = $text; + $text = undef; + $pack = undef; + next; + } + if (defined $text) { + $text .= $_; + } elsif (/^(\S*)\s*(.*)$/) { + my $attr = $1; + my $string = $2; + $string =~ s,^\s*,,; + $string =~ s,\s*$,,; + $attributes{$attr} = $string; + } +} +close(FILE); + +open(FILE, $ARGV[0]); + +sub description() +{ + if (/^%description\s*(.*)\s*/) { + my $suffix = $1; + my $pname = $name; + + if ($suffix =~ m/-n\s*(.*)/) { + $pname = $1; + } else { + $pname = "$name-$suffix" if ($suffix); + } + + if (defined $attributes{"description.$pname"}) { + print $_; + my $descr = $attributes{"description.$pname"}; + print "$descr\n"; + $_ = ''; + do { + $_ = <FILE>; + } while ( $_ !~ /^%/ && $_ !~ /^@/ ); + print "\n"; + description(); + } + } + +} + +# current subpackage +my $pname = $name; + +while ( <FILE> ) +{ + if (/^Name:\s*(.*)/) { + $name = $1; + $pname = $1; + } + description(); + + if (/^%package\s*(.*)/) { + my $suffix = $1; + if ($suffix =~ m/-n\s*(.*)/) { + $pname = $1; + } else { + $pname = "$name-$1"; + } + } + + if (/^(Summary:\s*)(.*)$/) { + if (defined $attributes{"summary.$pname"}) { + print $1 . $attributes{"summary.$pname"} ."\n"; + next; + } + } + if (/^(License:\s*)(.*)$/) { + if (defined $attributes{"license.$pname"}) { + print $1 . $attributes{"license.$pname"} ."\n"; + next; + } + } + if (/^(Group:\s*)(.*)$/) { + if (defined $attributes{"group.$pname"}) { + print $1 . $attributes{"group.$pname"} ."\n"; + next; + } + } + print $_; +} + +close(FILE); |