l-s-c as dep on Makefile, avoid raising exceptions

- And clear .subiquity/var/cache
This commit is contained in:
Carlos Nihelton 2021-11-05 18:09:15 -03:00
parent 5f9f2122ce
commit 6be4aea138
3 changed files with 11 additions and 6 deletions

View File

@ -30,7 +30,7 @@ aptdeps:
libnl-route-3-dev python3-attr python3-distutils-extra python3-requests \
python3-requests-unixsocket python3-jsonschema python3-apport \
python3-bson xorriso isolinux python3-aiohttp cloud-init ssh-import-id \
curl jq build-essential python3-pytest python3-async-timeout
curl jq build-essential python3-pytest python3-async-timeout language-selector-common
install_deps: aptdeps gitdeps

View File

@ -95,6 +95,7 @@ clean () {
rm -rf .subiquity/etc/*.conf
rm -rf .subiquity/etc/cloud/cloud.cfg.d/99-installer.cfg
rm -rf .subiquity/var/crash
rm -rf .subiquity/var/cache
}
error () {

View File

@ -53,8 +53,8 @@ class ConfigureController(SubiquityController):
lineFound = fileContents.find(lang)
if lineFound == -1:
# An unsupported locale coming from our UI is a bug
raise AssertionError("Selected language {} not supported."
.format(lang))
log.error("Selected language %s not supported.", lang)
return
pattern = r'#+\s*({}.*)'.format(lang)
commented = re.compile(pattern)
@ -62,8 +62,11 @@ class ConfigureController(SubiquityController):
locGenNeedsWrite = n == 1
if locGenNeedsWrite:
try:
with open(localeGenPath, "wt") as f:
f.write(fileContents)
except IOError as err:
log.error("Failed to modify %s file. %s", localeGenPath, err)
async def _install_check_lang_support_packages(self, lang, env):
""" Installs any packages recommended by
@ -90,7 +93,8 @@ class ConfigureController(SubiquityController):
packs_dir = os.path.join(self.model.root,
apt_pkg.config
.find_dir("Dir::Cache::Archives")[1:])
cmd = ["wget", cache[package].candidate.uri, "-O", packs_dir]
archive = os.path.join(packs_dir, cache[package].fullname)
cmd = ["wget", "-O", archive, cache[package].candidate.uri]
os.makedirs(packs_dir, exist_ok=True)
await arun_command(cmd, env=env)
else: