Skip to content

Commit

Permalink
Merge pull request coreos#4819 from jlebon/pr/opt-relabel
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebon authored Feb 7, 2024
2 parents eeeeaa2 + ab58750 commit 9f7cc77
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .copr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ srpm:
./ci/installdeps.sh
# similar to https://github.com/actions/checkout/issues/760, but for COPR
git config --global --add safe.directory '*'
# fetch tags so `git describe` gives a nice NEVRA when building the RPM
git fetch origin --tags
# if we have a git repo with remotes, fetch tags so `git describe` gives a nice NEVRA when
# building the RPM
if git remote | grep origin; then git fetch origin --tags; fi
git submodule update --init --recursive
# Our primary CI build goes via RPM rather than direct to binaries
# to better test that path, including our vendored spec file, etc.
Expand Down
6 changes: 2 additions & 4 deletions ci/prow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM registry.ci.openshift.org/coreos/fcos-buildroot:testing-devel as builder
WORKDIR /src
COPY . .
RUN ./ci/build.sh && make install DESTDIR=/cosa/component-install
RUN ./ci/coreosci-rpmbuild.sh && mkdir -p /cosa/component-rpms && mv rpm-ostree{,-libs}-20*.rpm /cosa/component-rpms
RUN make -C tests/kolainst install DESTDIR=/cosa/component-tests
# Uncomment this to fake a build to test the code below
#RUN mkdir -p /cosa/component-install/usr/bin && echo foo > /cosa/component-install/usr/bin/foo
Expand All @@ -12,9 +12,7 @@ USER root
# Copy binaries from the build
COPY --from=builder /cosa /cosa
# Merge them to the real root since we're used at compose time
# XXX: disabled for now
# https://github.com/coreos/rpm-ostree/pull/4763#issuecomment-1883686187
# RUN rsync -rlv /cosa/component-install/ /
RUN dnf install -y /cosa/component-rpms/*.rpm
# Merge installed tests
RUN rsync -rlv /cosa/component-tests/ /
# Grab all of our ci scripts
Expand Down
2 changes: 1 addition & 1 deletion ci/prow/fcos-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ls -al /usr/bin/rpm-ostree
rpm-ostree --version
cd $(mktemp -d)
cosa init https://github.com/coreos/fedora-coreos-config/
rsync -rlv /cosa/component-install/ overrides/rootfs/
cp /cosa/component-rpms/*.rpm overrides/rpm
cosa fetch
cosa build
cosa kola run 'ext.rpm-ostree.*'
2 changes: 2 additions & 0 deletions rust/src/composepost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ fn postprocess_subs_dist(rootfs_dfd: &Dir) -> Result<()> {
writeln!(w, "/home /var/home")?;
writeln!(w, "# https://github.com/coreos/rpm-ostree/pull/4640")?;
writeln!(w, "/usr/etc /etc")?;
writeln!(w, "# https://github.com/coreos/rpm-ostree/pull/1795")?;
writeln!(w, "/usr/lib/opt /opt")?;
Ok(())
})?;
}
Expand Down
6 changes: 6 additions & 0 deletions tests/kolainst/destructive/state-overlays
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ EOF
/tmp/autopkgtest-reboot 1
;;
1)
test -f /opt/bin/test-opt
test -f /opt/megacorp/bin/test-opt
test -f /opt/megacorp/lib/mylib
test -d /opt/megacorp/state
Expand All @@ -76,6 +77,11 @@ EOF
assert_file_has_content /tmp/out.txt 'test-opt'
assert_file_has_content /opt/megacorp/lib/mylib 'lib1'

stat -c '%C' /opt/bin/test-opt > /tmp/out.txt
assert_file_has_content /tmp/out.txt ':bin_t:'
stat -c '%C' /opt/megacorp > /tmp/out.txt
assert_file_has_content /tmp/out.txt ':usr_t:'

# add some state files
echo 'foobar' > /opt/megacorp/state/mystate

Expand Down
6 changes: 4 additions & 2 deletions tests/kolainst/kolainst-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ build_rpm zincati version 99.99 release 3

# An RPM that installs in /opt
build_rpm test-opt \
install "mkdir -p %{buildroot}/opt/megacorp/{bin,lib,state}
install "mkdir -p %{buildroot}/opt/megacorp/{bin,lib,state} %{buildroot}/opt/bin
install %{name} %{buildroot}/opt/bin
install %{name} %{buildroot}/opt/megacorp/bin
echo lib1 > %{buildroot}/opt/megacorp/lib/mylib" \
files "/opt/megacorp"
files "/opt/megacorp
/opt/bin/test-opt"

mv ${test_tmpdir}/yumrepo/* ${test_tmpdir}/rpm-repos/${repover}

Expand Down

0 comments on commit 9f7cc77

Please sign in to comment.