diff options
Diffstat (limited to 'zarb-ml/mageia-dev/2012-May/015807.html')
-rw-r--r-- | zarb-ml/mageia-dev/2012-May/015807.html | 170 |
1 files changed, 170 insertions, 0 deletions
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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> + <HEAD> + <TITLE> [Mageia-dev] [soft-commits] [4670] replace with a perl script using URPM parse_synthesis + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B4670%5D%20replace%20with%20a%20perl%20script%0A%09using%20URPM%20parse_synthesis&In-Reply-To=%3CCAONrEta597cFZHiK0rsUoQjv-pDYzkOyXXJdpKf1aGsjpFhKkw%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="015821.html"> + <LINK REL="Next" HREF="015809.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[Mageia-dev] [soft-commits] [4670] replace with a perl script using URPM parse_synthesis</H1> + <B>Thierry Vignaud</B> + <A HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B4670%5D%20replace%20with%20a%20perl%20script%0A%09using%20URPM%20parse_synthesis&In-Reply-To=%3CCAONrEta597cFZHiK0rsUoQjv-pDYzkOyXXJdpKf1aGsjpFhKkw%40mail.gmail.com%3E" + TITLE="[Mageia-dev] [soft-commits] [4670] replace with a perl script using URPM parse_synthesis">thierry.vignaud at gmail.com + </A><BR> + <I>Thu May 24 17:42:27 CEST 2012</I> + <P><UL> + <LI>Previous message: <A HREF="015821.html">[Mageia-dev] Mageia 2 DVD 64bits install is broken +</A></li> + <LI>Next message: <A HREF="015809.html">[Mageia-dev] Cauldron? +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#15807">[ date ]</a> + <a href="thread.html#15807">[ thread ]</a> + <a href="subject.html#15807">[ subject ]</a> + <a href="author.html#15807">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>On 24 May 2012 17:11, <<A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">root at mageia.org</A>> wrote: +><i> Revision 4670 Author boklm Date 2012-05-24 17:11:32 +0200 (Thu, 24 May 2012) +</I>><i> +</I>><i> Log Message +</I>><i> +</I>><i> replace with a perl script using URPM parse_synthesis +</I>><i> +</I>><i> Modified Paths +</I>><i> +</I>><i> release/trunk/src-rpm-list +</I>><i> +</I>><i> Modified: release/trunk/src-rpm-list +</I>><i> =================================================================== +</I>><i> --- release/trunk/src-rpm-list 2012-05-24 14:17:29 UTC (rev 4669) +</I>><i> +++ release/trunk/src-rpm-list 2012-05-24 15:11:32 UTC (rev 4670) +</I>><i> @@ -1,25 +1,38 @@ +</I>><i> -#!/bin/sh +</I>><i> +#!/usr/bin/perl -w +</I>><i> +</I>><i> -# This take a root SRPMS directory as argument, and print the list of +</I>><i> -# package names on stdout +</I>><i> +# This script takes a root SRPMS directory as argument, and print the +</I>><i> +# list of package names on stdout +</I>><i> +</I>><i> -function list_srpms() +</I>><i> +use strict; +</I>><i> +use URPM; +</I>><i> +use Data::Dump qw/dump/; +</I> +You don't use Data::Dump (and you probably meant Data::Dumper since Data::Dump +is not installed by default) + +><i> +sub list_pkgnames +</I>><i> { +</I>><i> - local dir="$1" +</I>><i> + my ($synthesis_file, $res) = @_; +</I>><i> + my $urpm = new URPM; +</I>><i> + $urpm->parse_synthesis($synthesis_file); +</I>><i> + $urpm->traverse( +</I>><i> + sub { +</I>><i> + $res->{$_[0]->name()} = 1; +</I>><i> + } +</I>><i> + ); +</I>><i> +} +</I>><i> +</I>><i> - urpmf --distrib "$dir" --qf '%name' . +</I>><i> +exit 1 unless @ARGV == 1; +</I>><i> +my $srpmsdir = $ARGV[0]; +</I>><i> +my @medias = qw/core nonfree tainted/; +</I>><i> +my @submedias = qw/release updates updates_testing/; +</I>><i> + +</I>><i> +my %res; +</I>><i> +for my $media (@medias) { +</I>><i> + for my $submedia (@submedias) { +</I>><i> + list_pkgnames("$srpmsdir/$media/$submedia/media_info/synthesis.hdlist.cz", +</I>><i> + \%res); +</I>><i> + } +</I>><i> } +</I> +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> +</PRE> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="015821.html">[Mageia-dev] Mageia 2 DVD 64bits install is broken +</A></li> + <LI>Next message: <A HREF="015809.html">[Mageia-dev] Cauldron? +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#15807">[ date ]</a> + <a href="thread.html#15807">[ thread ]</a> + <a href="subject.html#15807">[ subject ]</a> + <a href="author.html#15807">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://www.mageia.org/mailman/listinfo/mageia-dev">More information about the Mageia-dev +mailing list</a><br> +</body></html> |