aboutsummaryrefslogtreecommitdiffstats
path: root/URPM
diff options
context:
space:
mode:
Diffstat (limited to 'URPM')
-rw-r--r--URPM/Build.pm2
-rw-r--r--URPM/Query.pm20
2 files changed, 21 insertions, 1 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm
index 88e6d5b..4e37edb 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -55,7 +55,7 @@ sub parse_rpms_build_headers {
$filename = $cache{$key}{file};
} else {
- ($id, undef) = $urpm->parse_rpm($_);
+ ($id, undef) = $urpm->parse_rpm($_, %options);
unless (defined $id) {
if ($options{dontdie}) {
print STDERR "bad rpm $_\n";
diff --git a/URPM/Query.pm b/URPM/Query.pm
index 6e639c8..7929ce6 100644
--- a/URPM/Query.pm
+++ b/URPM/Query.pm
@@ -188,4 +188,24 @@ sub id2tag {
@ret
}
+sub query_pkg {
+ my ($urpm, $pkg, $query) = @_;
+ my @tags = map {
+ [ $pkg->get_tag(tag2id($_)) ]
+ } $query =~ m/\%\{([^{}]*)\}*/g;
+
+ $query =~ s/\%\{[^{}]*\}/%s/g;
+ $query =~ s/\\n/\n/g;
+ $query =~ s/\\t/\t/g;
+ my ($max, @res) = 0;
+
+ foreach (@tags) { $max < $#{$_} and $max = $#{$_} };
+
+ foreach my $i (0 .. $max) {
+ push(@res, sprintf($query, map { ${$_}[ $#{$_} < $i ? $#{$_} : $i ] } @tags));
+ }
+ @res
+}
+
+
1;