Wanted: script to list uninstalled optdepends and packages that need t

I had a thought today that a script to list package that are optdepends but not installed could be quite useful...  I have not written one, but thought it would be good for pacman-contrib if someone wanted to contribute.
Example output:
tk - optional for:
   ruby - for Ruby/TK
   python - for IDLE, pynche and modulator
fakeroot - optional for:
   pacman - for makepkg usage as normal user
So get script writing!  Preferably in bash or perl (which the current pacman-contrib scripts use).

I cheated and used my perl ALPM module.  I think the logic is sound, though, and you can replace the module calls with backticking pacman (preferably functions wrapping them).  I planned to but ran out of time.
#!/usr/bin/perl
use warnings;
use strict;
use ALPM ( dbpath => '/var/lib/pacman/' );
my %reverse_depends;
my $db = ALPM->register_db;
OPT_SEARCH:
for my $pkg ( @{$db->get_pkg_cache} ) {
my $pkg_optdeps = $pkg->get_optdepends;
next OPT_SEARCH unless @$pkg_optdeps;
my $depender = $pkg->get_name;
my %reason_for = map {
/\A([^:]*):\s*(.*)/ ? ($1 => $2) : ($_ => '')
} @$pkg_optdeps;
DEP_LOOP:
for my $dependee ( keys %reason_for ) {
next DEP_LOOP if $db->get_pkg($dependee); #ignore installed
$reverse_depends{$dependee}->{$depender} = $reason_for{$dependee};
for my $opt_dep ( sort keys %reverse_depends ) {
print "$opt_dep\n";
my $reason_of = $reverse_depends{$opt_dep};
for my $depender ( sort keys %$reason_of ) {
my $reason = $reason_of->{$depender};
print " $depender",
( $reason ? ": $reason\n" : "\n" );

Similar Messages

  • Pacexp - python script to list REALLY explicitly installed packages

    I usually just lurk the forums-- well, except for when I'm here asking for help with some PEBKAC issues... but never mind that.
    This is a small python script I just wrote today while procrastinating. I'd love some feedback on the code, personally, but I'm hoping this could be useful to someone else. I always forget the stuff I have installed when I'm looking to clean my system up and `pacman -Qe` lists a lot of packages that Arch installs itself, so this is my way of dealing with it.
    I'll probably be adding some other features to this script anyway, I'm gonna try to keep this post updated whenever I do so.
    pacexp
    A quick and dirty script to intersect the output of `pacman -Qe` with manually installed packages from /var/log/pacman.log
    https://gist.github.com/spaceporn/d4ec6391a4684efb933c
    If anyone has any suggestions to improve the code (even a better regexp counts), feel free to write them down here or on the gist page!

    karol wrote:
    I use
    expac "%n %N" $(comm -23 <(pacman -Qq|sort) <(pacman -Qqg base base-devel|sort)) | awk '$2 == ""' | less;
    to list packages that aren't required by any other package and are not part of base or base-devel. All of them have been explicitly installed.
    That's pretty cool! I'll probably save it as an alias if I ever have problems with my script

  • Hi, recently I have been making a list of songs and now that I have all of the songs that I want my iTunes is telling me to answer security questions that I forget the answers to, is it possible to get rid if this?

    Hi, recently I have been making a list of songs and now that I have all of the songs that I want my iTunes is telling me to answer security questions that I forget the answers to, is it possible to get rid if this?

    Damian_2087 wrote:
    ... I forget the answers... is it possible to get rid if this?
    No.
    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • My iphone safari history, my 'reading list' shows visits and sites that I have never frequented. A few months back the same thing happened with my youtube history.  My phone is pass protected, so its just me using it. any ideas?

    My iphone safari history, my 'reading list' shows visits and sites that I have never frequented. A few months back the same thing happened with my youtube history.
    My phone is pass protected, and its just me using it, phone with me all the time. any ideas?
    How can things be added to my reading list/youtube???

    Try:                                               
    - iOS: Not responding or does not turn on           
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try another cable                     
    - Try on another computer                                                       
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar
    The missing apps could have been done by setting the Restrictions that can hid those apps. If the backup was made with those retrictions set the the Restrictions are also restored.
    Thus, if you get it to work restore to factory settings/new iPod, not from backup                               
    You can redownload most iTunes purchases by:        
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • Hi I got a iPad 1 for Christmas and I want kik and google and stuff that needs iOS 6 solo how can I git them and when I play a game my apps close all the time

    I need the iOS 6 for my iPad 1 can apple plz make one or help me out with the stuff to git kik and stuff that need iOS 6 plz responde

    Unfortunately you cannot install iOS 6 on an iPad 1, the latest release it supports is iOS 5.1.1. So any apps that require a later version of iOS than that are not useable on your iPad.

  • Would like to create a script for list all elements and structure of an indesign document

    Hello everybody,
    I'm a very beginner in indesign scripting.
    I would like to create a script in order to list all elements and the inner structure of a n indesign document.
    The aim for me is to understand how elements are sorted and arranged into indesign, and be able to find an specific element by its item name.
    The output document could be an xml or txt document with a treeview structure.
    I would like have a rough idea of which kind of javascript code I should use for that.
    Thanks for answers.

    Hi Ossydoc,
    You can use Muse to create such a website. All you need to do is, create links in Muse for the sermons and select  " link to File " in the hyperlink option and link to those Mp3 files.
    Please refer to this screenshot :- http://prntscr.com/4xvdup
    Now, when you publish your site,  Muse would automatically upload those files onto the server and the users would then be able to listen as well as download those sermons using the links on your site.
    Hope this helps
    Regards,
    Rohit Nair 

  • Power shell script to list all files and folder permissions recursively

    Hi All,
    I am looking for a powershell script to perform the following operations.
    1) To list the folder and file permissions(Allow,Deny both) recursively in a given folder.
    2) List out all the files and folders which are having the deny permission or having only the read access (or) only the write access. Basically the folder should have Read,Execute,Write permissions. Else we have to flag that file/folder name.
    I had written a batch script for the same which does this task using icacls.exe output, but this script takes lot of time to recursively parse all the files ( ~1 lakh files).
    Please help me with the powershell script for the same.
    Thanks
    Sambasiva

    Try this module: http://gallery.technet.microsoft.com/scriptcenter/PowerShellAccessControl-d3be7b83
    After importing the module, you can run something like this:
    dir c:\folder -recurse | Get-AccessControlEntry
    That output can be exported to a CSV for later viewing. You can also provide some parameters to Get-AccessControlEntry to limit the results:
    dir c:\folder -recurse | Get-AccessControlEntry -FileRights Write
    dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessDenied
    dir c:\folder -recurse | Get-AccessControlEntry -AceType AccessAllowed -FileRights Write

  • List of Colleges and Universities that use Peoplesoft

    Can someone provide me a list or point me in the right direction as to where to acquire a list of colleges and universities in the U.S. that use Peoplesoft? Thanks in advance for your help!

    I was kind of thinking that, but wasn't sure if they would be willing to give a list (or partial) of just the colleges/universities that use them. I currently work for a university that uses it and we are implementing document imaging so I wanted to contact those universities to see what their process is. Any suggestions? Thanks again :)

  • I just moved to Germany, I want to know if an adapter and converter is needed to charge my iPod, iPhone and MacBook Air is needed or can I simply use an adapter? Will the voltage automatically change?

    I am having a really hard time with keeping my charger on the adapter/converter that I bought for my trip but I also bought an adapter and with that my charger doen't fall and my apple products would be able to charge withought me having to hold the charger in place. I want to know if the converter is needed or if I only need the adapter. I do not want to blowout my iPhone, iPod or my MacBook Air.

    All that is requried is an inexpensive plug adapter. Apple's power adapters themselves will work with any utility power on Earth. Non-Apple power adapters may not.
    I don't understand what you mean by having to hold the charger in place though.

  • Detection of aur package that needs update

    Hi all,
    Is there a way to find out the packages that's install from AUR and needs to be updated?
    Thanks,

    lang2 wrote:Did read http://wiki.archlinux.org/index.php/AUR_Helpers but didn't find it.
    You could always add it  
    And slurpy for good measure.
    It will help whoever next asks the same question.

  • Script to list the users and their privileges in a database

    Hi Team,
    Can someone provide me a script that list all the users and their privileges in a database?
    DB version:11.2.0.2
    OS:AIX

    Osama_mustafa wrote:
    Why you create your own script
    SELECT * FROM USER_SYS_PRIVS;
    SELECT * FROM USER_TAB_PRIVS;
    SELECT * FROM USER_ROLE_PRIVS;
    That won't tell him what privileges a user has via a role. It will only tell him what privilges were granted directly, and what roles were granted directly. But those roles have privileges, and may have other roles, which have still more roles and privs, etc. It's a recursive issue and a simple select from user__privs won't get it.
    Pete Finnigan has a good script for reporting the entire picture. I leave it as an exercise for the student to use google to find it. I have already given all the information needed to complete that exercise.

  • Modifying my script to list all folders and their lastwritetime on remote computers

    Hello,
    I've got the following script that is trying to report on a list of computers (in computerlist.txt) the contents of the C:\Users folder and list in the resulting CSV File the Name of the computer, the Folder Name and the Date it was last changed (sort by
    most recent first).
    $servers = GC C:\Powershell_Scripts\computerlist.txt
    ForEach($server in $servers) {
    If (Test-Connection -comp $server -count 1 -quiet) {
    Get-Childitem ("\\$server\c$\Users") | Where-Object { $_.mode -like 'd*' } | Select-Object $server, Name, LastWriteTime | Export-Csv C:\Apps\Powershell_Scripts\LastLogin\Reports\directoryFile.csv
    I'm part way there but my script is not showing each computer..only the last computer in the list.
    Please assist with making the necessary changes to this script.
    Thank you.

    Thanks for the reply Mike.
    I am running version 3.  I've added the -Append to my script but it doesn't seem to like it.  Here's the error I get:
    Export-Csv : Cannot append CSV content to the following file: C:\Powershell_Scripts\Reports\directoryFile.csv. The appended object does not have a property that corresponds to the following column: ServerABC. To proceed with mismatched
    properties, add the -Force switch and retry.
    Where ServerABC is the name of the first server in computerlist.txt. 
    Here is how I added the -Append:
    $servers = GC C:\Powershell_Scripts\computerlist.txt
    ForEach($server in $servers) {
    If (Test-Connection -comp $server -count 1 -quiet) {
    Get-Childitem ("\\$server\c$\Users") | Where-Object { $_.mode -like 'd*' } | Select-Object $server, Name, LastWriteTime | Export-Csv -Append C:\Apps\Powershell_Scripts\LastLogin\Reports\directoryFile.csv
    The report being written out also isn't in the format I need.
    ServerABC Name LastWriteTime
    User1 5/12/2014 16:11
    ADMINI~1 7/30/2012 13:37
    User2 4/1/2014 18:23
    How do I modify this to show the following output instead:
    Computer Name LastWriteTime
    ServerABC User1 5/12/2014 16:11
    ADMINI~1 7/30/2012 13:37
    User2 4/1/2014 18:23
    ServerDEF User1 6/14/2014 14:12
    ADMINI~1 6/24/2012 15:38
    User2 5/1/2014 20:25
    Thank you.

  • How can I add a response to the end of each item question in an email list of questions and send that back to the originator?

    I have emails that ask for certian items to be addressed such as "please fix leak in bath sink" and then the next line will have another request and on and on. I would like to answer each question at the end of each line with a response (preferably in a different color font to stand out) such as "yes - will fix" or "that can't be done" or "you will have to fix that yourself". Then I want to send that reply back to the original sender.

    ''sfhowes [[#answer-697423|said]]''
    <blockquote>
    I suggest you consider this add-on: [https://addons.mozilla.org/en-US/thunderbird/addon/clippings/ Clippings] ([http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html How to install]).
    </blockquote>
    I did look int this but I need to have each answer different in a lot of cases but i thank you and did get an answer that does help greatly - Thanks

  • Yaourt and packages that have been moved from AUR to community

    Well first off, why does yaourt even wanna build the package if it has been removed? I did a search in the AUR and all I see is stress 1.0.0-1. I thought I read somewhere that yaourt is a wrapper for pacman and therefor would search the repositories before it searches the AUR for the program?
    [jasin@kermit ~]$ yaourt -S stress
    ==> Downloading stress PKGBUILD from AUR...
    ==> WARNING: It seems like stress was removed from AUR probably for security reason. Please Abort
    stress 0.18.9-1 (NOT SAFE): A tool that stress tests your system (CPU, memory, I/O, disks)
    ==> stress dependencies:
    - glibc (already installed)
    ==> Edit the PKGBUILD (recommended) ? [Y/n] ("A" to abort)
    ==> ----------------------------------------------
    ==>n
    ==> Continue the building of 'stress'? [Y/n]
    ==> ----------------------------------------------
    ==>n
    [jasin@kermit ~]$ sudo pacman -S stress
    resolving dependencies...
    looking for inter-conflicts...
    Targets: stress-1.0.0-1
    Total Download Size: 0.01 MB
    Total Installed Size: 0.04 MB
    Proceed with installation? [Y/n] y
    :: Retrieving packages from community...
    stress-1.0.0-1 9.6K 23.4K/s 00:00:00 [#####################] 100%
    checking package integrity...
    (1/1) checking for file conflicts [#####################] 100%
    (1/1) installing stress
    This doesn't seem right to me either... is it just me or should yaourt be informed on where stress has gone if it has been removed from AUR and not just leave yaourt open ended with a basic error?
    I tried
    [jasin@kermit ~]$ yaourt -S community/stress
    ==> Downloading community/stress PKGBUILD from AUR...
    Error: community/stress not found in AUR.
    but yaourt thinks it should be a package in AUR. But I presume this should be added functionality in yaourt to work like pacman?
    Last edited by jacko (2008-01-13 16:52:56)

    somairotevoli wrote:hmm, works here.
    How long ago was it added to community? Maybe the repo your using isn't updated yet?
    hmm, maybe I should update yaourt... I never thought about it but yaourt will not update itself.
    edit:
    yaourt -Su --aur
    yes, that fixed it. never thought about updating AUR packages.
    would be alright to add something like this to .bashrc to make this whole process a one time command?
    alias pac-update="yaourt -Syyu | yaourt -Su --aur"
    the answer to this ^^^ is NO, because the second command locks the database. U would need a way to tell it to pause until the first command finished, then issue the second command. I quite frankly do not understand enough of linux bash programming to accomplish that ATM.
    Last edited by jacko (2008-01-13 19:40:44)

  • Facebook won't load properly. Takes forever and then I get a script page with log-in and then that takes forever and gives me further script that won't let me access anything. Other sites load and work OK!

    Started after last auto update several days ago. A few other sites are slow to load while many are good but Facebook just won't present it's usual mix of pre-programmed scripts and links but comes up eventually as part HTML script with a log-in box and when you log-in it then takes forever again and just gives HTML type script for "Friends" "messages" etc. but if you click these it goes nowhere!
    Also it won't let me clear history at all despite many tries. I removed and reloaded the program last night but no positive effect.

    I still haven't resolved this problem. Here is some more information...
    youtube is the only website that has started working, but it sometimes stops working again.
    There are many other sites that don't work, cnn.com, washingtonpost.com (sometimes), and a lot of others.
    I have contacted our internet service provider and they said that they had nothing to do with the problem.
    Some websites will not work at all. Safari tells me that it can't find the server. Some that do this are ups.com, computerworld.com, and others.
    I think that the problem is that, for some reason, our mac computers can't access certain servers where we are. (We are at a small ski resort (on the mountain) in Canada.) I think this because when a site doesn't load properly there are several errors and they are all "can't find host" errors from a couple of the same sites (ex. example.something.something).
    *Also, I ran a test on speedtest.net on the laptop and one of our iMacs and the results were way faster than anything actually loads/downloads or than the activity monitor shows, even when checking the activity monitor at the same time as running the test.

Maybe you are looking for

  • I want to use Thunderbird without saving e-mails to PC. How is this possible?

    I want to use Thunderbird without saving any e-mail to local folder in my PC. Can you please help me on this? thanks.

  • How do I direct iTunes to music on an external drive

    I have my music in a folder on an external hard drive.  I purchased a new computer and have downloaded iTunes 10 but don't know how direct it to the music on the external drive

  • Invalid Floating Point Error

    I have one Captivate 3 project published as a Stand Alone project with Flash 8 selected. There are 36 slides, no audio, no eLearning, SWF size and quality are high. One person who runs this gets an "Invalid Floating Point" error when he tries to run

  • Little blue box with "?" inside

    when I open my mail messages, in my iPhone, that usually have such items as the senders logo or a photo of an item in their newsletter, instead of seeing those items all I see is a little blue square with a question mark inside of it. Does anyone kno

  • Cant import raw files from pentax k20d

    I have a Pentax k20d and iPhoto6 will only import JPGs. iPhoto will not import RAW files from my camera. I can't find if its supported but can only assume its not.