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.

By sudo add-apt-repository '<deb url codename component>', a repository is added to the /etc/apt/source.list file.

By sudo add-apt-repository ppa:<user>/<ppa-name>, I saw that all the ppa repositories are added to /etc/apt/source.list.d dir:

$ ls /etc/apt/sources.list.d/
ferramroberto-sopcast-precise.list
ferramroberto-sopcast-precise.list.save
google-talkplugin.list
google-talkplugin.list.save
kalakris-okular-precise.list
kalakris-okular-precise.list.save
linrunner-thinkpad-extras-precise.list
linrunner-thinkpad-extras-precise.list.save
precise-partner.list
precise-partner.list.save
staticfloat-julia-deps-precise.list
staticfloat-juliareleases-precise.list
staticfloat-juliareleases-precise.list.save
telepathy-ppa-precise.list
telepathy-ppa-precise.list.save
ubuntu-wine-ppa-precise.list
ubuntu-wine-ppa-precise.list.save
venerix-blug-precise.list
venerix-blug-precise.list.save

Can a ppa repositories be added to the end of /etc/apt/source.list file, instead?

Why are ppa repositories are treated differently from nonppa ones?

Are there other nonppa repositories treated similarly as ppa ones?

Will `sudo add-apt-repository '' add a ppa repository to /etc/apt/source.list, or to some files under /etc/apt/source.list.d?

share|improve this question

1 Answer 1

  • Yes, PPA's can be add to /etc/apt/source.list, similar way to deb repositories

    deb http://ppa.launchpad.net/<ppa-name>/ppa/ubuntu <release-code-name> main 
    deb-src http://ppa.launchpad.net/<ppa-name>/ppa/ubuntu <release-code-name> main
    

    Example for WineHq: ppa debian repository link

  • Thought just matter of keeping thing somehow easily managed, leaving /etc/apt/source.list only for official release repositories. All additional repositories goes to /etc/apt/source.list.d/. Easy to:

    1. add (creating file then editing existing one, a partial solution to avoid duplicates too)
    2. remove (with parsing a /etc/apt/source.list looking to related line)
    3. backup/restore (using compressed archive of /etc/apt/source.list.d/ folder)
    4. avoid breaking things with much edits targeting /etc/apt/source.list
  • PPA always added to /etc/apt/source.list.d/ folder if wrote it in ppa:<user>/<ppa-name> form.

    Reference: man add-apt-repository

    REPOSITORY STRING
           REPOSITORY can  be  either  a  line  that  can  be  added  directly  to
           sources.list(5),  in the form ppa:<user>/<ppa-name> for adding Personal
           Package Archives, or a distribution component to enable.
    
           In  the   first   form,   REPOSITORY   will   just   be   appended   to
           /etc/apt/sources.list.
    
           In  the second form, ppa:<user>/<ppa-name> will be expanded to the full
           deb  line  of  the  PPA  and   added   into   a   new   file   in   the
           /etc/apt/sources.list.d/  directory.   The  GPG public key of the newly
           added PPA will also be downloaded and added to apt's keyring.
    
           In the third form, the given distribution component will be enabled for
           all sources.
    
  • Well, it seems only PPA's as shortcut goes to /etc/apt/sources.list.d/. add-apt-repository or apt-add-repository is Ubuntu specific tools. All I can think of is just Ubuntu decision to keep personal PPA's out.

    However you can for modify it to use only /etc/apt/sources.list. It's a python3 script. Modify /usr/bin/add-apt-repository line:

    shortcut = shortcut_handler(line)
    

    to (resolve ppa shortcut to deb line):

    shortcut = shortcut_handler(shortcut_handler(line).expand(sp.distro.codename)[0])
    
share|improve this answer
    
Note that, strangely enough, non-PPA repos will get added to /etc/apt/sources.list. –  saiarcot895 Jul 11 at 16:32
1  
@saiarcot895, I think add-apt-repository was written to ease the work with PPA in 1st place. Here the commit description when it was added: "new helper script "add-apt-repository" that can be used to enable a repository from the commandline. Useful for e.g.'add-apt-repository ppa:gnome-desktop'". bazaar.launchpad.net/~ubuntu-core-dev/software-properties/main/… –  Sneetsher Jul 11 at 17:08

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.