3

Is there any way without running:

sudo apt-add-repository [PPA]

That you can get the description (and possibly some other additional information) of a PPA through Terminal?

6
  • I don't think so. Try googling the PPA.
    – Daniel
    Oct 1, 2015 at 16:44
  • @Daniel: I could do that, but in this case I want to check a PPA which apparently no longer exists, 'officially', but I think might exist, but I don't want to accidentally add it.
    – user364819
    Oct 1, 2015 at 17:00
  • If it existed at any time in history, you should be able to find some record of it somewhere.
    – Daniel
    Oct 1, 2015 at 17:01
  • Which PPA, by the way?
    – Daniel
    Oct 1, 2015 at 17:01
  • @ParanoidPanda link the PPA. If it likely doesn't exist, you can't get data on it.
    – Thomas Ward
    Oct 1, 2015 at 17:02

2 Answers 2

2

A quick hack (needs package python3-launchpadlib):

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys,re

from launchpadlib.launchpad import Launchpad
import httplib2
import  lazr.restfulclient.errors

if len(sys.argv) < 2:
    print('Syntax: {cmd} ppa'.format(cmd=sys.argv[0]))
    print()
    print('For example: {cmd}  ppa://diesch/testing'.format(cmd=sys.argv[0]))
    sys.exit(2)


try:
    lp = Launchpad.login_anonymously('foo', 'production', None)
except  httplib2.HttpLib2Error as e:
    print('Error connection to launchpad.net:', e)
    sys.exit(1)


ppa_name = sys.argv[1].strip()

m = re.search(r'^(ppa:)?(?P<user>[^/]+)/(?P<name>.+)', ppa_name)
if m:
    user, name = m.group('user', 'name')
else:
    print('Unvalid PPA name:', ppa)
    sys.exit(1)

try:    
    owner =  lp.people[user]
    ppa = owner.getPPAByName(name=name)

    print('PPA {name} at {url}'.format(name=ppa_name, url=ppa.web_link))
    print()
    print('Owner: {owner} ({url})'.format(owner=owner.display_name,
                                            url=owner.web_link))
    print()
    print(ppa.description) 
except lazr.restfulclient.errors.RestfulError as e:
    print('Error getting PPA info:', e)
    exit(1)

Save this as e.g. ppa-info, make it executable and run it like

ppa-info ppa:diesch/testing

If the PPA exists, you will get some information, like owner and description, otherwise you'll get an error message.

1

add-apt-repository confirms addition of PPAs:

$ sudo add-apt-repository ppa:gnome3-team/gnome3
 Before upgrading your system to a new Ubuntu release (i.e. from Ubuntu 14.04 to 14.10), you should probably run 'ppa-purge ppa:gnome3-team/gnome3' first.

*** You need to run 'sudo apt-get dist-upgrade' to avoid problems. ***
Please read the output before entering 'Y' to make sure important packages won't be removed.

=== Ubuntu 14.10 (Utopic) ===
GNOME 3.12 that didn't make it into the normal Ubuntu 14.10 repositories.

=== Ubuntu 14.04 (Trusty) ===
GNOME 3.10 that didn't make it into the normal Ubuntu 14.04 repositories.

=== Ubuntu 12.04 (Precise) ===
Parts of GNOME 3.4 that didn't make it into the normal Ubuntu 12.04 repositories.

=== Bugs ===
On Trusty (14.04) and newer please use 'ubuntu-bug' to report bugs against packages in this PPA
 More info: https://launchpad.net/~gnome3-team/+archive/ubuntu/gnome3
Press [ENTER] to continue or ctrl-c to cancel adding it
^CTraceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 139, in <module>
    sys.stdin.readline()
KeyboardInterrupt

$ sudo add-apt-repository ppa:ondrej/common 
 Lowest common denominator needed to build other packages, a.k.a. build essentials.
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/common
Press [ENTER] to continue or ctrl-c to cancel adding it
^CTraceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 139, in <module>
    sys.stdin.readline()
KeyboardInterrupt

Therefore, the simplest way to get information for a PPA without adding it is to run add-apt-repository, and press CtrlC.

3
  • How does add-apt-repository get that information? Can't one get it the same way or is that what the accepted answer describes?
    – user364819
    Oct 1, 2015 at 17:30
  • @ParanoidPanda that's what the accepted answer shows, yes. Add-apt-repository is a python script using the launchpad library.
    – muru
    Oct 1, 2015 at 17:32
  • @ParanoidPanda if you want to, do look at the code.
    – muru
    Oct 1, 2015 at 17:37

You must log in to answer this question.