commit:     497edc4c920a2a01f91e5af51f118d21ef0b140a
Author:     Kenton Groombridge <concord <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  1 18:23:13 2022 +0000
Commit:     Kenton Groombridge <concord <AT> gentoo <DOT> org>
CommitDate: Fri Jun  3 13:07:37 2022 +0000
URL:        
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=497edc4c

Make release-userspace script prefer pkgdev

Use pkgdev and pkgcheck if they are available and fallback to repoman
otherwise.

Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>

 gentoo/release-userspace.sh | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/gentoo/release-userspace.sh b/gentoo/release-userspace.sh
index 93565f23..4b81d2fd 100644
--- a/gentoo/release-userspace.sh
+++ b/gentoo/release-userspace.sh
@@ -21,6 +21,9 @@ sys-apps/restorecond
 # app-admin/setools not released together
 # dev-python/sepolgen became selinux-python in 2.7 release
 
+SCAN="$(command -v pkgcheck || command -v repoman)"
+COMMIT="$(command -v pkgdev || command -v repoman)"
+
 usage() {
   echo "Usage: $0 <release date> <newversion>"
   echo ""
@@ -51,6 +54,20 @@ die() {
   exit 2
 }
 
+# scan the tree for QA issues with pkgcheck or repoman
+doScan() {
+  if [[ "$(basename "${SCAN}")" == "pkgcheck" ]]; then
+    "${SCAN}" -q scan --staged
+  else
+    "${SCAN}" -q full
+  fi
+}
+
+# commit the current staged changes with pkgdev or repoman
+doCommit() {
+  "${COMMIT}" -q commit -m "${@}"
+}
+
 # set the release date in the live ebuilds so it will be correct when copying 
to the new version
 updateLiveEbuilds() {
     local PKG
@@ -80,10 +97,10 @@ updateLiveEbuilds() {
         # commit changes
         git add "${PN}-9999.ebuild"
         git --no-pager diff --cached
-        repoman -q full
+        doScan
         if [[ $? -eq 0 ]]
         then
-            repoman -q commit -m "$PKG: update live ebuild"
+            doCommit "$PKG: update live ebuild"
         else
             git reset -- .
         fi
@@ -112,14 +129,14 @@ createEbuilds() {
         sed -i -e "/${PN}-${NEWVERSION//_/-}/d" Manifest || die
         cp ${PN}-9999.ebuild ${PN}-${NEWVERSION}.ebuild || die
 
-        repoman -q manifest || die
+        "${COMMIT}" -q manifest || die
         git add Manifest ${PN}-${NEWVERSION}.ebuild || die
 
         #git --no-pager diff --cached
-        repoman -q full
+        doScan
         if [[ $? -eq 0 ]]
         then
-            repoman -q commit -m "$PKG: bump to ${NEWVERSION}" || die
+            doCommit "$PKG: bump to ${NEWVERSION}" || die
         else
             git reset -- . || die
         fi

Reply via email to