stratis-storage / ci

To manage CI for various project repos.
0 stars 6 forks source link

Preliminary work for stratis-dumpmetadata subpackage #335

Closed mulkieran closed 2 years ago

mulkieran commented 2 years ago

Related https://github.com/stratis-storage/project/issues/443

mulkieran commented 2 years ago

Requires a number of updates to stratisd repo Makefile targets before it will be ready. Also depends on https://github.com/stratis-storage/stratisd/issues/3102.

mulkieran commented 2 years ago

I believe that this spec file will work correctly, just that it will not satisfy its pretty-hex dependency on f35.

bgurney-rh commented 2 years ago

I'm getting a failure to build, on rawhide:

error: no bin target named `stratis-dumpmetadata`

        Did you mean `stratis_dumpmetadata`?

I tried modifying the stratisd spec file...

diff --git a/mockbuild_test/stratisd.spec b/mockbuild_test/stratisd.spec
index b426325..f6865ee 100644
--- a/mockbuild_test/stratisd.spec
+++ b/mockbuild_test/stratisd.spec
@@ -104,7 +104,7 @@ tar --strip-components=1 --extract --verbose --file %{SOURCE2}
 %else
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratisd
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-min --bin=stratisd-min --bin=stratis-utils --no-default-features --features min,systemd_compat
-%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-dumpmetadata --no-default-features --features extras
+%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis_dumpmetadata --no-default-features --features extras
 a2x -f manpage docs/stratis_dumpmetadata.txt
 %endif
 a2x -f manpage docs/stratisd.txt
@@ -164,7 +164,7 @@ a2x -f manpage docs/stratisd.txt
 %if !0%{?rhel} || 0%{?eln}
 %files stratis-tools
 %license LICENSE
-%{_bindir}/stratis-dumpmetadata
+%{_bindir}/stratis_dumpmetadata
 %{_mandir}/man8/stratis_dumpmetadata.8*
 %endif

...and had a different failure (perhaps I need to add a "--features" flag in the "cargo build" line?):

error[E0432]: unresolved import `crate::stratis::ipc_support::setup`
  --> src/stratis/run.rs:26:53
   |
26 |         dm::dm_event_thread, errors::StratisResult, ipc_support::setup, stratis::VERSION,
   |                                                     ^^^^^^^^^^^^^^^^^^ no `setup` in `stratis::ipc_support`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `stratisd` due to previous error
bgurney-rh commented 2 years ago

I seem to be getting closer; I had to change the doc text file to docs/stratis-dumpmetadata.txt. Testing this now:

diff --git a/mockbuild_test/stratisd.spec b/mockbuild_test/stratisd.spec
index b426325..3d8938d 100644
--- a/mockbuild_test/stratisd.spec
+++ b/mockbuild_test/stratisd.spec
@@ -104,8 +104,8 @@ tar --strip-components=1 --extract --verbose --file %{SOURCE2}
 %else
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratisd
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-min --bin=stratisd-min --bin=stratis-utils --no-default-features --features min,systemd_compat
-%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-dumpmetadata --no-default-features --features extras
-a2x -f manpage docs/stratis_dumpmetadata.txt
+%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis_dumpmetadata --no-default-features --features extras,min
+a2x -f manpage docs/stratis-dumpmetadata.txt
 %endif
 a2x -f manpage docs/stratisd.txt

@@ -164,7 +164,7 @@ a2x -f manpage docs/stratisd.txt
 %if !0%{?rhel} || 0%{?eln}
 %files stratis-tools
 %license LICENSE
-%{_bindir}/stratis-dumpmetadata
+%{_bindir}/stratis_dumpmetadata
 %{_mandir}/man8/stratis_dumpmetadata.8*
 %endif
bgurney-rh commented 2 years ago

After stratis-storage/stratisd#3143 was merged, I was able to successfully build with this change to stratisd.spec:

diff --git a/mockbuild_test/stratisd.spec b/mockbuild_test/stratisd.spec
index b426325..3956b15 100644
--- a/mockbuild_test/stratisd.spec
+++ b/mockbuild_test/stratisd.spec
@@ -104,13 +104,15 @@ tar --strip-components=1 --extract --verbose --file %{SOURCE2}
 %else
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratisd
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-min --bin=stratisd-min --bin=stratis-utils --no-default-features --features min,systemd_compat
-%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-dumpmetadata --no-default-features --features extras
-a2x -f manpage docs/stratis_dumpmetadata.txt
+%{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-dumpmetadata --no-default-features --features extras,min
+a2x -f manpage docs/stratis-dumpmetadata.txt
 %endif
 a2x -f manpage docs/stratisd.txt

 %install
 %make_install DRACUTDIR=%{dracutdir} PROFILEDIR=release
+%{__install} -Dpm0644 -t %{buildroot}%{_mandir}/man8 docs/stratis-dumpmetadata.8
+%{__install} -Dpm0755 -t %{buildroot}%{_bindir} target/release/stratis-dumpmetadata

 %if %{with check}
 %check
@@ -165,7 +167,7 @@ a2x -f manpage docs/stratisd.txt
 %files stratis-tools
 %license LICENSE
 %{_bindir}/stratis-dumpmetadata
-%{_mandir}/man8/stratis_dumpmetadata.8*
+%{_mandir}/man8/stratis-dumpmetadata.8*
 %endif

 %changelog
bgurney-rh commented 2 years ago

I'm still encountering an inability to mock build with the CentOS 9 Stream chroot (-r /etc/mock/centos-stream-9.x86_64.cfg)

bgurney-rh commented 2 years ago

I have something that builds with the CentOS 9 Stream, applied on top of of 9e37895:

(Mostly removing some %if blocks that are no longer necessary, but also a couple of %{__install} lines:)

diff --git a/mockbuild_test/stratisd.spec b/mockbuild_test/stratisd.spec
index e72bd0a..66c9fc7 100644
--- a/mockbuild_test/stratisd.spec
+++ b/mockbuild_test/stratisd.spec
@@ -72,7 +72,6 @@ Requires:     plymouth
 %description dracut
 %{summary}. This package should not be used in production.

-%if !0%{?rhel} || 0%{?eln}
 %package stratis-tools
 Summary: Tools that support Stratis operation

@@ -82,7 +81,6 @@ Requires:     stratisd

 %description stratis-tools
 %{summary}. This package should not be used in production.
-%endif

 %prep
 %setup -q
@@ -101,16 +99,19 @@ tar --strip-components=1 --extract --verbose --file %{SOURCE2}
 %if 0%{?rhel} && !0%{?eln}
 %{cargo_build} --bin=stratisd
 %{cargo_build} --bin=stratis-min --bin=stratisd-min --bin=stratis-utils --no-default-features --features min,systemd_compat
+%{cargo_build} --bin=stratis-dumpmetadata --no-default-features --features extras,min
 %else
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratisd
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-min --bin=stratisd-min --bin=stratis-utils --no-default-features --features min,systemd_compat
 %{__cargo} build %{?__cargo_common_opts} --release --bin=stratis-dumpmetadata --no-default-features --features extras,min
-a2x -f manpage docs/stratis-dumpmetadata.txt
 %endif
 a2x -f manpage docs/stratisd.txt
+a2x -f manpage docs/stratis-dumpmetadata.txt

 %install
 %make_install DRACUTDIR=%{dracutdir} PROFILEDIR=release
+%{__install} -Dpm0644 -t %{buildroot}%{_mandir}/man8 docs/stratis-dumpmetadata.8
+%{__install} -Dpm0755 -t %{buildroot}%{_bindir} target/release/stratis-dumpmetadata

 %if %{with check}
 %check
@@ -161,12 +162,10 @@ a2x -f manpage docs/stratisd.txt
 %{_systemd_util_dir}/system-generators/stratis-clevis-setup-generator
 %{_systemd_util_dir}/system-generators/stratis-setup-generator

-%if !0%{?rhel} || 0%{?eln}
 %files stratis-tools
 %license LICENSE
 %{_bindir}/stratis-dumpmetadata
 %{_mandir}/man8/stratis-dumpmetadata.8*
-%endif

 %changelog
 * Fri Mar 22 2233 Stratis Team <stratis-team@redhat.com> - 77.77.77-77
bgurney-rh commented 2 years ago

The above also builds with Fedora Rawhide.

mulkieran commented 2 years ago

Obsolete.