1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2025-06-07 10:03:56 +00:00
Commit Graph

20 Commits

Author SHA1 Message Date
Erik Flodin
4214de8d91
Change handling of dirs with alt conditions
Instead of creating symlinks pointing at the directory, create individual
symlinks for each file within the dir alternate (fixes #490).

Also rework how stale symlinks are removed. Now a (stale) symlink will only be
removed if it's pointing at a file that's an altnerate file (fixes #236).
2025-03-18 20:50:34 +01:00
AaronYoung5
9ff5e09650
Add support for negative alt conditions (#522) 2025-03-02 22:06:12 +01:00
Erik Flodin
119d1ddbaa
Refactor template handling
Move common template logic out to a new template() function that calls one of
the existing template processors and then handles writing the result and
copying permissions.
2024-12-15 16:15:14 +01:00
Erik Flodin
c092b7c099
Ignore case in alt and default template processor conditions
This aligns all conditions with distro and distro_family.

Suggestion from #456.
2024-12-09 23:50:49 +01:00
Erik Flodin
b2b0b143d6
Refactor alt handling
* Simplify score_file() by using case in instead of nested ifs with regexps.
* Merge record_score() and record_template().
* Alt condition processing no longer stops when a template condition is seen
  but continues processing to verify that all conditions are valid (as the
  documentation says it should). Fixes #478.
* Support alt dirs with deeply nested tracked files (fixes #490).
* Use git ls-files to filter out which tracked files to consider for alt
  processing. Should speed up auto-alt (#505).
* Use nocasematch when comparing distro and distro_family. Fixed #455.
2024-12-06 23:10:52 +01:00
Erik Flodin
30fa6f08a4
Update testbed docker image
* Update base image to Ubuntu 24.10. This uses a python version where j2cli no
  longer works when installed using pip so use the version from Ubuntu instead
  which has been patched to work.

* Update shellcheck, pylint, pytest, isort, flake8, black and yamllint to the
  latest versions. This closes #502.

* Use a longer expect timeout to fix tests failing when gpg is killed due to
  this timeout.

* Explicitly flush gpg-agent's cached passwords to fix failing tests with
  latest gnupg. Also clean up after tests to avoid having gpg-agents running
  after the test (e.g. when running tests directly without docker).
2024-11-11 22:30:41 +01:00
Tim Byrne
76ce3defea
Changes for black compliance 2023-07-12 09:20:00 -05:00
Tim Byrne
8a87f4a30f
Changes for new pylint compliance 2023-07-12 09:19:59 -05:00
Tim Byrne
0f8538d3e3
Create tests for underscores in distro/family 2022-09-13 12:38:18 -05:00
Tim Byrne
ebb6715aad
Reduce supported labels for architecture 2022-02-21 14:01:08 -06:00
Tim Byrne
027c7359ac
Merge pull request #304 from erijo/multiple-classes 2022-01-22 18:14:23 -06:00
Tim Byrne
5ae553b078
Add support for distro_family (#213)
Obtained from /etc/os-release: ID_LIKE.
Alternate attributes f & distro_family.
2022-01-22 18:05:15 -06:00
Erik Flodin
42c74efbac
Add support for multiple local classes
A local class is set with:
$ yadm config local.class cls1

More classes can be added with:
$ yadm config --add local.class cls2
$ yadm config --add local.class cls3

Any of cls1, cls2 and cls3 can be used in an alternate condition.

For templates, the existing variable yadm.class/YADM_CLASS is set to
the last class (i.e. cls3) to remain compatible with how it works
today and with what the following command gives:
$ yadm config local.class

For the default template processor there is no explicit yadm.classes
variable. Instead a yadm.class condition will check against all
classes.

For the other processors, a new template variable YADM_CLASSES will be
set to all classes separated by newline. For jinja2 templates a class
can be checked with: {%- if "cls" in YADM_CLASSES.split("\n") %}

For esh templates the logic is a bit more complex, but it is possible
to do.

Fixes #185.
2021-12-27 21:14:09 +01:00
Tim Byrne
85e05d311a
Merge pull request #203 from jameshclrk/arch-alternative 2021-12-21 16:50:41 -06:00
Tim Byrne
99897124e6
Verify extension does not modify alt score 2020-12-22 10:51:23 -06:00
Tim Byrne
13a3cdc8a8
Remove reporting of invalid alts 2020-11-25 23:18:25 -06:00
James Clark
77d2da4e9b
Support architecture in alternates (#202) 2020-02-22 02:08:53 +00:00
Tim Byrne
66a3969c8a
Add unit tests for reporting invalid alternates (#183) 2019-12-04 17:36:43 -06:00
Tim Byrne
6a3199ceea
Support DISTRO in alternates (#72) 2019-10-06 16:35:47 -05:00
Tim Byrne
cfda485b34
Implement future alternate processing 2019-10-02 15:16:02 -05:00