The list of APT repositories

Hello,

We have been using UCS since 4.0 version and I noticed that we have a long list of repositories in file “/etc/apt/sources.list.d/15_ucs-online-version.list”.

For example, here is the list:

deb https://updates.software-univention.de/4.0/maintained/ 4.0-0/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-0/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-0/all/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-0/amd64/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-1/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-1/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-1/all/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-1/amd64/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-2/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-2/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-2/all/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-2/amd64/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-3/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-3/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-3/all/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-3/amd64/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-4/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-4/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-4/all/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-4/amd64/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-5/all/
deb https://updates.software-univention.de/4.0/maintained/ 4.0-5/amd64/
deb https://updates.software-univention.de/4.0/unmaintained/ 4.0-5/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-0/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-0/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-0/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-0/amd64/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-1/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-1/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-1/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-1/amd64/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-2/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-2/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-2/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-2/amd64/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-3/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-3/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-3/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-3/amd64/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-4/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-4/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-4/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-4/amd64/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-5/all/
deb https://updates.software-univention.de/4.1/maintained/ 4.1-5/amd64/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-5/all/
deb https://updates.software-univention.de/4.1/unmaintained/ 4.1-5/amd64/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-0/all/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-0/amd64/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-0/all/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-0/amd64/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-1/all/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-1/amd64/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-1/all/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-1/amd64/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-2/all/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-2/amd64/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-2/all/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-2/amd64/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-3/all/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-3/amd64/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-3/all/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-3/amd64/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-4/all/
deb https://updates.software-univention.de/4.2/maintained/ 4.2-4/amd64/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-4/all/
deb https://updates.software-univention.de/4.2/unmaintained/ 4.2-4/amd64/
deb https://updates.software-univention.de/4.3/maintained/ 4.3-0/all/
deb https://updates.software-univention.de/4.3/maintained/ 4.3-0/amd64/
deb https://updates.software-univention.de/4.3/unmaintained/ 4.3-0/all/
deb https://updates.software-univention.de/4.3/unmaintained/ 4.3-0/amd64/

The checking of all these links takes too much time. Therefore, when you want to install/remove some package or install errata updates, the process of update takes a lot of time.

I thought this somehow depends on the UCR entries, and I removed those that we had not been using for a long time. But the list have not decreased.

Could you share a tip how the list might be reduced for speeding up the process of updating and installing packages?

Thanks in advance.

Hey,

the file /etc/apt/sources.list.d/15_ucs-online-version.list will always be populated with all repositories for all version numbers that share the same major version number component as your current system (and that are smaller than or equal to your system’s current version). Therefore if you’re running e.g. 4.3-0 the major version number component is 4. Hence the first entry being 4.0-0 (that’s the first/smallest version number with the same major component) and the last being 4.3-0 even though 4.3-1 is already available (4.3-1 shares the same major version number but is larger/higher than your current version number, 4.3-0).

This happens because the template the actual file is created from, /etc/univention/templates/files/etc/apt/sources.list.d/15_ucs-online-version.list, does this:

	updater = UniventionUpdater()

	if updater.online_repository:
		print updater.print_version_repositories()

That print_version_repositories() call can be traced to /usr/share/pyshared/univention/updater/tools.py which does this:

    def print_version_repositories(self, clean=False, dists=False, start=None, end=None):
        # unimportant details removed

        if not start:
            start = UCS_Version((self.version_major, 0, 0))

        if not end:
            end = UCS_Version((self.version_major, self.version_minor, self.patchlevel))

You can experiment with modifying the template to pass an explicit start parameter to the print_version_repositories() function, e.g. something like this which would restrict the repositories to the current and the previous version (if they’re from the same major version):

# …start inserting after last 'from … import…' line
from univention.updater.ucs_version import UCS_Version

try:
	updater = UniventionUpdater()

	if updater.online_repository:
		minor_start = 0 if updater.version_minor == 0 else updater.version_minor - 1
		print updater.print_version_repositories(start=UCS_Version((updater.version_major, minor_start, 0)))
# …rest as given in the template

Note that modifying templates this way means you’ll have to pay special attention after upgrades as new versions of said template files might be installed, and you’ll have to merge those new versions with your custom changes.

The other file, 20_ucs-online-component.list, is constructed from the UCR variables whose names start with repository/online/component/ and should only contain few lines if you’ve already removed unneeded components.

Kind regards

1 Like

Hey,

please note that doing what I’ve outlined above isn’t a good idea, in fact it turns out to be a bad one. I opened a bug report for getting the number of repositories down. In it a Univention developer said that skipping the older repositories isn’t possible yet as 4.3 isn’t self-contained; it uses packages from the older versions.

So… please don’t do that :slight_smile:

m.

Hello,

Perfect research and excellent explanation! Thank you!

I have read the bug report and looks like we have to wait for the next major release.
It is sad.

Thanks anyway for your help in researching that.

Mastodon