diff options
-rw-r--r-- | packaging/hal-rootstrap-checker.sh | 39 | ||||
-rw-r--r-- | packaging/hal-rootstrap-checker.yaml | 4 |
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: |