diff options
author | Nicolas Vigier <boklm@mageia.org> | 2012-05-24 15:11:32 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2012-05-24 15:11:32 +0000 |
commit | 73e9fe3957c8f010fab2260381811cd818afbb9c (patch) | |
tree | a7131f077f3dc3584ebfd6fb6ccb4ae96cc794e6 | |
parent | 82a891cc83fc1dc19c0aefe2b0ad008dc41815c3 (diff) | |
download | release-73e9fe3957c8f010fab2260381811cd818afbb9c.tar release-73e9fe3957c8f010fab2260381811cd818afbb9c.tar.gz release-73e9fe3957c8f010fab2260381811cd818afbb9c.tar.bz2 release-73e9fe3957c8f010fab2260381811cd818afbb9c.tar.xz release-73e9fe3957c8f010fab2260381811cd818afbb9c.zip |
replace with a perl script using URPM parse_synthesis
-rwxr-xr-x | src-rpm-list | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src-rpm-list b/src-rpm-list index 28a5e48..c5b4077 100755 --- a/src-rpm-list +++ b/src-rpm-list @@ -1,25 +1,38 @@ -#!/bin/sh +#!/usr/bin/perl -w -# This take a root SRPMS directory as argument, and print the list of -# package names on stdout +# This script takes a root SRPMS directory as argument, and print the +# list of package names on stdout -function list_srpms() -{ - local dir="$1" +use strict; +use URPM; +use Data::Dump qw/dump/; - urpmf --distrib "$dir" --qf '%name' . +sub list_pkgnames +{ + my ($synthesis_file, $res) = @_; + my $urpm = new URPM; + $urpm->parse_synthesis($synthesis_file); + $urpm->traverse( + sub { + $res->{$_[0]->name()} = 1; + } + ); } -[ $# -eq 1 ] || exit 1 -srpmsdir="$1" +exit 1 unless @ARGV == 1; +my $srpmsdir = $ARGV[0]; +my @medias = qw/core nonfree tainted/; +my @submedias = qw/release updates updates_testing/; -( -for media in core non-free tainted -do - for submedia in release updates updates_testing - do - list_srpms "$srpmsdir/$media/$submedia" - done -done -) | sort | uniq +my %res; +for my $media (@medias) { + for my $submedia (@submedias) { + list_pkgnames("$srpmsdir/$media/$submedia/media_info/synthesis.hdlist.cz", + \%res); + } +} + +for my $pkg (sort keys %res) { + print $pkg, "\n"; +} |