[pve-devel] [PATCH v2 pve-common 11/12] introduce PVE::Filesystem

2024-12-20 Thread Max Carrara
The PVE::Filesystem module implements filesystem manipulation operations. Currently, this is limited to two wrapper functions, but in the future anything that concernts itself with altering the filesystem should be added to it. This module can be seen as the "complement" to PVE::Path -- while PVE:

[pve-devel] [PATCH v2 pve-common 03/12] test: add tests for path_is_absolute and path_is_relative of PVE::Path

2024-12-20 Thread Max Carrara
Add cases for both functions, as they're each other's opposite. Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from patch 02 test/Path/Makefile | 1 + test/Path/path_is_absolute_relative_tests.pl | 122 +++ 2 files changed, 123 inser

[pve-devel] [PATCH v2 pve-common 04/12] test: add tests for path_components of PVE::Path

2024-12-20 Thread Max Carrara
Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from patch 02 test/Path/Makefile | 1 + test/Path/path_components_tests.pl | 159 + 2 files changed, 160 insertions(+) create mode 100755 test/Path/path_components_tests.pl diff --git

[pve-devel] [PATCH v2 pve-common 07/12] test: add tests for path_parent of PVE::Path

2024-12-20 Thread Max Carrara
What's important to note is that among the cases added are also some that specifically account for Perl's File::Spec->canonpath treating paths consisting of a single component that is neither "/" or "." as the same. This means that e.g. "foo" and "./foo" are both the same (canonpath returns "foo").

[pve-devel] [PATCH v2 pve-common 10/12] test: add tests for path_normalize of PVE::Path

2024-12-20 Thread Max Carrara
Add these tests solely to ensure that the behaviour of path_normalize stays consistent / stable in case we ever decide to provide our own implementation instead of wrapping File::Spec->canonpath(). Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from patch 02 test/Path/Makefile

Re: [pve-devel] [PATCH v1 pve-common 0/4] Introduce and Package PVE::Path & PVE::Filesystem

2024-12-20 Thread Max Carrara
On Thu Dec 19, 2024 at 7:31 PM CET, Max Carrara wrote: > Introduce and Package PVE::Path & PVE::Filesystem > = > Superseded by: https://lore.proxmox.com/pve-devel/20241220185207.519912-1-m.carr...@proxmox.com/ _

[pve-devel] [PATCH v2 pve-common 06/12] test: add tests for path_push of PVE::Path

2024-12-20 Thread Max Carrara
Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from patch 02 test/Path/Makefile | 1 + test/Path/path_push_tests.pl | 159 +++ 2 files changed, 160 insertions(+) create mode 100755 test/Path/path_push_tests.pl diff --git a/test/Path

[pve-devel] [PATCH v2 pve-common 09/12] test: add tests for file path ops functions of PVE::Path

2024-12-20 Thread Max Carrara
Add tests for the functions path_file_name, path_file_prefix, path_file_suffix and path_file_suffixes as well as their path_with_* counterparts. The cases defined here are a bit more elaborate than the others, because manipulating file names specifically is more insidious as one might think at fir

[pve-devel] [PATCH v2 pve-common 08/12] test: add tests for path_starts_with, path_ends_with, path_equals

2024-12-20 Thread Max Carrara
.. of PVE::Path. Each function has its test cases defined separately to avoid running unnecessary tests / repeating equivalent tests for certain things. Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from patch 02 test/Path/Makefile | 1 + test/Path/path_com

[pve-devel] [PATCH v2 pve-common 01/12] introduce PVE::Path

2024-12-20 Thread Max Carrara
The PVE::Path module concerns itself with file / directory path operations, like getting the parent directory of a path, extracting the file name of a path, splitting a path into its individual components, joining path components together, comparing paths, and so on. This module is added here in o

[pve-devel] [PATCH v2 pve-common 02/12] test: add directory for tests of PVE::Path module

2024-12-20 Thread Max Carrara
Add the test/Path directory as well as test/Path/Makefile, containing the scaffolding for tests regarding PVE::Path. Include test/Path as subdirectory in test/Makefile, so test/Path/Makefile runs when the other tests run, too. Signed-off-by: Max Carrara --- Changes v1 --> v2: * NEW: Split from

[pve-devel] [PATCH v2 pve-common 12/12] debian: introduce package libproxmox-fs-path-utils-perl

2024-12-20 Thread Max Carrara
This package contains both PVE::Path and PVE::Filesystem and is added in order to split off those two modules from the rest of libpve-common-perl from the get-go. Both modules are provided in one package because chances are, if one needs stuff from one module, they'll need stuff from the other mod

[pve-devel] [PATCH v2 pve-common 05/12] test: add tests for path_join of PVE::Path

2024-12-20 Thread Max Carrara
Add not just tests for the path_join function alone, but also a separate test subroutine that checks whether a joined path remains the same after splitting (with path_components) and joining it a second time. Because the path doesn't strictly have to be the *same string* after it is split and join

[pve-devel] [PATCH v2 pve-common 00/12] Introduce and Package PVE::Path & PVE::Filesystem

2024-12-20 Thread Max Carrara
Introduce and Package PVE::Path & PVE::Filesystem - v2 == Notable Changes Since v1 Incorporate Thomas's feedback [1] as much as possible. I was probably too eager to push this out yesterday and did notice many spots whe

Re: [pve-devel] [PATCH v1 pve-common 2/4] add tests for PVE::Path

2024-12-20 Thread Max Carrara
On Thu Dec 19, 2024 at 8:08 PM CET, Thomas Lamprecht wrote: > Am 19.12.24 um 19:31 schrieb Max Carrara: > > This commit adds a plethora of parameterized tests for all functions > > of PVE::Path (except aliases). This surmounts to 1050 tests being run > > in total. Some of these tests might perhaps