public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Onderka <jonderka@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: Rebuild and install checkpolicy
Date: Fri, 11 Sep 2026 13:23:59 GMT	[thread overview]
Message-ID: <178913303935.1.10861873501777362840.tests-selinux-feec2238742e@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : feec2238742e804c5039cef94e0834a6f0df8140
            Author : Jan Onderka <jonderka@redhat.com>
            Date   : 2026-09-11T14:42:24+02:00
            Stats  : +91/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/feec2238742e804c5039cef94e0834a6f0df8140?branch=pr775-checkpolicy-revdeps

            Log:
            Rebuild and install checkpolicy

The goal is to rebuild checkpolicy every time libsepol is updated and
install new checkpolicy build.

The test is intentionally notier without component so that it's not
picked up by existing selinux plans.

It's expected that this test will be run first in checkpolicy revdeps
plan which will invoke tests for checkpolicy component on the system
with updated checkpolicy.

Originated-by: Jan Onderka <jonderka@redhat.com>

---
diff --git a/libsepol/rebuild-and-install-checkpolicy/main.fmf b/libsepol/rebuild-and-install-checkpolicy/main.fmf
new file mode 100644
index 0000000..3a4371e
--- /dev/null
+++ b/libsepol/rebuild-and-install-checkpolicy/main.fmf
@@ -0,0 +1,22 @@
+summary: Rebuild and install checkpolicy
+description: |+
+    Rebuilds checkpolicy package from its source RPM and installs it to the system.
+    This is necessary for checkpolicy reverse dependecy testing - checkpolicy statically links
+    libsepol-static and so we need to rebuild checkpolicy and run its tests every time libsepol is updated.
+
+contact:
+  - Jan Onderka <jonderka@redhat.com>
+  - Petr Lautrbach <lautrbach@redhat.com>
+test: ./runtest.sh
+framework: beakerlib
+require:
+  - libsepol-static
+  - checkpolicy
+recommend:
+  - dnf-utils
+  - rpm-build
+duration: 10m
+enabled: true
+tag:
+  - avoidImageMode
+id: 9cbc42ad-95a9-4c15-b33d-e515d683360a

diff --git a/libsepol/rebuild-and-install-checkpolicy/runtest.sh b/libsepol/rebuild-and-install-checkpolicy/runtest.sh
new file mode 100755
index 0000000..c4fbc6e
--- /dev/null
+++ b/libsepol/rebuild-and-install-checkpolicy/runtest.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/checkpolicy/Sanity/rebuild-and-install
+#   Description: runs package rebuild and install if needed by reverse dependency
+#   Author: Jan Onderka <jonderka@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2009 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include rhts environment
+. /usr/share/beakerlib/beakerlib.sh
+
+PACKAGE="checkpolicy"
+RPMBUILDDIR="$(rpm -E '%{_topdir}')"
+ARCH_VERSION="$(uname -m)"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm ${PACKAGE}
+        rlRun "rm -rf ${RPMBUILDDIR} ${PACKAGE}*"
+        rlRun "mkdir -p ${RPMBUILDDIR}"
+        rlRun "pushd ${RPMBUILDDIR}"
+        rlFetchSrcForInstalled ${PACKAGE}
+        rlRun "popd"
+    rlPhaseEnd
+
+    rlPhaseStartTest "Source code tests"
+        PACKAGE_VERSION="$(rpm -qp --qf '%{version}\n' ${RPMBUILDDIR}/checkpolicy-*.src.rpm)"
+        rlLogInfo "PACKAGE_VERSION=${PACKAGE_VERSION}"
+        rlRun "dnf builddep -y ${RPMBUILDDIR}/checkpolicy-*.src.rpm"
+        rlRun "DIST=$(rpm --eval '%{dist}')"
+        rlRun -t "rpmbuild --rebuild --define '%dist $DIST.rebuild' ${RPMBUILDDIR}/checkpolicy-*.src.rpm"
+
+        if [[ -n "${SAVE_RPMBUILD_DATA:-}" ]]; then
+            rlRun "ls ${PACKAGE}*.src.rpm > ${TMT_TEST_DATA}/src.version"
+            rlRun "cp ${RPMBUILD}/checkpolicy-*.src.rpm ${TMT_TEST_DATA}/"
+            # rlRun "cp ${TMT_TEST_DATA}/${PACKAGE}-rpmbuild.tar.gz -C ${RPMBUILDDIR}/ ."
+        fi
+
+        rlRun "dnf install -y ${RPMBUILDDIR}/RPMS/${ARCH_VERSION}/${PACKAGE}-${PACKAGE_VERSION}*.rpm"
+
+        rlLog "$(rpm -qa | grep checkpolicy)"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "rm -rf ${RPMBUILDDIR}"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+

                 reply	other threads:[~2026-09-11 13:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178913303935.1.10861873501777362840.tests-selinux-feec2238742e@fedoraproject.org \
    --to=jonderka@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox