Correct build failure after mock updrade

Problem:
   Mockchain-parallel requires python2-requests, but it is not found.
Mockchain-parallel runs inside docker. the Dockerfile does not
explicitly list python2-requests as a requires package. The Dockerfile
does list mock, which used to resolve to mock-1.4.15-1.el7.noarch,
which pulled in python2-requests. Centos/EPEL upgraded to
mock-1.4.16-1.el7.noarch 2019-06-04, and it now pulls in
python36-requests, rather than python2-requests.

   Mockchain-parallel also uses functions from yum and mock.
Yum remains at python2, mock is now at python3.

   There is also one api change in the new mock.

   Whatever solution should allow mockchain-parallel function
in both a new or an old container.  The difference being the
mock version, and the verion of python required to run
mock/mockchain.  Supporting the old mock will also allow more
time for conversion of old build systems that pre-date
the conversion to docker.

Solution:
   1) For now, ship two versions of mock-parallel.  One
compatible with the new mock (python 3, new api). The
second compatible with the older mock (python 2, old api).
The old version can eventually be retired, so not worth
trying to break out common functions.
   2) Remove the dependency on yum.  We only needed
one function to split an rpm file name into components
(package-name, version, release, architecture, epoch).
We'll write our own.
   3) mockchain-parallel becomes a wrapper that detects
which mock is present, and from that determine which
version of mock-parallel-* to use, and which python to use.

Change-Id: Ia56dfd39e349096b09351e89ad3d4f024e60e4e4
Depends-On: I7c5d9b52eed49cdce02224603b9bfd17e4426558
Closes-Bug: 1831768
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2019-06-05 19:57:03 -04:00
parent 21d836f94e
commit 7f7154ef56
5 changed files with 2552 additions and 1193 deletions

View File

@ -616,7 +616,7 @@ kill_descendents ()
local relevant_recursive_children="$ME"
local relevant_recursive_promote_children="mock"
local relevant_other_children="mockchain-parallel"
local relevant_other_children="mockchain-parallel mockchain-parallel-1.3.4 mockchain-parallel-1.4.16"
local recursive_promote_children=$(for relevant_child in $relevant_recursive_promote_children; do pgrep -P $kill_pid $relevant_child; done)
local recursive_children=$(for relevant_child in $relevant_recursive_children; do pgrep -P $kill_pid $relevant_child; done)
@ -2282,6 +2282,7 @@ echo "CMD_OPTIONS=$CMD_OPTIONS"
echo "MAX_WORKERS=$MAX_WORKERS"
echo "MOCKCHAIN_RESOURCE_ALLOCATION=$MOCKCHAIN_RESOURCE_ALLOCATION"
CMD="$CMD_PREFIX mockchain-parallel -r $BUILD_CFG -l $BUILD_BASE --recurse --workers=$MAX_WORKERS --worker-resources=$MOCKCHAIN_RESOURCE_ALLOCATION --basedir=$MY_WORKSPACE --log=$MOCKCHAIN_LOG --tmp_prefix=$USER --addrepo=$LOCAL_URL --addrepo=$LOCAL_SRC_URL $CMD_OPTIONS -m --rebuild $SRPMS_LIST"
echo ""
echo "$CMD -m --define='_tis_dist .tis' -m --define='platform_release $PLATFORM_RELEASE'"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# A place to collect potentially reusable python functions
#
def splitRpmFilename(filename):
"""
Split an rpm filename into components:
package name, version, release, epoch, architecture
"""
if filename[-4:] == '.rpm':
filename = filename[:-4]
idx = filename.rfind('.')
arch = filename[idx+1:]
filename = filename[:idx]
idx = filename.rfind('-')
rel = filename[idx+1:]
filename = filename[:idx]
idx = filename.rfind('-')
ver = filename[idx+1:]
filename = filename[:idx]
idx = filename.find(':')
if idx == -1:
epoch = ''
name = filename
else:
epoch = filename[:idx]
name = filename[idx+1:]
return name, ver, rel, epoch, arch