Ignore:
Timestamp:
Oct 6, 2007, 2:34:43 AM (17 years ago)
Author:
quentin
Message:
Autoupgrade system, draft 1
Location:
locker/update-system/bin
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • locker/update-system/bin/propose-update

    r411 r446  
    3434
    3535unpackPackage($old, $olddir);
    36 unpackPackage($old, $newdir);
     36unpackPackage($new, $newdir);
    3737
    3838sub unpackPackage($$) {
    3939  my ($package, $dir) = @_;
    40   print "Extracting $package to $dir...";
     40  print STDERR "Extracting $package to $dir... ";
    4141  if (-d $dir) {
    4242    warn "$dir already exists; assuming unpacking was successful";
     
    113113my (@todelete, @toadd, @changed);
    114114my @comp = compareDirectories(\@oldfiles, \@newfiles);
    115 print Dumper(@comp);
     115open(DIFF, ">", catfile($outdir, "diff.pl"));
     116print DIFF Dumper(@comp);
     117close(DIFF);
    116118@todelete = @{$comp[0]};
    117119@toadd = @{$comp[1]};
     
    124126        }
    125127        close(TODELETE);
    126 }
     128        printf "Wrote %d filenames to files.delete\n", scalar(@todelete);
     129} else { printf "Not overwriting existing files.delete\n"; }
    127130
    128131if ($redoadd or ! -e catfile($outdir, "files.add")) {
    129132        open(TOADD, ">", catfile($outdir, "files.add")) or die "Can't open files.add: $!";
    130133        foreach my $file (@toadd) {
    131           printf TOADD "%s # MD5 = %s\n", $file->[1], $file->[0];
     134          printf TOADD "%s %s\n", $file->[0], $file->[1];
    132135        }
    133136        close(TOADD);
    134 }
     137        printf "Wrote %d filenames to files.add\n", scalar(@toadd);
     138} else { printf "Not overwriting existing files.add\n"; }
    135139
    136140my @toreplace;
     
    148152        open(TOREPLACE, ">", catfile($outdir, "files.replace")) or die "Can't open files.replace: $!";
    149153        foreach my $file (@toreplace) {
    150                 printf TOREPLACE "%s %s\n", $file->[2][0], $file->[0];
     154                printf TOREPLACE "%s %s\n", $file->[1][0], $file->[0];
    151155        }
    152156        close(TOREPLACE);
    153 }
     157        printf "Wrote %d filenames to files.replace\n", scalar(@toreplace);
     158} else { printf "Not overwriting existing files.replace\n"; }
     159
     160if ($redodiff or ! -e catfile($outdir, "update.diff")) {
     161    open(DIFF, ">", catfile($outdir, "update.diff")) or die "Can't open update.diff: $!";
     162    foreach my $file (@topatch) {
     163        my $filename = $file->[0];
     164        my $oldfile = catfile($olddir, $file->[1][1]);
     165        my $newfile = catfile($newdir, $file->[2][1]);
     166        my $cmd = "diff -urN $oldfile $newfile";
     167        print DIFF "$cmd\n";
     168        print DIFF `$cmd`;
     169    }
     170    close(DIFF);
     171    printf "Wrote %d diffs to update.diff\n", scalar(@topatch);
     172} else { printf "Not overwriting existing update.patch\n"; }
Note: See TracChangeset for help on using the changeset viewer.