Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft script for fetching origins of required packages #289

Merged
merged 3 commits into from Feb 15, 2024
Merged

Conversation

baierjan
Copy link
Member

@baierjan baierjan commented Feb 8, 2024

Fetch requirements from package spec file, look for package names for
such requirements, search all relevant instances where the package is
maintained and fetch version info from spec file and from Tumbleweed
repo.

Reference: https://progress.opensuse.org/issues/154723

Note: The only related change is in the last commit.

subrepo:
  subdir:   "external/os-autoinst-common"
  merged:   "db78c61"
upstream:
  origin:   "git@github.com:os-autoinst/os-autoinst-common.git"
  branch:   "master"
  commit:   "db78c61"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"
Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. The script generally looks good enough. I am still running it and it takes some time so I don't want to give my approval just yet :)

Just because of the name "obs-check-package-origin" that reminded me of similarly named tool which you might want to look into if not already done:

Would be great if you can put your addition in relation to those and describe differences

@baierjan
Copy link
Member Author

baierjan commented Feb 8, 2024

Ok. The script generally looks good enough. I am still running it and it takes some time so I don't want to give my approval just yet :)

Yes, it takes a while. Also if you run it with ZYPPER=1 (and source repos enabled) it is even longer. You are basically making several osc and zypper calls per each entry in requirements and the queries into OBS are not fast (and I did not bother to cache anything in this draft).

Just because of the name "obs-check-package-origin" that reminded me of similarly named tool which you might want to look into if not already done:

Would be great if you can put your addition in relation to those and describe differences

Yes, good point. Some if that would be probably doing similar things. The osc-origin plugin is probably the most prominent, however I am not sure if that is usable without checking out the package first. The advantage in my approach is, that we are basically doing https://en.opensuse.org/openSUSE:Maintenance_update_process#Check_if_a_Leap_package_is_inherited_from_SLE and that can be done just with plain osc without checking-out anything upfront. If I am not mistaken, the openSUSE-release-tools is wrapping around already created submission requests.

The script is far from perfect and the very core is just osc sm <package> in a loop. For further usage in any other scripts, one would probably need to use something better than a shell script.

}

init_check() {
which yq &> /dev/null || {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
which yq &> /dev/null || {
command yq &> /dev/null || {

This was failing on a TW container until I changed it, also if checking for dependencies, rpmspec should also be included, and I guess osc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, so which is not preinstalled in a TW container, good to know. Unfortunately command is not an equivalent of which here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, so which is not preinstalled in a TW container, good to know. Unfortunately command is not an equivalent of which here.

why so? but either way at least is known now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are brave enough you can try the difference between which vim and command vim; but even if command -v is used, it behaves differently (the difference is in respect of bash functions and aliases, which will be found by command but would not work without interactive shell).

Comment on lines 76 to 90
rpmspec -q -D "sysusers_requires BuildRequires: sysuser-tools" --buildrequires "$tmpfile" \
| sort -u \
| while read -r; do
package="$(get_package_name "$REPLY")"
test -n "$package" || {
error "Unable to get package name for '$REPLY'"
continue
}
echo "$package"
done
rm "$tmpfile"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baierjan maybe you want to look at how I did it at https://progress.opensuse.org/issues/154747#note-3

Not entirely sure if buildrequires will also pull requires (the distri doesn't have buildrequires for instance)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely not, there were some assumptions in place when writing this script (for example, we know it could be run on Leap/SLES by adding devel:openQA:Leap:xx repositories). You probably want to include also the --requires list.

Fetch requirements from package spec file, look for package names for
such requirements, search all relevant instances where the package is
maintained and fetch version info from spec file and from Tumbleweed
repo

Reference: https://progress.opensuse.org/issues/154723
@mergify mergify bot merged commit 42cd82a into master Feb 15, 2024
6 checks passed
@mergify mergify bot deleted the codestreams branch February 15, 2024 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants