Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New name metapackages #2915

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,23 @@ Vcs-Git: https://github.com/canonical/ubuntu-pro-client.git
Vcs-Browser: https://github.com/canonical/ubuntu-pro-client
Rules-Requires-Root: no

# ubuntu-pro-client is the new name, implemented as a meta package that
# Depends: ubuntu-advantage-tools. ubuntu-advantage-tools is the package
# that actually contains the pro-client.
# Note: Homepage and Description should be kept in sync with ubuntu-advantage-tools
Package: ubuntu-pro-client
Homepage: https://canonical-ubuntu-pro-client.readthedocs-hosted.com/
Architecture: any
Depends: ubuntu-advantage-tools (=${binary:Version}), ${misc:Depends}
Description: Management tools for Ubuntu Pro
Ubuntu Pro is a suite of additional services provided by Canonical on
top of Ubuntu. Whether you're an enterprise customer deploying systems
at scale or want security patching for your personal Ubuntu LTS
at home, the Ubuntu Pro Client (pro) is the command-line tool that
will help you manage the services you need.

Package: ubuntu-advantage-tools
Homepage: https://canonical-ubuntu-pro-client.readthedocs-hosted.com/
Architecture: any
Depends: ${misc:Depends},
${python3:Depends},
Expand All @@ -43,13 +59,12 @@ Depends: ${misc:Depends},
python3-pkg-resources,
${extra:Depends}
Recommends: ubuntu-pro-client-l10n
Description: management tools for Ubuntu Pro
Ubuntu Pro is the professional package of tooling, technology
and expertise from Canonical, helping organisations around the world
manage their Ubuntu deployments.
.
Subscribers to Ubuntu Pro will find helpful tools for accessing
services in this package.
Description: Management tools for Ubuntu Pro
Ubuntu Pro is a suite of additional services provided by Canonical on
top of Ubuntu. Whether you're an enterprise customer deploying systems
at scale or want security patching for your personal Ubuntu LTS
at home, the Ubuntu Pro Client (pro) is the command-line tool that
will help you manage the services you need.

Package: ubuntu-pro-client-l10n
Architecture: any
Expand All @@ -58,12 +73,26 @@ Description: Translations for Ubuntu Pro Client
This package delivers translations of Ubuntu Pro Client for various
languages.

# ubuntu-pro-image-auto-attach is the new name, implemented as a meta package that
# Depends: ubuntu-advantage-pro. ubuntu-advantage-pro is the package
# that actually contains the auto-attach systemd service.
# Note: Homepage and Description should be kept in sync with ubuntu-advantage-pro
Package: ubuntu-pro-image-auto-attach
Homepage: https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/explanations/what_are_ubuntu_pro_cloud_instances/
Architecture: all
Depends: ubuntu-advantage-pro (=${binary:Version}), ${misc:Depends}
Description: Service to auto-attach Ubuntu Pro cloud images
This package delivers an additional service that performs an auto-attach
operation for Ubuntu Pro cloud instances. This package should not be manually
installed, as it is already present on the cloud instances that require it.

Package: ubuntu-advantage-pro
Homepage: https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/explanations/what_are_ubuntu_pro_cloud_instances/
Architecture: all
Depends: ${misc:Depends}, ubuntu-advantage-tools (>=20.2)
Replaces: ubuntu-advantage-tools (<<20.2)
Breaks: ubuntu-advantage-tools (<<20.2)
Description: Additional services for Ubuntu Pro images
Description: Service to auto-attach Ubuntu Pro cloud images
This package delivers an additional service that performs an auto-attach
operation for Ubuntu Pro cloud instances. This package should not be manually
installed, as it is already present on the cloud instances that require it.
4 changes: 0 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ APT_PKG_DEPS="apt (>= 1.2.32), apt-transport-https (>= 1.2.32), apt-utils (>= 1.
DISTRO_INFO_DEPS="distro-info (>= 0.14ubuntu0.2),"
else ifeq (${VERSION_ID},"18.04")
APT_PKG_DEPS="apt (>= 1.6.11), apt-utils (>= 1.6.11), libapt-inst2.0 (>= 1.6.11), libapt-pkg5.0 (>= 1.6.11),"
else ifeq (${VERSION_ID},"19.04")
APT_PKG_DEPS="apt (>= 1.8.1), apt-utils (>= 1.8.1), libapt-inst2.0 (>= 1.8.1), libapt-pkg5.0 (>= 1.8.1),"
else ifeq (${VERSION_ID},"19.10")
APT_PKG_DEPS="apt (>= 1.8.1), apt-utils (>= 1.8.1), libapt-pkg5.90 (>= 1.8.1),"
endif

%:
Expand Down
15 changes: 15 additions & 0 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,21 @@ def before_scenario(context: Context, scenario: Scenario):
)
return

# skip scenario based on install_from value
for tag in scenario.effective_tags:
parts = tag.split(".")
if all(
[len(parts) == 3, parts[0] == "skip", parts[1] == "install_from"]
):
to_skip = InstallationSource(parts[2])
if context.pro_config.install_from == to_skip:
scenario.skip(
reason="Scenario does not support install_from={}".format(
to_skip.value
)
)
return

# before_step doesn't execute early enough to modify the step
# so we perform step text surgery here
# Also, logging capture is not set up when before_scenario is called,
Expand Down
30 changes: 30 additions & 0 deletions features/install_uninstall.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,33 @@ Feature: Pro Install and Uninstall related tests
| bionic | lxd-container |
| focal | lxd-container |
| jammy | lxd-container |

@skip.install_from.local
@skip.install_from.prebuilt
Scenario Outline: ubuntu-pro-client brings up-to-date ubuntu-advantage-tools
Given a `<release>` `<machine_type>` machine
When I set up the apt source for ubuntu-advantage-tools
When I apt install `ubuntu-pro-client`
Then I verify that the version of `ubuntu-pro-client` equals the version of `ubuntu-advantage-tools`
Examples: ubuntu release
| release | machine_type |
| xenial | lxd-container |
| bionic | lxd-container |
| focal | lxd-container |
| jammy | lxd-container |
| mantic | lxd-container |

@skip.install_from.local
@skip.install_from.prebuilt
Scenario Outline: ubuntu-pro-image-auto-attach brings up-to-date ubuntu-advantage-pro
Given a `<release>` `<machine_type>` machine
When I set up the apt source for ubuntu-advantage-tools
When I apt install `ubuntu-pro-image-auto-attach`
Then I verify that the version of `ubuntu-pro-image-auto-attach` equals the version of `ubuntu-advantage-pro`
Examples: ubuntu release
| release | machine_type |
| xenial | aws.pro |
| bionic | aws.pro |
| focal | aws.pro |
| jammy | aws.pro |
| mantic | aws.pro |
8 changes: 7 additions & 1 deletion features/steps/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
from pycloudlib.instance import BaseInstance # type: ignore

from features.steps.shell import when_i_run_command
from features.steps.ubuntu_advantage_tools import when_i_install_uat
from features.steps.ubuntu_advantage_tools import (
when_i_install_uat,
when_i_setup_uat_source,
)
from features.util import (
BUILDER_NAME_PREFIX,
SUT,
Expand Down Expand Up @@ -190,6 +193,7 @@ def given_a_sut_machine(context, series, machine_type):
machine_name=builder_name,
cleanup=False,
)
when_i_setup_uat_source(context, machine_name=builder_name)
when_i_install_uat(context, machine_name=builder_name)
when_i_take_a_snapshot(
context,
Expand All @@ -205,6 +209,7 @@ def given_a_sut_machine(context, series, machine_type):
)
else:
given_a_machine(context, series, machine_type=machine_type)
when_i_setup_uat_source(context)
when_i_install_uat(context)

logging.info(
Expand All @@ -219,6 +224,7 @@ def given_a_sut_machine_with_user_data(context, series, machine_type):
# doesn't support snapshot strategy because the test depends on
# custom user data
given_a_machine(context, series, machine_type, user_data=context.text)
when_i_setup_uat_source(context)
when_i_install_uat(context)


Expand Down
22 changes: 21 additions & 1 deletion features/steps/packages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re

from behave import then, when
from hamcrest import assert_that, contains_string, matches_regexp
from hamcrest import assert_that, contains_string, equal_to, matches_regexp

from features.steps.shell import when_i_retry_run_command, when_i_run_command
from features.util import SUT
Expand Down Expand Up @@ -254,3 +254,23 @@ def store_candidate_version(context, package):
context.stored_vars["candidate"] = candidate_version_match.group(
1
).strip()


@then(
"I verify that the version of `{package1}` equals the version of `{package2}`" # noqa: E501
)
def verify_package_version_equality(context, package1, package2):
when_i_run_command(
context,
"dpkg-query --showformat='${{Version}}' --show {}".format(package1),
"as non-root",
)
package1_version_str = context.process.stdout.strip()
when_i_run_command(
context,
"dpkg-query --showformat='${{Version}}' --show {}".format(package2),
"as non-root",
)
package2_version_str = context.process.stdout.strip()

assert_that(package1_version_str, equal_to(package2_version_str))
123 changes: 53 additions & 70 deletions features/steps/ubuntu_advantage_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,83 +14,21 @@
)


