diff options
Diffstat (limited to 'scripts/lib/devtool')
-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 47b9a7e1fc..afe52cf1b6 100644 --- a/scripts/lib/devtool/sdk.py +++ b/scripts/lib/devtool/sdk.py | |||
@@ -86,7 +86,7 @@ def sdk_update(args, config, basepath, workspace): | |||
86 | updateserver = config.get('SDK', 'updateserver', '') | 86 | updateserver = config.get('SDK', 'updateserver', '') |
87 | if not updateserver: | 87 | if not updateserver: |
88 | raise DevtoolError("Update server not specified in config file, you must specify it on the command line") | 88 | raise DevtoolError("Update server not specified in config file, you must specify it on the command line") |
89 | logger.debug("updateserver: %s" % args.updateserver) | 89 | logger.debug("updateserver: %s" % updateserver) |
90 | 90 | ||
91 | # Make sure we are using sdk-update from within SDK | 91 | # Make sure we are using sdk-update from within SDK |
92 | logger.debug("basepath = %s" % basepath) | 92 | logger.debug("basepath = %s" % basepath) |
@@ -97,35 +97,35 @@ def sdk_update(args, config, basepath, workspace): | |||
97 | else: | 97 | else: |
98 | logger.debug("Found conf/locked-sigs.inc in %s" % basepath) | 98 | logger.debug("Found conf/locked-sigs.inc in %s" % basepath) |
99 | 99 | ||
100 | if ':' in args.updateserver: | 100 | if ':' in updateserver: |
101 | is_remote = True | 101 | is_remote = True |
102 | else: | 102 | else: |
103 | is_remote = False | 103 | is_remote = False |
104 | 104 | ||
105 | if not is_remote: | 105 | if not is_remote: |
106 | # devtool sdk-update /local/path/to/latest/sdk | 106 | # devtool sdk-update /local/path/to/latest/sdk |
107 | new_locked_sig_file_path = os.path.join(args.updateserver, 'conf/locked-sigs.inc') | 107 | new_locked_sig_file_path = os.path.join(updateserver, 'conf/locked-sigs.inc') |
108 | if not os.path.exists(new_locked_sig_file_path): | 108 | if not os.path.exists(new_locked_sig_file_path): |
109 | logger.error("%s doesn't exist or is not an extensible SDK" % args.updateserver) | 109 | logger.error("%s doesn't exist or is not an extensible SDK" % updateserver) |
110 | return -1 | 110 | return -1 |
111 | else: | 111 | else: |
112 | logger.debug("Found conf/locked-sigs.inc in %s" % args.updateserver) | 112 | logger.debug("Found conf/locked-sigs.inc in %s" % updateserver) |
113 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) | 113 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) |
114 | logger.debug("update_dict = %s" % update_dict) | 114 | logger.debug("update_dict = %s" % update_dict) |
115 | sstate_objects = get_sstate_objects(update_dict, args.updateserver) | 115 | sstate_objects = get_sstate_objects(update_dict, updateserver) |
116 | logger.debug("sstate_objects = %s" % sstate_objects) | 116 | logger.debug("sstate_objects = %s" % sstate_objects) |
117 | if len(sstate_objects) == 0: | 117 | if len(sstate_objects) == 0: |
118 | logger.info("No need to update.") | 118 | logger.info("No need to update.") |
119 | return 0 | 119 | return 0 |
120 | logger.info("Installing sstate objects into %s", basepath) | 120 | logger.info("Installing sstate objects into %s", basepath) |
121 | install_sstate_objects(sstate_objects, args.updateserver.rstrip('/'), basepath) | 121 | install_sstate_objects(sstate_objects, updateserver.rstrip('/'), basepath) |
122 | logger.info("Updating configuration files") | 122 | logger.info("Updating configuration files") |
123 | new_conf_dir = os.path.join(args.updateserver, 'conf') | 123 | new_conf_dir = os.path.join(updateserver, 'conf') |
124 | old_conf_dir = os.path.join(basepath, 'conf') | 124 | old_conf_dir = os.path.join(basepath, 'conf') |
125 | shutil.rmtree(old_conf_dir) | 125 | shutil.rmtree(old_conf_dir) |
126 | shutil.copytree(new_conf_dir, old_conf_dir) | 126 | shutil.copytree(new_conf_dir, old_conf_dir) |
127 | logger.info("Updating layers") | 127 | logger.info("Updating layers") |
128 | new_layers_dir = os.path.join(args.updateserver, 'layers') | 128 | new_layers_dir = os.path.join(updateserver, 'layers') |
129 | old_layers_dir = os.path.join(basepath, 'layers') | 129 | old_layers_dir = os.path.join(basepath, 'layers') |
130 | shutil.rmtree(old_layers_dir) | 130 | shutil.rmtree(old_layers_dir) |
131 | ret = subprocess.call("cp -a %s %s" % (new_layers_dir, old_layers_dir), shell=True) | 131 | ret = subprocess.call("cp -a %s %s" % (new_layers_dir, old_layers_dir), shell=True) |
@@ -140,12 +140,12 @@ def sdk_update(args, config, basepath, workspace): | |||
140 | os.makedirs(tmpsdk_dir) | 140 | os.makedirs(tmpsdk_dir) |
141 | os.makedirs(os.path.join(tmpsdk_dir, 'conf')) | 141 | os.makedirs(os.path.join(tmpsdk_dir, 'conf')) |
142 | # Fetch locked-sigs.inc from update server | 142 | # Fetch locked-sigs.inc from update server |
143 | 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) | 143 | ret = subprocess.call("wget -q -O - %s/conf/locked-sigs.inc > %s/locked-sigs.inc" % (updateserver, os.path.join(tmpsdk_dir, 'conf')), shell=True) |
144 | if ret != 0: | 144 | if ret != 0: |
145 | logger.error("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc failed" % (args.updateserver, os.path.join(tmpsdk_dir, 'conf'))) | 145 | logger.error("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc failed" % (updateserver, os.path.join(tmpsdk_dir, 'conf'))) |
146 | return ret | 146 | return ret |
147 | else: | 147 | else: |
148 | logger.info("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc succeeded" % (args.updateserver, os.path.join(tmpsdk_dir, 'conf'))) | 148 | logger.info("Fetching conf/locked-sigs.inc from %s to %s/locked-sigs.inc succeeded" % (updateserver, os.path.join(tmpsdk_dir, 'conf'))) |
149 | new_locked_sig_file_path = os.path.join(tmpsdk_dir, 'conf/locked-sigs.inc') | 149 | new_locked_sig_file_path = os.path.join(tmpsdk_dir, 'conf/locked-sigs.inc') |
150 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) | 150 | update_dict = generate_update_dict(new_locked_sig_file_path, old_locked_sig_file_path) |
151 | logger.debug("update_dict = %s" % update_dict) | 151 | logger.debug("update_dict = %s" % update_dict) |
@@ -160,19 +160,19 @@ def sdk_update(args, config, basepath, workspace): | |||
160 | else: | 160 | else: |
161 | ret = -1 | 161 | ret = -1 |
162 | if ret != 0: | 162 | if ret != 0: |
163 | ret = subprocess.call("rm -rf layers && git clone %s/layers" % args.updateserver, shell=True) | 163 | ret = subprocess.call("rm -rf layers && git clone %s/layers" % updateserver, shell=True) |
164 | if ret != 0: | 164 | if ret != 0: |
165 | logger.error("Updating meta data via git failed") | 165 | logger.error("Updating meta data via git failed") |
166 | return ret | 166 | return ret |
167 | logger.debug("Updating conf files ...") | 167 | logger.debug("Updating conf files ...") |
168 | conf_files = ['local.conf', 'bblayers.conf', 'devtool.conf', 'locked-sigs.inc'] | 168 | conf_files = ['local.conf', 'bblayers.conf', 'devtool.conf', 'locked-sigs.inc'] |
169 | for conf in conf_files: | 169 | for conf in conf_files: |
170 | ret = subprocess.call("wget -q -O - %s/conf/%s > conf/%s" % (args.updateserver, conf, conf), shell=True) | 170 | ret = subprocess.call("wget -q -O - %s/conf/%s > conf/%s" % (updateserver, conf, conf), shell=True) |
171 | if ret != 0: | 171 | if ret != 0: |
172 | logger.error("Update %s failed" % conf) | 172 | logger.error("Update %s failed" % conf) |
173 | return ret | 173 | return ret |
174 | with open(os.path.join(basepath, 'conf/local.conf'), 'a') as f: | 174 | with open(os.path.join(basepath, 'conf/local.conf'), 'a') as f: |
175 | f.write('SSTATE_MIRRORS_append = " file://.* %s/sstate-cache/PATH \\n "\n' % args.updateserver) | 175 | f.write('SSTATE_MIRRORS_append = " file://.* %s/sstate-cache/PATH \\n "\n' % updateserver) |
176 | 176 | ||
177 | # Run bitbake command for the whole SDK | 177 | # Run bitbake command for the whole SDK |
178 | sdk_targets = config.get('SDK', 'sdk_targets') | 178 | sdk_targets = config.get('SDK', 'sdk_targets') |