| 1 |
#!/usr/bin/perl |
| 2 |
# Copyright 2022 Jeffrey Kegler |
| 3 |
# This file is part of Marpa::R2. Marpa::R2 is free software: you can |
| 4 |
# redistribute it and/or modify it under the terms of the GNU Lesser |
| 5 |
# General Public License as published by the Free Software Foundation, |
| 6 |
# either version 3 of the License, or (at your option) any later version. |
| 7 |
# |
| 8 |
# Marpa::R2 is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
# Lesser General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU Lesser |
| 14 |
# General Public License along with Marpa::R2. If not, see |
| 15 |
# http://www.gnu.org/licenses/. |
| 16 |
|
| 17 |
use 5.010001; |
| 18 |
use strict; |
| 19 |
use warnings; |
| 20 |
use autodie; |
| 21 |
use IPC::Cmd; |
| 22 |
use File::Path; |
| 23 |
|
| 24 |
my $libmarpa_repo = '[email protected]:jeffreykegler/libmarpa.git'; |
| 25 |
my $stage = 'engine/stage'; |
| 26 |
|
| 27 |
my $deleted_count = File::Path::remove_tree($stage); |
| 28 |
say "$deleted_count files deleted in $stage"; |
| 29 |
|
| 30 |
$deleted_count = File::Path::remove_tree('libmarpa_build'); |
| 31 |
say "$deleted_count files deleted in 'libmarpa_build'"; |
| 32 |
|
| 33 |
if (not IPC::Cmd::run( |
| 34 |
command => [ qw(git clone -b r2dev --depth 5), $libmarpa_repo, $stage ], |
| 35 |
verbose => 1 |
| 36 |
) |
| 37 |
) |
| 38 |
{ |
| 39 |
die "Could not clone"; |
| 40 |
} ## end if ( not IPC::Cmd::run( command => [ qw(git clone -n --depth 1)...])) |
| 41 |
|
| 42 |
# CHIDR into staging dir |
| 43 |
chdir $stage || die "Could not chdir"; |
| 44 |
|
| 45 |
my $log_data; |
| 46 |
if (not IPC::Cmd::run( |
| 47 |
command => [ qw(git log -n 5) ], |
| 48 |
verbose => 1, |
| 49 |
buffer => \$log_data |
| 50 |
) |
| 51 |
) |
| 52 |
{ |
| 53 |
die "Could not clone"; |
| 54 |
} ## end if ( not IPC::Cmd::run( command => [ qw(git clone -n --depth 1)...])) |
| 55 |
|
| 56 |
{ |
| 57 |
open my $fh, q{>}, '../LOG_DATA'; |
| 58 |
print {$fh} $log_data; |
| 59 |
close $fh; |
| 60 |
} |
| 61 |
|
| 62 |
if (not IPC::Cmd::run( |
| 63 |
command => [ qw(make dist) ], |
| 64 |
verbose => 1 |
| 65 |
) |
| 66 |
) |
| 67 |
{ |
| 68 |
die qq{Could not make dist}; |
| 69 |
} ## end if ( not IPC::Cmd::run( command => [ qw(git checkout)...])) |
| 70 |
|
| 71 |
$deleted_count = File::Path::remove_tree('../read_only'); |
| 72 |
say "$deleted_count files deleted in ../read_only"; |
| 73 |
|
| 74 |
if (not IPC::Cmd::run( |
| 75 |
command => [ qw(sh etc/cp_libmarpa.sh ../read_only) ], |
| 76 |
verbose => 1 |
| 77 |
) |
| 78 |
) |
| 79 |
{ |
| 80 |
die qq{Could not make dist}; |
| 81 |
} ## end if ( not IPC::Cmd::run( command => [ qw(git checkout)...])) |
| 82 |
|
| 83 |
exit 0 |