Changeset 949 for rpmbuild-bot


Ignore:
Timestamp:
Feb 3, 2017, 8:12:15 PM (9 years ago)
Author:
dmik
Message:

rpmbuild-bot: Add support for automatic generation of legacy runtime sub-packages.

Location:
rpmbuild-bot
Files:
2 edited

Legend:

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

    r870 r949  
    6666RPMBUILD_BOT_ARCH_LIST_kLIBCum="i686" # Binary build -> no other archs.
    6767
     68# Legacy DLLs for specific packages. Each RPM from the list (format is
     69# "ABI|NAME|VERSION-RELEASE|[FILEMASK]|[ARCH]") for each target platform is
     70# downloaded from a repository specified in RPMBUILD_BOT_UPLOAD_REPO_STABLE
     71# and scanned for FILEMASK files (*.dll by default). These files are then
     72# extracted to a directory called RPM_SOURCE_DIR/PACKAGE-legacy (preserving the
     73# original directory tree) and, if PACKAGE.spec contains a macro named
     74# %legacy_runtime_packages, they are later placed to a sub-package called
     75# `legacy-ABI` when rpmbuild is run. If ARCH is specified, this platform's
     76# legacy package will be used for all target platforms.
     77RPMBUILD_BOT_LEGACY_libvpx="2|libvpx|1.4.0-2"
     78
    6879# Basic RPM repository layout for this distribution channel.
    6980RPMBUILD_BOT_UPLOAD_REPO_LAYOUT_rpm="\$base/i386/\$arch"
     
    7485RPMBUILD_BOT_UPLOAD_REPO_LIST="exp rel"
    7586
     87# Name of the stable repository (must be present in the above list).
     88RPMBUILD_BOT_UPLOAD_REPO_STABLE="rel"
     89
    7690# Sanity checks.
    7791check_dir_var "RPM_NETLABS_ORG_DIR"
  • rpmbuild-bot/rpmbuild-bot.sh

    r881 r949  
    342342}
    343343
    344 build_cmd()
    345 {
     344get_legacy_runtime()
     345{
     346  [ -n "$src_dir" ] || die "src_dir is empty."
     347  [ -n "$RPMBUILD_BOT_UPLOAD_REPO_STABLE" ] || die "RPMBUILD_BOT_UPLOAD_REPO_STABLE is empty."
     348
    346349  local spec_name_=`echo "${spec_name}" | tr - _`
    347350  eval local arch_list="\${RPMBUILD_BOT_ARCH_LIST_${spec_name_}}"
    348351  [ -z "$arch_list" ] && arch_list="${RPMBUILD_BOT_ARCH_LIST}"
    349352
     353  eval local rpm_list="\${RPMBUILD_BOT_LEGACY_${spec_name_}}"
     354  [ -z "$rpm_list" ] && return # nothing to do
     355
     356  eval local base="\$RPMBUILD_BOT_UPLOAD_${RPMBUILD_BOT_UPLOAD_REPO_STABLE}_DIR"
     357
     358  local abi_list=
     359
     360  for rpm_spec in "$rpm_list" ; do
     361    local abi name ver mask legacy_arch
     362    IFS='|' read abi name ver mask legacy_arch <<EOF
     363${rpm_spec}
     364EOF
     365    [ -z "$abi" -o -z "$name" -o -z "$ver" ] && die "Value '${rpm_spec}' in RPMBUILD_BOT_LEGACY_${spec_name_} is invalid."
     366    [ -z "$mask" ] && mask="*.dll"
     367
     368    abi_list="$abi_list${abi_list:+ }$abi"
     369
     370    # Enumerate RPMs for all archs and extract them
     371    echo "Getting legacy runtime ($mask) for ABI '$abi'..."
     372    for arch in ${legacy_arch:-${arch_list}} ; do
     373      eval local rpm="$RPMBUILD_BOT_UPLOAD_REPO_LAYOUT_rpm/$name-$ver$dist_mark.$arch.rpm"
     374      local tgt_dir="$src_dir/$spec_name-legacy/$abi/$arch"
     375      # Check filenames and timestamps
     376      echo "Checking package $rpm..."
     377      [ -f "$rpm" ] || die "File '$rpm' is not found."
     378      local old_ts old_rpm old_name old_ver
     379      [ -f "$tgt_dir.list" ] && IFS='|' read old_ts old_rpm old_name old_ver < "$tgt_dir.list"
     380      local ts=`stat -c '%Y' "$rpm"`
     381      # Drop fractional part of seconds reported by older coreutils
     382      ts="${ts%%.*}"
     383      old_ts="${old_ts%%.*}"
     384      if [ "$old_rpm" != "$rpm" -o "$ts" != "$old_ts" -o "$name" != "$old_name" -o "$ver" != "$old_ver" ] ; then
     385        echo "Extracting to $tgt_dir..."
     386        run rm -f "$tgt_dir.list" && rm -rf "$tgt_dir"
     387        (run mkdir -p "$tgt_dir" && cd "$tgt_dir"; run rpm2cpio "$rpm" | eval cpio -idm $mask)
     388        # save the list for later use
     389        find "$tgt_dir" -type f -printf '/%P\n' > "$tgt_dir.files.list"
     390        # now try to locate the debuginfo package and extract *.dbg from it
     391        eval local debug_rpm="$RPMBUILD_BOT_UPLOAD_REPO_LAYOUT_rpm/$name-debuginfo-$ver$dist_mark.$arch.rpm"
     392        [ ! -f "$debug_rpm" ] && eval debug_rpm="$RPMBUILD_BOT_UPLOAD_REPO_LAYOUT_rpm/$name-debug-$ver$dist_mark.$arch.rpm"
     393        if [ -f "$debug_rpm" ] ; then
     394          echo "Found debug info package $debug_rpm, extracting..."
     395          local dbgfilelist="$tgt_dir.debugfiles.list"
     396          run rm -rf "$dbgfilelist"
     397          local masks=
     398          local f
     399          while read -r f ; do
     400            f="${f%.*}.dbg"
     401            masks="$masks${masks:+ }'*$f'"
     402            # Save the file for later inclusion into debugfiles.list (%debug_package magic in brp-strip.os2)
     403            run echo "$f" >> "$dbgfilelist"
     404          done < "$tgt_dir.files.list"
     405          (run cd "$tgt_dir"; run rpm2cpio "$debug_rpm" | eval cpio -idm $masks)
     406        fi
     407        # put the 'done' mark
     408        run echo "$ts|$rpm|$name|$ver" > "$tgt_dir.list"
     409      fi
     410    done
     411  done
     412
     413  run echo "$abi_list" > "$src_dir/$spec_name-legacy/abi.list"
     414}
     415
     416build_prepare()
     417{
     418  sync_aux_src
     419  get_legacy_runtime
     420}
     421
     422build_cmd()
     423{
     424  local spec_name_=`echo "${spec_name}" | tr - _`
     425  eval local arch_list="\${RPMBUILD_BOT_ARCH_LIST_${spec_name_}}"
     426  [ -z "$arch_list" ] && arch_list="${RPMBUILD_BOT_ARCH_LIST}"
     427
    350428  local base_arch="${arch_list##* }"
    351429
     
    353431  echo "Targets:   $arch_list + SRPM + ZIP ($base_arch)"
    354432
    355   sync_aux_src
     433  build_prepare
    356434
    357435  if [ -f "$spec_list" ] ; then
     
    471549  echo "Spec file: $spec_full"
    472550
    473   sync_aux_src
    474 
    475551  local base_arch="${RPMBUILD_BOT_ARCH_LIST##* }"
    476552  local cmds=
     
    480556  case "$command_arg" in
    481557    all)
     558      build_prepare
    482559      cmds="$cmds -bb"
    483560      ;;
Note: See TracChangeset for help on using the changeset viewer.