hal-rootstrap-checker: Move source to Tizen-Base project 55/316155/1 accepted/tizen/unified/20240819.150149 accepted/tizen/unified/dev/20240821.053507 accepted/tizen/unified/x/20240820.013158
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 14 Aug 2024 06:56:19 +0000 (15:56 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 14 Aug 2024 06:58:14 +0000 (15:58 +0900)
The hal-rootstrap-checker should have worked for every rpmbuild. But
packages from Tizen-Base project cannot have build dependency to
packages of Tizen-Unified project, making them unable to locate
hal-rootstrap-checker. Therefore, move hal-rootstrap-checker sources
to the Tizen-Base project, platform/hal/backend/rootstrap-checker.

Change-Id: I383c6ca9588242c1a5653f9d77974e00562448b1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
packaging/hal-rootstrap-checker.sh [deleted file]
packaging/hal-rootstrap-checker.yaml [deleted file]
packaging/hal-rootstrap.spec
packaging/macros.hal-rootstrap-checker [deleted file]

diff --git a/packaging/hal-rootstrap-checker.sh b/packaging/hal-rootstrap-checker.sh
deleted file mode 100644 (file)
index 7ab0fb0..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/bin/bash
-
-# Disable pathname expansion by '*' or '?'
-set -f
-
-IFS=";"
-
-# Message formatting
-LINE_MAX_LENGTH=90
-
-print_border() {
-       PLACEHOLDER=$(printf "%*s" "$LINE_MAX_LENGTH" " ")
-       echo ${PLACEHOLDER// /\#}
-}
-
-print_message() {
-       MESSAGE_MAX_LENGTH=$(($LINE_MAX_LENGTH - 3))
-       printf "# %-*s#\n" "$MESSAGE_MAX_LENGTH" "$1"
-}
-
-print_not_allowed_warning() {
-       WARNING_TYPE=$1
-       NOT_ALLOWED_LIST=$2
-       ALLOWED_LIST=$3
-       CHECK_ALWAYS=$4
-
-       print_border
-       print_border
-
-       print_message "WARNING: There are not allowed $WARNING_TYPE. They might cause ABI break."
-       for NOT_ALLOWED in ${NOT_ALLOWED_LIST}; do
-               print_message "WARNING:  - $NOT_ALLOWED"
-       done
-
-       print_message "WARINIG:"
-       if [[ ! -z $ALLOWED_LIST ]]; then
-               print_message "WARNING: Use only allowed packages below for $WARNING_TYPE"
-               for ALLOWED in ${ALLOWED_LIST}; do
-                       print_message "WARNING:  - $ALLOWED"
-               done
-       else
-               print_message "WARNING: It is not allowed to specify $WARNING_TYPE"
-       fi
-
-       if [[ $CHECK_ALWAYS == "no" ]]; then
-               print_message "WARNING:"
-               print_message "WARNING: Give parameter --define 'disable_hal_rootstrap_checker 1' to gbs build"
-               print_message "WARNING: to skip this check."
-       fi
-
-       print_border
-       print_border
-}
-
-# main
-DISABLE_HAL_ROOTSTRAP_CHECKER=$1
-SOURCEDIR=$2
-
-# Checker configuration filepath
-HAL_ROOTSTRAP_CHECKER_CONF=/etc/hal/rootstrap/hal-rootstrap-checker.yaml
-HAL_ROOTSTRAP_CHECKER_CONF_D=/etc/hal/rootstrap/rules.d/hal-rootstrap-checker.yaml
-
-# Checker configuration
-TARGET_PACKAGE_NAME=""
-EXCLUDED_TARGET_PACKAGE_NAME=""
-ALLOWED_BUILDREQUIRES=""
-ALLOWED_BUILDCONFLICTS=""
-ALLOWED_REQUIRES=""
-CHECK_ALWAYS="no"
-
-# Locate configuration file
-CONFFILE=""
-if [[ -s $HAL_ROOTSTRAP_CHECKER_CONF_D ]]; then
-       CONFFILE=$HAL_ROOTSTRAP_CHECKER_CONF_D
-elif [[ -s $HAL_ROOTSTRAP_CHECKER_CONF ]]; then
-       CONFFILE=$HAL_ROOTSTRAP_CHECKER_CONF
-else
-       echo "No configuration has been specified. Skipping test"
-       exit 0
-fi
-
-# Naive yaml parser for configuration file
-KEY=""
-while read LINE; do
-       # Trim comment(#) and whitespace
-       LINE=$(echo "$LINE" | sed 's/#.*//')
-       LINE=$(echo "$LINE" | sed 's/^[[:space:]]*\(.*\)[[:space:]]*$/\1/')
-
-       if [[ -z "$LINE" ]]; then
-               continue
-       fi
-
-       VALUE=""
-       if [[ "$LINE" =~ ^(.*):\ (.*)$ ]]; then # 'key: value'
-               KEY="${BASH_REMATCH[1]}"
-               VALUE="${BASH_REMATCH[2]}"
-       elif [[ "$LINE" =~ ^(.*):$ ]]; then # 'key:'
-               KEY="${BASH_REMATCH[1]}"
-               VALUE=""
-       elif [[ "$LINE" =~ ^-\ (.*)$ ]]; then # '- value'
-               VALUE="${BASH_REMATCH[1]}"
-       fi
-
-       if [[ -z "$VALUE" ]]; then
-               continue
-       fi
-
-       case $KEY in
-               target_package_name)
-                       TARGET_PACKAGE_NAME+="$VALUE$IFS"
-                       ;;
-               excluded_target_package_name)
-                       EXCLUDED_TARGET_PACKAGE_NAME+="$VALUE$IFS"
-                       ;;
-               allowed_buildrequires)
-                       ALLOWED_BUILDREQUIRES+="$VALUE$IFS"
-                       ;;
-               allowed_buildconflicts)
-                       ALLOWED_BUILDCONFLICTS+="$VALUE$IFS"
-                       ;;
-               allowed_requires)
-                       ALLOWED_REQUIRES+="$VALUE$IFS"
-                       ;;
-               check_always)
-                       CHECK_ALWAYS="$VALUE"
-                       ;;
-               *)
-                       echo "Undefined key($KEY), skip the line: $LINE"
-                       ;;
-       esac
-done < $CONFFILE
-
-# Screen out packages that are not subject to the hal-rootstrap-checker
-SPECFILE=$(find $SOURCEDIR -name *.spec)
-if [[ $? != 0 ]]; then
-       echo "Cannot locate specfile for hal-rootstrap-checker"
-       exit 0
-fi
-
-CURRENT_PACKAGE_NAME=$(rpmspec -q --queryformat "[%{NAME}\n]" $SPECFILE | head -n 1)
-PATTERN_MATCHED=0
-for PATTERN in $TARGET_PACKAGE_NAME; do
-       if [[ $CURRENT_PACKAGE_NAME == $PATTERN ]]; then
-               PATTERN_MATCHED=1
-               break
-       fi
-done
-
-if [[ $PATTERN_MATCHED == 0 ]]; then
-       exit 0
-fi
-
-PATTERN_MATCHED=0
-for PATTERN in $EXCLUDED_TARGET_PACKAGE_NAME; do
-       if [[ $CURRENT_PACKAGE_NAME == $PATTERN ]]; then
-               PATTERN_MATCHED=1
-               break
-       fi
-done
-
-if [[ $PATTERN_MATCHED == 1 ]]; then
-       print_border
-       print_border
-
-       print_message "NOTICE: $CURRENT_PACKAGE_NAME is skipped from hal-rootstrap-checker"
-       print_message "NOTICE: as it has been specified at excluded_target_package_name."
-
-       print_border
-       print_border
-       exit 0
-fi
-
-# Parse specfile: Get BuildRequires
-SPECFILE_BUILDREQUIRES=""
-while read -r LINE; do
-       if [[ -z $LINE ]]; then
-               continue
-       fi
-       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
-       if [[ -z $LINE ]]; then
-               continue
-       fi
-       SPECFILE_REQUIRES+="$LINE$IFS"
-done <<< $(rpmspec -q --queryformat "[%{REQUIRES}\n]" $SPECFILE)
-
-# Collect not allowed BuildRequires
-SPECFILE_NOT_ALLOWED_BUILDREQUIRES=""
-for BUILDREQUIRES in $SPECFILE_BUILDREQUIRES; do
-       IS_ALLOWED=0
-       for ALLOWED_PATTERN in $ALLOWED_BUILDREQUIRES; do
-               if [[ $BUILDREQUIRES == $ALLOWED_PATTERN ]]; then
-                       IS_ALLOWED=1
-                       break
-               fi
-       done
-
-       if [[ $IS_ALLOWED == 0 ]]; then
-               SPECFILE_NOT_ALLOWED_BUILDREQUIRES+="$BUILDREQUIRES$IFS"
-       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
-       IS_ALLOWED=0
-       for ALLOWED_PATTERN in $ALLOWED_REQUIRES; do
-               if [[ $REQUIRES == $ALLOWED_PATTERN ]]; then
-                       IS_ALLOWED=1
-                       break
-               fi
-       done
-
-       if [[ $IS_ALLOWED == 0 ]]; then
-               SPECFILE_NOT_ALLOWED_REQUIRES+="$REQUIRES$IFS"
-       fi
-done
-
-# Check if there are not allowed BuildRequires
-if [[ ! -z $SPECFILE_NOT_ALLOWED_BUILDREQUIRES ]]; then
-       print_not_allowed_warning "BuildRequires" \
-               "$SPECFILE_NOT_ALLOWED_BUILDREQUIRES" \
-               "$ALLOWED_BUILDREQUIRES" \
-               "$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" \
-               "$SPECFILE_NOT_ALLOWED_REQUIRES" \
-               "$ALLOWED_REQUIRES" \
-               "$CHECK_ALWAYS"
-fi
-
-# Check whether the test can be skipped
-if [[ $DISABLE_HAL_ROOTSTRAP_CHECKER != 0 && $CHECK_ALWAYS == "no" ]]; then
-       exit 0
-fi
-
-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
deleted file mode 100644 (file)
index 1aacc29..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-# List of packages that are subject to the hal-rootstrap-checker.
-# Follow pattern matching of bash(1).
-target_package_name:
-    - hal-backend-*
-    - alsa-ucm-data-*
-    - audio-hal-*
-    - bluetooth-firmware-*
-    - camera-hal-*
-    - fm-data-*
-    - lbs-server-plugin-*
-    - media-config-target-*
-    - model-config-*
-    - pass-hal-*
-
-# List of packages that are exempt from the hal-rootstrap-checker.
-# It is applied on top of the above 'target_package_name'.
-# Follow pattern matching of bash(1).
-excluded_target_package_name:
-
-# List of packages that are allowed to be used as BuildRequires
-# Follow pattern matching of bash(1).
-allowed_buildrequires:
-    - cmake
-    - pkgconfig(hal-rootstrap)
-    - linux-glibc-devel
-    - kernel-headers-*
-
-# List of packages that are allowed to be used as BuildConflicts
-# Follow pattern matching of bash(1).
-allowed_buildconflicts:
-    - linux-glibc-devel
-    - kernel-headers-*
-
-# List of packages that are allowed to be used as Requires
-# Follow pattern matching of bash(1).
-allowed_requires:
-
-# yes or no(default)
-# if no, you can skip the hal-rootstrap-checker test
-# by giving gbs build parameter, --define 'disable_hal_rootstrap_checker 1'.
-check_always: no
index 2a127f8763565dfc4e85cf0441be73b791181a85..4becef8bedd20cb0260c6572fcaab6be6a83a365 100644 (file)
@@ -13,9 +13,6 @@ Release:      1
 #Group: 
 License:       Apache-2.0
 Source0:       %{name}-%{version}.tar.gz
