Skip to content

Commit

Permalink
cmd-diff: support passing in the architecture
Browse files Browse the repository at this point in the history
This adds '--arch' argument to pass architecture you want to get information about.
By default current arch is used.

```
$ uname -m
x86_64
$ cosa diff --arch=s390x --from=41.20250101.20.0 --to=41.20250114.20.0 --rpms
ostree diff commit from: c3fe29653cf0ebd1d093b1a55cf9ac79a386373e71f64c67769f904332ba0ca6
ostree diff commit to:   988aa49471f406354274bc013c1102004dad25000862df68472d6058fcb00f8b
Upgraded:
  audit 4.0.2-1.fc41 -> 4.0.3-1.fc41
  audit-libs 4.0.2-1.fc41 -> 4.0.3-1.fc41
  ...
```

Issue: #3987
  • Loading branch information
nikita-dubrovskii authored and jlebon committed Jan 17, 2025
1 parent 09868d1 commit 41c6b42
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/cmd-diff
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class DiffBuildTarget:
meta: dict

@staticmethod
def from_build(builds, build):
return DiffBuildTarget(build, builds.get_build_dir(build),
builds.get_build_meta(build))
def from_build(builds, build, arch):
return DiffBuildTarget(build, builds.get_build_dir(build, arch),
builds.get_build_meta(build, arch))


@dataclass
Expand Down Expand Up @@ -66,8 +66,8 @@ def main():
if args.diff_from == args.diff_to:
raise Exception("from and to builds are the same")

diff_from = DiffBuildTarget.from_build(builds, args.diff_from)
diff_to = DiffBuildTarget.from_build(builds, args.diff_to)
diff_from = DiffBuildTarget.from_build(builds, args.diff_from, args.arch)
diff_to = DiffBuildTarget.from_build(builds, args.diff_to, args.arch)

# get activated differs
active_differs = []
Expand Down Expand Up @@ -96,6 +96,8 @@ def parse_args():
parser.add_argument("--from", dest='diff_from', help="First build ID")
parser.add_argument("--to", dest='diff_to', help="Second build ID")
parser.add_argument("--gc", action='store_true', help="Delete cached diff content")
parser.add_argument("--arch", dest='arch', help="Architecture of builds")

for differ in DIFFERS:
parser.add_argument("--" + differ.name, action='store_true', default=False,
help=differ.description)
Expand Down

0 comments on commit 41c6b42

Please sign in to comment.