From 8ba2eb1d66fd718fb2bb85a7e00f4a94d7b99300 Mon Sep 17 00:00:00 2001 From: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:41:30 +0100 Subject: [PATCH] WIP: Test pkg replacement/obsoletion. [incomplete] --- .github/workflows/pkg.yml | 54 ++++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- successor/Cargo.lock | 7 +++++ successor/Cargo.toml | 44 +++++++++++++++++++++++++++++++ successor/src/main.rs | 3 +++ 5 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 successor/Cargo.lock create mode 100644 successor/Cargo.toml create mode 100644 successor/src/main.rs diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index 0b9cac8..6770bd9 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -401,12 +401,12 @@ jobs: rpm_scriptlets_path: pkg/rpm/scriptlets.toml - test_with_alt_cargo_toml: - if: ${{ inputs.single_job == '' || inputs.single_job == 'test_with_alt_cargo_toml' }} + test_with_cargo_workspace: + if: ${{ inputs.single_job == '' || inputs.single_job == 'test_with_cargo_workspace' }} uses: NLnetLabs/ploutos/.github/workflows/pkg-rust.yml@v7 secrets: inherit with: - artifact_prefix: test_with_alt_cargo_toml + artifact_prefix: test_with_cargo_workspace_ manifest_dir: virtual workspace_package: app @@ -420,3 +420,51 @@ jobs: - "fresh-install" target: - "x86_64" + + test_with_obsolete_pkg_replacement: + if: ${{ inputs.single_job == '' || inputs.single_job == 'test_with_obsolete_pkg_replacement' }} + uses: NLnetLabs/ploutos/.github/workflows/pkg-rust.yml@120-upgrade-cargo-generate-rpm-to-support-posttrans + secrets: inherit + with: + artifact_prefix: test_with_obsolete_pkg_replacement_ + manifest_dir: successor + + package_build_rules: | + pkg: + - "successor" + image: + - "rockylinux:8" + - "ubuntu:jammy" + mode: + - "fresh-install" + - "upgrade-from-published" + target: + - "x86_64" + + package_test_rules: | + pkg: + - "successor" + published_pkg: + - "mytest" + image: + - "ubuntu:jammy" # ubuntu/22.04 + - "centos:8" + mode: + - "fresh-install" + - "upgrade-from-published" + target: + - "x86_64" + + package_test_scripts_path: pkg/test-scripts/test-mytest-successor.sh + + deb_apt_key_url: 'https://raw.githubusercontent.com/NLnetLabs/ploutos-testing/main/repo/apt-key.asc' + deb_apt_source: 'deb https://raw.githubusercontent.com/NLnetLabs/ploutos-testing/main/repo/linux/${OS_NAME}/ ${OS_REL} main' + + rpm_scriptlets_path: pkg/rpm/scriptlets-successor.toml + rpm_yum_key_url: 'https://raw.githubusercontent.com/NLnetLabs/ploutos-testing/main/repo/yum-key.asc' + rpm_yum_repo: | + [nlnetlabs] + name=NLnet Labs + baseurl=https://raw.githubusercontent.com/NLnetLabs/ploutos-testing/main/repo/linux/centos/$releasever/main/$basearch + enabled=1 + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 30f1b87..31de0f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [workspace] members = [ "adder" -] +, "successor"] [package] name = "mytest" diff --git a/successor/Cargo.lock b/successor/Cargo.lock new file mode 100644 index 0000000..4e57f73 --- /dev/null +++ b/successor/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "successor" +version = "0.1.0" diff --git a/successor/Cargo.toml b/successor/Cargo.toml new file mode 100644 index 0000000..f738b6c --- /dev/null +++ b/successor/Cargo.toml @@ -0,0 +1,44 @@ +# This package is intended to +[package] +name = "successor" +version = "0.1.0" +edition = "2021" + +[dependencies] + +# Stupid trick to stop Cargo searching upwards for a parent Cargo.toml. +# See: +# - https://github.com/rust-lang/cargo/issues/4992#issuecomment-362143452 +# - https://github.com/rust-lang/cargo/issues/7871 +[workspace] + +[package.metadata.deb] +name = "successor" +priority = "optional" +section = "net" +extended-description-file = "pkg/debian/description.txt" +license-file = ["LICENSE", "0"] +maintainer-scripts = "pkg/debian/" +changelog = "target/debian/changelog" # this will be generated by the pkg workflow +copyright = "Copyright (c) 2022, Your Company. All rights reserved." +assets = [ + ["target/release/successor", "/usr/bin/successor", "755"], +] +replaces = "mytest" + +[package.metadata.generate-rpm] +# "BSD" alone is the 3-clause license. Inheriting "license" from above causes rpmlint to +# complain with "invalid-license". +# See: https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing +license = "BSD" +assets = [ + { source = "target/release/successor", dest = "/usr/bin/successor", mode = "755" }, +] + +# These get set using cargo-generate-rpm --set-metadata at package build time. +#post_install_script = ... +#pre_uninstall_script = ... +#post_uninstall_script = ... + +[package.metadata.generate-rpm.obsoletes] +mytest = "*" \ No newline at end of file diff --git a/successor/src/main.rs b/successor/src/main.rs new file mode 100644 index 0000000..ae82f79 --- /dev/null +++ b/successor/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello from successor!"); +}