Apply the old patches to the latest code 00/309300/2 accepted/tizen_base_asan accepted/tizen/base/20240418.043804 accepted/tizen/base/asan/20240422.014748 accepted/tizen/base/toolchain/20240503.130549 accepted/tizen/base/x/20240503.083735
authorwang biao <biao716.wang@samsung.com>
Mon, 8 Apr 2024 08:51:55 +0000 (16:51 +0800)
committerwang biao <biao716.wang@samsung.com>
Tue, 16 Apr 2024 01:33:30 +0000 (09:33 +0800)
Change-Id: I8fc652f201a17ff929202f0bbc4c939a4be6da1e
Signed-off-by: wang biao <biao716.wang@samsung.com>
packaging/functions.sh
packaging/pkg-diff.sh
packaging/same-build-result.sh

index e5af36b..bdbbbb4 100755 (executable)
 
 RPM="rpm -qp --nodigest --nosignature"
 
+function is_prerelease_project() {
+  local proj_name=$1
+  if [[ $proj_name =~ "prerelease" ]] || [[ $proj_name =~ "trbs" ]]; then
+    return 1
+  fi
+
+  return 0
+}
+
 declare -a rpm_querytags
 collect_rpm_querytags() {
   rpm_querytags=( $(rpm --querytags) )
@@ -68,7 +77,7 @@ done
 QF_TAGS="%{NAME} %{VERSION} %{EPOCH}\\n"
 QF_TAGS="${QF_TAGS}%{SUMMARY}\\n%{DESCRIPTION}\\n"
 # the DISTURL tag can be used as checkin ID
-QF_TAGS="${QF_TAGS}%{VENDOR} %{DISTRIBUTION} %{DISTURL}\\n"
+QF_TAGS="${QF_TAGS}%{VENDOR}\\n"
 QF_TAGS="${QF_TAGS}%{LICENSE}\\n"
 QF_TAGS="${QF_TAGS}%{GROUP} %{URL} %{EXCLUDEARCH} %{EXCLUDEOS} %{EXCLUSIVEARCH}\\n"
 QF_TAGS="${QF_TAGS}%{EXCLUSIVEOS} %{RPMVERSION} %{PLATFORM}\\n"
@@ -318,6 +327,7 @@ function cmp_rpm_meta ()
     local file2="$tmpdir/file2"
     local rpm_meta_old="$tmpdir/rpm-meta-old"
     local rpm_meta_new="$tmpdir/rpm-meta-new"
+    local QF
 
     collect_rpm_querytags
     set_rpm_meta_global_variables $oldrpm
@@ -325,6 +335,23 @@ function cmp_rpm_meta ()
     check_header "$QF_ALL" $oldrpm > $rpm_meta_old
     check_header "$QF_ALL" $newrpm > $rpm_meta_new
 
+    if [ -n $newrpm ]; then
+      # if the rpm is from prerelease projects, do not compare project name.
+      QF="%{DISTRIBUTION}"
+      dist=$(check_header "$QF" $newrpm | sed -r 's/(.*)\/.*/\1/')
+      if ! is_prerelease_project $dist; then
+        echo "This is a prerelease project. Do not compare the project name."
+        QF="\n___QF_DISTURL___\n%{DISTURL}\n___QF_DISTURL___\n"
+        echo `check_header "$QF" $oldrpm | sed -r 's/.*\/(.*\/.*)/\1/'` >> $rpm_meta_old
+        echo `check_header "$QF" $newrpm | sed -r 's/.*\/(.*\/.*)/\1/'` >> $rpm_meta_new
+      else
+        QF="\n___QF_DISTURL_DISTRIBUTION___\n%{DISTURL} %{DISTRIBUTION}\n___QF_DISTURL_DISTRIBUTION___\n"
+        echo "This is not a prerelease project. Compare the project name."
+        check_header "$QF" $oldrpm >> $rpm_meta_old
+        check_header "$QF" $newrpm >> $rpm_meta_new
+      fi
+    fi
+
     # rpm returns 0 even in case of error
     if test -s $rpm_meta_old && test -s $rpm_meta_new ; then
       : some output provided, all query tags understood by rpm
index 13d1e5f..ac3a797 100755 (executable)
@@ -290,6 +290,10 @@ trim_man_TH()
     #.TH Locale::Po4a::Xml.pm 3pm "2015-01-30" "Po4a Tools" "Po4a Tools"
     local f=$1
     [[ $nofilter ]] && return
+
+    #.TH dos2unix 1 "2016-08-30" "dos2unix" "2016-08-30"
++   sed -i -e 's|\(\.TH dos2unix.*\)"[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}"\(.*\)"[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}"|\1"uuu2000-05-05"\2"uuu2000-05-05"|g' $f
+
     # (.TH   quoted section) (quoted_date)(*)
     sed -i -e 's|^\([[:blank:]]*\.TH[[:blank:]]\+"[^"]\+"[[:blank:]]\+[^[:blank:]]\+\)[[:blank:]]\+\("[^"]\+"\)\([[:blank:]]\+.*\)\?|\1 "qq2000-01-01"\3|' $f
     # (.TH unquoted section) (quoted_date)(*)
index 5549207..2f5fe9a 100644 (file)
@@ -13,6 +13,7 @@
 
 CMPSCRIPT=${0%/*}/pkg-diff.sh
 SCMPSCRIPT=${0%/*}/srpm-check.sh
+FUNCTIONS=${0%/*}/functions.sh
 
 declare -a exit_code
 # exit_code[0]='' # binaries_differ
@@ -72,35 +73,51 @@ if [ -z "$NEWDIRS" ]; then
   echo "No valid directory with new build result given !"
   exit 1
 fi
+source $FUNCTIONS
 
-if test `find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l` != `find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l`; then
-   echo "different number of subpackages"
-   find $OLDDIR  -name '*.rpm' -and ! -name '*.delta.rpm' -print0 | xargs -0 rpm -qp --qf '%{NAME}\n' | sort > ${file1}
-   find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' -print0 | xargs -0 rpm -qp --qf '%{NAME}\n' | sort > ${file2}
-   diff -u ${file1} ${file2}
-   exit 1
-fi
+first_rpm=$(find $NEWDIRS -name *.rpm | head -1)
+dist=$(rpm -qp --nodigest --nosignature --qf "%{DISTRIBUTION}" $first_rpm | sed -r 's/(.*)\/.*/\1/')
+prerelease=0
+if ! is_prerelease_project $dist; then
+  echo "This is a prerelease project. Do not check the existence of source rpm files."
 
-osrpm=$(find "$OLDDIR" -name \*src.rpm)
-nsrpm=$(find $NEWDIRS -name \*src.rpm)
+  prerelease=1
+  num_new_pkgs=`find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' -and ! -name '*.src.rpm' | wc -l`
+  num_old_pkgs=`find $OLDDIR  -name '*.rpm' -and ! -name '*.delta.rpm' -and ! -name '*.src.rpm' | wc -l`
+  if test $num_new_pkgs != $num_old_pkgs; then
+     echo "different number of subpackages"
+     find $OLDDIR $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' -and ! -name '*.src.rpm'
+     exit 1
+  fi
 
-if test ! -f "$osrpm"; then
-  echo no old source rpm in $OLDDIR
-  exit 1
-fi
+else
+  if test `find $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l` != `find $OLDDIR -name '*.rpm' -and ! -name '*.delta.rpm' | wc -l`; then
+     echo "different number of subpackages"
+     find $OLDDIR $NEWDIRS -name '*.rpm' -and ! -name '*.delta.rpm'
+     exit 1
+  fi
 
-if test ! -f "$nsrpm"; then
-  echo no new source rpm in $NEWDIRS
-  exit 1
-fi
+  osrpm=$(find "$OLDDIR" -name \*src.rpm)
+  nsrpm=$(find $NEWDIRS -name \*src.rpm)
 
-echo "compare $osrpm $nsrpm"
-if bash $SCMPSCRIPT $check_all "$osrpm" "$nsrpm"
-then
-  : src.rpm identical
-else
-  test -z "${check_all}" && exit 1
-  exit_code[3]='srcrpm_differs'
+  if test ! -f "$osrpm"; then
+    echo no old source rpm in $OLDDIR
+    exit 1
+  fi
+
+  if test ! -f "$nsrpm"; then
+    echo no new source rpm in $NEWDIRS
+    exit 1
+  fi
+
+  echo "compare $osrpm $nsrpm"
+  if bash $SCMPSCRIPT $check_all "$osrpm" "$nsrpm"
+  then
+    : src.rpm identical
+  else
+    test -z "${check_all}" && exit 1
+    exit_code[3]='srcrpm_differs'
+  fi
 fi
 
 # technically we should not all exclude all -32bit but filter for different archs,
@@ -175,47 +192,51 @@ else
 fi
 
 if test -n "$OTHERDIR"; then
-  old_log=$OLDDIR/rpmlint.log
-  new_log=$OTHERDIR/rpmlint.log
-  if test -e ${old_log} && test -e ${new_log} ; then
-    echo "comparing ${old_log} and ${new_log}"
-    # Remove --time-report from rpmlint
-    # Sort the files first since the order of messages is not deterministic
-    # Remove release from files
-    remove_check_time_report ${old_log}|sort -u|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
-    remove_check_time_report ${new_log}|sort -u|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2
-    # Remove odd warning about not-hardlinked files
-    # Remove odd warning about data and time, it comes and goes
-    # Remove warning about python mtime mismatch, a republish will not help
-    # Remove odd warning about filenames, they contain VERSION-RELEASE
-    # Remove durations from progress reports
-    # Remove odd output about number of checks and packages
-    sed -i -e "
-    /: W: files-duplicate /d
-    /: W: file-contains-date-and-time /d
-    /: W: python-bytecode-inconsistent-mtime /d
-    /: W: filename-too-long-for-joliet /d
-    /: I: \(filelist-initialization\|check-completed\) /s| [0-9]\+\.[0-9] s| x.x s|
-    s/; has taken [0-9]\+\.[0-9] s/; has taken x.x s/
-    /^checks: [0-9]\+, packages: [0-9]\+/d
-    " $file1 $file2
-    if ! cmp -s $file1 $file2; then
-      echo "rpmlint.log files differ:"
-      diff -u $file1 $file2 |head -n 20
-      exit_code[1]='rpmlint_differs'
-    fi
-    rm $file1 $file2
+  if [ $prerelease -eq 1 ] ; then
+      echo "do not compare rpmlint.log if it is a prerelease project!"
   else
-    if test -e "${new_log}"
-    then
-      exit_code[1]='rpmlint_new'
-      echo "rpmlint.log is new"
-    elif test -e "${old_log}"
-    then
-      exit_code[1]='rpmlint_old'
-      echo "rpmlint.log disappeared"
+    old_log=$OLDDIR/rpmlint.log
+    new_log=$OTHERDIR/rpmlint.log
+    if test -e ${old_log} && test -e ${new_log} ; then
+      echo "comparing ${old_log} and ${new_log}"
+      # Remove --time-report from rpmlint
+      # Sort the files first since the order of messages is not deterministic
+      # Remove release from files
+      remove_check_time_report ${old_log}|sort -u|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
+      remove_check_time_report ${new_log}|sort -u|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file2
+      # Remove odd warning about not-hardlinked files
+      # Remove odd warning about data and time, it comes and goes
+      # Remove warning about python mtime mismatch, a republish will not help
+      # Remove odd warning about filenames, they contain VERSION-RELEASE
+      # Remove durations from progress reports
+      # Remove odd output about number of checks and packages
+      sed -i -e "
+      /: W: files-duplicate /d
+      /: W: file-contains-date-and-time /d
+      /: W: python-bytecode-inconsistent-mtime /d
+      /: W: filename-too-long-for-joliet /d
+      /: I: \(filelist-initialization\|check-completed\) /s| [0-9]\+\.[0-9] s| x.x s|
+      s/; has taken [0-9]\+\.[0-9] s/; has taken x.x s/
+      /^checks: [0-9]\+, packages: [0-9]\+/d
+      " $file1 $file2
+      if ! cmp -s $file1 $file2; then
+        echo "rpmlint.log files differ:"
+        diff -u $file1 $file2 |head -n 20
+        exit_code[1]='rpmlint_differs'
+      fi
+      rm $file1 $file2
     else
-      echo "No rpmlint.log available"
+      if test -e "${new_log}"
+      then
+        exit_code[1]='rpmlint_new'
+        echo "rpmlint.log is new"
+      elif test -e "${old_log}"
+      then
+        exit_code[1]='rpmlint_old'
+        echo "rpmlint.log disappeared"
+      else
+        echo "No rpmlint.log available"
+      fi
     fi
   fi
 
@@ -236,6 +257,7 @@ if test -n "$OTHERDIR"; then
     fi
   done
 fi
+
 if test -n "${exit_code[*]}"; then
   exit 1
 fi