OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 18-Nov-2002 15:35:37 Branch: HEAD Handle: 2002111814353700 Modified files: openpkg-re openpkg-index Log: code cleanup Summary: Revision Changes Path 1.12 +25 -19 openpkg-re/openpkg-index ____________________________________________________________________________ Index: openpkg-re/openpkg-index ============================================================ $ cvs diff -u -r1.11 -r1.12 openpkg-index --- openpkg-re/openpkg-index 18 Nov 2002 13:56:14 -0000 1.11 +++ openpkg-re/openpkg-index 18 Nov 2002 14:35:37 -0000 1.12 @@ -401,37 +401,43 @@ # translate attributs from %$a as generated by package2data # into XML and write to file $fh # -sub xml_record ($$) { - my($fh, $a) = @_; - my($maj,$min,$rel,$sub, $srcrpm); +sub xml_record ($$$) { + my($fh, $a, $href) = @_; + my($maj,$min,$rel,$srcrpm); $srcrpm = n($a,'Name').'-'. n($a,'Version').'-'. n($a,'Release').'.src.rpm'; - ($maj,$min,$rel) = n($a,'Release') =~ /^(\d+)\.(\d+)\.(\d+)/; + unless (defined $href) { - $sub = ''; - if (defined $min) { - if ($maj > 1 || ($maj == 1 && $min > 0)) { - # 1.1 or later - if (n($a,'Distribution') =~ /\[PLUS\]/) { - $sub = 'PLUS/'; + # guess location from Information in Specfile + + $href = $srcrpm; + ($maj,$min,$rel) = n($a,'Release') =~ /^(\d+)\.(\d+)\.(\d+)/; + + if (defined $min) { + if ($maj > 1 || ($maj == 1 && $min > 0)) { + # 1.1 or later + if (n($a,'Distribution') =~ /\[PLUS\]/) { + $href = 'PLUS/'.$href; + } } - } - if ($maj > 1 || ($maj == 1 && $min >= 0)) { - # 1.0 or later - if ($rel > 0) { - $sub = 'UPD/'; + if ($maj > 1 || ($maj == 1 && $min >= 0)) { + # 1.0 or later + if ($rel > 0) { + $href = 'UPD/'.$href; + } } + } else { + # current } - } else { - # current + } print $fh <<EOFEOF; - <rdf:Description about="$srcrpm" href="$sub$srcrpm"> + <rdf:Description about="$srcrpm" href="$href"> EOFEOF # fake Source attribute from Source\d attribtutes @@ -502,7 +508,7 @@ if (-f $specpath) { $s = `cat $specpath`; if ($a = spec2data($s)) { - xml_record(\*STDOUT, $a); + xml_record(\*STDOUT, $a, undef); } else { die "ERROR: cannot parse $specpath\n"; } ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]