Ignore:
Timestamp:
Jun 30, 2009, 4:54:48 PM (13 years ago)
Author:
ezyang
Message:
Implement enhanced logic for Git-style installs; namely, removing patching facilities that are built into Git and generating an empty commit when performing the install to subsume .scripts-version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/locker/deploy/bin/onserver.pm

    r728 r1215  
    99use POSIX qw(strftime);
    1010use LWP::UserAgent;
     11use IPC::Open2;
    1112use URI;
    1213our @ISA = qw(Exporter);
     
    127128  }
    128129 
    129   open(VERSION, ">.scripts-version") or die "Can't write scripts-version file: $!\n";
    130   print VERSION strftime("%F %T %z\n", localtime);
    131   print VERSION $ENV{'USER'}, '@', getclienthostname(), "\n";
    132   my $tarball = abs_path("/mit/scripts/deploy$scriptsdev/$deploy.tar.gz");
    133   print VERSION $tarball, "\n";
    134   $tarball =~ s|/deploydev/|/deploy/|;
    135   print VERSION dirname($tarball), "\n";
    136   close(VERSION);
     130  if(-e "/mit/scripts/wizard$scriptsdev/srv/$deploy.git") {
     131    # fake an empty commit to get version info
     132    my $pid = open2(\*GIT_OUT, \*GIT_IN, "git commit-tree HEAD: -p HEAD") or die "Can't execute git process";
     133    print GIT_IN "User autoinstalled application\n";
     134    print GIT_IN "Installed-by: ", $ENV{'USER'}, '@', getclienthostname(), "\n";
     135    close(GIT_IN);
     136    my $hash=<GIT_OUT>;
     137    chomp($hash);
     138    close(GIT_OUT);
     139    waitpid $pid, 0; # reap zombies
     140    system("git reset $hash");
     141  } else {
     142    open(VERSION, ">.scripts-version") or die "Can't write scripts-version file: $!\n";
     143    print VERSION strftime("%F %T %z\n", localtime);
     144    print VERSION $ENV{'USER'}, '@', getclienthostname(), "\n";
     145    my $tarball = abs_path("/mit/scripts/deploy$scriptsdev/$deploy.tar.gz");
     146    print VERSION $tarball, "\n";
     147    $tarball =~ s|/deploydev/|/deploy/|;
     148    print VERSION dirname($tarball), "\n";
     149    close(VERSION);
     150  }
    137151
    138152  select STDOUT;
Note: See TracChangeset for help on using the changeset viewer.