From 1be510f9529cb082f802408b472a77d074b394c0 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Sun, 14 Apr 2013 13:46:12 +0000 Subject: Add zarb MLs html archives --- zarb-ml/mageia-dev/2012-May/015807.html | 170 ++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 zarb-ml/mageia-dev/2012-May/015807.html (limited to 'zarb-ml/mageia-dev/2012-May/015807.html') diff --git a/zarb-ml/mageia-dev/2012-May/015807.html b/zarb-ml/mageia-dev/2012-May/015807.html new file mode 100644 index 000000000..4dd50ecce --- /dev/null +++ b/zarb-ml/mageia-dev/2012-May/015807.html @@ -0,0 +1,170 @@ + + + + [Mageia-dev] [soft-commits] [4670] replace with a perl script using URPM parse_synthesis + + + + + + + + + +

[Mageia-dev] [soft-commits] [4670] replace with a perl script using URPM parse_synthesis

+ Thierry Vignaud + thierry.vignaud at gmail.com +
+ Thu May 24 17:42:27 CEST 2012 +

+
+ +
On 24 May 2012 17:11,  <root at mageia.org> wrote:
+> Revision 4670 Author boklm Date 2012-05-24 17:11:32 +0200 (Thu, 24 May 2012)
+>
+> Log Message
+>
+> replace with a perl script using URPM parse_synthesis
+>
+> Modified Paths
+>
+> release/trunk/src-rpm-list
+>
+> Modified: release/trunk/src-rpm-list
+> ===================================================================
+> --- release/trunk/src-rpm-list	2012-05-24 14:17:29 UTC (rev 4669)
+> +++ release/trunk/src-rpm-list	2012-05-24 15:11:32 UTC (rev 4670)
+> @@ -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()
+> +use strict;
+> +use URPM;
+> +use Data::Dump qw/dump/;
+
+You don't use Data::Dump (and you probably meant Data::Dumper since Data::Dump
+is not installed by default)
+
+> +sub list_pkgnames
+>  {
+> -    local dir="$1"
+> +    my ($synthesis_file, $res) = @_;
+> +    my $urpm = new URPM;
+> +    $urpm->parse_synthesis($synthesis_file);
+> +    $urpm->traverse(
+> +	sub {
+> +	    $res->{$_[0]->name()} = 1;
+> +	}
+> +    );
+> +}
+>
+> -    urpmf --distrib "$dir" --qf '%name' .
+> +exit 1 unless @ARGV == 1;
+> +my $srpmsdir = $ARGV[0];
+> +my @medias = qw/core nonfree tainted/;
+> +my @submedias = qw/release updates updates_testing/;
+> +
+> +my %res;
+> +for my $media (@medias) {
+> +    for my $submedia (@submedias) {
+> +	list_pkgnames("$srpmsdir/$media/$submedia/media_info/synthesis.hdlist.cz",
+> +	    \%res);
+> +    }
+>  }
+
+Also you're hardcoding media names, which is not nice.
+Just do this:
+
+my %res;
+foreach (glob("$srpmsdir/*/*/media_info/synthesis.hdlist.cz")) {
+    list_pkgnames($_, \%res);
+}
+
+Also you should run perl_checker on it.
+
+You don't need to recreate a URPM object for each synthesis:
+See attached version
+-------------- next part --------------
+A non-text attachment was scrubbed...
+Name: u.pl
+Type: application/octet-stream
+Size: 402 bytes
+Desc: not available
+URL: </pipermail/mageia-dev/attachments/20120524/bf498b23/attachment.obj>
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ +
+More information about the Mageia-dev +mailing list
+ -- cgit v1.2.1