You are not logged in.

#1 2008-10-25 20:46:12

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

[Feature] view already installed package when pacman -Ss

Maybe I've miss something but when I pacman -Ss sth
I have a list of package related to this sth but it would be nice to know if it's already installed

Also yaourt include this feature already

Last edited by ChoK (2008-10-25 20:46:58)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#2 2008-10-25 21:12:26

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: [Feature] view already installed package when pacman -Ss

I don't think pacman can do that but since the feature you're referring to is already available in yaourt, maybe it's best if you just use that. smile

Offline

#3 2008-10-25 21:39:35

creslin
Member
Registered: 2008-10-04
Posts: 241

Re: [Feature] view already installed package when pacman -Ss

I think this might accomplish that, but it's really, really crude.  It was just the first thing that came to mind, so I'm sure there are more elegant ways of doing it.

pacman -Q $(pacman -Ss sth | grep '\/.*-' | awk '{print $1}' | sed -e 's|.*/||')

Of course, now it will probably be revealed that you can just do it with pacman -Xyz or some such cool
... and yes, turns out it's as simple as grabbing the pacman-contrib package mad

Last edited by creslin (2008-10-26 16:23:02)


ARCH|awesome3.0 powered by Pentium M 750 | 512MB DDR2-533 | Radeon X300 M
The journey is the reward.

Offline

#4 2008-10-25 22:02:00

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [Feature] view already installed package when pacman -Ss

Even if it is possible with yaourt, it's very KISS to have it in pacman smile
and loading package from aur is long when I actually don't want to see them (4 seconds loading + 1 second browsing through and getting to the interessant part ... yeah I'm lazy xD)

@creslin you're right it's ugly, but it has some charm as well (add some 1337 output converter and show off smile


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#5 2008-10-25 22:13:17

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: [Feature] view already installed package when pacman -Ss

ChoK wrote:

Even if it is possible with yaourt, it's very KISS to have it in pacman smile

I think you misunderstand what KISS means for Arch -- it is not about simplicity in the sense of ease/convenience for the end user, but about simplicity in the sense of the quality of the design.  Why add marginally useful functionalities to pacman directly when they can be easily realized with wrapper scripts?  Pacman is a KISS package manager because it doesn't try to do more than it needs to.

Offline

#6 2008-10-25 22:18:59

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: [Feature] view already installed package when pacman -Ss

ChoK wrote:

and loading package from aur is long when I actually don't want to see them (4 seconds loading + 1 second browsing through and getting to the interessant part ... yeah I'm lazy xD)

Well, to get around that you can use a "dirty" trick like setting http_proxy to something invalid like:

http_proxy=meow yaourt -Ss foo

@fwojciec: Well said. wink

Offline

#7 2008-10-25 23:56:44

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,403
Website

Re: [Feature] view already installed package when pacman -Ss

Or you can install "pacman-contrib" which are the contributed scripts distributed with the pacman sources.  Then run "pacsearch <package>"

Offline

#8 2008-10-26 14:12:59

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [Feature] view already installed package when pacman -Ss

I reread the Arch way, you are right

well I'll just stick with yaourt.


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#9 2008-10-26 14:16:42

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [Feature] view already installed package when pacman -Ss

Tupac (in the AUR) is a very fast yaourt wrapper, so you can get the results you want, even faster than using plain pacman.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#10 2008-10-26 14:48:38

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [Feature] view already installed package when pacman -Ss

finferflu wrote:

Tupac (in the AUR) is a very fast yaourt wrapper, so you can get the results you want, even faster than using plain pacman.

I just missed something... how can a wrapper around a wrapper around pacman be faster than pacman?


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2008-10-26 14:51:25

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: [Feature] view already installed package when pacman -Ss

Xyne wrote:
finferflu wrote:

Tupac (in the AUR) is a very fast yaourt wrapper, so you can get the results you want, even faster than using plain pacman.

I just missed something... how can a wrapper around a wrapper around pacman be faster than pacman?

lol it uses its own database, but uses yaourt to install packages.


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

#12 2008-10-26 16:56:57

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [Feature] view already installed package when pacman -Ss

Lol, and I have yaourt already wrapping powerpill. Sometimes speedy and bloaty make for a happy couple smile
If someone know the traduction of the french expression "usine à gaz" maybe gasworks
800px-Gas_Works_Park_03.jpg


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#13 2008-10-26 17:14:04

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [Feature] view already installed package when pacman -Ss

Here's a script that you can use to search the repos and see which of the results you already have installed:

#!/usr/bin/python

import sys
import os
import re

# colors
CURRENT_VERSION="\x1B[0;32m" # used if installed version is the current version 
OLDER_VERSION="\x1B[0;36m" # used if installed version is an older version
RESET="\x1B[0;39m" # the default color

def get_args():
    if len(sys.argv) > 1:
        return ' '+' '.join(sys.argv[1:])
    else:
        return ''


local_pkgs = {}
local_regex = re.compile('(\S+)\s+(\S+)\s*(?:\n|$)')
local_list = os.popen('pacman -Q').read().rstrip()
for match in local_regex.findall(local_list):
    (pkg,ver) = match
    local_pkgs[pkg] = ver


search_regex = re.compile('((\S*?/)(\S+)\s+(\S+)(.*?)\n(\s+.*?)(?:\n|$))')
search_list = os.popen('pacman -Ss'+get_args()).read().rstrip()
for match in search_regex.findall(search_list):
    (full,repo,pkg,ver,group,desc) = match
    if local_pkgs.has_key(pkg):
        if ver == local_pkgs[pkg]:
            print "%s%s%s %s%s\n%s" % (CURRENT_VERSION,repo,pkg,ver,RESET,desc)
        else:
            print "%s%s%s %s%s\n%s" % (OLDER_VERSION,repo,pkg,ver,RESET,desc)
    else:
        print full.rstrip()

Just pass it the search term that you would pass pacman. I've added 4 comments at the top to make it clear how to change the output colors if you want.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB