Skip to content

Commit 194968d

Browse files
committed
cmd-import: consider architecture when calculating previous build
Not all architectures get built for every build in a stream. This is true at least for non-production streams. Let's account for that here.
1 parent ee19d83 commit 194968d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cmd-import

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ def main():
3939

4040
builds = Builds()
4141
arch = get_basearch()
42+
previous_build = builds.get_latest_for_arch(arch)
4243
if builds.has(buildid) and arch in builds.get_build_arches(buildid):
4344
print(f"ERROR: Build ID {buildid} ({arch}) already exists!")
4445
sys.exit(1)
4546

47+
4648
with tempfile.TemporaryDirectory(prefix='cosa-import-', dir='tmp') as tmpd:
4749
# create the OCI archive
4850
tmp_oci_archive = generate_oci_archive(args, tmpd)
@@ -68,8 +70,8 @@ def main():
6870
# right places) let's use `cosa diff` to insert package and
6971
# advisory diffs into the meta.json and log the RPM diff, but
7072
# only if we have something to diff against.
71-
if args.parent_build or len(builds.get_builds()) > 1:
72-
starting_buildid = args.parent_build if args.parent_build else builds.get_previous()
73+
if args.parent_build or previous_build:
74+
starting_buildid = args.parent_build if args.parent_build else previous_build
7375
calculate_and_log_diffs(builds, buildid, arch, starting_buildid)
7476

7577
if not args.skip_prune:

0 commit comments

Comments
 (0)