Skip to content

Commit

Permalink
Support overriding architecture
Browse files Browse the repository at this point in the history
In the same way as os, hostname and user.
  • Loading branch information
erijo committed Dec 27, 2021
1 parent 2f00dab commit 2379d63
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 9 additions & 1 deletion test/test_unit_set_local_alt_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@
'override', [
False,
'class',
'arch',
'os',
'hostname',
'user',
],
ids=[
'no-override',
'override-class',
'override-arch',
'override-os',
'override-hostname',
'override-user',
]
)
@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} &&
set_operating_system &&
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'"
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion yadm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions yadm.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2379d63

Please sign in to comment.