Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Command-not-found hook
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Fri Nov 01, 2013 5:23 pm    Post subject: Command-not-found hook Reply with quote

Hello guys,

I have been looking on the internet for HOURS but failed to see anything related to a command-not-found hook for gentoo... (for zsh). Am I missing something or is this impossible?

For those who dont know: "command-not-found hook" refers to configuring zsh to detect if a command does not exist, and then suggesting packages in which this command is found.

In archlinux you can get this by installing pkgfile and then adding a line into your zshrc file so that it loads.

Thanks in advance!
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Mon Nov 04, 2013 10:52 am    Post subject: no one????? Reply with quote

Is this question really this ridiculous that no one even says that its a stupid question???????? :? :cry:
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 04, 2013 11:40 am    Post subject: Reply with quote

https://github.com/metti/command-not-found/ is in the mv overlay as app-shells/command-not-found; see http://wiki.gentoo.org/wiki/Layman for overlay instructions, don't forget to edit make.conf accordingly and then it should be something along the lines of
Quote:
emerge app-portage/layman
layman -a mv
layman -S
to add the mv overlay.
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Mon Nov 04, 2013 12:54 pm    Post subject: Reply with quote

Why thank you kindly sir! I always thought those overlay things are some kind of malicious software :S
Now i also understand what people exactly mean by bumblebee overlay!! :D

thanks again and have a nice day!
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 04, 2013 1:07 pm    Post subject: Reply with quote

Well, just be on your guard; most are with good intent, but since anyone can do anything in them don't run at them with your eyes closed.

Take a look at `man make.conf` at the FEATURES that you can configure; some can restrict what ebuilds can do, like the sandbox and user* ones.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Nov 04, 2013 1:12 pm    Post subject: Reply with quote

Unfortunately, command-not-found uses the arch database.
It would be nice if somebody would write some analogous thing for gentoo, but unfortunately for gentoo this is not so simple:
One would have to use e.g. the portagefilelist.de database, but this either means an online access for every typo (which IMHO is not so good, although perhaps in some cases to have this option is nice) or to download the corresponding database locally. I do not know whether the latter is technically simple and juristically possible. In addition some means would have to be provided to update the local database.
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 04, 2013 1:29 pm    Post subject: Reply with quote

We have app-portage/pfl which contains e-file for that.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Nov 04, 2013 3:26 pm    Post subject: Reply with quote

TomWij wrote:
We have app-portage/pfl which contains e-file for that.

But if this would be bound to command-not-found this would mean an online request to database for every typo. This produces a lot of undesired traffic. It can even be a security issue if you use it for "trusted" users which should better not access the internet at all.
In contrast, command-not-found downloads the full database to the local machine which makes more sense for such an approach IMHO.
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 04, 2013 3:37 pm    Post subject: Reply with quote

Yeah, I see that they host snapshots to download so I guess it could be adapted to use it locally.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Nov 04, 2013 6:59 pm    Post subject: Reply with quote

TomWij wrote:
Yeah, I see that they host snapshots to download so I guess it could be adapted to use it locally.

Yes, but somebody would have to write the code to download it and update and query the local database. I will probably not have the time to do that now. Moreover, I am not sure how this is concerning legal matters and whether they would like it and their server would stand it if there is such a tool which does this automatically, since probably there is a reason why they have written "use with care" above the snapshot...
Back to top
View user's profile Send private message
TomWij
Retired Dev
Retired Dev


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Mon Nov 04, 2013 8:49 pm    Post subject: Reply with quote

mv wrote:
TomWij wrote:
Yeah, I see that they host snapshots to download so I guess it could be adapted to use it locally.

Yes, but somebody would have to write the code to download it and update and query the local database. I will probably not have the time to do that now. Moreover, I am not sure how this is concerning legal matters and whether they would like it and their server would stand it if there is such a tool which does this automatically, since probably there is a reason why they have written "use with care" above the snapshot...


wget in a cron once a week; legal is okay as they provide it, shouldn't hurt their servers but probably should be checked up with them, otherwise mirroring it could be appropriate; then simply open the database and run a query against it. The code involved is as long as one of our posts; but indeed, how often to download it and having reliable hosting that one is permitted to use for this purpose are more concerning matters.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum