Skip to content

Commit

Permalink
WIP: Test pkg replacement/obsoletion. [incomplete]
Browse files Browse the repository at this point in the history
  • Loading branch information
ximon18 committed Nov 20, 2024
1 parent 79d9c09 commit 8ba2eb1
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 4 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[workspace]
members = [
"adder"
]
, "successor"]

[package]
name = "mytest"
Expand Down
7 changes: 7 additions & 0 deletions successor/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions successor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 = "*"
3 changes: 3 additions & 0 deletions successor/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello from successor!");
}

0 comments on commit 8ba2eb1

Please sign in to comment.