Cleans comments and adresses test.
- Under dry-run apt is run with --simulate. - That can still fail if a package does not exist, for instance. - If so, a file will not be written.
This commit is contained in:
parent
c9f90dffb3
commit
ef18564eca
|
@ -100,10 +100,16 @@ validate () {
|
||||||
fi
|
fi
|
||||||
# Extract value of the LANG variable from etc/default/locale (with or without quotes)
|
# Extract value of the LANG variable from etc/default/locale (with or without quotes)
|
||||||
lang="$(grep -Eo 'LANG=([^.@ _]+)' $tmpdir/etc/default/locale | cut -d= -f 2- | cut -d\" -f 2-)"
|
lang="$(grep -Eo 'LANG=([^.@ _]+)' $tmpdir/etc/default/locale | cut -d= -f 2- | cut -d\" -f 2-)"
|
||||||
if ! ls $tmpdir/var/cache/apt/archives/ | grep --fixed-strings --quiet -- "$lang"; then
|
if ! ls $tmpdir/var/cache/apt/archives/*.log | grep --fixed-strings --quiet -- "$lang"; then
|
||||||
echo "expected $lang language packs in directory var/cache/apt/archives/"
|
echo "expected $lang language packs in directory var/cache/apt/archives/"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
for f in $tmpdir/var/cache/apt/archives/*.log ; do
|
||||||
|
if ! [ -s $f ]; then
|
||||||
|
echo "apt failed for package $f"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
if [ -z "$( diff -Nup $tmpdir/etc/locale.gen $tmpdir/etc/locale.gen.test)" ] ; then
|
if [ -z "$( diff -Nup $tmpdir/etc/locale.gen $tmpdir/etc/locale.gen.test)" ] ; then
|
||||||
echo "expected changes in etc/locale.gen"
|
echo "expected changes in etc/locale.gen"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -180,10 +180,8 @@ class ConfigureController(SubiquityController):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
cp = await arun_command([aptCommand, "update"], env=env)
|
cp = await arun_command([aptCommand, "update"], env=env)
|
||||||
|
|
||||||
if cp.returncode != 0:
|
if cp.returncode != 0:
|
||||||
# TODO: deal with the error case.
|
log.debug("Failed to update apt cache.\n%s", cp.stderr)
|
||||||
log.error("Failed to update apt cache.\n%s", cp.stderr)
|
|
||||||
|
|
||||||
if self.app.opts.dry_run: # only empty in dry-run on failure.
|
if self.app.opts.dry_run: # only empty in dry-run on failure.
|
||||||
if len(packages) == 0:
|
if len(packages) == 0:
|
||||||
|
@ -195,12 +193,14 @@ class ConfigureController(SubiquityController):
|
||||||
os.makedirs(packs_dir, exist_ok=True)
|
os.makedirs(packs_dir, exist_ok=True)
|
||||||
try:
|
try:
|
||||||
for package in packages:
|
for package in packages:
|
||||||
# Just write the package uri to a file.
|
# Just write the apt simulation log if succeeds.
|
||||||
lcp = await arun_command([aptCommand, "install", package,
|
lcp = await arun_command([aptCommand, "install", package,
|
||||||
"--simulate"], env=env)
|
"--simulate"], env=env)
|
||||||
archive = os.path.join(packs_dir, package)
|
archive = os.path.join(packs_dir, package+".log")
|
||||||
with open(archive, "wt") as f:
|
with open(archive, "wt") as f:
|
||||||
|
if lcp.returncode == 0:
|
||||||
f.write(lcp.stdout)
|
f.write(lcp.stdout)
|
||||||
|
# otherwise file will be empty.
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -335,7 +335,6 @@ class ConfigureController(SubiquityController):
|
||||||
create_user_base = ["-P", root_dir]
|
create_user_base = ["-P", root_dir]
|
||||||
assign_grp_base = ["-P", root_dir]
|
assign_grp_base = ["-P", root_dir]
|
||||||
|
|
||||||
# TODO: Figure out if Hardcoded paths here cause trouble for runtests.
|
|
||||||
create_user_cmd = ["/usr/sbin/useradd"] + create_user_base + \
|
create_user_cmd = ["/usr/sbin/useradd"] + create_user_base + \
|
||||||
["-m", "-s", "/bin/bash", "-c", wsl_id.realname,
|
["-m", "-s", "/bin/bash", "-c", wsl_id.realname,
|
||||||
"-p", wsl_id.password, username]
|
"-p", wsl_id.password, username]
|
||||||
|
|
Loading…
Reference in New Issue