Changeset 862 for rpmbuild-bot


Ignore:
Timestamp:
Oct 18, 2016, 10:14:43 PM (9 years ago)
Author:
dmik
Message:

rpmbuild-bot: Run rpmbuild only once for noarch-only specs.

It makes no sense to build noarch packages several times for different
architectures if there are no architecture specific pakgages. Unfortunately,
we cannot avoud duplicate noarch builds for specs with architecture
specific packages because rpmbuild doesn't seem to allow to exclude noarch
from the build.

Note that this revision also fixes a regression of building noarch-only
specs with rpmbuild-bot introduced somewhere in the past.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rpmbuild-bot/rpmbuild-bot.sh

    r839 r862  
    366366  fi
    367367
     368  local noarch_only=
    368369  local start_time=
    369370
    370   # Generate RPMs.
    371   for arch in $arch_list ; do
     371  # Generate RPMs (note that base_arch always goes first).
     372  for arch in $base_arch ${arch_list%${base_arch}} ; do
    372373    echo "Creating RPMs for '$arch' target (logging to $log_base.$arch.log)..."
    373374    start_time=$(date +%s)
    374375    log_run "$log_base.$arch.log" rpmbuild.exe --target=$arch -bb "$spec_full"
    375376    print_elapsed start_time "Completed in \$e."
     377    if ! grep -q "^Wrote: \+.*\.$arch\.rpm$" "$log_base.$arch.log" ; then
     378      if ! grep -q "^Wrote: \+.*\.noarch\.rpm$" "$log_base.$arch.log" ; then
     379        die "Target '$arch' did not produce any RPMs."
     380      fi
     381      noarch_only=1
     382      echo "Skipping other targets because '$arch' produced only 'noarch' RPMs."
     383      break
     384    fi
    376385  done
    377386
     
    432441    echo `stat -c '%Y' "$f"`"|$f" >> "$ver_list"
    433442  done
    434   # Save other arch RPMs.
    435   for arch in ${arch_list%${base_arch}} ; do
    436     rpms="`grep "^Wrote: \+.*\.$arch\.rpm$" "$log_base.$arch.log" | sed -e "s#^Wrote: \+##g"`"
    437     [ -n "$rpms" ] || die "Cannot find .$arch.rpm file names in '$log_base.arch.log'."
    438     for f in $rpms ; do
    439       echo `stat -c '%Y' "$f"`"|$f" >> "$ver_list"
     443  # Save other arch RPMs (only if there is anything but noarch).
     444  if [ -z "$noarch_only" ] ; then
     445    for arch in ${arch_list%${base_arch}} ; do
     446      rpms="`grep "^Wrote: \+.*\.$arch\.rpm$" "$log_base.$arch.log" | sed -e "s#^Wrote: \+##g"`"
     447      [ -n "$rpms" ] || die "Cannot find .$arch.rpm file names in '$log_base.arch.log'."
     448      for f in $rpms ; do
     449        echo `stat -c '%Y' "$f"`"|$f" >> "$ver_list"
     450      done
    440451    done
    441   done
     452  fi
    442453
    443454  # Everything succeeded. Symlink the list file so that "upload" can find it.
Note: See TracChangeset for help on using the changeset viewer.