mirror of
				https://github.com/TheLocehiliosan/yadm
				synced 2025-06-13 13:03:58 +00:00 
			
		
		
		
	Support overriding architecture
In the same way as os, hostname and user.
This commit is contained in:
		
							parent
							
								
									2f00dabcdb
								
							
						
					
					
						commit
						2379d63068
					
				| @ -7,6 +7,7 @@ import utils | |||||||
|     'override', [ |     'override', [ | ||||||
|         False, |         False, | ||||||
|         'class', |         'class', | ||||||
|  |         'arch', | ||||||
|         'os', |         'os', | ||||||
|         'hostname', |         'hostname', | ||||||
|         'user', |         'user', | ||||||
| @ -14,6 +15,7 @@ import utils | |||||||
|     ids=[ |     ids=[ | ||||||
|         'no-override', |         'no-override', | ||||||
|         'override-class', |         'override-class', | ||||||
|  |         'override-arch', | ||||||
|         'override-os', |         'override-os', | ||||||
|         'override-hostname', |         'override-hostname', | ||||||
|         'override-user', |         'override-user', | ||||||
| @ -21,7 +23,7 @@ import utils | |||||||
|     ) |     ) | ||||||
| @pytest.mark.usefixtures('ds1_copy') | @pytest.mark.usefixtures('ds1_copy') | ||||||
| def test_set_local_alt_values( | 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""" |     """Use issue_legacy_path_warning""" | ||||||
|     script = f""" |     script = f""" | ||||||
|         YADM_TEST=1 source {yadm} && |         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 && |         YADM_DIR={paths.yadm} YADM_DATA={paths.data} configure_paths && | ||||||
|         set_local_alt_values |         set_local_alt_values | ||||||
|         echo "class='$local_class'" |         echo "class='$local_class'" | ||||||
|  |         echo "arch='$local_arch'" | ||||||
|         echo "os='$local_system'" |         echo "os='$local_system'" | ||||||
|         echo "host='$local_host'" |         echo "host='$local_host'" | ||||||
|         echo "user='$local_user'" |         echo "user='$local_user'" | ||||||
| @ -46,6 +49,11 @@ def test_set_local_alt_values( | |||||||
|     else: |     else: | ||||||
|         assert "class=''" in run.out |         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': |     if override == 'os': | ||||||
|         assert "os='override'" in run.out |         assert "os='override'" in run.out | ||||||
|     else: |     else: | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								yadm
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								yadm
									
									
									
									
									
								
							| @ -837,7 +837,7 @@ EOF | |||||||
| function config() { | function config() { | ||||||
| 
 | 
 | ||||||
|   use_repo_config=0 |   use_repo_config=0 | ||||||
|   local_options="^local\.(class|os|hostname|user)$" |   local_options="^local\.(class|arch|os|hostname|user)$" | ||||||
|   for option in "$@"; do |   for option in "$@"; do | ||||||
|     [[ "$option" =~ $local_options ]] && use_repo_config=1 |     [[ "$option" =~ $local_options ]] && use_repo_config=1 | ||||||
|   done |   done | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								yadm.1
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								yadm.1
									
									
									
									
									
								
							| @ -427,7 +427,7 @@ Disable the permission changes to | |||||||
| This feature is enabled by default. | This feature is enabled by default. | ||||||
| 
 | 
 | ||||||
| .RE | .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, | .IR $HOME/.config/yadm/config, | ||||||
| they are stored in the local repository. | 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. | Specify a class for the purpose of symlinking alternate files. | ||||||
| By default, no class will be matched. | By default, no class will be matched. | ||||||
| .TP | .TP | ||||||
|  | .B local.arch | ||||||
|  | Override the architecture for the purpose of symlinking alternate files. | ||||||
|  | .TP | ||||||
| .B local.hostname | .B local.hostname | ||||||
| Override the hostname for the purpose of symlinking alternate files. | Override the hostname for the purpose of symlinking alternate files. | ||||||
| .TP | .TP | ||||||
| @ -601,8 +604,9 @@ command. The following sets the class to be "Work". | |||||||
| 
 | 
 | ||||||
|   yadm config local.class Work |   yadm config local.class Work | ||||||
| 
 | 
 | ||||||
| Similarly, the values of os, hostname, and user can be manually overridden | Similarly, the values of architecture, os, hostname, and user can be manually | ||||||
| using the configuration options | overridden using the configuration options | ||||||
|  | .BR local.arch , | ||||||
| .BR local.os , | .BR local.os , | ||||||
| .BR local.hostname , | .BR local.hostname , | ||||||
| and | and | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user