]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
yocto-bsp: add basic git connectivity check
authorTom Zanussi <tom.zanussi@intel.com>
Tue, 15 Jan 2013 22:59:57 +0000 (16:59 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 16 Jan 2013 12:05:38 +0000 (12:05 +0000)
yocto-bsp create does a 'git ls-remote
git://git.yoctoproject.org/linux-yocto-3.4.git *heads*' to get the set
of existing branches from the kernel repo.

If the user isn't connected to the network, or if git isn't configured
sanely, yocto-bsp fails with an ugly Python backtrace.

We should try to avoid this by doing a basic sanity check for those
things before actually running the command.

The sanity check can be avoided by specifying -s on the yocto-bsp
command-line:

 $ yocto-bsp create -s test qemu

Fixes [YOCTO #3279]

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/bsp/tags.py
scripts/yocto-bsp

index 256b25cb043750a9cd7c01496dab2b078456405b..6d5feb0a5965ba5ccf9e9b94a5e4fc6b707a9265 100644 (file)
@@ -41,7 +41,7 @@ INPUT_TYPE_PROPERTY = "type"
 
 SRC_URI_FILE = "file://"
 
-
+GIT_CHECK_URI = "git://git.yoctoproject.org/linux-yocto-dev.git"
 
 
 
index 126fc8dc0d9112ee11be03017ec7b0325765662f..d26986176908f24681a601acaf442a548952a923 100755 (executable)
@@ -58,6 +58,8 @@ def yocto_bsp_create_subcommand(args, usage_str):
                       help = "name of file containing the values for BSP properties as a JSON file")
     parser.add_option("-c", "--codedump", dest = "codedump", action = "store_true",
                       default = False, help = "dump the generated code to bspgen.out")
+    parser.add_option("-s", "--skip-git-check", dest = "git_check", action = "store_false",
+                      default = True, help = "skip the git connectivity check")
     (options, args) = parser.parse_args(args)
 
     if len(args) != 2:
@@ -73,6 +75,17 @@ def yocto_bsp_create_subcommand(args, usage_str):
     else:
         bsp_output_dir = "meta-" + machine
 
+    if options.git_check and not options.properties_file:
+        print "Checking basic git connectivity..."
+        if not verify_git_repo(GIT_CHECK_URI):
+            print "Couldn't verify git connectivity, exiting\n"
+            print "Details: couldn't access %s" % GIT_CHECK_URI
+            print "         (this most likely indicates a network connectivity problem or"
+            print "         a misconfigured git intallation)"
+            sys.exit(1)
+        else:
+            print "Done.\n"
+
     yocto_bsp_create(machine, karch, scripts_path, bsp_output_dir, options.codedump, options.properties_file)