-Source1:       hal-rootstrap-checker.sh
-Source2:       hal-rootstrap-checker.yaml
-Source3:       macros.hal-rootstrap-checker
 AutoReqProv:    no
 
 BuildRequires: cmake
@@ -37,15 +34,6 @@ Requires:    %{name} = %{version}-%{release}
 %description -n        %{devel_name}
 %{name} Interface for product vendor developer
 
-### hal-rootstrap-checker
-%package checker
-Summary:       %{name} checker
-Group:         System/Base
-#Requires:     hal-rootstrap-checker-plugin-conf
-
-%description checker
-Checker for the hal rootstrap
-
 ### hal-rootstrap-headed
 %package -n    %{headed_name}
 Summary:       Package for rootstrap of hal, for headed image
@@ -87,13 +75,6 @@ cp packaging/hal-rootstrap-headed.pc %{buildroot}%{_libdir}/pkgconfig/
 ./modify_pc.py "%{buildroot}%{_libdir}/pkgconfig/hal-rootstrap-headed.pc" "%{buildroot}%{hal_rootstrap_headed_install_path}/%{_libdir}/pkgconfig"
 rm -f "%{buildroot}%{hal_rootstrap_headed_install_path}/%{_libdir}/pkgconfig/*.pc"
 
-mkdir -p %{buildroot}%{_sysconfdir}/hal/rootstrap
-install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/hal/rootstrap
-install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/hal/rootstrap
-
-mkdir -p %{buildroot}%{_sysconfdir}/rpm
-install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm
-
 %files
 %{hal_rootstrap_install_path}
 %exclude %dir %{hal_rootstrap_install_path}/%{_includedir}
@@ -111,9 +92,3 @@ install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm
 %defattr(-,root,root,-)
 %{hal_rootstrap_headed_install_path}/%{_includedir}
 %{_libdir}/pkgconfig/hal-rootstrap-headed.pc
-
-%files checker
-%defattr(-,root,root,-)
-%{_sysconfdir}/hal/rootstrap/hal-rootstrap-checker.sh
-%{_sysconfdir}/hal/rootstrap/hal-rootstrap-checker.yaml
-%{_sysconfdir}/rpm/macros.hal-rootstrap-checker
diff --git a/packaging/macros.hal-rootstrap-checker b/packaging/macros.hal-rootstrap-checker
deleted file mode 100644 (file)
index 77a7054..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-%__hal_rootstrap_checker_install_post \
-    /etc/hal/rootstrap/hal-rootstrap-checker.sh %{!?disable_hal_rootstrap_checker:0}%{?disable_hal_rootstrap_checker} %{_sourcedir} \
-%{nil}