Mailinglist Archive: opensuse-packaging (182 mails)

< Previous Next >
Re: [opensuse-packaging] pre_checkin.sh and prepare_spec
  • From: Karl Eichwalder <ke@xxxxxxx>
  • Date: Tue, 23 Jun 2009 16:51:00 +0200
  • Message-id: <shocsf9f6z.fsf@xxxxxxxxxxxxxxx>
Stephan Kulow <coolo@xxxxxxx> writes:

I fixed this for the pre_checkin.sh in bundle-lang-common now in having a
little perl script that I call like this:

perl update_spec.pl oldfile attributes > newfile

this reads Summary, Description, Group and License out of the attributes
file and updates the spec file. The attributes file I created from pdb
content.

Because I'm not that good with querying the pdb, here are some awk bits
to create the attributes file from the old spec file (multi-line
processing is not perfect...):

awk -f create-attr.awk *.spec > attributes

/^Name:/ {
name=$2
nname = name
next}

in_desc == 1 && /^%/ {
in_desc = 0
sub (/^ */, "", line)
printf ("+description.%s\n",nname)
print line
printf ("-description.%s\n",nname)
line = ""
}
in_desc == 1 {
line = line " " $0
next
}

/^%description/ {
in_desc = 1
next
}

/^%package/ {
if ( $2 == "-n" )
nname = $3
else
nname = name "-" $2
next
}
/^Group:/ {
group = $2
printf ("group.%s %s\n", nname,group)
next
}
/^License:/ {
sub(/License:/, "", $0)
printf ("license.%s %s\n", nname,$0 )
next}
/^Summary:/ {
sub(/Summary:/, "", $0)
printf ("summary.%s %s\n", nname,$0 )
next}

--
Karl Eichwalder
R&D / Documentation

SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
< Previous Next >