From 73e9fe3957c8f010fab2260381811cd818afbb9c Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Thu, 24 May 2012 15:11:32 +0000 Subject: replace with a perl script using URPM parse_synthesis --- src-rpm-list | 49 +++++++++++++++++++++++++++++++------------------ 1 file 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"; +} -- cgit v1.2.1