summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-dev/2011-December/010333.html
blob: 7790d1fd0fced699bb981af17239d2ce7a6acc7e (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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Mageia-dev] [soft-commits] [2359] coding style update	(perl_checker)
   </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%5B2359%5D%20coding%20style%20update%0A%09%28perl_checker%29&In-Reply-To=%3CCAONrEtaCezTNCJvfXfVDZhDwNy-O7uX8byPLp0djOATv3i1_ag%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="010352.html">
   <LINK REL="Next"  HREF="010340.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Mageia-dev] [soft-commits] [2359] coding style update	(perl_checker)</H1>
    <B>Thierry Vignaud</B> 
    <A HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B2359%5D%20coding%20style%20update%0A%09%28perl_checker%29&In-Reply-To=%3CCAONrEtaCezTNCJvfXfVDZhDwNy-O7uX8byPLp0djOATv3i1_ag%40mail.gmail.com%3E"
       TITLE="[Mageia-dev] [soft-commits] [2359] coding style update	(perl_checker)">thierry.vignaud at gmail.com
       </A><BR>
    <I>Sat Dec 10 18:59:32 CET 2011</I>
    <P><UL>
        <LI>Previous message: <A HREF="010352.html">[Mageia-dev] Need for a clear policy on translated man pages
</A></li>
        <LI>Next message: <A HREF="010340.html">[Mageia-dev] [soft-commits] [2359] coding style update	(perl_checker)
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#10333">[ date ]</a>
              <a href="thread.html#10333">[ thread ]</a>
              <a href="subject.html#10333">[ subject ]</a>
              <a href="author.html#10333">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>On 10 December 2011 18:29,  &lt;<A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">root at mageia.org</A>&gt; wrote:
&gt;<i> Revision 2359 Author rda Date 2011-12-10 18:29:07 +0100 (Sat, 10 Dec 2011)
</I>&gt;<i>
</I>&gt;<i> Log Message
</I>&gt;<i>
</I>&gt;<i> coding style update (perl_checker)
</I>
uh?&#160;Tools.pm doesn't currently pass perl_checker

