Record information about locale support (in particular, whether to install langpacks and which languages have pre-baked squashfses).

impish-sru-lp-1946520
Michael Hudson-Doyle 3 years ago
parent e19d501949
commit 391439d44c

7
debian/changelog vendored

@ -1,3 +1,10 @@
livecd-rootfs (2.739) UNRELEASED; urgency=medium
* Record information about locale support (in particular, whether to install
langpacks and which languages have pre-baked squashfses).
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 20 Sep 2021 10:31:41 +1200
livecd-rootfs (2.737) impish; urgency=medium livecd-rootfs (2.737) impish; urgency=medium
* Generate source catalogs for the desktop canary build. * Generate source catalogs for the desktop canary build.

@ -204,12 +204,28 @@ add_snap ()
done done
} }
get_seeded_languages () {
# We assume any seed name of the form ${no_lang_seed}-${foo} where
# ${foo} is only two or three characters long is a default language
# seed.
langs=''
for no_lang_seed in "$@"; do
seed_regex="${no_lang_seed}"'-[^-.]{2,3}$'
for seed in $(ls config/germinate-output | grep -E "${seed_regex}"); do
lang=$(echo "${seed}" | grep -oE '[^-.]{2,3}$')
langs="$langs $lang"
done
done
echo $langs | tr ' ' '\n' | sort -u | tr '\n' ' '
}
derive_language_layers () { derive_language_layers () {
# create special layers for each default language # create special layers for each default language
# #
# $1 base pass # $1 base pass
# $2 base seed (without any languages) # $2 base seed (without any languages)
# $3 default language seed # $3 default language seed
# $4 space separated list of default languages
# e.g.: # e.g.:
# derive_language_layers minimal desktop-minimal desktop-minimal-default-languages # derive_language_layers minimal desktop-minimal desktop-minimal-default-languages
# derive_language_layers minimal.standard desktop desktop-default-languages # derive_language_layers minimal.standard desktop desktop-default-languages
@ -243,29 +259,26 @@ derive_language_layers () {
# support for all languages from the base layer. We also create a # support for all languages from the base layer. We also create a
# layer than has support for all languages removed, which can be used # layer than has support for all languages removed, which can be used
# for the base of an install for a non-default language. # for the base of an install for a non-default language.
local pass base_pass=$1 no_lang_seed=$2 def_lang_seed=$3 local pass base_pass=$1 no_lang_seed=$2 def_lang_seed=$3 langs=$4
_check_immutable_passes_to_layers _check_immutable_passes_to_layers
_check_layers_only_API "derive_language_layers" _check_layers_only_API "derive_language_layers"
pass=$base_pass.no-languages for lang in $langs; do
_register_pass ${pass} pass="${base_pass}.${lang}"
# Remove all packages from the default language seed that are not in
# the no_lang_seed from the no-languages layer.
subtract_package_lists ${def_lang_seed} ${no_lang_seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_${pass}
# We assume any seed name of the form ${no_lang_seed}-${foo} where
# ${foo} is only two or three characters long is a default language
# seed.
seed_regex="${no_lang_seed}"'-[^-.]{2,3}$'
for seed in $(ls config/germinate-output | grep -E "${seed_regex}"); do
lang=$(echo "${seed}" | grep -oE '[^-.]{2,3}$')
pass="${1}.${lang}"
_register_pass ${pass} _register_pass ${pass}
# Remove packages from the default language seed that are not # Remove packages from the default language seed that are not
# in the language specific seed from the language specific layer. # in the language specific seed from the language specific layer.
subtract_package_lists ${def_lang_seed} ${seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass # I find this expression helps a little to make this make sense:
# ((base) + (en fr de)) - ( (en fr de) - (fr)) == (base + fr)
# `layer will all langs' `def_lang_seed' `lang' `what we want to install'
subtract_package_lists ${def_lang_seed} ${no_lang_seed}-${lang} >> config/package-lists/livecd-rootfs.removal-list.chroot_$pass
done done
no_lang_pass=$base_pass.no-languages
_register_pass ${no_lang_pass}
# Remove all packages from the default language seed that are not in
# the no_lang_seed from the no-languages layer.
subtract_package_lists ${def_lang_seed} ${no_lang_seed} >> config/package-lists/livecd-rootfs.removal-list.chroot_${no_lang_pass}
} }
add_chroot_hook () add_chroot_hook ()
@ -650,8 +663,10 @@ case $PROJECT in
remove_package minimal.standard.live ubiquity-frontend-gtk remove_package minimal.standard.live ubiquity-frontend-gtk
add_snap minimal.standard.live ubuntu-desktop-installer/classic add_snap minimal.standard.live ubuntu-desktop-installer/classic
derive_language_layers minimal desktop-minimal desktop-minimal-default-languages seeded_langs="$(get_seeded_languages desktop-minimal desktop)"
derive_language_layers minimal.standard desktop desktop-default-languages echo "$seeded_langs" | tr ' ' ',' > config/seeded-languages
derive_language_layers minimal desktop-minimal desktop-minimal-default-languages "$seeded_langs"
derive_language_layers minimal.standard desktop desktop-default-languages "$seeded_langs"
cat <<-EOF > config/minimal.catalog-in.yaml cat <<-EOF > config/minimal.catalog-in.yaml
name: "Ubuntu Desktop (minimized)" name: "Ubuntu Desktop (minimized)"
description: >- description: >-
@ -659,6 +674,7 @@ case $PROJECT in
id: ubuntu-desktop-minimal id: ubuntu-desktop-minimal
type: fsimage type: fsimage
variant: desktop variant: desktop
locale_support: langpack
EOF EOF
cat <<-EOF > config/minimal.standard.catalog-in.yaml cat <<-EOF > config/minimal.standard.catalog-in.yaml
name: "Ubuntu Desktop" name: "Ubuntu Desktop"
@ -667,6 +683,7 @@ case $PROJECT in
id: ubuntu-desktop id: ubuntu-desktop
type: fsimage type: fsimage
variant: desktop variant: desktop
locale_support: langpack
default: yes default: yes
EOF EOF
/usr/share/livecd-rootfs/checkout-translations-branch \ /usr/share/livecd-rootfs/checkout-translations-branch \

@ -141,10 +141,14 @@ build_layered_squashfs () {
if [ -f config/$pass.catalog-in.yaml ]; then if [ -f config/$pass.catalog-in.yaml ]; then
echo "Expanding catalog entry template for $pass" echo "Expanding catalog entry template for $pass"
/usr/share/livecd-rootfs/update-source-catalog --output livecd.${PROJECT}.install-sources.yaml \ usc_opts="--output livecd.${PROJECT}.install-sources.yaml \
--template config/$pass.catalog-in.yaml \ --template config/$pass.catalog-in.yaml \
--size $(du -B 1 -s chroot/ | cut -f1) --squashfs ${pass}.squashfs \ --size $(du -B 1 -s chroot/ | cut -f1) --squashfs ${pass}.squashfs \
--translations config/catalog-translations --translations config/catalog-translations"
if [ -f config/seeded-languages ]; then
usc_opts="$usc_opts --langs $(cat config/seeded-languages)"
fi
/usr/share/livecd-rootfs/update-source-catalog $usc_opts
else else
echo "No catalog entry template for $pass" echo "No catalog entry template for $pass"
fi fi

@ -5,3 +5,4 @@ description: >-
id: ubuntu-server-minimal id: ubuntu-server-minimal
type: fsimage type: fsimage
variant: server variant: server
locale_support: none

@ -6,3 +6,4 @@ id: ubuntu-server
default: yes default: yes
type: fsimage-layered type: fsimage-layered
variant: server variant: server
locale_support: locale-only

@ -13,6 +13,7 @@ parser.add_argument('--size', required=True)
parser.add_argument('--squashfs', required=True) parser.add_argument('--squashfs', required=True)
parser.add_argument('--translations', required=True) parser.add_argument('--translations', required=True)
parser.add_argument('--template', required=True) parser.add_argument('--template', required=True)
parser.add_argument('--langs', default=None)
opts = parser.parse_args(sys.argv[1:]) opts = parser.parse_args(sys.argv[1:])
@ -47,6 +48,8 @@ for mo in glob.glob(os.path.join(opts.translations, '*.mo')):
if t_description != en_description: if t_description != en_description:
lang = os.path.splitext(os.path.basedescription(mo))[0] lang = os.path.splitext(os.path.basedescription(mo))[0]
template['description'][lang] = t_description template['description'][lang] = t_description
if opts.langs is not None:
template['preinstalled_langs'] = opts.langs.split(',')
output.append(template) output.append(template)

Loading…
Cancel
Save