-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Enable pkg.installed to detect packages by their origin name on FreeBSD #67127
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed pkg.install in test mode would not detect FreeBSD packages installed by their origin name |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -743,7 +743,15 @@ def _find_install_targets( | |||
warnings = [] | ||||
failed_verify = False | ||||
for package_name, version_string in desired.items(): | ||||
cver = cur_pkgs.get(package_name, []) | ||||
|
||||
# FreeBSD pkg supports `openjdk` and `java/openjdk7` package names | ||||
origin = bool(re.search('/', package_name)) | ||||
|
||||
if __grains__['os'] == 'FreeBSD' and origin: | ||||
cver = [k for k, v in cur_pkgs.items() if v['origin'] == package_name] | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are often hundreds or thousands of packages installed on a system. If someone is attempting to install many of these packages that have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears there is a orgins dict stored in the context ( Line 171 in 9233e1c
|
||||
else: | ||||
cver = cur_pkgs.get(package_name, []) | ||||
|
||||
if resolve_capabilities and not cver and package_name in cur_prov: | ||||
cver = cur_pkgs.get(cur_prov.get(package_name)[0], []) | ||||
|
||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a regex to check if a substring is in a string; it can just be
has_origin = '/' in package_name
. However we might want to use a regex in order to not match cases like/package_name
andpackage_name/