Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c1e7f05 authored by Wei Li's avatar Wei Li
Browse files

Remove diff excludes for partition compatibility symlink files in SBOM integration test.

Bug: 272358980
Test: CIs
Change-Id: I5436c77d6a63942771422a17a8b4876b6c81150a
parent 15807fa7
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -98,19 +98,15 @@ diff_excludes[system]=\
 -I /system/lib64/libkm_compat.so \
 -I /system/lib64/vndk-29 \
 -I /system/lib64/vndk-sp-29 \
 -I /system/lib/modules \
 -I /system/lib/vndk-29 \
 -I /system/lib/vndk-sp-29 \
 -I /system/product \
 -I /system/system_ext \
 -I /system/usr/icu \
 -I /system/vendor \
 -I /vendor_dlkm/etc"

function diff_files {
   file_list_file="$1";
   files_in_spdx_file="$2"
   partition_name="$3"
   file_list_file="$1"; shift
   files_in_spdx_file="$1"; shift
   partition_name="$1"; shift
   exclude=
   if [ -v 'diff_excludes[$partition_name]' ]; then
     exclude=${diff_excludes[$partition_name]}
@@ -168,9 +164,9 @@ for f in $EROFS_IMAGES; do
    all_dirs=$(echo "$all_dirs" | cut -d ' ' -f1 --complement -s)
    entries=$($dump_erofs --ls --path "$dir" $f | tail -n +11)
    while read -r entry; do
      type=$(echo $entry | awk -F ' ' '{print $2}')
      inode_type=$(echo $entry | awk -F ' ' '{print $2}')
      name=$(echo $entry | awk -F ' ' '{print $3}')
      case $type in
      case $inode_type in
        "2")  # directory
          all_dirs=$(echo "$all_dirs $dir/$name" | sed 's/^\s*//')
          ;;
@@ -204,6 +200,11 @@ for f in $RAMDISK_IMAGES; do
  partition_name=$(basename $f | cut -d. -f1)
  file_list_file="${sbom_test}/sbom-${partition_name}-files.txt"
  files_in_spdx_file="${sbom_test}/sbom-${partition_name}-files-in-spdx.txt"
  # lz4 decompress $f to stdout
  # cpio list all entries like ls -l
  # grep filter normal files and symlinks
  # awk get entry names
  # sed remove partition name from entry names
  $lz4 -c -d $f | cpio -tv 2>/dev/null | grep '^[-l]' | awk -F ' ' '{print $9}' | sed "s:^:/$partition_name/:" | sort -n > "$file_list_file"

  grep "FileName: /${partition_name}/" $product_out/sbom.spdx | sed 's/^FileName: //' | sort -n > "$files_in_spdx_file"