forked from DeviationTX/deviation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmake
executable file
·35 lines (31 loc) · 924 Bytes
/
dmake
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
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd;
use FindBin;
my $docker_container = "deviation_build";
my $gitroot = `git rev-parse --show-toplevel 2> /dev/null`;
chomp($gitroot);
if ($gitroot eq "") {
print "ERROR: Not in a GIT repository. Cannot determine which directory in the docker container to use\n";
exit(1);
}
if (! -d "$gitroot/../deviation") {
print "ERROR: Could not locate 'deviation' GIT repository\n";
exit(1);
}
my $runonce = "$gitroot/../deviation/.run_once";
my ($curdir) = (cwd() =~ /^\Q$gitroot\E\/(.*)$/);
$curdir ||= "";
my $reponame = (split(/\//, $gitroot))[-1];
open my $fh, ">", $runonce or die "ERROR: Can't write $runonce\n";
print $fh "#!/bin/sh\n";
print $fh "cd /git/$reponame/$curdir\n" if ($reponame);
print $fh "make";
foreach (@ARGV) {
print $fh " \"$_\"";
}
close($fh);
chmod 0755, $runonce;
system("docker start -i $docker_container");
unlink($runonce);