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

packaging/opkg: add upgrade function #54781

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@aparcar
Copy link

aparcar commented Apr 3, 2019

SUMMARY

introduce the latest state which will check if a package is upgradable
and performs an upgrade if available.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

packaging/opkg

ADDITIONAL INFORMATION

There have been such efforts some years ago, however they missed to actually check if a package was upgradeable or not.

Also blacked the code for better readability, hope that's fine!

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Apr 3, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/packaging/os/opkg.py:0:0: E316 ANSIBLE_METADATA.metadata_version: not a valid value for dictionary value @ data['metadata_version']. Got '1.2'

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Apr 3, 2019

@skinp

This comment has been minimized.

Copy link
Contributor

skinp commented Apr 3, 2019

@aparcar seems useful. Can you have a look at this test failure?
Also, can we seperate the logic and formatting changes for easier review?

@ansibot ansibot removed the needs_triage label Apr 3, 2019

@aparcar aparcar force-pushed the aparcar:opkg-latest branch Apr 3, 2019

@ansibot ansibot removed the ci_verified label Apr 3, 2019

@aparcar aparcar force-pushed the aparcar:opkg-latest branch to 13f8fb6 Apr 3, 2019

@aparcar

This comment has been minimized.

Copy link
Author

aparcar commented Apr 3, 2019

@skinp should work now

packaging/opkg: add upgrade function
introduce the `latest` state which will check if a package is upgradable
and performs an upgrade if available.

Signed-off-by: Paul Spooren <mail@aparcar.org>

@aparcar aparcar force-pushed the aparcar:opkg-latest branch from 13f8fb6 to fe482c7 Apr 8, 2019

@aparcar

This comment has been minimized.

Copy link
Author

aparcar commented Apr 8, 2019

Now it's fixed and tested, would be great to merge it :)!

@@ -148,12 +157,12 @@ def install_packages(module, opkg_path, packages):
install_c = 0

for package in packages:
if query_package(module, opkg_path, package):
if query_package(module, opkg_path, package, latest):
continue

rc, out, err = module.run_command("%s install %s %s" % (opkg_path, force, package))

This comment has been minimized.

Copy link
@skinp

skinp Apr 9, 2019

Contributor

Does opkg install actually upgrade the package if it needs to? Docs seem to say there's an upgrade subcommand?

This comment has been minimized.

Copy link
@aparcar

aparcar Apr 10, 2019

Author

I did some testing but the behavior seems to be the same. Both install and upgrade install the package missing and upgrade the package if an upgrade is available (if the repos where updated previously).

This comment has been minimized.

Copy link
@aparcar

This comment has been minimized.

Copy link
@skinp

skinp Apr 16, 2019

Contributor

Alright we'll trust your tests at this point. Thanks!

@skinp

skinp approved these changes Apr 16, 2019

@skinp

This comment has been minimized.

Copy link
Contributor

skinp commented Apr 16, 2019

@ansibot shipit

@ansibot ansibot added the stale_ci label Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.