Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An option to limit expac to search only specified repos via -S. #24

Open
Earnestly opened this issue Sep 13, 2015 · 6 comments
Open

An option to limit expac to search only specified repos via -S. #24

Earnestly opened this issue Sep 13, 2015 · 6 comments

Comments

@Earnestly
Copy link

This is related to issue #23.

I would like to limit expac to search only specific repositories when
specifying -S.

As a work around for this I am instead prefixing the repo name (%r) and using
that as a marker for awk which then prints the remaining column. E.g.

expac -S '%r %n:%E' -l ':' < <(pacman -Sql "$repo") | awk -v repo="^$repo" '$1 ~ repo { print $2 }'

Ideally I would like to constrain -S to the defined $repo above via
something like expac -S --repo=$repo ....

Any thoughts?

@AladW
Copy link

AladW commented Apr 19, 2016

Actually you can do this already by specifying the repo name to expac with repo/package pairs. So in case package names are available from several repos, this would work in theory:

pacman -Sl "$1" --print-format='%r/%n' | expac -S '%n %E' -

However, --print-format doesn't work with --list for some reason. pacsift does work:

pacsift --exact --repo="$1" | expac -S '%n %E' -

Note the - after expac so it takes values from stdin, rather than print every sync package. You might also want xargs -r as pacsift returns 0 with no output on a non-existing or empty repo:

pacsift --exact --repo="$1" | xargs -r expac -S '%n %E' -

@Earnestly
Copy link
Author

Earnestly commented Apr 19, 2016

Oh that's nice. pacsift is quite useful here. I've switched to this for the repo-cycle-detector instead, thanks for that.

Perhaps the issue of pacsift not returning zero on non-extant repos should be regarded as a bug? @andrewgregory

@andrewgregory
Copy link
Contributor

I'm not sure what you think having pacsift return non-zero would do here. If you use expac in a pipe it will run regardless of what pacsift returns. What needs to happen is that expac needs to be changed to not fallback to all packages when - is given with empty stdin.

@Earnestly
Copy link
Author

Earnestly commented Apr 19, 2016

Sorry, I didn't mean to talk about return values, I'm being a bit of a derp lately. Yes you're exactly right, if expac ... /dev/stdin or expac ... - is used it shouldn't fallback to all packages if empty.

@AladW
Copy link

AladW commented May 2, 2016

For the stdin issue, see #29

@falconindy
Copy link
Owner

So this is basically a dupe of #29? Or is there something else that needs to be addressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants