Patches for Rpmbuildstage:bb. 50/83950/1 accepted/tizen/base/20160817.064158 submit/tizen_base/20160816.083924
authorJunghyun Kim <jh0822.kim@samsung.com>
Tue, 16 Aug 2016 02:57:52 +0000 (11:57 +0900)
committerJunghyun Kim <jh0822.kim@samsung.com>
Tue, 16 Aug 2016 02:57:52 +0000 (11:57 +0900)
If "RpmbuildStage:bb" is in project config, *.src.rpm are not generated.
However, for our RPM comparison optimization for prerelease projects,
it is required to compare RPMs in prerelease projects and RPMs in normal projects.

In this case, we have to do followings:
1. Exclude *.src.rpm to check the number of subpackages
2. Do not check the existence of source rpm
3. Do not compare rpmlint.log
  The last line of rpmlint.log can be different because the number of subpackages are different.

Change-Id: Ie0b02e45ad46cc23737a5fec836f42118f6e6868
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
packaging/same-build-result.sh

index 3b707a2..e46999f 100644 (file)
@@ -30,27 +30,44 @@ if [ -z "$NEWDIRS" ]; then
   exit 1
 fi
 
-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
+first_rpm=$(find $NEWDIRS -name *.rpm | head -1)
+dist=$(rpm -qp --nodigest --nosignature --qf "%{DISTRIBUTION}" $first_rpm | sed -r 's/(.*)\/.*/\1/')
+prerelease=0
+if [[ $dist =~ "prerelease" ]]; then
+  echo "This is a prerelease project. Do not check the existence of source rpm files."
+
+  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'
+     exit 1
+  fi
 
-osrpm=$(find "$OLDDIR" -name \*src.rpm)
-nsrpm=$(find $NEWDIRS -name \*src.rpm)
+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 "$osrpm"; then
-  echo no old source rpm in $OLDDIR
-  exit 1
-fi
+  osrpm=$(find "$OLDDIR" -name \*src.rpm)
+  nsrpm=$(find $NEWDIRS -name \*src.rpm)
 
-if test ! -f "$nsrpm"; then
-  echo no new source rpm in $NEWDIRS
-  exit 1
-fi
+  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"
-bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
+  echo "compare $osrpm $nsrpm"
+  bash $SCMPSCRIPT "$osrpm" "$nsrpm" || exit 1
+fi
 
 # technically we should not all exclude all -32bit but filter for different archs,
 # like done with -x86
@@ -109,23 +126,27 @@ else
 fi
 
 if test -n "$OTHERDIR"; then
-  if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
-    file1=`mktemp`
-    file2=`mktemp`
-    echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log"
-    # Sort the files first since the order of messages is not deterministic
-    # Remove release from files
-    sort -u $OLDDIR/rpmlint.log|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
-    sort -u $OTHERDIR/rpmlint.log|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g"  > $file2
-    if ! cmp -s $file1 $file2; then
-      echo "rpmlint.log files differ:"
-      diff -u $file1 $file2 |head -n 20
+  if [ $prerelease -eq 1 ] ; then
+    echo "do not compare rpmlint.log if it is a prerelease project!"
+  else
+    if test -e $OLDDIR/rpmlint.log -a -e $OTHERDIR/rpmlint.log; then
+      file1=`mktemp`
+      file2=`mktemp`
+      echo "comparing $OLDDIR/rpmlint.log and $OTHERDIR/rpmlint.log"
+      # Sort the files first since the order of messages is not deterministic
+      # Remove release from files
+      sort -u $OLDDIR/rpmlint.log|sed -e "s,$ver_rel1,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g" > $file1
+      sort -u $OTHERDIR/rpmlint.log|sed -e "s,$ver_rel2,@VERSION@-@RELEASE@,g" -e "s|/tmp/rpmlint\..*spec|.spec|g"  > $file2
+      if ! cmp -s $file1 $file2; then
+        echo "rpmlint.log files differ:"
+        diff -u $file1 $file2 |head -n 20
+        SUCCESS=0
+      fi
+      rm $file1 $file2
+    elif test -e $OTHERDIR/rpmlint.log; then
+      echo "rpmlint.log is new"
       SUCCESS=0
     fi
-    rm $file1 $file2
-  elif test -e $OTHERDIR/rpmlint.log; then
-    echo "rpmlint.log is new"
-    SUCCESS=0
   fi
 
   appdatas=`cd $OTHERDIR && find . -name *-appdata.xml`