How to Return List of Packages from Pacman/Yaourt Search

----EDIT----
Changed the name of the script from pacsearch to pacdot.
Apparently yaourt -Ssaq does this, so this script isn't as necessary as I thought. Although, I still find using pacdot -w to open the results in a text document helpful.
----/EDIT----
This isn't a question; it's a script I wrote. I thought someone else might find this useful.
I keep finding myself searching with pacman or yaourt and wishing I could get just the package names, not all of the extra stuff. For example, I'd love to be able to run yaourt -Sa $(yaourt -Ssa package). It doesn't seem like pacman and yaourt have an option for this (not that I can tell, at least), so I wrote a python script to do it. Copy it if you'd like. You can name it what you want, but I'll refer to it as pacdot.py.
pacdot.py package will be like yaourt -Ssa package but only list the package names.
I added a few extra options:
pacdot.py -o package will only list results from the official Arch repositories, not the AUR.
pacdot.py -i package will install all the found packages. If you've ever thought about running something like yaourt -Sa $(yaourt -Ssa package), that's what this command does.
pacdot.py -w package will:
Create a file called 'the-package-you-searched.txt',
Write an example command that would install the found packages,
(yaourt -Sa all-of-the-results),
Write each result on a new line, and
Open the file for you (with your default text editor).
Here's the code:
#!/bin/python3
import argparse
import re
from subprocess import Popen, PIPE, call
from collections import deque
desc = ''.join(('Search the official Arch and AUR databases ',
'and return package names only. ',
'e.g.: `pacdot.py arch` will return "arch", ',
'whereas `$ yaourt -Ssa arch` will return ',
'"community/arch 1.3.5-10',
' A modern and remarkable revision control system."'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('package',
help='Package to search with pacman')
parser.add_argument('-o', '--official', action='store_true',
help='Search official repositories only, not the AUR')
parser.add_argument('-i', '--install', action='store_true',
help='Install found packages')
parser.add_argument('-w', '--write', action='store_true',
help='Write to file')
#Set args strings.
args = parser.parse_args()
pkg = args.package
official_only = args.official
install = args.install
write = args.write
# Do yaourt search.
package_search = Popen(['yaourt', '-Ssa', '%s' % pkg], stdout=PIPE).communicate()
# Put each found package into a list.
package_titles_descs = str(package_search[0]).split('\\n')
# Strip off the packages descriptions.
package_titles = [package_titles_descs[i]
for i in range(0, len(package_titles_descs), 2)]
# Remove empty item in list.
del(package_titles[-1])
# Make a separate list of the non-aur packages.
package_titles_official = deque(package_titles)
[package_titles_official.remove(p)
for p in package_titles if p.startswith('aur')]
# Strip off extra stuff like repository names and version numbers.
packages_all = [re.sub('([^/]+)/([^\s]+) (.*)',
r'\2', str(p))
for p in package_titles]
packages_official = [re.sub('([^/]+)/([^\s]+) (.*)',
r'\2', str(p))
for p in package_titles_official]
# Mark the aur packages.
# (Not needed, just in case you want to modify this script.)
#packages_aur = packages_all[len(packages_official):]
# Set target packages to 'all' or 'official repos only'
# based on argparse arguments.
if official_only:
packages = packages_official
else:
packages = packages_all
# Print the good stuff.
for p in packages:
print(p)
if write:
# Write results to file.
filename = ''.join((pkg, '.txt'))
with open(filename, 'a') as f:
print(''.join(('Yaourt search for "', pkg, '"\n')), file=f)
print('To install:', file=f)
packages_string = ' '.join(packages)
print(' '.join(('yaourt -Sa', packages_string)), file=f)
print('\nPackage list:', file=f)
for p in packages:
print(p, file=f)
# Open file.
call(('xdg-open', filename))
if install:
# Install packages with yaourt.
for p in packages:
print(''.join(('\n\033[1;32m==> ', '\033[1;37m', p,
'\033[0m')))
Popen(['yaourt', '-Sa', '%s' % p]).communicate()
Last edited by GreenRaccoon23 (2014-12-22 19:17:37)

expac works only with official and unofficial repos, not with the AUR, but it's very nice.
Adding  '-q' should help, grep to weed out false positives.
yaourt -Sa $(yaourt -Ssaq pulse)
works, but
$ yaourt -Sa $(yaourt -Ssaq chrome)
resolving dependencies...
looking for inter-conflicts...
warning: removing 'chromium' from target list because it conflicts with 'chromium-no-sse2'
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: chromium-no-sse2 and chromium-scroll-pixelGs are in conflict
so at least
$ yaourt -Sa $(yaourt -Ssaq chrome|grep google)
is needed.
Edit: Also:
$ LC_ALL=C TZ=GMT0 diff -Naur /usr/bin/pacsearch /usr/local/bin/pacsearch
--- /usr/bin/pacsearch 2014-11-21 11:20:37.000000000 +0000
+++ /usr/local/bin/pacsearch 2014-12-21 08:21:14.758856006 +0000
@@ -84,7 +84,7 @@
my %allpkgs = ();
-my $syncout = `pacman -Ss '@ARGV'`;
+my $syncout = `pacman -Ssq '@ARGV'`;
# split each sync search entry into its own array entry
my @syncpkgs = split(/\n^(?=\w)/m, $syncout);
# remove the extra \n from the last desc entry
@@ -110,7 +110,7 @@
$allpkgs{$pkgfields[1]} = [ @pkgfields ];
-my $queryout = `pacman -Qs '@ARGV'`;
+my $queryout = `pacman -Qqs '@ARGV'`;
# split each querysearch entry into its own array entry
my @querypkgs = split(/\n^(?=\w)/m, $queryout);
# remove the extra \n from the last desc entry
$ /usr/local/bin/pacsearch pulse
libpulse
pulseaudio
libao
libcanberra-pulse
libpulse
paprefs
pavucontrol
pulseaudio
pulseaudio-alsa
floyd
libcec
mate-media-pulseaudio
mate-settings-daemon-pulseaudio
ponymix
projectm-pulseaudio
Although why not simply use pacman or expac?
Last edited by karol (2014-12-21 08:26:48)

Similar Messages

  • How to return List or Array from Web Service without using ADF?

    All,
    I would like to know how to do this before I use ADF. Sounds like a simple thing to do - common even - but I haven't found a solution in existing postings. My attempts have failed though I'm not sure exactly why.
    I have created a declarative WS that takes a single parameter and tries to return a List<Employees> resultset. My Sample Java Client works just fine. When I change the result type from List to String[], for example, it also works fine.
    What am I doing wrong??
    Thanks
    package wizard;
    (imports removed for readability)
    @WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
    @Deployment(restSupport = true)
    public class HelloWorld {
    List<Employees> employees = null;
    public HelloWorld() {
    public List<Employees> sayHello (String s) {
    try {
    final Context context = getInitialContext();
    ATOABPFacade aTOABPFacade = (ATOABPFacade)context.lookup("ATOABPFacade");
    employees = aTOABPFacade.queryEmployeesFindByName(s);
    return employees;
    } catch (Exception ex) {
    ex.printStackTrace();
    return employees;
    private static Context getInitialContext() throws NamingException {
    return new InitialContext();
    Trace:
    Ready message received from Oc4jNotifier.
    Embedded OC4J Server startup time: 24063 ms.
    Target URL -- http://localhost:8988/JPA-Wizard-context-root/mywebservice1soaphttpport
    Feb 18, 2008 7:42:49 PM com.evermind.server.ServerBase log
    WARNING: JPA-Wizard-webapp: Error preloading servlet
    javax.servlet.ServletException: java.lang.NullPointerException
         at oracle.j2ee.ws.server.provider.ProviderServlet.init(ProviderServlet.java:186)
         at javax.servlet.GenericServlet.init(GenericServlet.java:241)
         at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2674)
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5162)
         at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5085)
         at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5275)
         at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1357)
         at com.evermind.server.http.HttpApplication.init(HttpApplication.java:873)
         at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:699)

    Gi,
    not sure what you are doing there, but you can build the J2EE WebService from your working POJO, and create a Web Service proxy class from the WSDL description (of the deployed or local WSDL file). Then, using the proxy class, you can access the output of the WebService.
    Frank

  • How to execute an ODI package from Command Line

    Please can anyone help me to know how to execute an ODI package from the command line without creating a scenario from the package.
    Appreciate your help.
    Thanks
    B

    You can't. Create a scenario and then execute that from the command line.

  • How to return a ref cursor from this dbms_sql?

    Hi,
    Can anyone show me how to return a ref cursor from this dbms_sql based procedure? I see 11g has a dbms_sql.to_refcursor(cursor_handle). How can this be done is 10g?
    Thx.
    CREATE OR REPLACE PROCEDURE Sample_Get_t
    p_sample_id sample.sample_id%TYPE,
    p_contract_id sample.contr_id%TYPE
    IS
    cursor_handle INT;
    sql_stmnt varchar2(500);
    rows_processed NUMBER;
    BEGIN
    sql_stmnt :=
    'SELECT
    sample_id,
    contr_id,
    rcpt_id
    FROM
    sample s
    WHERE
    s.contr_id = :1
    and s.sample_id = :2
    ORDER BY
    sample_id';
    cursor_handle := dbms_sql.open_cursor;
    dbms_sql.parse(cursor_handle, sql_stmnt, dbms_sql.native);
    dbms_sql.bind_variable(cursor_handle, ':1', p_contract_id);
    dbms_sql.bind_variable(cursor_handle, ':2', p_sample_id);
    rows_processed := dbms_sql.execute(cursor_handle);
    dbms_sql.close_cursor(cursor_handle);
    END Sample_Get_t;

    In 10 this cannot be done with dbms_sql (to my knowledge). There are a couple of other options.
    1) open the ref cursor for the dynamic statement using bind variables (or SYS_CONTEXT variables, which i prefer since they are much easier to deal with when you are dynamically adding predicates).
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = :Logged_in_user' using user;
    end;
    /or using the context (the context will bind for you)
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = SYS_CONTEXT(''CONTEXT_NAME'', ''VARIABLE_NAME'') ';
    end;
    /Be aware that contexts ALWAYS return varchar values, so if you are comparing to a number you should wrap it in TO_NUMBER, a date, TO_DATE and so on....
    2) change the DBMS_SQL to do an insert into a global temporary table and return the ref cursor which select's * from GTT;
    3) upgrade to Oracle 11 :)

  • How to make a ARCH package from local folder?

    hello ARCH lovers
    I can't seem to figure out how to make a installable
    package from a folder on my desktop?
    Coming from Slackware; the procedure would be simple enough just issuing
    "makepkg /root/pkgname.txz"
    Now; how would I do the same in ARCH?
    I know about PKGBUILD, etc but there is no source or any url's
    I just need to make it into a .pkg.tar.xz
    The package is my "kernel-live-kit" for both x86 and x86_64 versions of arch
    enabling one to remaster there existing install into a livecd/usb, etc
    The kernel itself is kernel26-zen from AUR
    http://aur.archlinux.org/packages.php?ID=30330
    however; mine is quite different and also includes all components to make the livecd using modified linux-live-6.3.0
    scripts and special stuff
    The pkg includes a premade kernel with modules and full kernel source
    The resulting live media is similar to my nFluxOS builds
    http://multidistro.com/
    As I will be releasing the new four horsemen of nFluxOS today; I also made 4 Kernel pkg's for the arch and slack versions
    Those will be for x86/x86_64 versions for both arch and slackware
    I did this in lieu of creating a quartet of x86_64 versions of nFluxOS; as that would up the number of versions to 8
    and I would then have to maintain 8 distro's instead of 4.
    I made a testing version of ARCH x86_64 live
    http://www.linuxquestions.org/questions … ost4017796
    so, I really need to make the ARCH x86 and x86_64 kernel kits into installable pkg's because there are many symlinks that would get corrupted if I just tarred it and then the end user untars it and copies it somewhere it would mess up the symlinks.
    as I said, in slackware I do makepkg and it creates a script named "doinst.sh" that makes all the symlinks, etc
    so, any help appreciated!
    thanks

    You can read a simple introduction to using the ABS here.
    By the way, it's not hard. Out of all the distributions I've used, Arch Linux is the only one I've figured out how to make packages for.

  • [SOLVED] Exclude a package from pacman database without uninstalling

    Hi all,
    I have heroes of newerth installed from AUR and I would like to detach this package from the database so it doesnt get updated when I use packer, the reason is because when an update occurs, I have to download the whole game again, and if I dont update the game prompts me to update when I login and I get only the patch (which results in a 2 minutes download instead of an hour download)
    So what I want to do Is tell pacman or packer that this package should be tracked an updated anymore, how can I do that?
    cheers and thanks for the help
    Last edited by 655321 (2011-08-26 22:02:51)

    mcmillan wrote:
    From man pacman
    TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
    -k, --dbonly
    Adds/Removes the database entry only, leaves all files in place.
    This would probably be a more proper way than just deleting the files from /var/lib/pacman/local. Though it may be best to reinstall it outside of pacman like Karol suggested just to be sure nothing is inconsistant.
    I didn't say it, Stebalien did ;P but I too think it would be the best choice.

  • How to return a single datetime from multiple rows of MAX(value) in DAX

    Hi
    I have a Results table with ResultTime, Balance, Equity which is updated with a new row every 5 minutes. I've used SUMX to find opening and closing balances and it has worked so far.
    Res_OpeningBalance:=SUMX(TOPN(1,Results,Results[ResultTime],1),[Balance])
    Res_ClosingBalance:=SUMX(TOPN(1,Results,Results[ResultTime],0),[Balance])
    But when I tried it with dates, the whole thing fell apart.
    Res_MaxBalance_Date:=SUMX(TOPN(1,Results,Results[Balance],0),[ResultTime])
    Since the highest Balance is likely to be represented through many rows due to it lasting more than 5 minutes, ResultTime (which is unique to each row) is summed up and returns messed up dates well into the future. How to return only one date (first or last
    datetime) from the rows where Balance is at max?
    I tried a TOPN of TOPN, but Excel was not amused.
    =SUMX(TOPN(1,Results,Results[Balance],0),TOPN(1,Results,Results[ResultTime],0))
    TIA!
    Re
    Dennis

    I still don't understand RANKX, but I figured it out anyway. I get the correct data by using:
    Res_MaxBalance:=MAX(Results[Balance])
    Res_MaxBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MAX(Results[Balance])))
    Res_MinBalance:=MIN(Results[Balance])
    Res_MinBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MIN(Results[Balance])))
    Res_MaxEquity:=MAX(Results[Equity])
    Res_MaxEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MAX(Results[Equity])))
    Res_MinEquity:=MIN(Results[Equity])
    Res_MinEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MIN(Results[Equity])))
    Re
    D

  • How to return the entire row from a table

    Hi guys,
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100),
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    Now how can i return the entire row from table A with the datatype and its length.
    Any help would be appreciated ?
    Here is the query I wrote but it how to take the datatype and its length..
    create or replace procedure disp_table_data
    as
    type r_cursor is REF CURSOR;
    c_A r_cursor;
    er A%rowtype;
    begin
    open c_A for select * from A;
    loop
    fetch c_A into er;
    exit when c_A%notfound;
    dbms_output.put_line(er.FirstName||'--'||er.Age);
    end loop;
    close c_A;
    END;
    /

    Guys,
    I want column value from table A and its corresponding data_type and length from table B. I think I cant do it through joins.
    Any idea would be appreciated ?.
    Example ..
    Tabl A
    FirstName varchar2(10),
    Age Number,
    Add varchar2(100)
    insert into A values('John',24,'Boston');
    Table B
    Filedname varchar2(200), -- contains all the fields of table A
    Datatype varchar2(100), -- Contains the datatypes of the filedname
    Length Number -- contains the length of the fileds
    insert into B values('FirstName','varchar2',10); -- this is coming from table A.
    Output should be like this...
    John,Varchar2,10
    Here (John is the FirstName - coming from table A, Varchar2 is a Datatype and 10 is the Length which are coming from table B ). Only column values are coming from table A , corresponding datatype and length are coming from B.
    Any idea would be appreciated ?
    Thanks.

  • How to return a entire table from a Function in Oracle?

    Can anyone pls let me know if there is some way to return an entire table from a function which is called from a stored procedure?
    Thanks

    > Can anyone pls let me know if there is some way to return an entire table from a function which
    is called from a stored procedure?
    For what purpose?
    Do you realise that this means pulling Megabytes (or even many Gugabytes) of data from disk, into the buffer cache, and then copying that data into PL/SQL memory (using a function) in order to give a stored proc that data?
    This is just plain crazy.. resource wise, performance wise, scalability wise.. this is exactly how NOT to use Oracle.
    Why don't you instead tell us what problem you want to solve. Forget for the moment what you think the solution should be. (and asking us how to get a potentially flawed solution, to work)
    Let's get an accurate problem definition so that we can provide you with suggestions and recommendation on what Oracle features can be used to address that problem.

  • Where used List for Packages (from Transport connection)

    Hi SDN,
    If objects , such as queries, or webtemplates, are incorrectly allocated to a BEx package at the beginning, my question is as follows:
    Can we find out which objects/queries/templates have been allocated to a particular package?
    Via some table, or where used list?
    As we have a global system, we are performing this task for many developers who have incorrectly used packages from the start.
    Thank you.
    Simon

    Hi Khaja,
    That is perfect!  I am tracking the various element objects
    ELEM
    TMPL
    QVIW
    etc...
    Would you happen to know if it is possible to mass change objects to the correct package and transport through.
    Thank you.
    Simon

  • How to return a bool value from MyBrokerProcess

    To make MyPlugin work in Adobe Reader X in Protected Mode On, i have created a Broker Process(MyBrokerProcess.exe)
    Plugincode(C++)--->BrokerProcess(C#)---->Helper(C#)
    MyPlugin has 4 button, when i click on each button a Window(System.Window.Form) will open and perform its task.
    1.While i trying to close the ActivePDF document , if any of the Windows(System.Window.Form) is open i will display the message saying("Choose YES to Close this Window first Before Closing the ActiveDoc and Choose NO to continue without closing Window and ActiveDoc"). This is taken care in Helper Class(C#)
    2.If the user choose "Yes", then the Helper functin will return 'true' to MyBrokerProcess.
    3.Inturn  MyBrokerProcess has to return this bool value to the PluginCode(C++) which is the only place to  access Acrobat API function to close the ActiveDocument.
    Now i am clueless as to how i have to return this bool value from MyBrokerProcess to PluginCode. Or is there any other way to accomplish the above task. Please some one help me to solve this issue.
    Thanks in advance.

    Hi Richard,
    This is what i tried to do. But i couldnot make MyPlugin work in Protected Mode On.
    Plugincode(C++)<--->BrokerProcess(C#)<---->Helper(C#)
    I added a simple Process between Plugin(C++)code and Helper(C#)code.
    Previously it was like
    Plugincode(C++) <----> Helper(C#)
    Thanks and Regards,
    Chetan.

  • How do I update/install packages from a CD?

    Hello,
    I am new to Arch Linux. Kindly excuse me if this task is very trivial. I have installed the base system and updated it using pacman -Syu. I also installed all the other software packages using pacman -S <packagename>. Now I want to burn a CD containing all these updates and packages so that I can make a similar installation later on other systems which are not connected to the internet. I am not able to figure out how this can be done.
    I need to upgrade the system and install all the packages I have on the CD by giving minimum number of commands at the command line. This helps me install Arch Linux on a large number of machines in a very short time.
    Thanks for your help.

    If you're talking about batch installing packages, the method you suggested
    will work for every package in the current directory.

  • How to remove list of events from sidebar?

    I have the latest iPhoto and have just installed Aperture.
    When I open iPhoto I now have all of my events listed in the sidebar and have to scroll down countless pages to access my Projects listed further down.
    This is a disater for my workflow. Please, how can I remove the list of events from the sidebar?

    Put your mouse over the word EVENTS and slowly slide right. See the word 'Hide' appear? Click on it.

  • How to create list of string from set of parameters?

    Hey,
    I have query methods who gets set of parameters for example:
    getUser(String userName, int userAge)I use in int because this field is not null!!!
    I want to create a general auditing method - the auditing method get list of query param names and query param values, so i need to create a generic method that get set of valus (can be from any type) and return List<String>.
    Array.asList will not work because i have primitive types (like int)
    Thank you

    I wrote a helper for this.
    I dont know if there is supported helper in java.
        public static List<String> getStringList(Object... arguments)
            List<String> list = new ArrayList<String>();
            for (Object object : arguments)
                if (object == null)
                    list.add("NULL");
                else
                    list.add(object.toString());
            return list;
        }

  • How to install/uninstall multiple packages from a list

    Is there any way to install/uninstall multiple packages written in file? E.g. I have text file with content:
    packageA
    packageB
    packageC
    And I want use something like "pacman -S <<< file-with-packages". I know, I can get these files on one line and paste it as parameters, but this is not pretty way.
    I tried searching (also in man), but I didn't found anything (if I missed this in man/wiki, I am sorry, now is "early tomorow" and my mind needs redbull or sleep )

    https://wiki.archlinux.org/index.php/Pa … d_packages

Maybe you are looking for