summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-dev/2012-May/015807.html
blob: 4dd50ecce1d039f0aea611526cb326e2fcc765dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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,  &lt;<A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">root at mageia.org</A>&gt; wrote:
&gt;<i> Revision 4670 Author boklm Date 2012-05-24 17:11:32 +0200 (Thu, 24 May 2012)
</I>&gt;<i>
</I>&gt;<i> Log Message
</I>&gt;<i>
</I>&gt;<i> replace with a perl script using URPM parse_synthesis
</I>&gt;<i>
</I>&gt;<i> Modified Paths
</I>&gt;<i>
</I>&gt;<i> release/trunk/src-rpm-list
</I>&gt;<i>
</I>&gt;<i> Modified: release/trunk/src-rpm-list
</I>&gt;<i> ===================================================================
</I>&gt;<i> --- release/trunk/src-rpm-list	2012-05-24 14:17:29 UTC (rev 4669)
</I>&gt;<i> +++ release/trunk/src-rpm-list	2012-05-24 15:11:32 UTC (rev 4670)
</I>&gt;<i> @@ -1,25 +1,38 @@
</I>&gt;<i> -#!/bin/sh
</I>&gt;<i> +#!/usr/bin/perl -w
</I>&gt;<i>
</I>&gt;<i> -# This take a root SRPMS directory as argument, and print the list of
</I>&gt;<i> -# package names on stdout
</I>&gt;<i> +# This script takes a root SRPMS directory as argument, and print the
</I>&gt;<i> +# list of package names on stdout
</I>&gt;<i>
</I>&gt;<i> -function list_srpms()
</I>&gt;<i> +use strict;
</I>&gt;<i> +use URPM;
</I>&gt;<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)

&gt;<i> +sub list_pkgnames
</I>&gt;<i>  {
</I>&gt;<i> -    local dir=&quot;$1&quot;
</I>&gt;<i> +    my ($synthesis_file, $res) = @_;
</I>&gt;<i> +    my $urpm = new URPM;
</I>&gt;<i> +    $urpm-&gt;parse_synthesis($synthesis_file);
</I>&gt;<i> +    $urpm-&gt;traverse(
</I>&gt;<i> +	sub {
</I>&gt;<i> +	    $res-&gt;{$_[0]-&gt;name()} = 1;
</I>&gt;<i> +	}
</I>&gt;<i> +    );
</I>&gt;<i> +}
</I>&gt;<i>
</I>&gt;<i> -    urpmf --distrib &quot;$dir&quot; --qf '%name' .
</I>&gt;<i> +exit 1 unless @ARGV == 1;
</I>&gt;<i> +my $srpmsdir = $ARGV[0];
</I>&gt;<i> +my @medias = qw/core nonfree tainted/;
</I>&gt;<i> +my @submedias = qw/release updates updates_testing/;
</I>&gt;<i> +
</I>&gt;<i> +my %res;
</I>&gt;<i> +for my $media (@medias) {
</I>&gt;<i> +    for my $submedia (@submedias) {
</I>&gt;<i> +	list_pkgnames(&quot;$srpmsdir/$media/$submedia/media_info/synthesis.hdlist.cz&quot;,
</I>&gt;<i> +	    \%res);
</I>&gt;<i> +    }
</I>&gt;<i>  }
</I>
Also you're hardcoding media names, which is not nice.
Just do this:

my %res;
foreach (glob(&quot;$srpmsdir/*/*/media_info/synthesis.hdlist.cz&quot;)) {
    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: &lt;/pipermail/mageia-dev/attachments/20120524/bf498b23/attachment.obj&gt;
</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>