@when("I install ubuntu-advantage-tools")
def when_i_install_uat(context, machine_name=SUT):
@when("I set up the apt source for ubuntu-advantage-tools")
def when_i_setup_uat_source(context, machine_name=SUT):
instance = context.machines[machine_name].instance
series = context.machines[machine_name].series
is_pro = "pro" in context.machines[machine_name].machine_type
if context.pro_config.install_from is InstallationSource.ARCHIVE:
instance.execute("sudo apt update")
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
)
if is_pro:
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
)
elif context.pro_config.install_from is InstallationSource.PREBUILT:
deb_paths = sorted(
get_debs_for_series(context.pro_config.debs_path, series)
)
logging.info("using debs: {}".format(deb_paths))
for deb_path in deb_paths:
if "advantage-pro" not in deb_path or is_pro:
instance.push_file(deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
elif context.pro_config.install_from is InstallationSource.LOCAL:
ua_deb_path, pro_deb_path, l10n_deb_path = build_debs(
series,
sbuild_output_to_terminal=context.pro_config.sbuild_output_to_terminal, # noqa: E501
)
instance.push_file(ua_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
instance.push_file(l10n_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
if is_pro:
instance.push_file(pro_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
elif context.pro_config.install_from is InstallationSource.DAILY:
instance.execute("sudo add-apt-repository ppa:ua-client/daily")
instance.execute("sudo apt update")
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
)
if is_pro:
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
)
elif context.pro_config.install_from is InstallationSource.STAGING:
instance.execute("sudo add-apt-repository ppa:ua-client/staging")
instance.execute("sudo apt update")
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
)
if is_pro:
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
)
elif context.pro_config.install_from is InstallationSource.STABLE:
instance.execute("sudo add-apt-repository ppa:ua-client/stable")
instance.execute("sudo apt update")
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
)
if is_pro:
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
)
elif context.pro_config.install_from is InstallationSource.PROPOSED:
context.text = "deb http://archive.ubuntu.com/ubuntu/ {series}-proposed main\n".format( # noqa: E501
series=series
Expand Down Expand Up @@ -129,25 +67,70 @@ def when_i_install_uat(context, machine_name=SUT):
)

instance.execute("sudo apt update")
elif context.pro_config.install_from is InstallationSource.CUSTOM:
instance.execute(
"sudo add-apt-repository {}".format(context.pro_config.custom_ppa)
)
instance.execute("sudo apt update")


@when("I install ubuntu-advantage-tools")
def when_i_install_uat(context, machine_name=SUT):
instance = context.machines[machine_name].instance
series = context.machines[machine_name].series
is_pro = "pro" in context.machines[machine_name].machine_type
if context.pro_config.install_from in [
InstallationSource.ARCHIVE,
InstallationSource.DAILY,
InstallationSource.STAGING,
InstallationSource.STABLE,
InstallationSource.PROPOSED,
InstallationSource.CUSTOM,
]:
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
)
if is_pro:
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
)
elif context.pro_config.install_from is InstallationSource.CUSTOM:
instance.execute(
"sudo add-apt-repository {}".format(context.pro_config.custom_ppa)
elif context.pro_config.install_from is InstallationSource.PREBUILT:
deb_paths = sorted(
get_debs_for_series(context.pro_config.debs_path, series)
)
instance.execute("sudo apt update")
logging.info("using debs: {}".format(deb_paths))
for deb_path in deb_paths:
if (
"ubuntu-pro-client-l10n" in deb_path
or "ubuntu-advantage-tools" in deb_path
or ("ubuntu-advantage-pro" in deb_path and is_pro)
):
instance.push_file(deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
elif context.pro_config.install_from is InstallationSource.LOCAL:
ua_deb_path, pro_deb_path, l10n_deb_path = build_debs(
series,
sbuild_output_to_terminal=context.pro_config.sbuild_output_to_terminal, # noqa: E501
)
instance.push_file(ua_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "ubuntu-advantage-tools", machine_name=machine_name
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
instance.push_file(l10n_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")
if is_pro:
instance.push_file(pro_deb_path, "/tmp/behave_ua.deb")
when_i_apt_install(
context, "ubuntu-advantage-pro", machine_name=machine_name
context, "/tmp/behave_ua.deb", machine_name=machine_name
)
instance.execute("sudo rm /tmp/behave_ua.deb")


@when("I have the `{series}` debs under test in `{dest}`")
Expand Down
Loading