| ... |
... |
@@ -87,6 +87,33 @@ sub get_sha512_hex_of_file { |
|
87
|
87
|
return $sha->hexdigest;
|
|
88
|
88
|
}
|
|
89
|
89
|
|
|
|
90
|
+# With release 15.0 _ALL is being removed from mar file names.
|
|
|
91
|
+# However we need to be able to generate incrementals from versions
|
|
|
92
|
+# using the old filenames. As a workaround, if the old filename is
|
|
|
93
|
+# found we create a symlink to the new file name.
|
|
|
94
|
+# The symlinks are used in `create_incremental_mar` and `get_buildinfos`,
|
|
|
95
|
+# where supporting both file names would complexify things. The symlinks
|
|
|
96
|
+# are ignored in `get_version_files` where the regexp used support both
|
|
|
97
|
+# old and new filenames.
|
|
|
98
|
+# We can remove this once we don't need to generate incrementals from
|
|
|
99
|
+# versions with the old file names.
|
|
|
100
|
+sub symlink_ALL {
|
|
|
101
|
+ my ($config, $version) = @_;
|
|
|
102
|
+ my $vdir = version_dir($config, $version);
|
|
|
103
|
+ opendir(my $d, $vdir) or exit_error "Error opening directory $vdir";
|
|
|
104
|
+ foreach my $file (readdir $d) {
|
|
|
105
|
+ next unless -f "$vdir/$file";
|
|
|
106
|
+ if ($file =~ m/^(.+)_ALL\.mar$/) {
|
|
|
107
|
+ next if -f "$vdir/$1.mar";
|
|
|
108
|
+ symlink $file, "$vdir/$1.mar";
|
|
|
109
|
+ }
|
|
|
110
|
+ if ($file =~ m/^(.+)_ALL\.incremental\.mar$/) {
|
|
|
111
|
+ next if -f "$vdir/$1.incremental.mar";
|
|
|
112
|
+ symlink $file, "$vdir/$1.incremental.mar";
|
|
|
113
|
+ }
|
|
|
114
|
+ }
|
|
|
115
|
+}
|
|
|
116
|
+
|
|
90
|
117
|
sub get_version_files {
|
|
91
|
118
|
my ($config, $version) = @_;
|
|
92
|
119
|
return if $config->{versions}{$version}{files};
|
| ... |
... |
@@ -97,8 +124,13 @@ sub get_version_files { |
|
97
|
124
|
opendir(my $d, $vdir) or exit_error "Error opening directory $vdir";
|
|
98
|
125
|
foreach my $file (readdir $d) {
|
|
99
|
126
|
next unless -f "$vdir/$file";
|
|
|
127
|
+ # Ignore the symlinks created by `symlink_ALL` to avoid adding the files
|
|
|
128
|
+ # twice.
|
|
|
129
|
+ # We can remove this line once we don't need to support the legacy channel with
|
|
|
130
|
+ # with the old file names.
|
|
|
131
|
+ next if -l "$vdir/$file";
|
|
100
|
132
|
if ($file !~ m/incremental\.mar$/ &&
|
|
101
|
|
- $file =~ m/^$appname-(.+)-${version}_ALL\.mar$/) {
|
|
|
133
|
+ $file =~ m/^$appname-(.+)-${version}(_ALL)?\.mar$/) {
|
|
102
|
134
|
my $os = $1;
|
|
103
|
135
|
$files->{$os}{complete} = {
|
|
104
|
136
|
type => 'complete',
|
| ... |
... |
@@ -111,7 +143,7 @@ sub get_version_files { |
|
111
|
143
|
};
|
|
112
|
144
|
next;
|
|
113
|
145
|
}
|
|
114
|
|
- if ($file =~ m/^$appname-(.+)--(.+)-${version}_ALL\.incremental\.mar$/) {
|
|
|
146
|
+ if ($file =~ m/^$appname-(.+)--(.+)-${version}(_ALL)?\.incremental\.mar$/) {
|
|
115
|
147
|
my ($os, $from_version) = ($1, $2);
|
|
116
|
148
|
$files->{$os}{partial}{$from_version} = {
|
|
117
|
149
|
type => 'partial',
|
| ... |
... |
@@ -221,13 +253,13 @@ sub extract_mar { |
|
221
|
253
|
|
|
222
|
254
|
sub mar_filename {
|
|
223
|
255
|
my ($config, $appname, $version, $os) = @_;
|
|
224
|
|
- version_dir($config, $version) . "/$appname-$os-${version}_ALL.mar";
|
|
|
256
|
+ version_dir($config, $version) . "/$appname-$os-${version}.mar";
|
|
225
|
257
|
}
|
|
226
|
258
|
|
|
227
|
259
|
sub create_incremental_mar {
|
|
228
|
260
|
my ($config, $pm, $from_version, $new_version, $os, $channel) = @_;
|
|
229
|
261
|
my $appname = $config->{appname_marfile};
|
|
230
|
|
- my $mar_file = "$appname-$os--${from_version}-${new_version}_ALL.incremental.mar";
|
|
|
262
|
+ my $mar_file = "$appname-$os--${from_version}-${new_version}.incremental.mar";
|
|
231
|
263
|
my $mar_file_path = version_dir($config, $new_version) . '/' . $mar_file;
|
|
232
|
264
|
if ($ENV{MAR_SKIP_EXISTING} && -f $mar_file_path) {
|
|
233
|
265
|
print "Skipping $mar_file\n";
|
| ... |
... |
@@ -288,6 +320,7 @@ sub create_incremental_mars_for_version { |
|
288
|
320
|
my $v = $config->{versions}{$version};
|
|
289
|
321
|
foreach my $from_version (@{$v->{incremental_from}}) {
|
|
290
|
322
|
$config->{versions}{$from_version} //= {};
|
|
|
323
|
+ symlink_ALL($config, $from_version);
|
|
291
|
324
|
get_version_files($config, $from_version);
|
|
292
|
325
|
my $from_v = $config->{versions}{$from_version};
|
|
293
|
326
|
foreach my $os (keys %{$v->{files}}) {
|
| ... |
... |
@@ -396,6 +429,7 @@ sub write_responses { |
|
396
|
429
|
my (%oses, %from_versions);
|
|
397
|
430
|
foreach my $version (@$versions) {
|
|
398
|
431
|
get_version_files($config, $version);
|
|
|
432
|
+ symlink_ALL($config, $version);
|
|
399
|
433
|
get_buildinfos($config, $version);
|
|
400
|
434
|
my $files = $config->{versions}{$version}{files};
|
|
401
|
435
|
foreach my $os (keys %$files) {
|