@@ -1231,6 +1231,54 @@ sub in_tarball {
1231
1231
1232
1232
# ---------------------------------------------------------------------------
1233
1233
1234
+ ++$step ;
1235
+ verbose " \n $step . Checking for git submodules\n\n " ;
1236
+
1237
+ # Make sure we got a submodule-full clone. If not, abort and let a
1238
+ # human figure it out.
1239
+ if (-f " .gitmodules" ) {
1240
+ open (IN, " git submodule status|" )
1241
+ || die " Can't run \" git submodule status\" " ;
1242
+ while (<IN>) {
1243
+ chomp ;
1244
+ $_ =~ m / ^(.)(.{40}) ([^ ]+) *\( *([^\(\) ]*)\) *$ / ;
1245
+ my $status = $1 ;
1246
+ my $local_hash = $2 ;
1247
+ my $path = $3 ;
1248
+ my $extra = $4 ;
1249
+
1250
+ print (" === Submodule: $path \n " );
1251
+
1252
+ # Make sure the submodule is there
1253
+ if ($status eq " -" ) {
1254
+ print (" ==> ERROR: Missing
1255
+
1256
+ The submodule \" $path \" is missing.
1257
+
1258
+ Perhaps you forgot to \" git clone --recursive ...\" , or you need to
1259
+ \" git submodule update --init --recursive\" ...?\n\n " );
1260
+ exit (1);
1261
+ }
1262
+
1263
+ # See if the submodule is at the expected git hash
1264
+ # (it may be ok if it's not -- just warn the user)
1265
+ $extra =~ m / -g(.+)/ ;
1266
+ my $remote_hash = $1 ;
1267
+ if ($remote_hash ) {
1268
+ my $abbrev_local_hash = substr ($local_hash , 0, length ($remote_hash ));
1269
+ if ($remote_hash ne $abbrev_local_hash ) {
1270
+ print (" ==> WARNING: Submodule hash is different than upstream.
1271
+ If this is not intentional, you may want to run:
1272
+ \" git submodule update --init --recursive\"\n " );
1273
+ } else {
1274
+ print (" Local hash == remote hash (good!)\n " );
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+
1280
+ # ---------------------------------------------------------------------------
1281
+
1234
1282
# Save the platform file in the m4
1235
1283
$m4 .= " dnl Platform file\n " ;
1236
1284
0 commit comments