Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to list all Head packages available from specific ppa.

Example: webupd8 ppa:nilarimogard/webupd8 has following head packages for trusty:

screen

Can I list them by command-line?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I've written a function that grabs the Packages list for the repo that would be used on the current release/architecture. It's fairly simple and could be written as a single line... It would just be a very unwieldy line.

function lsppa {
    # expects one argument in the form of ppa:nilarimogard/webupd8

    USAGE="lsppa <ppa:user/ppaname>"

    if [[ "$#" != "1" || ! "$1"  == *"ppa"* ]]; then
      echo "$USAGE"
      return
    fi

    REPO="${1/ppa:/}"
    CODE="$(lsb_release -cs)"
    ARCH="$(dpkg --print-architecture)"
    URL="http://ppa.launchpad.net/$REPO/ubuntu/dists/$CODE/main/binary-$ARCH/Packages"

    awk '/^Package:/ {print $2}' <(wget -qO- "$URL")
}

So after you paste that into a terminal, you can call it like lsppa ppa:nilarimogard/webupd8 and it returns a list as ordered by the packages list.

In this case it might be non-alphabetical and could even contain duplicates (different versions) so you might (you could pass it through sort -u if you want to call:

lsppa ppa:nilarimogard/webupd8 | sort -u | less
share|improve this answer
    
I added a simple usage check to the function. I hope you don't mind ☺. –  Glutanimate Jun 9 at 14:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.