autogen: add sanity checks for git submodules
Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
родитель
3f11c8ef6c
Коммит
c32eeb3eb9
50
autogen.pl
50
autogen.pl
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
|
||||
# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved
|
||||
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2013 Mellanox Technologies, Inc.
|
||||
# All rights reserved.
|
||||
@ -1231,6 +1231,54 @@ $step. Checking tool versions\n\n";
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
++$step;
|
||||
verbose "\n$step. Checking for git submodules\n\n";
|
||||
|
||||
# Make sure we got a submodule-full clone. If not, abort and let a
|
||||
# human figure it out.
|
||||
if (-f ".gitmodules") {
|
||||
open(IN, "git submodule status|")
|
||||
|| die "Can't run \"git submodule status\"";
|
||||
while (<IN>) {
|
||||
chomp;
|
||||
$_ =~ m/^(.)(.{40}) ([^ ]+) *\(*([^\(\)]*)\)*$/;
|
||||
my $status = $1;
|
||||
my $local_hash = $2;
|
||||
my $path = $3;
|
||||
my $extra = $4;
|
||||
|
||||
print("=== Submodule: $path\n");
|
||||
|
||||
# Make sure the submodule is there
|
||||
if ($status eq "-") {
|
||||
print(" ==> ERROR: Missing
|
||||
|
||||
The submodule \"$path\" is missing.
|
||||
|
||||
Perhaps you forgot to \"git clone --recursive ...\", or you need to
|
||||
\"git submodule update --init --recursive\"...?\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# See if the submodule is at the expected git hash
|
||||
# (it may be ok if it's not -- just warn the user)
|
||||
$extra =~ m/-g(.+)/;
|
||||
my $remote_hash = $1;
|
||||
if ($remote_hash) {
|
||||
my $abbrev_local_hash = substr($local_hash, 0, length($remote_hash));
|
||||
if ($remote_hash ne $abbrev_local_hash) {
|
||||
print(" ==> WARNING: Submodule hash is different than upstream.
|
||||
If this is not intentional, you may want to run:
|
||||
\"git submodule update --init --recursive\"\n");
|
||||
} else {
|
||||
print(" Local hash == remote hash (good!)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Save the platform file in the m4
|
||||
$m4 .= "dnl Platform file\n";
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user