&gt;<i> Modified Paths
</I>&gt;<i>
</I>&gt;<i> isocheck/trunk/Tools.pm
</I>&gt;<i> isocheck/trunk/t/003_is_hybrid.t
</I>&gt;<i> isocheck/trunk/t_install_iso/010_check_autorun.t
</I>&gt;<i> isocheck/trunk/t_install_iso/012_check_ids.t
</I>&gt;<i> isocheck/trunk/t_install_iso/013_check_rpms.t
</I>&gt;<i> isocheck/trunk/t_install_iso/016_check_pubkey.t
</I>&gt;<i>
</I>&gt;<i> Modified: isocheck/trunk/Tools.pm
</I>&gt;<i> ===================================================================
</I>&gt;<i> --- isocheck/trunk/Tools.pm	2011-12-10 17:27:16 UTC (rev 2358)
</I>&gt;<i> +++ isocheck/trunk/Tools.pm	2011-12-10 17:29:07 UTC (rev 2359)
</I>&gt;<i> @@ -33,18 +33,18 @@
</I>&gt;<i>
</I>&gt;<i>  sub parse_mageia_iso_name {
</I>&gt;<i>      my ($name) = @_;
</I>&gt;<i> -    my %info = ();
</I>&gt;<i> +    my %info;
</I>&gt;<i>
</I>&gt;<i> -    if ($name =~
</I>&gt;<i> m/^(Mageia)-(\d+)(-(alpha|beta|RC)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BD))?(-(build\_\w+))?\.(.*)$/)
</I>&gt;<i> {
</I>&gt;<i> -        $info{&quot;full&quot;}    = $name;
</I>&gt;<i> -        $info{&quot;name&quot;}    = $1  if defined $1;
</I>&gt;<i> -        $info{&quot;version&quot;} = $2  if defined $2;
</I>&gt;<i> -        $info{&quot;release&quot;} = &quot;$4$5&quot; if defined $4;
</I>&gt;<i> -        $info{&quot;variant&quot;} = $7  if defined $7;
</I>&gt;<i> -        $info{&quot;arch&quot;}    = $8  if defined $8;
</I>&gt;<i> -        $info{&quot;medium&quot;}  = $10 if defined $10;
</I>&gt;<i> -        $info{&quot;build&quot;}   = $12 if defined $12;
</I>&gt;<i> -        $info{&quot;ext&quot;}     = $13 if defined $13;
</I>&gt;<i> +    if ($name =~
</I>&gt;<i> m/^(Mageia)-(\d+)(-(alpha|beta|RC)(\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BD))?(-(build_\w+))?\.(.*)$/)
</I>&gt;<i> {
</I>&gt;<i> +        $info{full}    = $name;
</I>&gt;<i> +        $info{name}    = $1  if defined $1;
</I>&gt;<i> +        $info{version} = $2  if defined $2;
</I>&gt;<i> +        $info{release} = &quot;$4$5&quot; if defined $4;
</I>&gt;<i> +        $info{variant} = $7  if defined $7;
</I>&gt;<i> +        $info{arch}    = $8  if defined $8;
</I>&gt;<i> +        $info{medium}  = $10 if defined $10;
</I>&gt;<i> +        $info{build}   = $12 if defined $12;
</I>&gt;<i> +        $info{ext}     = $13 if defined $13;
</I>
You don't need all those tests since you already checked if the regexp
matched or not.
You only have to check for ()? groups.
What's more your checks are inconsistant anyway (eg you don't check for $5)


just do sg like this:

sub parse_mageia_iso_name {
    my ($name) = @_;
    my %info;

    if ((@info{qw(name version release variant arch medium build
ext)}) = $name =~
	m/^(Mageia)-(\d+)-((?:alpha|beta|RC)\d*)?(-(?:.*))?-(i586|x86_64|dual)?(?:-(CD|DVD|BD))?(?:-(build_\w+))?\.(.*)$/)
{
        $info{full} = $name;
    }

    return %info;
}


&gt;<i> Modified: isocheck/trunk/t/003_is_hybrid.t
</I>&gt;<i> ===================================================================
</I>&gt;<i> --- isocheck/trunk/t/003_is_hybrid.t	2011-12-10 17:27:16 UTC (rev 2358)
</I>&gt;<i> +++ isocheck/trunk/t/003_is_hybrid.t	2011-12-10 17:29:07 UTC (rev 2359)
</I>&gt;<i> @@ -24,7 +24,7 @@
</I>&gt;<i>
</I>&gt;<i>  my ($image_path) = @ARGV;
</I>&gt;<i>
</I>&gt;<i> -ok (is_hybrid($image_path, 0), &quot;Is hybrid&quot;);
</I>&gt;<i> +ok is_hybrid($image_path, 0), &quot;Is hybrid&quot;;
</I>
please keep (), it's clearer. just remove the space between &quot;ok&quot; and &quot;(&quot;


&gt;<i> Modified: isocheck/trunk/t_install_iso/016_check_pubkey.t
</I>&gt;<i> ===================================================================
</I>&gt;<i> --- isocheck/trunk/t_install_iso/016_check_pubkey.t	2011-12-10 17:27:16 UTC
</I>&gt;<i> (rev 2358)
</I>&gt;<i> +++ isocheck/trunk/t_install_iso/016_check_pubkey.t	2011-12-10 17:29:07 UTC
</I>&gt;<i> (rev 2359)
</I>&gt;<i> @@ -39,17 +39,17 @@
</I>&gt;<i>  system &quot;ls /media/iso_check/i586/media/ &gt; temp_media_on_iso.log&quot; if -r
</I>&gt;<i> &quot;/media/iso_check/i586/media/&quot;;
</I>&gt;<i>  system &quot;ls /media/iso_check/x86_64/media/ &gt;&gt; temp_media_on_iso.log&quot; if -r
</I>&gt;<i> &quot;/media/iso_check/x86_64/media/&quot;;
</I>&gt;<i>
</I>&gt;<i> -ok (-r &quot;temp_media_on_iso.log&quot;, &quot;Got a log for media contents&quot;);
</I>&gt;<i> +ok -r &quot;temp_media_on_iso.log&quot;, &quot;Got a log for media contents&quot;;
</I>&gt;<i>
</I>&gt;<i>  open(my $file, &quot;temp_media_on_iso.log&quot;) if -r &quot;temp_media_on_iso.log&quot;;
</I>&gt;<i>
</I>&gt;<i>  while ($media = &lt;$file&gt;) {
</I>
just reuse cat_() from MDK::Common (simpler, easier to read)
</PRE>







































<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="010352.html">[Mageia-dev] Need for a clear policy on translated man pages
</A></li>
	<LI>Next message: <A HREF="010340.html">[Mageia-dev] [soft-commits] [2359] coding style update	(perl_checker)
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#10333">[ date ]</a>
              <a href="thread.html#10333">[ thread ]</a>
              <a href="subject.html#10333">[ subject ]</a>
              <a href="author.html#10333">[ 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>