Ignore:
Timestamp:
Apr 15, 2016, 8:00:47 PM (9 years ago)
Author:
dmik
Message:

rpmbuild-bot: Copy auxiliary source files for .spec to SOURCES.

Auxiliary source files found in a directory named SPEC located
in the same directory where the SPEC.spec fie resides, will be
automatically copied to the SOURCES directory of the rpmbuild
tree (for further use in .spec via SourceN:).

File:
1 edited

Legend:

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

    r744 r748  
    3535# >                 [-f]
    3636#
    37 # MYAPP is the name of the RPM package spec file (extension is optional,
     37# SPEC is the name of the RPM package spec file (extension is optional,
    3838# .spec is assumed). The spec file is searched in the SPECS directory of the
    3939# rpmbuild tree (usually $USER/rpmbuild/SPECS, rpmbuild --eval='%_specdir'
     
    6868# log files and the corresponding package files if you are absolutely sure they
    6969# should be discarded.
     70#
     71# The "build" command will also check if there is a directory named SPEC in the
     72# same directory where the given .spec file resides. If such a directory
     73# exists, all files in it are assumed to be auxiliary source files used by the
     74# .spec file via SourceN: directives. These files will be automatically copied
     75# to the SOURCES directory in the rpmbuild tree befure starting the build
     76# process.
    7077#
    7178# Doing test builds
     
    100107# directory of the rpmbuild tree. The previous log file, if any, is given a .bak
    101108# extension (the previous .bak file will be deleted).
     109#
     110# The "test" command will copy auxiliary source files for the .spec file, if any,
     111# to the proper location before rpmbuild execution -- the same way the "build"
     112# command does it.
    102113#
    103114# Uploading packages
     
    242253}
    243254
     255sync_aux_src()
     256{
     257  [ -n "$src_dir" ] || die "src_dir is empty."
     258  [ -n "$spec_full" ] || die "spec_full is empty."
     259
     260  # Aux source dir is expected along the .spec file.
     261  local aux_src_dir="${spec_full%.spec}"
     262
     263  # Return early if there is no aux source dir.
     264  [ -d "$aux_src_dir" ] || return
     265
     266  echo "Copying auxiliary sources for '$spec' to $src_dir..."
     267
     268  for f in "$aux_src_dir"/* ; do
     269    local ts=`stat -c '%Y' "$f"`
     270    local trg_ts=
     271    local trg_f="$src_dir/${f##*/}"
     272    [ -f "$trg_f" ] && trg_ts=`stat -c '%Y' "$trg_f"`
     273    if [ "$ts" != "$trg_ts" ] ; then
     274      echo "Copying $f..."
     275      run cp -p "$f" "$trg_f"
     276    fi
     277  done
     278}
     279
    244280build_cmd()
    245281{
     
    248284  echo "Spec file: $spec_full"
    249285  echo "Targets:   $RPMBUILD_BOT_ARCH_LIST + SRPM + ZIP ($base_arch)"
     286
     287  sync_aux_src
    250288
    251289  if [ -f "$spec_list" ] ; then
     
    344382{
    345383  echo "Spec file: $spec_full"
     384
     385  sync_aux_src
    346386
    347387  local base_arch="${RPMBUILD_BOT_ARCH_LIST##* }"
     
    600640
    601641# Query all rpmbuild macros in a single run as it may be slow.
    602 eval `rpmbuild.exe --eval='rpmbuild_dir="%_topdir" ; spec_dir="%_specdir"' | tr '\\\' /`
     642eval `rpmbuild.exe --eval='rpmbuild_dir="%_topdir" ; spec_dir="%_specdir" ; src_dir="%_sourcedir"' | tr '\\\' /`
     643
     644[ -n "$rpmbuild_dir" -a -d "$rpmbuild_dir" ] || die "Falied to get %_topdir from rpmbuild or not directory ($rpmbuild_dir)."
     645[ -n "$spec_dir" -a -d "$spec_dir" ] || die "Falied to get %_specdir from rpmbuild or not directory ($spec_dir)."
     646[ -n "$src_dir" -a -d "$src_dir" ] || die "Falied to get %_sourcedir from rpmbuild or not directory ($src_dir)."
    603647
    604648log_dir="$rpmbuild_dir/logs"
Note: See TracChangeset for help on using the changeset viewer.