pkg_find is used for 2 purposes:
- finding all packages in KISS_PATH that meet some criteria
- finding the first package in KISS_PATH that meets criteria
The first is the case for `kiss search` but the second is more common.
It is used everywhere to find the first package, that is, the package to
be used for builds, downloads, upgrades etc.
However, in both cases, every repo in KISS_PATH is scanned for the
package, which is unnecessary in the second case which only needs the
first match. Therefore, break after the first match in this case.
On my system, this results in a 2x speedup of `kiss U` (just the logic
to detect upgrades, exiting before prompting).
Without KISS_HOOK exported to the privileged process, certain hooks
can't be run (pre- and post-install at least). run_hook_pkg works, but
not KISS_HOOK. Make sure it's preserved.
Previously, having an extra colon in KISS_PATH causes / to be a
directory being searched in, so you could get things like
$ KISS_PATH=: kiss s usr
/usr
which is clearly incorrect.
move compression to its own function
use threads for (de)compression where possible
drop some useless flags
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/110
Reviewed-by: phoebos <phoebos@noreply.codeberg.org>
Co-authored-by: illiliti <illiliti@protonmail.com>
Co-committed-by: illiliti <illiliti@protonmail.com>
d47508c0 shifted some args down without updating the use of $2 and $3
later on.
Co-authored-by: phoebos <ben@bvnf.space>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/107
Co-authored-by: phoebos <phoebos@noreply.codeberg.org>
Co-committed-by: phoebos <phoebos@noreply.codeberg.org>
use dd for prompt since it will always exit upon receiving SIGINT
signal, unlike the read builtin, which, as permitted by POSIX, can
ignore this signal.
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/106
Co-authored-by: illiliti <illiliti@protonmail.com>
Co-committed-by: illiliti <illiliti@protonmail.com>
EOF is defined by POSIX to cause read to return an error, and works with
every shell while SIGINT (Ctrl+C) does not (eg. with yash).
Co-authored-by: phoebos <ben@bvnf.space>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/105
Co-authored-by: phoebos <phoebos@noreply.codeberg.org>
Co-committed-by: phoebos <phoebos@noreply.codeberg.org>
If you run `kiss outdated .`, everything works but the cached SVGs are
all dumped into ~/.cache/kiss/repology/ rather than
~/.cache/kiss/repology/repo/. Fix this by getting the repo name from PWD.
Co-authored-by: phoebos <ben@bvnf.space>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/101
Co-authored-by: phoebos <phoebos@noreply.codeberg.org>
Co-committed-by: phoebos <phoebos@noreply.codeberg.org>
Not really necessary considering it occurs only when files are actually invalid
Example with manually broken linux package:
```
λ time ./kiss i linux > /dev/null
-> linux Checking if manifest valid
ERROR linux manifest contains 16997 non-existent files
Command exited with non-zero status 1
real 0m 0.57s
user 0m 0.15s
sys 0m 0.42s
```
```
λ time kiss i linux > /dev/null
-> linux Checking if manifest valid
ERROR linux manifest contains 16997 non-existent files
Command exited with non-zero status 1
real 1m 10.04s
user 1m 7.94s
sys 0m 2.08s
```
Co-authored-by: git-bruh <e817509a-8ee9-4332-b0ad-3a6bdf9ab63f@aleeas.com>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/91
As discussed in kiss-community/repo#100 and #39, we seem to be in favor of switching to blake3.
The following changes are made:
- All newly generated checksums are blake3
- The user is prompted to generate blake3 checksums if sha256 sums are present (maybe this should be automatic)
- For installed packages, we can fall back to sha256 to check etcsums
This includes a name change of the `checksums` and `etcsums` files -- I'm not sure of any better way to detect whether sha256 sums are in use, as blake3 sums are the same length.
Feedback is appreciated
Co-authored-by: Owen Rafferty <owen@owenrafferty.com>
Reviewed-on: https://codeberg.org/kiss-community/kiss/pulls/72
If KISS_PATH=:: or even KISS_PATH=:/repo1:/repo2, the `IFS=:; set -- $KISS_PATH`
trick leaves some of $@ as empty strings. These cause git to print errors.
Instead, skip empty arguments.
Demonstration of bug:
$ cd
$ KISS_PATH=::: kiss u 2>&1 | sed '/Checking/q'
-> Updating repositories
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
-> Checking for new package versions
The git commands producing the errors are:
git -C "" rev-parse 'HEAD@{upstream}'
and when the argument to -C is empty, the current working directory is
unchanged. Therefore, if PWD happens to be inside a git tree, this
command could have unexpected effects: currently, if KISS_PATH contains
(an) extra colon(s), and PWD is in a git repo with an upstream, the repo
is updated irrespective of whether it is in KISS_PATH or a package repo.
This behaviour is also fixed by this commit.