-
Notifications
You must be signed in to change notification settings - Fork 3
/
migrator.old
601 lines (546 loc) · 24.9 KB
/
migrator.old
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
program migrator;
uses
readtxt2,sysutils, contnrs, dpkgdb, classes, util;
const
reporoot = '/home/repo/repo/raspbian/';
codename = 'wheezy';
codenamestaging = 'wheezy-staging';
architecture = 'armhf';
//return -1 if versiona is less than versionb
//reutrn 0 if versiona is equal to versionb
//reutrn 1 if versiona is greater than versionb
function compareversion(versiona,versionb: string) : longint;
var
rversiona:versionrevision;
rversionb:versionrevision;
error : dpkg_error;
begin
//writeln(versiona,' ',versionb);
uniquestring(versiona);
uniquestring(versionb);
if parseversion(@rversiona,pchar(versiona),@error) <> 0 then begin
writeln('error parsing version '+versiona);
halt;
end;
//writeln('rversiona.version ',rversiona.version);
//writeln('rversiona.revision ',rversiona.revision);
if parseversion(@rversionb,pchar(versionb),@error) <> 0 then begin
writeln('error parsing version '+versionb);
halt;
end;
//writeln('rversionb.version ',rversionb.version);
//writeln('rversionb.revision ',rversionb.revision);
result := versioncompare(@rversiona,@rversionb);
end;
type
tsourcepackage=class
version : string;
name : string;
binaries : tfphashlist;
constructor createcopy(sourcepackage:tsourcepackage);
end;
tbinarypackage=class
version : string;
source : tsourcepackage;
sourceversion : string;
//note: depends is sorted for easier comparisons
depends : tfphashlist;
end;
constructor tsourcepackage.createcopy(sourcepackage:tsourcepackage);
var
i : integer;
binarypackage : tbinarypackage;
newbinarypackage : tbinarypackage;
binarypackagename : string;
begin
version := sourcepackage.version;
name := sourcepackage.name;
if assigned(sourcepackage.binaries) then begin
binaries := tfphashlist.create;
for i := 0 to sourcepackage.binaries.count-1 do begin
binarypackage := sourcepackage.binaries[i];
binarypackagename := sourcepackage.binaries.nameofindex(i);
newbinarypackage := tbinarypackage.create;
newbinarypackage.source := self;
newbinarypackage.version := binarypackage.version;
newbinarypackage.sourceversion := binarypackage.sourceversion;
binaries.add(binarypackagename,newbinarypackage);
end;
end;
end;
type
tdistribution=class
t : treadtxt;
currentpackage, currentversion, currentsourcepackage, currentsourceversion , currentdepends :string;
sources : tfphashlist;
//rdeps : tfpobjecthashtable;
procedure reset;
procedure processsource;
//procedure processdependency(const sourcepackage:string; const dependency : string);
procedure processpackage;
//constructor create(sourcesfile : string ;packagesfile :string);
procedure getbinaries(binaries:tfphashlist);
procedure readsources(sourcesfile : string);
procedure readpackages(packagesfile : string);
//WARNING: copy is shallow, the tfphashlist is copied but it's contents is not.
constructor createcopy(distribution : tdistribution);
end;
procedure tdistribution.reset;
begin
currentpackage := '';
currentversion := '';
currentsourcepackage := '';
currentsourceversion := '';
end;
procedure tdistribution.processsource;
var
sourcepackage : tsourcepackage;
begin
if currentversion = '' then begin
writeln('package without version!');
halt;
end;
sourcepackage := sources.find(currentpackage);
if sourcepackage = nil then begin
sourcepackage := tsourcepackage.create();
sourcepackage.name := currentpackage;
sourcepackage.version := currentversion;
sources.add(currentpackage, sourcepackage);
end else begin
writeln('multiple instances of source package '+currentpackage+' found, please use componentcleaner');
halt;
end;
end;
{procedure tdistribution.processdependency(const sourcepackage:string; const dependency : string);
var
rdeplist : tfphashlist;
begin
rdeplist := tfphashlist(rdeps[dependency]);
if rdeplist = nil then begin
rdeplist := tfphashlist.create;
rdeps[dependency] := rdeplist;
end;
if rdeplist.findindexof(sourcepackage) < 0 then rdeplist.add(sourcepackage,0);
end;}
procedure tdistribution.processpackage;
var
sourceversionfromsources : string;
versioncomparison : integer;
inbrackets : boolean;
dependency : string;
c : char;
i : integer;
rdeplist : tstringlist;
sourcepackage : tsourcepackage;
binarypackage : tbinarypackage;
depends : tfphashlist;
begin
if currentversion = '' then begin
writeln('package without version!');
halt;
end;
if currentsourcepackage = '' then currentsourcepackage := currentpackage;
if currentsourceversion = '' then currentsourceversion := currentversion;
depends := tfphashlist.create();
dependency := '';
inbrackets := false;
for i := 1 to length(currentdepends) do begin
c := currentdepends[i];
if c = '(' then inbrackets := true;
if c = '(' then inbrackets := false;
if (not inbrackets) and (c in ['a'..'z','0'..'9','+','-','.']) then begin
dependency := dependency + c;
end else begin
if dependency <> '' then depends.add(dependency,0);
dependency := '';
end;
end;
if dependency <> '' then depends.add(dependency,0);
sourcepackage := tsourcepackage(sources.find(currentsourcepackage));
if sourcepackage = nil then begin
sourcepackage := tsourcepackage.create();
sourcepackage.name := currentsourcepackage;
sourcepackage.version := '__NOT_PRESENT_BUT_HAS_BINARIES__';
sources.add(currentsourcepackage, sourcepackage);
end;
if sourcepackage.binaries = nil then begin
sourcepackage.binaries := tfphashlist.create;
end;
binarypackage := tbinarypackage.create;
binarypackage.version := currentversion;
binarypackage.source := sourcepackage;
binarypackage.sourceversion := currentsourceversion;
binarypackage.depends := depends;
sourcepackage.binaries.add(currentpackage,binarypackage);
end;
procedure tdistribution.readsources(sourcesfile :string);
var
p : integer;
pass : byte;
i : integer;
line : string;
t : treadtxt;
begin
//writeln(compareversion('1','2'));
//writeln(compareversion('1-1','1-2'));
//writeln(compareversion('2','1'));
//writeln(compareversion('1','1'));
//halt;
if sources = nil then sources := tfphashlist.create;
t := treadtxt.createf(sourcesfile);
reset;
repeat
line := t.readline;
if copy(line,1,8) = 'Package:' then begin
currentpackage := trim(copy(line,9,255));
end;
if copy(line,1,8) = 'Version:' then begin
currentversion := trim(copy(line,9,255));
end;
if line = '' then begin
//end of block
if currentpackage <> '' then processsource;
reset;
end;
until t.eof;
if currentpackage <> '' then processsource;
t.free;
end;
procedure tdistribution.readpackages(packagesfile : string);
var
line : string;
t : treadtxt;
sourcelinecontent : string;
p : integer;
begin
t := treadtxt.createf(packagesfile);
reset;
repeat
line := t.readline;
if stringstartis(line,'Package:') then begin
currentpackage := trim(copy(line,9,maxlongint));
end;
if stringstartis(line,'Version:') then begin
currentversion := trim(copy(line,9,maxlongint));
end;
if stringstartis(line,'Source:') then begin
sourcelinecontent := trim(copy(line,8,maxlongint));
p := pos('(',sourcelinecontent);
if p = 0 then begin
currentsourcepackage := sourcelinecontent;
end else begin
currentsourcepackage := trim(copy(sourcelinecontent,1,p-1));
currentsourceversion := copy(sourcelinecontent,p+1,255);
p := pos(')',currentsourceversion);
currentsourceversion := trim(copy(currentsourceversion,1,p-1));
end;
end;
if stringstartis(line,'Depends:') then begin
currentdepends := trim(copy(line,9,maxlongint));
end;
if line = '' then begin
//end of block
if currentpackage <> '' then processpackage;
reset;
end;
until t.eof;
if currentpackage <> '' then processpackage;
t.free;
end;
procedure tdistribution.getbinaries(binaries : tfphashlist);
var
i,j : integer;
sourcepackage : tsourcepackage;
binarypackagename : string;
binarypackage : tbinarypackage;
begin
binaries.clear;
for i := 0 to sources.count-1 do begin
sourcepackage := tsourcepackage(sources[i]);
if sourcepackage.binaries <> nil then for j := 0 to sourcepackage.binaries.count -1 do begin
binarypackage := tbinarypackage(sourcepackage.binaries[j]);
binarypackagename := sourcepackage.binaries.nameofindex(j);
binaries.add(binarypackagename,binarypackage);
end;
end;
end;
constructor tdistribution.createcopy(distribution: tdistribution);
var
i : integer;
begin
sources := tfphashlist.create;
for i := 0 to distribution.sources.count -1 do begin
sources.add(distribution.sources.nameofindex(i),distribution.sources[i]);
end;
end;
var
maindistribution: tdistribution;
stagingdistribution: tdistribution;
resultingdistribution: tdistribution;
mainbinaries,stagingbinaries,resultingbinaries : tfphashlist;
i,j,k: integer;
sourcepackagename: string;
mainsourcepackage: tsourcepackage;
stagingsourcepackage: tsourcepackage;
resultingsourcepackage: tsourcepackage;
binarypackage: tbinarypackage;
binarypackagename: string;
inconsistentcount: integer;
proposedsourcemigrations: tfphashlist;
proposedbinarymigrations: tfphashlist;
dummysourcepackage: tsourcepackage;
stagingbinarypackage: tbinarypackage;
mainbinarypackage: tbinarypackage;
resultingbinarypackage: tbinarypackage;
removalsthisiteration: integer;
dependedonpackage: string;
satisfiableinmain,satisfiableinstaging,satisfiableinresulting,presentinmain : boolean;
migrationindex : integer;
t : textfile;
b : boolean;
removalsforthissource : boolean;
begin
writeln('reading packages and sources files for main distribution');
maindistribution := tdistribution.create;
maindistribution.readsources(reporoot+'dists/'+codename+'/main/source/Sources');
maindistribution.readsources(reporoot+'dists/'+codename+'/contrib/source/Sources');
maindistribution.readsources(reporoot+'dists/'+codename+'/non-free/source/Sources');
maindistribution.readpackages(reporoot+'dists/'+codename+'/main/binary-'+architecture+'/Packages');
maindistribution.readpackages(reporoot+'dists/'+codename+'/contrib/binary-'+architecture+'/Packages');
maindistribution.readpackages(reporoot+'dists/'+codename+'/non-free/binary-'+architecture+'/Packages');
maindistribution.readpackages(reporoot+'dists/'+codename+'/main/debian-installer/binary-'+architecture+'/Packages');
//sourcesfilestaging = '/home/repo/repo/raspbian/dists/wheezy-staging/main/source/Sources';
//packagesfilestaging = '/home/repo/repo/raspbian/dists/wheezy-staging/main/binary-armhf/Packages';
mainbinaries := tfphashlist.create;
maindistribution.getbinaries(mainbinaries);
writeln('reading packages and sources files for staging distribution');
stagingdistribution := tdistribution.create;
stagingdistribution.readsources(reporoot+'dists/'+codenamestaging+'/main/source/Sources');
stagingdistribution.readsources(reporoot+'dists/'+codenamestaging+'/contrib/source/Sources');
stagingdistribution.readsources(reporoot+'dists/'+codenamestaging+'/non-free/source/Sources');
stagingdistribution.readpackages(reporoot+'dists/'+codenamestaging+'/main/binary-'+architecture+'/Packages');
stagingdistribution.readpackages(reporoot+'dists/'+codenamestaging+'/contrib/binary-'+architecture+'/Packages');
stagingdistribution.readpackages(reporoot+'dists/'+codenamestaging+'/non-free/binary-'+architecture+'/Packages');
stagingdistribution.readpackages(reporoot+'dists/'+codenamestaging+'/main/debian-installer/binary-'+architecture+'/Packages');
stagingbinaries := tfphashlist.create;
maindistribution.getbinaries(mainbinaries);
resultingbinaries := tfphashlist.create;
writeln('scanning for source migration canditates');
dummysourcepackage := tsourcepackage.create;
dummysourcepackage.version := '__NOT_PRESENT__';
proposedsourcemigrations := tfphashlist.create;
for i := 0 to stagingdistribution.sources.count-1 do begin
sourcepackagename := stagingdistribution.sources.nameofindex(i);
stagingsourcepackage := tsourcepackage(stagingdistribution.sources[i]);
mainsourcepackage := tsourcepackage(maindistribution.sources.find(sourcepackagename));
if mainsourcepackage = nil then begin
mainsourcepackage := dummysourcepackage;
end;
if mainsourcepackage.version = stagingsourcepackage.version then continue;
writeln(sourcepackagename,' ',mainsourcepackage.version,' ',stagingsourcepackage.version);
//if stagingsourcepackage.binaries <> nil then writeln(stagingsourcepackage.binaries.count) else writeln('no binaries found');
inconsistentcount := 0;
if stagingsourcepackage.binaries <> nil then for j := 0 to stagingsourcepackage.binaries.count -1 do begin
binarypackage := tbinarypackage(stagingsourcepackage.binaries[j]);
binarypackagename := stagingsourcepackage.binaries.nameofindex(j);
if binarypackage.sourceversion = stagingsourcepackage.version then begin
writeln(' ',binarypackagename,' consistent');
end else begin
writeln(' ',binarypackagename,' inconsistent');
inconsistentcount := inconsistentcount + 1;
end;
end;
if inconsistentcount <> 0 then begin
writeln(' rejecting migration of '+sourcepackagename+' due to inconsistent binaries');
writeln;
continue;
end;
writeln(' accepting '+sourcepackagename+' onto list of proposed source migrations');
proposedsourcemigrations.add(sourcepackagename,stagingsourcepackage);
writeln;
end;
writeln('scanning for binary migration canditates');
proposedbinarymigrations := tfphashlist.create;
for i := 0 to stagingdistribution.sources.count-1 do begin
sourcepackagename := stagingdistribution.sources.nameofindex(i);
stagingsourcepackage := tsourcepackage(stagingdistribution.sources[i]);
mainsourcepackage := tsourcepackage(maindistribution.sources.find(sourcepackagename));
if mainsourcepackage = nil then begin
mainsourcepackage := dummysourcepackage;
end;
if mainsourcepackage.version <> stagingsourcepackage.version then continue;
if stagingsourcepackage.binaries <> nil then for j := 0 to stagingsourcepackage.binaries.count -1 do begin
stagingbinarypackage := tbinarypackage(stagingsourcepackage.binaries[j]);
binarypackagename := stagingsourcepackage.binaries.nameofindex(j);
if assigned(mainsourcepackage.binaries) then begin
mainbinarypackage := tbinarypackage(mainsourcepackage.binaries.find(binarypackagename));
end else begin
mainbinarypackage := nil;
end;
if assigned(mainbinarypackage) then begin
b := stagingbinarypackage.version <> mainbinarypackage.version
end else begin
b := true;
end;
if b then begin
if stagingbinarypackage.sourceversion = stagingsourcepackage.version then begin
proposedbinarymigrations.add(binarypackagename,stagingbinarypackage);
writeln(binarypackagename,' accepted as candidate for binary migration');
end else begin
writeln(binarypackagename,' from source '+sourcepackagename+' rejected for binary migration due to inconsistent source version ',stagingbinarypackage.sourceversion,' expected ',stagingsourcepackage.version);
end;
end;
end;
end;
writeln('stage 1 complete, there are ',proposedsourcemigrations.count,' proposed source migrations and ',proposedbinarymigrations.count,' proposed binary migrations');
writeln('starting candidate test and removal loop');
repeat
writeln('copying distribution structure and applying changes');
removalsthisiteration := 0;
resultingdistribution := tdistribution.createcopy(maindistribution);
resultingdistribution.getbinaries(resultingbinaries);
for i := 0 to proposedsourcemigrations.count-1 do begin
sourcepackagename := proposedsourcemigrations.nameofindex(i);
stagingsourcepackage := proposedsourcemigrations[i];
writeln('applying source migration '+sourcepackagename+' '+stagingsourcepackage.version);
j := resultingdistribution.sources.findindexof(sourcepackagename);
if j >= 0 then begin
resultingdistribution.sources[j] := stagingsourcepackage;
end else begin
resultingdistribution.sources.add(sourcepackagename,stagingsourcepackage);
end;
end;
writeln('finished applying source migrations, about to apply binary ones');
for i := 0 to proposedbinarymigrations.count-1 do begin
binarypackagename := proposedbinarymigrations.nameofindex(i);
stagingbinarypackage := proposedbinarymigrations[i];
writeln('applying binary migration '+binarypackagename+' '+stagingbinarypackage.version);
sourcepackagename := stagingbinarypackage.source.name;
//writeln('a');
j := resultingdistribution.sources.findindexof(sourcepackagename);
//writeln('b');
resultingsourcepackage := tsourcepackage.createcopy(resultingdistribution.sources[j]);
//writeln('c');
resultingbinarypackage := tbinarypackage.create;
resultingbinarypackage.source := resultingsourcepackage;
resultingbinarypackage.version := stagingbinarypackage.version;
resultingbinarypackage.sourceversion := stagingbinarypackage.sourceversion;
if resultingsourcepackage.binaries = nil then resultingsourcepackage.binaries := tfphashlist.create;
//writeln('d');
k := resultingsourcepackage.binaries.findindexof(binarypackagename);
if k >= 0 then begin
resultingsourcepackage.binaries[k] := resultingbinarypackage;
end else begin
resultingsourcepackage.binaries.add(binarypackagename,resultingbinarypackage);
end;
//writeln('e');
resultingdistribution.sources[j] := resultingsourcepackage;
//writeln('f');
end;
writeln('scanning depedencies');
for i := 0 to resultingbinaries.count -1 do begin
binarypackagename := resultingbinaries.nameofindex(i);
resultingbinarypackage := tbinarypackage(resultingbinaries[i]);
mainbinarypackage := tbinarypackage(mainbinaries.find(binarypackagename));
//we don't care if new binaries migrate before their dependencies are satisfiable.
if mainbinarypackage = nil then continue;
for j := 0 to resultingbinarypackage.depends.count -1 do begin
//writeln(resultingbinarypackage.depends.nameofindex(j));
dependedonpackage := resultingbinarypackage.depends.nameofindex(j);
//find out whether the dependency is present in main
presentinmain := mainbinarypackage.depends.findindexof(dependedonpackage) >= 0;
//find out where the dependency is "satisfiable";
satisfiableinmain := mainbinaries.findindexof(dependedonpackage) >= 0;
satisfiableinstaging := stagingbinaries.findindexof(dependedonpackage) >= 0;
satisfiableinresulting := resultingbinaries.findindexof(dependedonpackage) >= 0;
if satisfiableinresulting then begin //is the dependency satisfiable in resulting, if so great
end else if presentinmain and not satisfiableinmain then begin //if the dependency is present in main and not satisdiable there we aren't making things worse
//if the dependency is present in main and not satisdiable there we aren't making things worse
end else if not (satisfiableinmain or satisfiableinstaging or satisfiableinresulting) then begin //if the dependency is not satisdiable in any distribution it's probablly a virtual package, ignore it
//if the dependency is not present in any distribution it's probablly a virtual package, ignore it
end else if presentinmain and satisfiableinmain then begin
//the dependency was made unsatisfiable in resulting by an update to another package, remove that update from the candidate list
mainsourcepackage := tbinarypackage(mainbinarypackage.depends.findindexof(dependedonpackage)).source;
sourcepackagename := mainsourcepackage.name;
migrationindex := proposedsourcemigrations.findindexof(sourcepackagename);
if migrationindex >= 0 then begin //if this is -1 it most likely means the migration has already been removed from the list
writeln('removing source package ',sourcepackagename,' from migration list because migrating it would break dependencies of ',binarypackagename);
proposedsourcemigrations.delete(migrationindex);
removalsthisiteration := removalsthisiteration + 1;
end;
end else begin
//if we get this far it means we are going to break a dependency and it's most likely a real one remove the migration
sourcepackagename := resultingbinarypackage.source.name;
migrationindex := proposedsourcemigrations.findindexof(sourcepackagename);
if migrationindex >= 0 then begin
writeln('removing source package ',sourcepackagename,' from migration list because of dependency on ',dependedonpackage);
proposedsourcemigrations.delete(migrationindex);
removalsthisiteration := removalsthisiteration + 1;
end;
migrationindex := proposedbinarymigrations.findindexof(binarypackagename);
if migrationindex >= 0 then begin
writeln('removing binary package ',sourcepackagename,' from migration list because of dependency on ',dependedonpackage);
proposedbinarymigrations.delete(migrationindex);
removalsthisiteration := removalsthisiteration + 1;
end;
end;
end;
end;
writeln('removed ',removalsthisiteration,' from the migration lists this iteration');
until removalsthisiteration = 0;
writeln('stage 2 complete, there are ',proposedsourcemigrations.count,' proposed source migrations and ',proposedbinarymigrations.count,' proposed binary migrations');
assignfile(t,'migrations.sh');
rewrite(t);
for i := 0 to proposedsourcemigrations.count-1 do begin
sourcepackagename := proposedsourcemigrations.nameofindex(i);
stagingsourcepackage := proposedsourcemigrations[i];
mainsourcepackage := maindistribution.sources.find(sourcepackagename);
//write removals
removalsforthissource := false;
if assigned(mainsourcepackage) then if assigned(mainsourcepackage.binaries) then for j := 0 to mainsourcepackage.binaries.count -1 do begin
binarypackagename := mainsourcepackage.binaries.nameofindex(j);
//writeln;
//writeln(sizeint(stagingsourcepackage));
//writeln(sizeint(stagingsourcepackage.binaries));
//writeln(binarypackagename);
//writeln(stagingsourcepackage.binaries.findindexof(binarypackagename));
if (stagingsourcepackage.binaries = nil) or (stagingsourcepackage.binaries.findindexof(binarypackagename) < 0) then begin
if not removalsforthissource then begin
writeln('outputing removals for source migration '+sourcepackagename+' '+stagingsourcepackage.version);
writeln(t,'#removals for source migration '+sourcepackagename+' '+stagingsourcepackage.version);
removalsforthissource := true;
end;
writeln(t,'reprepro -V --basedir . --morguedir +b/morgue --export=never --arch=armhf remove ',codename,' ',binarypackagename);
end;
end;
if removalsforthissource then writeln(t);
end;
for i := 0 to proposedsourcemigrations.count-1 do begin
sourcepackagename := proposedsourcemigrations.nameofindex(i);
stagingsourcepackage := proposedsourcemigrations[i];
mainsourcepackage := maindistribution.sources.find(sourcepackagename);
writeln('outputing source migration '+sourcepackagename+' '+stagingsourcepackage.version);
writeln(t,'#source migration '+sourcepackagename+' '+stagingsourcepackage.version);
//write source migration
writeln(t,'reprepro -V --basedir . --morguedir +b/morgue --export=never --arch=source copy ',codename,' ',codenamestaging,' ',sourcepackagename);
//write binary migration
if assigned(stagingsourcepackage.binaries) then for j := 0 to stagingsourcepackage.binaries.count -1 do begin
binarypackagename := stagingsourcepackage.binaries.nameofindex(j);
writeln(t,'reprepro -V --basedir . --morguedir +b/morgue --export=never --arch=armhf copy ',codename,' ',codenamestaging,' ',binarypackagename);
end;
writeln(t);
end;
for i := 0 to proposedbinarymigrations.count-1 do begin
binarypackagename := proposedbinarymigrations.nameofindex(i);
stagingbinarypackage := proposedbinarymigrations[i];
//mainsourcepackage := maindistribution.sources.find(sourcepackagename);
writeln('outputing binary migration '+binarypackagename+' '+stagingbinarypackage.version);
writeln(t,'#binary migration '+binarypackagename+' '+stagingbinarypackage.version);
//write migration
writeln(t,'reprepro -V --basedir . --morguedir +b/morgue --export=never --arch=armhf copy ',codename,' ',codenamestaging,' ',binarypackagename);
writeln(t);
end;
//write export
writeln(t,'reprepro -V --basedir . --morguedir +b/morgue export wheezy');
closefile(t);
end.