This repository has been archived by the owner on Apr 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDidbsBuilder.pm
73 lines (63 loc) · 1.81 KB
/
DidbsBuilder.pm
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
package DidbsBuilder;
use DidbsUtils;
sub new
{
my $self = bless {}, shift;
my $scriptLocation = shift;
my $packageDefsDir = shift;
my $packageId = shift;
my $packageDir = shift;
my $buildDir = shift;
my $installDir = shift;
my $didbsPackage = shift;
my $didbsExtractor = shift;
my $didbsPatcher = shift;
my $didbsConfigurator = shift;
$self->{scriptLocation} = $scriptLocation;
$self->{packageDefsDir} = $packageDefsDir;
$self->{packageId} = $packageId;
$self->{packageDir} = $packageDir;
$self->{buildDir} = $buildDir;
$self->{installDir} = $installDir;
$self->{didbsPackage} = $didbsPackage;
$self->{didbsExtractor} = $didbsExtractor;
$self->{didbsPatcher} = $didbsPatcher;
$self->{didbsConfigurator} = $didbsConfigurator;
return $self;
}
sub buildit
{
my $self = shift;
my $packageId = $self->{packageId};
didbsprint "Building $packageId\n";
my $builddir = "$self->{buildDir}/$self->{packageId}/$self->{didbsPackage}->{packageDir}";
my $installdir = $self->{installDir};
didbsprint "Would build in $builddir\n";
my $extraargs;
if( begins_with($packageId,"stage1") )
{
$extraargs="/usr/didbs/current";
}
else
{
$extraargs="";
}
my $packageDefDir = $self->{packageDefsDir} . "/" . $packageId;
didbsprint "Changing directory to $packageDefDir\n";
chdir $packageDefDir;
my $buildRecipe = "$self->{packageDefsDir}/$self->{packageId}/$self->{didbsPackage}->{buildRecipe}";
my $cmd = "$buildRecipe $builddir $installdir $extraargs";
didbsprint "About to execute $cmd\n";
if( system($cmd) != 0 )
{
didbsprint "Failed during build: $!\n";
die $!;
}
return 1;
}
sub debug
{
my $self = shift;
didbsprint "DidbsBuilder constructed for $self->{packageId}\n";
}
1;