Browse Source

changed index format, compatibility code, code cleanup, comments, clean revdep sort, optionally ignore XML parser

Michael van Elst 23 years ago
parent
commit
21132fea80
4 changed files with 644 additions and 360 deletions
  1. 582 353
      openpkg-tool/openpkg-build.pl
  2. 54 5
      openpkg-tool/openpkg-index.pl
  3. 2 2
      openpkg-tool/openpkg-tool.spec
  4. 6 0
      openpkg-tool/openpkg.pod

File diff suppressed because it is too large
+ 582 - 353
openpkg-tool/openpkg-build.pl


+ 54 - 5
openpkg-tool/openpkg-index.pl

@@ -68,11 +68,48 @@ sub e ($) {
     return $s;
 }
 
+my %attrname = (
+    '=='  => 'equ',
+    '='   => 'equ',
+    '>='  => 'geq',
+    '=>'  => 'geq',
+    '<='  => 'leq',
+    '=<'  => 'leq',
+    '>'   => 'gt',
+    '<'   => 'lt'
+);
+my($opreg) = join '|',
+    map {
+        "\Q$_\E"
+    } sort {
+        length($b) <=> length($a) ||
+        $b cmp $a
+    } keys %attrname;
+
+sub make_resource ($) {
+    my($s) = @_;
+
+    if ($s =~ /(\S+)\s*($opreg)\s*(.*?)\s*$/o) {
+        return {
+            resource  => $1,
+            attrname  => $attrname{$2},
+            attrval   => $3
+        } 
+    }
+
+    return {
+        resource => $s
+    }
+}
+
 sub commasep ($$) {
     my($k,$v) = @_;
 
-    if ($k =~ /^(PreReq|BuildPreReq|Provides|Conflicts|NoSource)$/) {
+    if ($k =~ /^(NoSource)$/) {
         return split(/\s*,\s*/, $v);
+    } elsif ($k =~ /^(PreReq|BuildPreReq|Provides|Conflicts)$/) {
+        return map { make_resource($_) }
+               split(/\s*,\s*/, $v);
     }
 
     return $v;
@@ -289,8 +326,11 @@ sub package2data ($$) {
             # store option for current condition
             #
             if (exists $attr{'Name'}->{''}) {
-                push @{$attr{'Provides'}->{$cond}},
-                    $attr{'Name'}->{''}->[0].'::'.$1.' = '.optesc($2);
+                push @{$attr{'Provides'}->{$cond}}, {
+                    resource => $attr{'Name'}->{''}->[0].'::'.$1,
+                    attrname => 'equ',
+                    attrval  => optesc($2)
+                }
             } else {
                 warn "ERROR: no package name set for option $1 = $2\n";
             }
@@ -455,7 +495,16 @@ sub xml_bag ($$$;$) {
                 ($cond ne '' ? "<$tag cond=\"$upn\">\n" : "<$tag>\n").
                 "$i  <rdf:bag>\n".
                 join("",
-                     map { "$i    <rdf:li>".e($_)."</rdf:li>\n" }
+                     map {
+                         ref $_
+                         ? "$i    <resource".
+                           ( exists $_->{attrname}
+                             ? " $_->{attrname}=\"".e($_->{attrval})."\""
+                             : ""
+                           ).
+                           ">".e($_->{resource})."</resource>\n"
+                         : "$i    <rdf:li>".e($_)."</rdf:li>\n"
+                     }
                      @{$a->{$k}->{$cond}}).
                 "$i  </rdf:bag>\n".
                 "$i</$tag>\n";
@@ -819,7 +868,7 @@ sub write_index ($$$$$$) {
         if (/\.spec$/) {
             $spec = readfile($_);
             $a    = spec2data($spec);
-        } elsif (/([^\/]+\.src\.rpm)$/) {
+        } elsif (/([^\/]+\.(?:no)?src\.rpm)$/) {
             $h    = relpath($prefix, $_);
             if ($cache) {
                 $mtime = (stat $_)[9];

+ 2 - 2
openpkg-tool/openpkg-tool.spec

@@ -32,8 +32,8 @@ Packager:     The OpenPKG Project
 Distribution: OpenPKG [EVAL]
 Group:        Bootstrapping
 License:      GPL
-Version:      20030108
-Release:      20030108
+Version:      20030109
+Release:      20030109
 
 #   list of sources
 Source0:      openpkg.sh

+ 6 - 0
openpkg-tool/openpkg.pod

@@ -59,6 +59,7 @@ B<build>
 [B<-q>]
 [B<-s>]
 [B<-S>]
+[B<-X>]
 [B<-P> I<priv-cmd>]
 [B<-N> I<non-priv-cmd>]
 [B<-p> I<platform>]
@@ -249,6 +250,11 @@ The package exists in the repository but isn't required yet.
 
 =back
 
+=item B<-X>
+
+Ignore an installed XML parser module but use the internal
+simple text parser instead.
+
 =item B<-P> I<priv-cmd>
 
 Command prefix to use for install commands that require elevated