ubuntu-helpers: New script "enable-proposed"

Dan Streetman ddstreet at canonical.com
Wed Jul 22 23:28:21 UTC 2020


On Wed, Jul 22, 2020 at 3:39 PM Bryce Harrington
<bryce.harrington at canonical.com> wrote:
>
> On Wed, Jul 22, 2020 at 08:57:05AM -0500, Simon Quigley wrote:
> > Hello,
> >
> > On 7/22/20 8:22 AM, Dan Streetman wrote:
> > > Since it's related to this topic, the add-apt-repository in this ppa
> > > has support for adding/enabling deb-src and arbitrary pockets as well
> > > as private ppas and more:
> > > https://launchpad.net/~ubuntu-support-team/+archive/ubuntu/add-apt-repository
>
> If that makes it easy to enable -proposed, that would indeed be very
> helpful.

yeah just like

$ sudo add-apt-repository -p proposed

>
> Googling "how to enable -proposed from CLI" returns too many results
> that have people either hand edit sources.list or simply append
> hand-written deb strings.  If those docs can give a simple-to-run
> invocation of add-apt-repository it would help eliminate user error and
> confusion.
>
> > > I need to find some time to push the changes into the upstream repo.
> > > https://code.launchpad.net/~ubuntu-support-team/software-properties/+git/software-properties/+ref/devel
> >
> > Merged, here you go:
> > https://launchpad.net/ubuntu/+source/software-properties/0.99.0
> >
> > (We're still a little bit away from Feature Freeze and we just released
> > an LTS. Now is the time to test major updates to software.)
> >
> > On 7/21/20 8:37 PM, Bryce Harrington wrote:> I've also added an
> > 'enable-proposed' script, similar to enable-debsrc,
> > > which adds DIST-proposed entries (deb and deb-src) for components
> > > currently enabled.  IOW, if you don't have
> > > universe/restricted/multiverse components enabled for anything, it won't
> > > add them for -proposed, but if you do, it will.
> > >
> > > The script also strives to use the same archive URI you are using for
> > > the main component, so if you're using a mirror it will also pull
> > > -proposed from that mirror too.
> > >
> > > https://git.launchpad.net/~ubuntu-server/ubuntu-helpers/tree/bryce/enable-proposed
> >
> > Thanks for your work here! How much of this is now in Groovy with the
> > above changes, and what can be merged into software-properties?
>
> Not sure, but I did notice a couple things I wished were in the API.
>
> First, a way to easily fuzzy search for a given entry, such as the one
> for the main component.  I ended up just iterating through all the
> components and examining their props, but it feels a bit brittle.  A
> sp.sourceslist.search() or similar would have given a cleaner solution.

I added a list option, e.g.:

$ add-apt-repository -L
deb http://archive.ubuntu.com/ubuntu focal universe restricted multiverse main
deb http://archive.ubuntu.com/ubuntu focal-updates universe restricted
multiverse main
deb http://archive.ubuntu.com/ubuntu focal-backports universe
restricted multiverse main
deb http://security.ubuntu.com/ubuntu focal-security universe
restricted multiverse main
deb http://ppa.launchpad.net/ubuntu-support-team/add-apt-repository/ubuntu
focal main

it filters out deb-src lines by default but you can include them with:

$ add-apt-repository -Ls
deb http://archive.ubuntu.com/ubuntu focal multiverse main universe restricted
deb-src http://archive.ubuntu.com/ubuntu focal multiverse main
universe restricted
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse main
universe restricted
deb-src http://archive.ubuntu.com/ubuntu focal-updates multiverse main
universe restricted
deb http://archive.ubuntu.com/ubuntu focal-backports multiverse main
universe restricted
deb-src http://archive.ubuntu.com/ubuntu focal-backports multiverse
main universe restricted
deb-src http://archive.canonical.com/ubuntu focal partner
deb http://security.ubuntu.com/ubuntu focal-security multiverse main
universe restricted
deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
main universe restricted
deb http://ppa.launchpad.net/ubuntu-support-team/add-apt-repository/ubuntu
focal main
deb-src http://ppa.launchpad.net/ubuntu-support-team/add-apt-repository/ubuntu
focal main

>
> Second, I'm not sure whether it's expected that users should access the
> internals of entries (e.g. entry.dist, entry.file).  If so, the docs
> don't document them and would make them more convenient to use.  If not,
> then getter/setter routines or similar might be appropriate.
>
> > Thanks Dan and Bryce, this definitely makes things a lot easier.
>
> Hey and thanks for maintaining SoftwareProperties.  Going into this task
> I was anticipating needing to parse sources.list myself, so in examining
> add-apt-repository's code was pleased to discover SoftwareProperties and
> find that it did most of the work for me, and let me make very short
> scripts.  :-)

well...personally I tried to use SoftwareProperties but found I
couldn't really modify it without wide-ranging impacts. So I just
disconnected add-apt-repository from it entirely. Also I think you're
really just using aptsources.sourceslist and aptsources.distro, you're
not using anything from SoftwareProperties AFAICT.

I think juliank wants to change over to from the sources.list
one-line-style format (which definitely is a very annoying format to
handle) over to the new deb822 format, which will require something
different from aptsources.sourceslist.SourcesList, since that is
connected to the one-line-style format. Not sure when that will
happen, but the deb822 format will probably be harder for people to
hand-edit (if they're not familiar with it) so tooling to modify the
apt sources will be even more important at that point.

>
> Bryce



More information about the ubuntu-server mailing list