Skip to content

Commit

Permalink
locale: rename new XKB variables to match Debian/Ubuntu's
Browse files Browse the repository at this point in the history
Debian/Ubuntu use almost the same variables, but without '_'. Given
our usage is new, rename them so that they match and downstream tech
debt can be removed.

Follow-up for systemd#25805

See:
 systemd#24228
 systemd#25412
  • Loading branch information
bluca committed Jan 24, 2023
1 parent 162f647 commit 82df0ee
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions src/locale/localed-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ int vconsole_read_data(Context *c, sd_bus_message *m) {
return parse_env_file_fd(fd, "/etc/vconsole.conf",
"KEYMAP", &c->vc_keymap,
"KEYMAP_TOGGLE", &c->vc_keymap_toggle,
"XKB_LAYOUT", &c->x11_from_vc.layout,
"XKB_MODEL", &c->x11_from_vc.model,
"XKB_VARIANT", &c->x11_from_vc.variant,
"XKB_OPTIONS", &c->x11_from_vc.options);
"XKBLAYOUT", &c->x11_from_vc.layout,
"XKBMODEL", &c->x11_from_vc.model,
"XKBVARIANT", &c->x11_from_vc.variant,
"XKBOPTIONS", &c->x11_from_vc.options);
}

int x11_read_data(Context *c, sd_bus_message *m) {
Expand Down Expand Up @@ -388,19 +388,19 @@ int vconsole_write_data(Context *c) {
if (r < 0)
return r;

r = strv_env_assign(&l, "XKB_LAYOUT", xc ? empty_to_null(xc->layout) : NULL);
r = strv_env_assign(&l, "XKBLAYOUT", xc ? empty_to_null(xc->layout) : NULL);
if (r < 0)
return r;

r = strv_env_assign(&l, "XKB_MODEL", xc ? empty_to_null(xc->model) : NULL);
r = strv_env_assign(&l, "XKBMODEL", xc ? empty_to_null(xc->model) : NULL);
if (r < 0)
return r;

r = strv_env_assign(&l, "XKB_VARIANT", xc ? empty_to_null(xc->variant) : NULL);
r = strv_env_assign(&l, "XKBVARIANT", xc ? empty_to_null(xc->variant) : NULL);
if (r < 0)
return r;

r = strv_env_assign(&l, "XKB_OPTIONS", xc ? empty_to_null(xc->options) : NULL);
r = strv_env_assign(&l, "XKBOPTIONS", xc ? empty_to_null(xc->options) : NULL);
if (r < 0)
return r;

Expand Down
56 changes: 28 additions & 28 deletions test/units/testsuite-73.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,30 +258,30 @@ test_vc_keymap() {
assert_not_in "X11 Variant:" "$output"
assert_in "X11 Options: terminate:ctrl_alt_bksp" "$output"

assert_in "XKB_LAYOUT=us" "$vc"
assert_in "XKB_MODEL=pc105\+inet" "$vc"
assert_not_in "XKB_VARIANT" "$vc"
assert_in "XKB_OPTIONS=terminate:ctrl_alt_bksp" "$vc"
assert_in "XKBLAYOUT=us" "$vc"
assert_in "XKBMODEL=pc105\+inet" "$vc"
assert_not_in "XKBVARIANT" "$vc"
assert_in "XKBOPTIONS=terminate:ctrl_alt_bksp" "$vc"
elif [[ "$i" == "us-acentos" ]]; then
assert_in "X11 Layout: us" "$output"
assert_in 'X11 Model: pc105$' "$output"
assert_in "X11 Variant: intl" "$output"
assert_in "X11 Options: terminate:ctrl_alt_bksp" "$output"

assert_in "XKB_LAYOUT=us" "$vc"
assert_in "XKB_MODEL=pc105$" "$vc"
assert_in "XKB_VARIANT=intl" "$vc"
assert_in "XKB_OPTIONS=terminate:ctrl_alt_bksp" "$vc"
assert_in "XKBLAYOUT=us" "$vc"
assert_in "XKBMODEL=pc105$" "$vc"
assert_in "XKBVARIANT=intl" "$vc"
assert_in "XKBOPTIONS=terminate:ctrl_alt_bksp" "$vc"
elif [[ "$i" =~ ^us-.* ]]; then
assert_in "X11 Layout: .unset." "$output"
assert_not_in "X11 Model:" "$output"
assert_not_in "X11 Variant:" "$output"
assert_not_in "X11 Options:" "$output"

assert_not_in "XKB_LAYOUT" "$vc"
assert_not_in "XKB_MODEL" "$vc"
assert_not_in "XKB_VARIANT" "$vc"
assert_not_in "XKB_OPTIONS" "$vc"
assert_not_in "XKBLAYOUT" "$vc"
assert_not_in "XKBMODEL" "$vc"
assert_not_in "XKBVARIANT" "$vc"
assert_not_in "XKBOPTIONS" "$vc"
fi
done

Expand Down Expand Up @@ -322,10 +322,10 @@ XKBOPTIONS=terminate:ctrl_alt_bksp"
assert_in 'Option "XkbOptions" "terminate:ctrl_alt_bksp"' "$output"

output=$(cat /etc/vconsole.conf)
assert_in 'XKB_LAYOUT=us' "$output"
assert_in 'XKB_MODEL=pc105\+inet' "$output"
assert_in 'XKB_VARIANT=intl' "$output"
assert_in 'XKB_OPTIONS=terminate:ctrl_alt_bksp' "$output"
assert_in 'XKBLAYOUT=us' "$output"
assert_in 'XKBMODEL=pc105\+inet' "$output"
assert_in 'XKBVARIANT=intl' "$output"
assert_in 'XKBOPTIONS=terminate:ctrl_alt_bksp' "$output"
fi

output=$(localectl)
Expand All @@ -352,10 +352,10 @@ XKBVARIANT=intl"
assert_not_in 'Option "XkbOptions"' "$output"

output=$(cat /etc/vconsole.conf)
assert_in 'XKB_LAYOUT=us' "$output"
assert_in 'XKB_MODEL=pc105\+inet' "$output"
assert_in 'XKB_VARIANT=intl' "$output"
assert_not_in 'XKB_OPTIONS' "$output"
assert_in 'XKBLAYOUT=us' "$output"
assert_in 'XKBMODEL=pc105\+inet' "$output"
assert_in 'XKBVARIANT=intl' "$output"
assert_not_in 'XKBOPTIONS' "$output"
fi

output=$(localectl)
Expand All @@ -381,10 +381,10 @@ XKBMODEL=pc105+inet"
assert_not_in 'Option "XkbOptions"' "$output"

output=$(cat /etc/vconsole.conf)
assert_in 'XKB_LAYOUT=us' "$output"
assert_in 'XKB_MODEL=pc105\+inet' "$output"
assert_not_in 'XKB_VARIANT' "$output"
assert_not_in 'XKB_OPTIONS' "$output"
assert_in 'XKBLAYOUT=us' "$output"
assert_in 'XKBMODEL=pc105\+inet' "$output"
assert_not_in 'XKBVARIANT' "$output"
assert_not_in 'XKBOPTIONS' "$output"
fi

output=$(localectl)
Expand All @@ -409,10 +409,10 @@ XKBMODEL=pc105+inet"
assert_not_in 'Option "XkbOptions"' "$output"

output=$(cat /etc/vconsole.conf)
assert_in 'XKB_LAYOUT=us' "$output"
assert_not_in 'XKB_MODEL' "$output"
assert_not_in 'XKB_VARIANT' "$output"
assert_not_in 'XKB_OPTIONS' "$output"
assert_in 'XKBLAYOUT=us' "$output"
assert_not_in 'XKBMODEL' "$output"
assert_not_in 'XKBVARIANT' "$output"
assert_not_in 'XKBOPTIONS' "$output"
fi

output=$(localectl)
Expand Down

0 comments on commit 82df0ee

Please sign in to comment.