From 2c0b161ac5428c700ffe66ede5dbdeb19c853e1cd7698eabc8fd7c3c205b9325 Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Tue, 28 Mar 2023 12:44:26 +0000 Subject: [PATCH] Accepting request 1075010 from home:cahu:branches:security:SELinux - Add debug-build.sh script to make debugging without committing easier OBS-URL: https://build.opensuse.org/request/show/1075010 OBS-URL: https://build.opensuse.org/package/show/security:SELinux/selinux-policy?expand=0&rev=180 --- debug-build.sh | 34 ++++++++++++++++++++++++++++++++++ selinux-policy.changes | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 debug-build.sh diff --git a/debug-build.sh b/debug-build.sh new file mode 100644 index 0000000..44a626f --- /dev/null +++ b/debug-build.sh @@ -0,0 +1,34 @@ +# This script creates a debugging and testing environment when working on the policy +# Basically a fancy wrapper for "tar --exclude-vcs -cJf selinux-policy-20230321.tar.xz --transform 's,^,selinux-policy-20230321/,' -C selinux-policy ." +# +# 1. Get the git repository with 'osc service manualrun' or './update.sh' +# 2. Do your changes in the selinux-policy repository, test around +# 1. When you want to build locally to debug, call this script. It will create a .tar.xz with your current selinux-policy working directory. +# 2. Build locally: e.g. with osc build +# 3. Test your rpms that contain your changes and repeat +# 3. When finished, commit your changes in the selinux-policy repository and push to git +# 4. Run './update.sh' and checkin the changes to OBS + +REPO_NAME=selinux-policy + +# Check if git repository exists, if not ask the user to fetch the latest version +if ! test -d "$REPO_NAME"; then + echo "-$REPO_NAME does not exist. Please run 'osc service manualrun' or './update.sh' first." + exit 1; +fi + +# Get current version: Parse "Version: " from specfile +VERSION=$(grep -Po '^Version:\s*\K.*?(?=$)' $REPO_NAME.spec) + +# Create tar file with name like selinux-policy-.tar.xz +TAR_NAME=$REPO_NAME-$VERSION.tar.xz +echo "Creating tar file: $TAR_NAME" +tar --exclude-vcs -cJf $TAR_NAME --transform "s,^,$REPO_NAME-$VERSION/," -C $REPO_NAME . + +# Some helpful prompts +if test $? -eq 0; then + echo "Success! Now you can run your local build command, e.g. 'osc build'. It will take the archive that contains your changes." + echo "You can also inspect the created archive with: 'tar tvf $REPO_NAME-$VERSION.tar.xz'" +else + echo "Error, creating archive failed" +fi diff --git a/selinux-policy.changes b/selinux-policy.changes index 361ee04..2dd0a11 100644 --- a/selinux-policy.changes +++ b/selinux-policy.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 28 12:27:47 UTC 2023 - Hu + +- Add debug-build.sh script to make debugging without committing easier + ------------------------------------------------------------------- Tue Mar 21 15:37:23 UTC 2023 - jsegitz@suse.com