Skip to content

Commit

Permalink
Change host rpms from cmd-koji-upload to cmd-build
Browse files Browse the repository at this point in the history
 - Now that we decided to split the Brew part from the main
build job, we need to store the host rpm list in S3 in order
to use it after.
 - Add the rpm list from the host used to build the image
in coreos-assembler-config-git.json

Signed-off-by: Renata Ravanelli <rravanel@redhat.com>
  • Loading branch information
ravanelli committed Jun 1, 2023
1 parent e92b5fe commit 56bbe9a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/cmd-koji-upload
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,13 @@ class Build(_Build):
if host is None:
rpms = self.commit["rpmostree.rpmdb.pkglist"]
else:
host_rpms = subprocess.check_output('rpm -qa --qf="%{NAME}:%{EPOCH}:%{RELEASE}:%{VERSION}:%{ARCH}:%{SIGMD5}:%{SIGPGP} \n"', shell=True).strip()
rpms = (host_rpms.decode('utf-8')).split("\n")

rpms = self.config["pkglist"]
for rpm in rpms:
if host is None:
name, epoch, version, release, arch = rpm
sigmd5, sigpgp, epoch = None, None, None
sigmd5, sigpgp = None, None
else:
name, epoch, release, version, arch, sigmd5, sigpgp = rpm.split(':')
name, epoch, version, release, arch, sigmd5, sigpgp = rpm
entry = {
"type": "rpm",
"name": name,
Expand Down
9 changes: 8 additions & 1 deletion src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,12 @@ prepare_git_artifacts() {

info "Directory ${gitd}, is from branch ${branch}, commit ${rev}"

pkglist=$(python3 -c "
import sys
sys.path.insert(0, '${DIR}')
from cosalib import cmdlib
print(cmdlib.create_cosa_rpm_list())")

# shellcheck disable=SC2046 disable=SC2086
cat > "${json}" <<EOC
{
Expand All @@ -951,7 +957,8 @@ prepare_git_artifacts() {
"origin": "${head_url}",
"branch": "${branch}",
"dirty": "${is_dirty}"
}
},
"pkglist": $pkglist
}
EOC

Expand Down
11 changes: 11 additions & 0 deletions src/cosalib/cmdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,14 @@ def ensure_glob(pathname, **kwargs):
def ncpu():
'''Return the number of usable CPUs we have for parallelism.'''
return int(subprocess.check_output(['kola', 'ncpu']))

def create_cosa_rpm_list():

host_rpms = subprocess.check_output('rpm -qa --qf="%{NAME}:%{EPOCH}:%{VERSION}:%{RELEASE}:%{ARCH}:%{SIGMD5}:%{SIGPGP} \n"', shell=True).strip()
rpms = (host_rpms.decode('utf-8')).split("\n")
components = []
for rpm in rpms:
name, epoch, version, release, arch, sigmd5, sigpgp = rpm.split(':')
entry = [name, epoch, version, release, arch, sigmd5, sigpgp]
components.append(entry)
return json.dumps(components)

0 comments on commit 56bbe9a

Please sign in to comment.