Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/topic/bbannier/issue-181'
Browse files Browse the repository at this point in the history
* origin/topic/bbannier/issue-181:
  Extend recognition of local Git repos
  Add `zkg.meta` to test package
  • Loading branch information
timwoj committed Mar 1, 2024
2 parents 4324265 + a53fed8 commit 0b99a94
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 6 deletions.
12 changes: 12 additions & 0 deletions CHANGES
@@ -1,3 +1,15 @@
3.0.1-3 | 2024-03-01 15:48:40 -0700

* Extend recognition of local Git repos (Benjamin Bannier, Corelight)

We previously would only recognize local Git repos for validation only
if their path started with `./` or `/`, even tough installation would
still find them without these prefixes.

Closes #181.

* Add `zkg.meta` to test package (Benjamin Bannier, Corelight)

3.0.1 | 2024-02-20 10:52:01 -0700

* Update github actions to checkout v3 and upload-artifact v4 (Tim Wojtulewicz, Corelight)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.1
3.0.1-3
2 changes: 1 addition & 1 deletion doc/man/zkg.1
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "ZKG" "1" "Feb 20, 2024" "3.0.1" "Zeek Package Manager"
.TH "ZKG" "1" "Mar 01, 2024" "3.0.1-3" "Zeek Package Manager"
.SH NAME
zkg \- Zeek Package Manager
.sp
Expand Down
2 changes: 2 additions & 0 deletions testing/baselines/tests.install-invalid/output
Expand Up @@ -4,3 +4,5 @@ error: invalid package ".": Package name 'trailing-whitespace ' is not valid.
error: path ./packages/doesntexist is not a git repository
error: path ./packages/notagitrepo is not a git repository
error: local git clone at ./packages/dirtyrepo is dirty
error: local git clone at dirtyrepo is dirty
error: local git clone at ./dirtyrepo is dirty
14 changes: 13 additions & 1 deletion testing/tests/install-invalid
Expand Up @@ -17,6 +17,18 @@ mkdir ./packages/notagitrepo
zkg --config=$CONFIG install --force ./packages/notagitrepo

mkdir ./packages/dirtyrepo
( cd ./packages/dirtyrepo && git init . && touch README && git add README && git commit -m "Initial commit")
(
cd ./packages/dirtyrepo && \
git init . && \
touch README && \
cat << EOF > zkg.meta
[package]
EOF
git add README zkg.meta && \
git commit -m "Initial commit"
)
echo README > ./packages/dirtyrepo/README
zkg --config=$CONFIG install --force ./packages/dirtyrepo

(cd ./packages && zkg --config=$CONFIG install dirtyrepo --force 1>&2)
(cd ./packages && zkg --config=$CONFIG install ./dirtyrepo --force 1>&2)
2 changes: 1 addition & 1 deletion zeekpkg/__init__.py
Expand Up @@ -9,7 +9,7 @@

import logging

__version__ = "3.0.1"
__version__ = "3.0.1-3"
__all__ = ["manager", "package", "source", "template", "uservar"]

LOG = logging.getLogger(__name__)
Expand Down
6 changes: 4 additions & 2 deletions zkg
Expand Up @@ -328,8 +328,10 @@ def active_git_branch(path):
return rval


def is_local_git_repo_url(git_url):
return git_url.startswith(".") or git_url.startswith("/")
def is_local_git_repo_url(git_url) -> bool:
return (
git_url.startswith(".") or git_url.startswith("/") or is_local_git_repo(git_url)
)


def is_local_git_repo(git_url):
Expand Down

0 comments on commit 0b99a94

Please sign in to comment.