You are not logged in.

#1 2010-02-02 20:47:35

partner55083777
Member
Registered: 2010-02-02
Posts: 10

[SOLVED] search just package name (not description) with yaourt

Is there a way to search just package names (not package descriptions) with yaourt or pacman?  I'm imagining something like this:

$ yaourt  -Ss  --pkgname-only  xterm

Thanks!

Last edited by partner55083777 (2010-02-03 16:30:43)

Offline

#2 2010-02-02 21:11:46

Skripka
Member
From: 2X1280X1024
Registered: 2009-02-19
Posts: 555

Re: [SOLVED] search just package name (not description) with yaourt

Fyi, using -Ss flags on Yaourt is known to not only be slow but very broken, and Yaourt will not return all or any results....or worse will return lots of search noise.

It will search for package name only...but you need to know the exact package name-i.e. "opera-devel" not just "opera"

Last edited by Skripka (2010-02-02 21:15:59)

Offline

#3 2010-02-02 22:09:41

partner55083777
Member
Registered: 2010-02-02
Posts: 10

Re: [SOLVED] search just package name (not description) with yaourt

My question still stands as to how I can search just package names.  If it is using another program other than yaourt or pacman, that is okay.

"yaourt -Ss SEARCH_STRING" has been working as stated in the documentation for me (with yaourt-0.9.2.6).  It will return all packages that have SEARCH_STRING in either the package name or package description.

Here are the first three results when running this command:

$ yaourt -Ss emacs
extra/emacs 23.1-3 [installed]
     The Emacs Editor
extra/snd 10.1-1
     Snd is the emacs of sound editor
extra/texmacs 1.0.7-3
     GNU TeXmacs is a free scientific text editor, which was both inspired by TeX
     and GNU Emacs. WYSIWYG editor TeX-fonts and CAS-interface (Giac, GTybalt,
     Macaulay 2, Maxima, Octave, Pari, Qcl, R and Yacas) in one.
...
$

It looks like it works as specified in the man pages:

-s, --search <'regexp'>
           This will search each package in the sync databases for names or descriptions that match regexp.
           When you include multiple search terms, only packages with descriptions matching ALL of those terms will be returned.

Last edited by partner55083777 (2010-02-02 22:10:24)

Offline

#4 2010-02-02 22:48:23

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] search just package name (not description) with yaourt

if you know the full and exact name... like, say you wanted to see quickly if emacs was available in the repos.

pacman -Ss ^emac$

seems to always give you the desired exact match on package name (or nothing).

on the other hand, if you were trying to find all packages named "^haskell-.*" this does not seem to work.  nor does it really obey the regex at all in my testing; i.e. ghc is matched which has only the word "Haskell" in the description which != ^haskell-.* IMO.

Offline

#5 2010-02-02 23:48:28

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [SOLVED] search just package name (not description) with yaourt

pacman -Sl | grep whatever

Offline

#6 2010-02-03 00:22:18

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] search just package name (not description) with yaourt

Profjim wrote:

pacman -Sl | grep whatever

-Sl needs a repo as an argument.

so maybe, pacman -Sl core extra community | grep whatever

but maybe pacman -Ssq whatever | grep whatever would be faster; make it a bash function for ease of use.

edit:

and...

pacnames() { pacman -Ssq "$*" | grep "$*"; }

Last edited by brisbin33 (2010-02-03 00:26:45)

Offline

#7 2010-02-03 01:16:21

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: [SOLVED] search just package name (not description) with yaourt

brisbin33 wrote:
Profjim wrote:

pacman -Sl | grep whatever

-Sl needs a repo as an argument.

pacman -Sl seems to work fine with no arguments and outputs all repos

Offline

#8 2010-02-03 14:00:07

partner55083777
Member
Registered: 2010-02-02
Posts: 10

Re: [SOLVED] search just package name (not description) with yaourt

pacman -Sl seems to work fine, albeit it is a bit slow.  pacman -Ssq whatever | grep whatever also works well.  Thanks!

But neither of these seem to work with yaourt and packages from AUR.  yaourt -Sl doesn't list any packages from AUR, even when you explicitly give the AUR repository (yaourt -Sl aur).

yaourt -Ss -q whatever | grep whatever also doesn't work for packages from AUR.  Their description is also output even with the -q flag.  But if you modify it a little bit, you can grep out their description:

yaourt -Ss -q whatever | grep whatever | grep -v "^    "


That seems to work, and answers my original question, but I am a little surprised that this functionality is missing from the pacman and yaourt programs.  This seems like something that other people would also be wanting.

If I submitted a patch for yaourt or pacman that implements this functionality, I wonder if it would be accepted?

Last edited by partner55083777 (2010-02-03 14:03:04)

Offline

#9 2010-02-03 14:47:32

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [SOLVED] search just package name (not description) with yaourt

You can do

yaourt -Ss --aur whatever | grep blah blah

Adding the -q switch to yaourt seems funky. For one thing, yaourt seems not to like "-Ssq", it needs "-Ss q". For another thing, when I do this (to yaourt-git, with some hacks of my own so maybe the fault is theirs):

yaourt -Ss -q pacman | grep namcap

I get back:

namcap/namcap ...

In other words, the repo is messed up.

I don't know how active yaourt development is going to be. The git repo stalled around Feb 2009, with a burst of 12 commits the following August,
then four small tweaks shortly afterwards. There are a couple of other community projects getting more attention. Paktahn and bauerbill have been especially active recently.

I'm still using yaourt myself, but will probably switch to another aur helper when I get a chance to review them.

Offline

#10 2016-07-21 17:15:06

lefsha
Banned
Registered: 2009-07-28
Posts: 22

Re: [SOLVED] search just package name (not description) with yaourt

OK. This thread is old, but the problem has remained.
Here is my solution:

search_in_AUR_byname:

#!/bin/bash

yaourt --color -Ss $1 | {
	found=0
	while IFS= read -r line; do
		if egrep -qv "^.\[0m    " <<< "$line"; then
			if egrep -q $1 <<< "$line"; then
				echo -e "$line"
				found=1
			else 	found=0
			fi
		elif [ $found -eq 1 ]; then echo -e "$line"
		fi
	done
}

P.S. Have a problem to post from ff because of Bad HTTP_REFERER issue.
Why it can't be ignored?

P.P.S. network.http.sendRefererHeader=2 and still doesn't work. bad site design.

Last edited by lefsha (2016-07-21 17:22:47)

Offline

#11 2016-07-21 17:23:20

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: [SOLVED] search just package name (not description) with yaourt

Nice solution.   And it falls under the exceptions of https://wiki.archlinux.org/index.php/Co … bumping.22 smile

As you point out, however, this is an ancient thread, so I will use this opportunity to close it.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB