Commit Graph

42 Commits

Author SHA1 Message Date
Gabriel Goller
762d1e9bc3 match_list: remove unsafe std::mem::transmute
By adding a lifetime to the `MatchList` trait, we don't need
to use unsafe code to transmute self anymore.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-10-19 11:07:24 +02:00
Wolfgang Bumiller
d7e1d50bfa buildsys: fix rebuild logic
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 10:16:53 +02:00
Wolfgang Bumiller
13145f729d bump version to 0.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 10:13:40 +02:00
Wolfgang Bumiller
9c16f1c85e buildsys: various improvements
- make deb and dsc targets phony and always rebuild the build/ dir
- add the build/*.{deb,dsc} files as targets without forcing a
  recreation of the build/ dir
- make upload target autodetect the distribution

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 10:13:40 +02:00
Wolfgang Bumiller
c18fcb9151 update d/copyright
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 10:01:08 +02:00
Wolfgang Bumiller
d4d7c0c5ae buildsys: add dsc target
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 10:00:38 +02:00
Wolfgang Bumiller
727b9339e3 bump edition to 2021
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 09:57:30 +02:00
Wolfgang Bumiller
17ac15fc3e minor cleanups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-24 09:54:49 +02:00
Gabriel Goller
4f065f7e73 match_list: updated matches(), to only retrieve file mode if necessary
Updated `matches()` function, which now takes the `GetFileMode` trait and returns a
Result. `GetFileMode` is a function that should return the `file_mode`. `matches()`
will go through the patterns and match by path only until it finds a pattern which
does not have `MatchFlag::ANY_FILE_TYPE`, in case it will call the
`get_file_mode`, which will return a `file_mode`. This will ensure that the
`get()` (which in our case executes `stat()`) will only be run once(at most),
every pattern will only be processed once and that the order of the patterns
will be respected. `GetFileMode` is also implemented for `Option<u32>` (so that
we can simply pass options of the `file_mode`) and `u32` (returning
`std::convert::Infallible`, so that we can pass a u32 mode directly).

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-08-24 09:50:44 +02:00
Fabian Grünbichler
8a0dce93d5 update d/control
after debcargo update

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-01-05 15:05:41 +01:00
Wolfgang Bumiller
fda9f89ee0 bump version to 0.1.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-29 11:59:05 +02:00
Wolfgang Bumiller
ca9b0e38e3 clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-29 11:56:18 +02:00
Wolfgang Bumiller
7e4c3e0987 clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-25 13:18:52 +02:00
Fabian Grünbichler
fcabdb9028 debcargo: fix maintainer directive
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-02-01 11:21:58 +01:00
Wolfgang Bumiller
0c9678fa78 doc fixups for intra-doc-links
because rustc 1.48 now supports them in stable

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-04 09:25:32 +01:00
Wolfgang Bumiller
2faab5045a tests for relative and absolute, anchored and unanchored mixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-11 13:56:23 +01:00
Wolfgang Bumiller
51f5c11e2b formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-08-28 09:00:43 +02:00
Wolfgang Bumiller
54ab179254 fix d/control recreation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-08-25 12:48:20 +02:00
Wolfgang Bumiller
da8de18073 build in subdir, add d/control, add upload target
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-08-25 10:30:53 +02:00
Wolfgang Bumiller
6a0e9c884a fix license identifier
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-14 11:55:25 +02:00
Wolfgang Bumiller
5d689e0444 ignore .cargo in Cargo.toml
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-14 11:50:49 +02:00
Wolfgang Bumiller
916e41c50e bump version to 0.1.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-09 14:32:22 +02:00
Wolfgang Bumiller
17b7bd9f3c Fix /**/ special case for beginning-of-text matching
Git actually skipped the next slash in the pattern. Since we
don't have a Component::Slash currently we'll just add a
flag to `do_match` instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-09 14:31:18 +02:00
Wolfgang Bumiller
f9fbdc3b94 pattern: drop unused component slice parameter
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-09 14:24:07 +02:00
Wolfgang Bumiller
37c4c9b20f typo and debug print fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-09 14:21:37 +02:00
Wolfgang Bumiller
865fa73fbc description fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-09 14:19:42 +02:00
Wolfgang Bumiller
8a186c18a5 bump version to 0.1.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-09 12:58:44 +02:00
Wolfgang Bumiller
68f4fe972d drop mut on self in MatchEntry::match_flags
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-09 12:09:29 +02:00
Wolfgang Bumiller
3b893e0346 fixup clean target in Makefile
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-04 11:30:32 +02:00
Wolfgang Bumiller
7ffe482dd5 add debian build files
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-03 13:32:09 +02:00
Wolfgang Bumiller
6d54e32c59 add .cargo/config to use local repos
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-03 13:30:33 +02:00
Wolfgang Bumiller
92591b0073 Relax MatchList to support slices of references
It must not consume `self`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-29 13:22:20 +02:00
Wolfgang Bumiller
909586e6ad document MatchList
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-29 12:50:28 +02:00
Wolfgang Bumiller
1d6ca6ca1b fix non-anchored literal matches starting with a slash
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-29 11:05:13 +02:00
Wolfgang Bumiller
1c51800f17 Replace MatchList type with a trait.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-29 09:42:13 +02:00
Wolfgang Bumiller
8e38a91c57 MatchEntry: also provide access to other parts
In the future we'll probably have a separate Builder type,
but that's an API change.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-20 12:37:05 +02:00
Wolfgang Bumiller
ed626f3831 MatchEntry: add mutable accessors
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-20 12:33:00 +02:00
Wolfgang Bumiller
e86ed76048 add MatchPattern::Literal
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-05-20 12:14:16 +02:00
Wolfgang Bumiller
e2255d72d1 Add MatchEntry::parse_pattern
This is a convenience helper to parse an entry with possible
inversion via a leading exclamation mark and interpreting
trailing slashes to mean `MatchFlag::MATCH_DIRECTORY` and
create a `Pattern` from the string with those characters
stripped off.

This also changes the way `MatchFlag`s are passed to a
builder pattern for convenience.

Also: impl std::ops::Not for MatchType.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-28 13:25:16 +02:00
Wolfgang Bumiller
b1a5365911 Pattern: strip triling slashes, forbid empty patterns
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-28 12:05:53 +02:00
Wolfgang Bumiller
96d7b7c74d MatchList::with_capacity and Into<Vec<MatchEntry>>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-27 16:54:38 +02:00
Wolfgang Bumiller
d5c0e44a9d initial import
Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
2020-04-27 12:46:59 +02:00