summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2024-08-12 18:36:08 +0900
committerYoungjae Cho <y0.cho@samsung.com>2024-08-12 19:00:39 +0900
commit817ac1c22bf5de59018438a110f50d0918e8947d (patch)
tree65ce5d812b1fa03ccaa195b62e11cd4fd7be2c03
parentb21d106504f8b94f8be4b5bb89a5d2eeeaa3547a (diff)
downloadrootstrap-817ac1c22bf5de59018438a110f50d0918e8947d.tar.gz
rootstrap-817ac1c22bf5de59018438a110f50d0918e8947d.tar.bz2
rootstrap-817ac1c22bf5de59018438a110f50d0918e8947d.zip
checker: Add configuration for BuildConflicts
Change-Id: I7d4fd5efb37b88d2b4fff641a1d565c5fd1a725b Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--packaging/hal-rootstrap-checker.sh39
-rw-r--r--packaging/hal-rootstrap-checker.yaml4
2 files changed, 42 insertions, 1 deletions
diff --git a/packaging/hal-rootstrap-checker.sh b/packaging/hal-rootstrap-checker.sh
index f4d52de..5fab1f0 100644
--- a/packaging/hal-rootstrap-checker.sh
+++ b/packaging/hal-rootstrap-checker.sh
@@ -64,6 +64,7 @@ HAL_ROOTSTRAP_CHECKER_CONF_D=/etc/hal/rootstrap/rules.d/hal-rootstrap-checker.ya
TARGET_PACKAGE_NAME=""
EXCLUDED_TARGET_PACKAGE_NAME=""
ALLOWED_BUILDREQUIRES=""
+ALLOWED_BUILDCONFLICTS=""
ALLOWED_REQUIRES=""
CHECK_ALWAYS="no"
@@ -114,6 +115,9 @@ while read LINE; do
allowed_buildrequires)
ALLOWED_BUILDREQUIRES+="$VALUE$IFS"
;;
+ allowed_buildconflicts)
+ ALLOWED_BUILDCONFLICTS+="$VALUE$IFS"
+ ;;
allowed_requires)
ALLOWED_REQUIRES+="$VALUE$IFS"
;;
@@ -175,6 +179,15 @@ while read -r LINE; do
SPECFILE_BUILDREQUIRES+="$LINE$IFS"
done <<< $(rpmspec -q --buildrequires $SPECFILE)
+# Parse specfile: Get BuildConflicts
+SPECFILE_BUILDCONFLICTS=""
+while read -r LINE; do
+ if [[ -z $LINE ]]; then
+ continue
+ fi
+ SPECFILE_BUILDCONFLICTS+="$LINE$IFS"
+done <<< $(rpmspec -q --buildconflicts $SPECFILE)
+
# Parse specfile: Get Requires
SPECFILE_REQUIRES=""
while read -r LINE; do
@@ -200,6 +213,22 @@ for BUILDREQUIRES in $SPECFILE_BUILDREQUIRES; do
fi
done
+# Collect not allowed BuildConflicts
+SPECFILE_NOT_ALLOWED_BUILDCONFLICTS=""
+for BUILDCONFLICTS in $SPECFILE_BUILDCONFLICTS; do
+ IS_ALLOWED=0
+ for ALLOWED_PATTERN in $ALLOWED_BUILDCONFLICTS; do
+ if [[ $BUILDCONFLICTS == $ALLOWED_PATTERN ]]; then
+ IS_ALLOWED=1
+ break
+ fi
+ done
+
+ if [[ $IS_ALLOWED == 0 ]]; then
+ SPECFILE_NOT_ALLOWED_BUILDCONFLICTS+="$BUILDCONFLICTS$IFS"
+ fi
+done
+
# Collect not allowed Requires
SPECFILE_NOT_ALLOWED_REQUIRES=""
for REQUIRES in $SPECFILE_REQUIRES; do
@@ -224,6 +253,14 @@ if [[ ! -z $SPECFILE_NOT_ALLOWED_BUILDREQUIRES ]]; then
"$CHECK_ALWAYS"
fi
+# Check if there are not allowed BuildConflicts
+if [[ ! -z $SPECFILE_NOT_ALLOWED_BUILDCONFLICTS ]]; then
+ print_not_allowed_warning "BuildConflicts" \
+ "$SPECFILE_NOT_ALLOWED_BUILDCONFLICTS" \
+ "$ALLOWED_BUILDCONFLICTS" \
+ "$CHECK_ALWAYS"
+fi
+
# Check if there are not allowed Requires
if [[ ! -z $SPECFILE_NOT_ALLOWED_REQUIRES ]]; then
print_not_allowed_warning "Requires" \
@@ -237,6 +274,6 @@ if [[ $DISABLE_HAL_ROOTSTRAP_CHECKER != 0 && $CHECK_ALWAYS == "no" ]]; then
exit 0
fi
-if [[ ! -z $SPECFILE_NOT_ALLOWED_BUILDREQUIRES || ! -z $SPECFILE_NOT_ALLOWED_REQUIRES ]]; then
+if [[ ! -z $SPECFILE_NOT_ALLOWED_BUILDREQUIRES || ! -z $SPECFILE_NOT_ALLOWED_REQUIRES || ! -z $SPECFILE_NOT_ALLOWED_BUILDCONFLICTS ]]; then
exit 0 # Let them pass for now
fi
diff --git a/packaging/hal-rootstrap-checker.yaml b/packaging/hal-rootstrap-checker.yaml
index df94650..5bb4ef1 100644
--- a/packaging/hal-rootstrap-checker.yaml
+++ b/packaging/hal-rootstrap-checker.yaml
@@ -14,6 +14,10 @@ allowed_buildrequires:
- cmake
- pkgconfig(hal-rootstrap)
+# List of packages that are allowed to be used as BuildConflicts
+# Follow pattern matching of bash(1).
+allowed_buildconflicts:
+
# List of packages that are allowed to be used as Requires
# Follow pattern matching of bash(1).
allowed_requires: