Merge pull request #393 from erijo/arch-fixes

This commit is contained in:
Tim Byrne 2021-12-27 16:59:23 -06:00
commit 0ae8931e01
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12
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