diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-01-07 00:15:45 +1300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-15 15:51:41 +0000 |
| commit | 5ba94af1e6193569700ba1d357c177209ab1633c (patch) | |
| tree | c80950e6e5e80a87f235f87668a14e7c337659ab | |
| parent | d03d145410d0414b48aa8dfc05d32325f0966e5e (diff) | |
| download | poky-5ba94af1e6193569700ba1d357c177209ab1633c.tar.gz | |
devtool: sdk-update: fix not using updateserver config file option
We read the updateserver setting from the config file but we never
actually used that value - the code then went on to use only the value
supplied on the command line.
Fix courtesy of Dmitry Rozhkov <dmitry.rozhkov@intel.com>
(From OE-Core master rev: 1c85237803038fba539d5b03bf4de39d99380684)
(From OE-Core rev: 3940fe87f944bd2067a96b1b6a8c1dc646569690)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | scripts/lib/devtool/sdk.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py index ae310489e6..ef1d0a723e 100644 --- a/scripts/lib/devtool/sdk.py +++ b/scripts/lib/devtool/sdk.py | |||
| @@ -90,7 +90,7 @@ def sdk_update(args, config, basepath, workspace): | |||
| 90 | updateserver = config.get('SDK', 'updateserver', '') | 90 | updateserver = config.get('SDK', 'updateserver', '') |
| 91 | if not updateserver: | 91 | if not updateserver: |
| 92 | raise DevtoolError("Update server not specified in config file, you must specify it on the command line") | 92 | raise DevtoolError("Update server not specified in config file, you must specify it on the command line") |
| 93 | logger.debug("updateserver: %s" % args.updateserver) | 93 | logger.debug("updateserver: %s" % updateserver) |
| 94 | 94 | ||
| 95 | # Make sure we are using sdk-update from within SDK | 95 | # Make sure we are using sdk-update from within SDK |
| 96 | logger.debug("basepath = %s" % basepath) | 96 | logger.debug("basepath = %s" % basepath) |
| @@ -101,35 +101,35 @@ def sdk_update(args, config, basepath, workspace): | |||
| 101 | else: | 101 | else: |
| 102 | logger.debug("Found conf/locked-sigs.inc in %s" % basepath) | 102 | logger.debug("Found conf/locked-sigs.inc in %s" % basepath) |
| 103 | 103 | ||
| 104 | if ':' in args.updateserver: | 104 | if ':' in updateserver: |
| 105 | is_remote = True | 105 | is_remote = True |
| 106 | else: | 106 | else: |
| 107 | is_remote = False | 107 | is_remote = False |
| 108 | 108 | ||
| 109 | if not is_remote: | 109 | if not is_remote: |
| 110 | # devtool sdk-update /local/path/to/latest/sdk | 110 | # devtool sdk-update /local/path/to/latest/sdk |
| 111 | new_locked_sig_file_path = os.path.join(args.updateserver, 'conf/locked-sigs.inc') | 111 | new_locked_sig_file_path = os.path.join(updateserver, 'conf/locked-sigs.inc') |
| 112 | if not os.path.exists(new_locked_sig_file_path): | 112 | if not os.path.exists(new_locked_sig_file_path): |
| 113 | logger.error("%s doesn't exist or is not an extensible SDK" % args.updateserver) | 113 | logger.error("%s doesn't exist or is not an extensible SDK" % updateserver) |
| 114 | return -1 | 114 | return -1 |
| 115 | else: | 115 | else: |
| 116 | logger.debug("Found conf/locked-sigs.inc in %s" % args.updateserver) | 116 | logger.debug("Found conf/locked-sigs.inc in %s" % updateserver) |
| 117 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) | 117 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) |
| 118 | logger.debug("update_dict = %s" % update_dict) | 118 | logger.debug("update_dict = %s" % update_dict) |
| 119 | sstate_objects = get_sstate_objects(update_dict, args.updateserver) | 119 | sstate_objects = get_sstate_objects(update_dict, updateserver) |
| 120 | logger.debug("sstate_objects = %s" % sstate_objects) | 120 | logger.debug("sstate_objects = %s" % sstate_objects) |
| 121 | if len(sstate_objects) == 0: | 121 | if len(sstate_objects) == 0: |
| 122 | logger.info("No need to update.") | 122 | logger.info("No need to update.") |
| 123 | return 0 | 123 | return 0 |
| 124 | logger.info("Installing sstate objects into %s", basepath) | 124 | logger.info("Installing sstate objects into %s", basepath) |
| 125 | install_sstate_objects(sstate_objects, args.updateserver.rstrip('/'), basepath) | 125 | install_sstate_objects(sstate_objects, updateserver.rstrip('/'), basepath) |
| 126 | logger.info("Updating configuration files") | 126 | logger.info("Updating configuration files") |
| 127 | new_conf_dir = os.path.join(args.updateserver, 'conf') | 127 | new_conf_dir = os.path.join(updateserver, 'conf') |
| 128 | old_conf_dir = os.path.join(basepath, 'conf') | 128 | old_conf_dir = os.path.join(basepath, 'conf') |
| 129 | shutil.rmtree(old_conf_dir) | 129 | shutil.rmtree(old_conf_dir) |
| 130 | shutil.copytree(new_conf_dir, old_conf_dir) | 130 | shutil.copytree(new_conf_dir, old_conf_dir) |
| 131 | logger.info("Updating layers") | 131 | logger.info("Updating layers") |
| 132 | new_layers_dir = os.path.join(args.updateserver, 'layers') | 132 | new_layers_dir = os.path.join(updateserver, 'layers') |
| 133 | old_layers_dir = os.path.join(basepath, 'layers') | 133 | old_layers_dir = os.path.join(basepath, 'layers') |
| 134 | shutil.rmtree(old_layers_dir) | 134 | shutil.rmtree(old_layers_dir) |
| 135 | ret = subprocess.call("cp -a %s %s" % (new_layers_dir, old_layers_dir), shell=True) | 135 | ret = subprocess.call("cp -a %s %s" % (new_layers_dir, old_layers_dir), shell=True) |
| @@ -144,12 +144,12 @@ def sdk_update(args, config, basepath, workspace): | |||
| 144 | os.makedirs(tmpsdk_dir) | 144 | os.makedirs(tmpsdk_dir) |
| 145 | os.makedirs(os.path.join(tmpsdk_dir, 'conf')) | 145 | os.makedirs(os.path.join(tmpsdk_dir, 'conf')) |
| 146 | # Fetch locked-sigs.inc from update server | 146 | # Fetch locked-sigs.inc from update server |
| 147 | ret = subprocess.call("wget -q -O - %s/conf/locked-sigs.inc > %s/locked-sigs.inc" % (args.updateserver, os.path.join(tmpsdk_dir, 'conf')), shell=True) | 147 | ret = subprocess.call("wget -q -O - %s/conf/locked-sigs.inc > %s/locked-sigs.inc" % (updateserver, os.path.join(tmpsdk_dir, 'conf')), shell=True) |
| 148 | if ret != 0: | 148 | if ret != 0: |
| 149 | logger.error("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc failed" % (args.updateserver, os.path.join(tmpsdk_dir, 'conf'))) | 149 | logger.error("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc failed" % (updateserver, os.path.join(tmpsdk_dir, 'conf'))) |
| 150 | return ret | 150 | return ret |
| 151 | else: | 151 | else: |
| 152 | logger.info("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc succeeded" % (args.updateserver, os.path.join(tmpsdk_dir, 'conf'))) | 152 | logger.info("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc succeeded" % (updateserver, os.path.join(tmpsdk_dir, 'conf'))) |
| 153 | new_locked_sig_file_path = os.path.join(tmpsdk_dir, 'conf/locked-sigs.inc') | 153 | new_locked_sig_file_path = os.path.join(tmpsdk_dir, 'conf/locked-sigs.inc') |
| 154 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) | 154 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) |
| 155 | logger.debug("update_dict = %s" % update_dict) | 155 | logger.debug("update_dict = %s" % update_dict) |
| @@ -164,19 +164,19 @@ def sdk_update(args, config, basepath, workspace): | |||
| 164 | else: | 164 | else: |
| 165 | ret = -1 | 165 | ret = -1 |
| 166 | if ret != 0: | 166 | if ret != 0: |
| 167 | ret = subprocess.call("rm -rf layers && git clone %s/layers" % args.updateserver, shell=True) | 167 | ret = subprocess.call("rm -rf layers && git clone %s/layers" % updateserver, shell=True) |
| 168 | if ret != 0: | 168 | if ret != 0: |
| 169 | logger.error("Updating meta data via git failed") | 169 | logger.error("Updating meta data via git failed") |
| 170 | return ret | 170 | return ret |
| 171 | logger.debug("Updating conf files ...") | 171 | logger.debug("Updating conf files ...") |
| 172 | conf_files = ['local.conf', 'bblayers.conf', 'devtool.conf', 'locked-sigs.inc'] | 172 | conf_files = ['local.conf', 'bblayers.conf', 'devtool.conf', 'locked-sigs.inc'] |
| 173 | for conf in conf_files: | 173 | for conf in conf_files: |
| 174 | ret = subprocess.call("wget -q -O - %s/conf/%s > conf/%s" % (args.updateserver, conf, conf), shell=True) | 174 | ret = subprocess.call("wget -q -O - %s/conf/%s > conf/%s" % (updateserver, conf, conf), shell=True) |
| 175 | if ret != 0: | 175 | if ret != 0: |
| 176 | logger.error("Update %s failed" % conf) | 176 | logger.error("Update %s failed" % conf) |
| 177 | return ret | 177 | return ret |
| 178 | with open(os.path.join(basepath, 'conf/local.conf'), 'a') as f: | 178 | with open(os.path.join(basepath, 'conf/local.conf'), 'a') as f: |
| 179 | f.write('SSTATE_MIRRORS_append = " file://.* %s/sstate-cache/PATH \\n "\n' % args.updateserver) | 179 | f.write('SSTATE_MIRRORS_append = " file://.* %s/sstate-cache/PATH \\n "\n' % updateserver) |
| 180 | 180 | ||
| 181 | # Run bitbake command for the whole SDK | 181 | # Run bitbake command for the whole SDK |
| 182 | sdk_targets = config.get('SDK', 'sdk_targets') | 182 | sdk_targets = config.get('SDK', 'sdk_targets') |
