Skip to content

Commit

Permalink
infra: Support adding RPMs in update_iso script
Browse files Browse the repository at this point in the history
Adding RPMs by update_iso script behaves differently than rebuild_iso
script. It will unpack RPMs into updates_image instead of using them
for creation of ISO.

Benefits are:
- it's faster
- can add packages not requested by ISO

Drawbacks are:
- not working on Live media
- not reliable
  - scriptlets are not executed
  - old files are not removed
  • Loading branch information
jkonecny12 committed Aug 6, 2024
1 parent 5223dfb commit 3482822
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/testing/update_iso
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def get_first_non_upstream_commit():

return None

def make_updates_image(git_id):
def make_updates_image(git_id, rpm_paths):
"""Build an updates image based on tag/hash and prepare it for inclusion in boot ISO.
:param str git_id: git revision id (hash, tag, etc.)
:param [str] rpm_paths: list of paths to the RPM files we are adding to updates_image
"""
if git_id is None:
print("** make updates:git_id is None, falling back to finding first non-upstream commit id")
Expand All @@ -79,11 +80,17 @@ def make_updates_image(git_id):
print("** error: could not determine a valid commit id")
sys.exit(1)

rpm_args = ""
for rpm in rpm_paths:
rpm_args += " -a " + rpm

print("** preparing updates image via tag/hash: %s" % git_id)
# Create the necessary folder structure
os.makedirs(UPDATES_FOLDER, exist_ok=True)
# Prepare updates image
os.system("./scripts/makeupdates -k -c -t %s" % git_id)
cmd = f"./scripts/makeupdates -k -c -t {git_id}{rpm_args}"
print("** Calling:", cmd)
os.system(cmd)
# Move it next to the ISOs
shutil.move(UPDATES_IMAGE, os.path.join(UPDATES_FOLDER, UPDATES_IMAGE))
print("** updates image is ready in: %s" % UPDATES_FOLDER)
Expand Down Expand Up @@ -242,6 +249,10 @@ def main():
help='path to the input ISO (optional)')
parser.add_argument('-t', '--tag', action='store', type=str,
help='add commits from TAG to HEAD to the image (NOTE: also works with commit hashes)')
parser.add_argument('-a', '--add-rpm', action='append', type=str, dest='rpm_paths',
metavar='RPM_PATH', default=[],
help='paths to additional RPMs which will be unpacked to updates image;'
' can be used multiple times')
parser.add_argument('-k', '--ks-file', action='store', type=str,
help='path to the kickstart file')
parser.add_argument('-b', '--boot-options', action='store', type=str,
Expand Down Expand Up @@ -281,7 +292,7 @@ def main():
sys.exit(1)

# Generate updates image
make_updates_image(base_git_revision)
make_updates_image(base_git_revision, args.rpm_paths)

# Check updates image has been generated and is in place
check_updates_image_available()
Expand Down

0 comments on commit 3482822

Please sign in to comment.