summaryrefslogtreecommitdiffstats
path: root/zarb-ml/mageia-sysadm/2011-January/002386.html
blob: 7d5d05e56060a02a03d624dd6b73294a52b6888c (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Mageia-sysadm] [338] Ugly code rejecting submit when buildrequires	are missing
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B338%5D%20Ugly%20code%20rejecting%20submit%20when%20buildrequires%0A%09are%20missing&In-Reply-To=%3C20110122144904.3251642DA6%40valstar.mageia.org%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="002385.html">
   <LINK REL="Next"  HREF="002387.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Mageia-sysadm] [338] Ugly code rejecting submit when buildrequires	are missing</H1>
    <B>root at mageia.org</B> 
    <A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B338%5D%20Ugly%20code%20rejecting%20submit%20when%20buildrequires%0A%09are%20missing&In-Reply-To=%3C20110122144904.3251642DA6%40valstar.mageia.org%3E"
       TITLE="[Mageia-sysadm] [338] Ugly code rejecting submit when buildrequires	are missing">root at mageia.org
       </A><BR>
    <I>Sat Jan 22 15:49:04 CET 2011</I>
    <P><UL>
        <LI>Previous message: <A HREF="002385.html">[Mageia-sysadm] [337] Add a means to filter out users who arent allowed to reset passwords with only
</A></li>
        <LI>Next message: <A HREF="002387.html">[Mageia-sysadm] [878] Enable my new rejection of submits with	missing buildrequires
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#2386">[ date ]</a>
              <a href="thread.html#2386">[ thread ]</a>
              <a href="subject.html#2386">[ subject ]</a>
              <a href="author.html#2386">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Revision: 338
Author:   pterjan
Date:     2011-01-22 15:49:03 +0100 (Sat, 22 Jan 2011)
Log Message:
-----------
Ugly code rejecting submit when buildrequires are missing

Added Paths:
-----------
    build_system/mdv-youri-submit/trunk/lib/Youri/Submit/Check/Deps.pm

Added: build_system/mdv-youri-submit/trunk/lib/Youri/Submit/Check/Deps.pm
===================================================================
--- build_system/mdv-youri-submit/trunk/lib/Youri/Submit/Check/Deps.pm	                        (rev 0)
+++ build_system/mdv-youri-submit/trunk/lib/Youri/Submit/Check/Deps.pm	2011-01-22 14:49:03 UTC (rev 338)
@@ -0,0 +1,87 @@
+package Youri::Submit::Check::Deps;
+
+=head1 NAME
+
+Youri::Submit::Check::Deps - Check dependencies
+
+=head1 DESCRIPTION
+
+This check plugin rejects packages with unresolved dependencies.
+
+=cut
+
+use warnings;
+use strict;
+use Carp;
+use Youri::Media::URPM;
+use base qw/Youri::Submit::Check/;
+
+sub resolvedep {
+    my ($media, @requires) = @_;
+
+    my @errors;
+    my $index = sub {
+        my ($package) = @_;
+
+	my @provides = $package-&gt;get_provides();
+
+	@requires = grep {
+	    my $require = $_;
+	    my $notfound = 1;
+            foreach my $provide (@provides) {
+                next unless $provide-&gt;[Youri::Package::DEPENDENCY_NAME] eq $require-&gt;[Youri::Package::DEPENDENCY_NAME];
+                if ($require-&gt;[Youri::Package::DEPENDENCY_RANGE]) {
+                    next unless $package-&gt;check_ranges_compatibility($provide-&gt;[Youri::Package::DEPENDENCY_RANGE], $require-&gt;[Youri::Package::DEPENDENCY_RANGE]);
+	        }
+	        $notfound = 0;
+	    }
+
+            if ($notfound &amp;&amp; $require-&gt;[Youri::Package::DEPENDENCY_NAME] =~ m|/|) {
+                foreach my $file ($package-&gt;get_files()) {
+		    next unless $file eq $require-&gt;[Youri::Package::DEPENDENCY_NAME];
+		    $notfound = 0;
+		    last;
+	        }
+            }
+	    $notfound;
+        } @requires;
+    };
+    $media-&gt;traverse_headers($index);
+    foreach my $require (@requires) {
+	    push (@errors, &quot;Unresolved dep on &quot; . $require-&gt;[Youri::Package::DEPENDENCY_NAME]);
+    }
+    return @errors;
+}
+
+sub run {
+    my ($self, $package, $repository, $target, $define) = @_;
+    croak &quot;Not a class method&quot; unless ref $self;
+
+    # FIXME Define some Youri::Media with allowed_deps in the config and
+    # match target + section to a media
+    my $section = $repository-&gt;_get_section($package, $target, $define);
+    return unless $target eq &quot;cauldron&quot; &amp;&amp; $section eq 'core/release';
+
+    my @requires = $package-&gt;get_requires();
+    
+    my $path = $repository-&gt;get_install_root() . &quot;/&quot; . $target;
+    # FIXME we need dependencies on all archs except for ExclusiveArch
+    my $arch = 'i586';
+#    foreach my $arch ($repository-&gt;get_extra_arches()) {
+        my $media = new Youri::Media::URPM(name =&gt; &quot;core.&quot;.$arch,
+                                           type =&gt; &quot;binary&quot;,
+					   hdlist =&gt; &quot;$path/$arch/media/$section/media_info/hdlist.cz&quot;);
+    return resolvedep($media, @requires);
+#    }
+
+}
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2011, YOURI project
+
+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut
+
+1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;/pipermail/mageia-sysadm/attachments/20110122/3f04e3ea/attachment.html&gt;
</PRE>











<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="002385.html">[Mageia-sysadm] [337] Add a means to filter out users who arent allowed to reset passwords with only
</A></li>
	<LI>Next message: <A HREF="002387.html">[Mageia-sysadm] [878] Enable my new rejection of submits with	missing buildrequires
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#2386">[ date ]</a>
              <a href="thread.html#2386">[ thread ]</a>
              <a href="subject.html#2386">[ subject ]</a>
              <a href="author.html#2386">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>