paru icon indicating copy to clipboard operation
paru copied to clipboard

[feat] `.Url` git subdir instead of `.Depth`

Open loynoir opened this issue 1 year ago • 3 comments

Have you checked the readme and man page for this feature?

Yes.

Have you checked previous issues for this feature?

Yes.

feat

.Url git subdir instead of .Depth

current

~/.config/paru/paru.conf

[foo]
Url = https://example.com/user/repo.git
Depth = 3

[bar]
Url = https://example.com/user/repo.git
Depth = 3
$ paru -Sql --pkgbuilds foo
foo-x
foo-y
bar-x
bar-y
$ paru -Sql --pkgbuilds bar
foo-x
foo-y
bar-x
bar-y

feat

support subdir

~/.config/paru/paru.conf

[foo]
Url = "https://example.com/user/repo.git#subdirectory=foo"
Depth = 2

[bar]
Url = "https://example.com/user/repo.git#subdirectory=bar"
Depth = 2
$ paru -Sql --pkgbuilds foo
foo-x
foo-y
$ paru -Sql --pkgbuilds bar
bar-x
bar-y

prior art

https://stackoverflow.com/questions/13566200/how-can-i-install-from-a-git-subdirectory-with-pip

https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support

python -m pip install -e 'git+https://git.repo/some_pkg.git#egg=SomePackage'          # from git
python -m pip install -e 'hg+https://hg.repo/some_pkg.git#egg=SomePackage'            # from mercurial
python -m pip install -e 'svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage'         # from svn
python -m pip install -e 'git+https://git.repo/some_pkg.git@feature#egg=SomePackage'  # from 'feature' branch
python -m pip install -e 'git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path' # install a python package from a repo subdirectory

loynoir avatar Sep 26 '24 02:09 loynoir

How about going by package name instead of path?

Having a Pkg = foo bardirective so you can pick which packages you want from a repo without having to know the actual path.

Morganamilo avatar Sep 26 '24 07:09 Morganamilo

Actually, the foo bar here is category, not package name.

For example, something like below

$ cd repo
$ fd PKGBUILD
admin/admin-a/PKGBUILD
admin/admin-b/PKGBUILD
container/container-a-preset/PKGBUILD
container/container-b-preset/PKGBUILD
shellscript-tools/shellscript-a/PKGBUILD
shellscript-tools/shellscript-b/PKGBUILD
third_party/stable/stable-a/PKGBUILD
third_party/stable/stable-b/PKGBUILD
third_party/unstable/unstable-a/PKGBUILD
third_party/unstable/unstable-b/PKGBUILD

Would be nice to per category per section. :)

[admin]
Url = "https://example.com/user/repo.git#subdirectory=admin"
Depth = 2

[container]
Url = "https://example.com/user/repo.git#subdirectory=container"
Depth = 2

[shellscript-tools]
Url = "https://example.com/user/repo.git#subdirectory=shellscript-tools"
Depth = 2

[third-party-stable]
Url = "https://example.com/user/repo.git#subdirectory=third_party/stable"
Depth = 2

[third-party-unstable]
Url = "https://example.com/user/repo.git#subdirectory=third_party/unstable"
Depth = 2

loynoir avatar Sep 26 '24 08:09 loynoir

Yeah that makes more sense for subdirs. Though I think it would still be cleaner to make it a directive than part of the URL itself.

Morganamilo avatar Sep 26 '24 08:09 Morganamilo