1
0
Fork 0
mirror of synced 2024-12-22 06:31:07 -05:00

Support overriding architecture

In the same way as os, hostname and user.
This commit is contained in:
Erik Flodin 2021-12-27 22:10:13 +01:00
parent 2f00dabcdb
commit 2379d63068
No known key found for this signature in database
GPG key ID: 420A7C865EE3F85F
3 changed files with 17 additions and 5 deletions

View file

@ -7,6 +7,7 @@ import utils
'override', [
False,
'class',
'arch',
'os',
'hostname',
'user',
@ -14,6 +15,7 @@ import utils
ids=[
'no-override',
'override-class',
'override-arch',
'override-os',
'override-hostname',
'override-user',
@ -21,7 +23,7 @@ import utils
)
@pytest.mark.usefixtures('ds1_copy')
def test_set_local_alt_values(
runner, yadm, paths, tst_sys, tst_host, tst_user, override):
runner, yadm, paths, tst_arch, tst_sys, tst_host, tst_user, override):
"""Use issue_legacy_path_warning"""
script = f"""
YADM_TEST=1 source {yadm} &&
@ -29,6 +31,7 @@ def test_set_local_alt_values(
YADM_DIR={paths.yadm} YADM_DATA={paths.data} configure_paths &&
set_local_alt_values
echo "class='$local_class'"
echo "arch='$local_arch'"
echo "os='$local_system'"
echo "host='$local_host'"
echo "user='$local_user'"
@ -46,6 +49,11 @@ def test_set_local_alt_values(
else:
assert "class=''" in run.out
if override == 'arch':
assert "arch='override'" in run.out
else:
assert f"arch='{tst_arch}'" in run.out
if override == 'os':
assert "os='override'" in run.out
else:

2
yadm
View file

@ -837,7 +837,7 @@ EOF
function config() {
use_repo_config=0
local_options="^local\.(class|os|hostname|user)$"
local_options="^local\.(class|arch|os|hostname|user)$"
for option in "$@"; do
[[ "$option" =~ $local_options ]] && use_repo_config=1
done

10
yadm.1
View file

@ -427,7 +427,7 @@ Disable the permission changes to
This feature is enabled by default.
.RE
The following four "local" configurations are not stored in the
The following five "local" configurations are not stored in the
.IR $HOME/.config/yadm/config,
they are stored in the local repository.
@ -436,6 +436,9 @@ they are stored in the local repository.
Specify a class for the purpose of symlinking alternate files.
By default, no class will be matched.
.TP
.B local.arch
Override the architecture for the purpose of symlinking alternate files.
.TP
.B local.hostname
Override the hostname for the purpose of symlinking alternate files.
.TP
@ -601,8 +604,9 @@ command. The following sets the class to be "Work".
yadm config local.class Work
Similarly, the values of os, hostname, and user can be manually overridden
using the configuration options
Similarly, the values of architecture, os, hostname, and user can be manually
overridden using the configuration options
.BR local.arch ,
.BR local.os ,
.BR local.hostname ,
and