Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add support of multiple architectures with differing information

  • Loading branch information...
commit 2f88bb3d570acd2a8c08faae76183ee23fca14c1 1 parent 3b930a0
Raphaël Hertzog authored October 28, 2009

Showing 2 changed files with 41 additions and 32 deletions. Show diff stats Hide diff stats

  1. 2  conf-slis.pl
  2. 71  lint-pkgrepo
2  conf-slis.pl
... ...
@@ -1,5 +1,5 @@
1 1
 
2  
-our @ARCHES = ('i386'); #, 'amd64');
  2
+our @ARCHES = ('i386', 'amd64');
3 3
 $REPOS = {
4 4
     '4.1' => {
5 5
 	base_uri => 'http://ftp.slis.fr/slis/dists/4.1',
71  lint-pkgrepo
@@ -34,8 +34,7 @@ my $global_bin_index = Dpkg::Index->new(type => CTRL_INDEX_PKG);
34 34
 foreach my $repo (keys %$REPOS) {
35 35
     my $base_uri = get_repo_info('base_uri', $repo);
36 36
     my $components = get_repo_info('components', $repo);
37  
-    my @archs;
38  
-    push @archs, @{get_repo_info('archs', $repo, [])};
  37
+    my @archs = @{get_repo_info('archs', $repo, [])};
39 38
     if (not defined $components) {
40 39
 	if (get_repo_info('source', $repo)) {
41 40
 	    my $index = parse_index_from_uri("$base_uri/source/Sources.gz",
@@ -92,30 +91,35 @@ print "</tr>\n";
92 91
 foreach my $pkg (sort $global_bin_index->get_keys()) {
93 92
     print "<tr><td>$pkg</td>\n";
94 93
     foreach my $repo (sort keys %$REPOS) {
95  
-	my $cell = "<td";
  94
+	my $cell;
  95
+	my @archs = @{get_repo_info('archs', $repo, [])};
96 96
 	my ($version, $arch) = same_version_on_all_arches($repo, $pkg);
97 97
 	if (not defined $version) {
98 98
 	    # Skip
99  
-	    $cell .= ">&nbsp;"
  99
+	    $cell = "<td>&nbsp;</td>"
100 100
 	} elsif ($version) {
101 101
 	    # Once for all arches
102  
-	    my $info = $idx->{"$repo/$arch"}->get_by_key($pkg);
  102
+	    my $info = get_repo_package("$repo/$arch", { Package => $pkg });
103 103
 	    my $res = bin_checks($info, $arch, $repo);
104  
-	    my $title = join(' ', @{$res->{'errors'}}, @{$res->{'warnings'}});
105  
-	    if (@{$res->{'errors'}}) {
106  
-		$cell .= " title='$title' style='background-color: red'>"
107  
-	    } elsif (@{$res->{'warnings'}}) {
108  
-		$cell .= " title='$title' style='background-color: orange'>"
109  
-	    } else {
110  
-		$cell .= " style='background-color: green'>"
111  
-	    }
112  
-	    $cell .= $version;
  104
+	    $cell .= "<td " . res_to_html($res) . ">";
  105
+	    $cell .= $version . "</td>";
113 106
 	} else {
114 107
 	    # Once for each arch
115  
-	    # TODO:
116  
-	    $cell .= ">TODO: Info differ between archs"
  108
+	    $cell = "<td>";
  109
+	    foreach $arch (@archs) {
  110
+		my $info = get_repo_package("$repo/$arch", { Package => $pkg });
  111
+		if (not defined $info) {
  112
+		    $cell .= "<div style='background-color: grey'>" .
  113
+			     "$arch: missing?</div>\n";
  114
+		    next;
  115
+		}
  116
+		my $res = bin_checks($info, $arch, $repo);
  117
+		$cell .= "<div " . res_to_html($res) . ">";
  118
+		$cell .= $arch . ": " . $info->{Version} . "</div>\n";
  119
+	    }
  120
+	    $cell .= "</td>";
117 121
 	}
118  
-	print "$cell</td>";
  122
+	print $cell;
119 123
     }
120 124
     print "</tr>\n";
121 125
 }
@@ -125,31 +129,36 @@ print "</tr>\n";
125 129
 foreach my $pkg ($global_src_index->get_keys()) {
126 130
     print "<tr><td>$pkg</td>\n";
127 131
     foreach my $repo (sort keys %$REPOS) {
128  
-	my $cell = "<td";
  132
+	my $cell;
129 133
 	my $info;
130  
-	if ($REPOS->{$repo}{'source'}) {
131  
-	    $info = $idx->{"$repo/src"}->get_by_key($pkg);
  134
+	if (get_repo_info('source', $repo)) {
  135
+	    $info = get_repo_package("$repo/src", { Package => $pkg });
132 136
 	}
133 137
 	if (defined $info) {
134 138
 	    my $res = src_checks($info, $repo);
135  
-	    my $title = join(' ', @{$res->{'errors'}}, @{$res->{'warnings'}});
136  
-	    if (@{$res->{'errors'}}) {
137  
-		$cell .= " title='$title' style='background-color: red'>"
138  
-	    } elsif (@{$res->{'warnings'}}) {
139  
-		$cell .= " title='$title' style='background-color: orange'>"
140  
-	    } else {
141  
-		$cell .= " style='background-color: green'>"
142  
-	    }
143  
-	    $cell .= $info->{'version'};
  139
+	    $cell .= "<td " . res_to_html($res);
  140
+	    $cell .= ">" . $info->{'version'} . "</td>";
144 141
 	} else {
145  
-	    $cell .= ">&nbsp;";
  142
+	    $cell .= "<td>&nbsp;</td>";
146 143
 	}
147  
-	print "$cell</td>";
  144
+	print $cell;
148 145
     }
149 146
     print "</tr>\n";
150 147
 }
151 148
 print "</table>\n</body>\n</html>";
152 149
 
  150
+sub res_to_html {
  151
+    my ($res) = @_;
  152
+    my $title = join(' ', @{$res->{'errors'}}, @{$res->{'warnings'}});
  153
+    if (@{$res->{'errors'}}) {
  154
+	return "title='$title' style='background-color: red'"
  155
+    } elsif (@{$res->{'warnings'}}) {
  156
+	return "title='$title' style='background-color: orange'"
  157
+    } else {
  158
+	return "style='background-color: green'"
  159
+    }
  160
+}
  161
+
153 162
 sub get_repo_info {
154 163
     my ($field, $repo, $default_value) = @_;
155 164
     return get_component_info($field, $repo, undef, $default_value);

0 notes on commit 2f88bb3

Please sign in to comment.
Something went wrong with that request. Please try again.