Repository: eclipse-bluechi/bluechi (language: python)

Issue:
Move version to dedicated script
This PR moves the version and release to a dedicated script, which can then be used by meson to fetch the short version (e.g. `0.6.0-1` for releases) or the long one (e.g. `0.6.0-0.202310261526.git3b060db` for dev/nightly builds). This changes the -v CLI option as well:
```bash
$ bluechictl -v
bluechictl version 0.6.0-0.202310261526.git3b060db
```

Fixes: https://github.com/eclipse-bluechi/bluechi/issues/454

/cc @dougsland @mkemel 


Discussion / hints:
/packit build
/packit test
/packit build
/packit build
/packit test

Fix patch:
diff --git a/.copr/Makefile b/.copr/Makefile
index 0b867c8595..f2a671e33b 100644
--- a/.copr/Makefile
+++ b/.copr/Makefile
@@ -4,5 +4,6 @@ installdeps:
 	dnf -y install gcc gcc-c++ git jq meson systemd-devel rpm-build
 
 srpm: installdeps
+	git config --global --add safe.directory "$(shell pwd)"
 	./build-scripts/build-srpm.sh
 	cp rpmbuild/SRPMS/*.src.rpm $(outdir)
diff --git a/.packit.yml b/.packit.yml
index 6d161f7589..68a6d0d44a 100644
--- a/.packit.yml
+++ b/.packit.yml
@@ -19,6 +19,7 @@ srpm_build_deps:
 
 actions:
   post-upstream-clone:
+    - bash -c 'git config --global --add safe.directory $(pwd)'
     - bash -c './build-scripts/create-spec.sh'
 
   get-current-version:
diff --git a/build-scripts/version.sh b/build-scripts/version.sh
index 5b019a9147..0ea1022b05 100755
--- a/build-scripts/version.sh
+++ b/build-scripts/version.sh
@@ -19,9 +19,6 @@ function release(){
         # Used for official releases. Increment if necessary
         RELEASE="1"
     else
-        # Mark current directory as safe for git to be able to parse git hash
-        git config --global --add safe.directory $(pwd)
-
         # Used for nightly builds
         RELEASE="0.$(date +%04Y%02m%02d%02H%02M).git$(git rev-parse --short ${GITHUB_SHA:-HEAD})"
     fi


Test patch:
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 9a6fd43a1a..d6d034b706 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -23,6 +23,10 @@ jobs:
           # Use githash of a tested commit instead of merge commit
           ref: ${{ github.event.pull_request.head.sha }}
 
+      - name: Mark source directory as safe
+        run: | 
+          git config --global --add safe.directory $(pwd)
+
       - name: Perform build
         run: |
           ./build-scripts/build-rpm.sh $ARTIFACTS_DIR