Page 1 of 1

[RESOLVED] Detection of a new version of an executable (upgrade_package)

Published: September 9, 2022 - 8:14 AM
by alain17
Good morning,

I am running a WAPT Enterprise 2.2.2.12388 server under Ubuntu.

My question concerns the upgrade_package functionality available in WAPT packages. I understand that this function allows you to define how the package should be updated; however, I don't understand how version detection is performed in the console.

For example, I took the tis-powertoys package and modified it, so I currently have two versions. The original version (0.61.1-7) correctly shows that an update is available from the publisher (the PowerToys Git repository) by displaying the text in red, but my slightly modified version (0.61.1-8) does not report any update, even though it is the same executable.
powertoys-upgrade.png
powertoys-upgrade.png (13.63 KB) Viewed 3459 times
Can you tell me how this version detection mechanism works and how I can configure it to react to the release of a new version of the executable?

I don't believe I've modified the upgrade_package code, but just in case, I'll put it here:

Code: Select all

def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    architecture = control.architecture
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    git_repo = "microsoft/PowerToys"
    url_api = "https://api.github.com/repos/%s/releases/latest" % git_repo
    bin_name_sub = "PowerToysSetup%s.exe"
    # Getting latest version information from official sources
    print("API used is: %s" % url_api)
    json_load = json.loads(wgets(url_api, proxies=proxies))

    for download in json_load["assets"]:
        if bin_contains in download["name"] and architecture in download["name"]:
            url_dl = download["browser_download_url"]
            version = json_load["tag_name"].replace("v", "")
            latest_bin = download["name"]
            break

    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(url_dl, latest_bin, proxies=proxies)

    # Changing version of the package
    if Version(version) > control.get_software_version():
        print("Software version updated from: %s to: %s" % (control.get_software_version(), Version(version)))
        result = True
    control.version = "%s-%s" % (Version(version), control.version.split("-", 1)[-1])
    # control.set_software_version(Version(version))
    control.save_control_to_wapt()

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Validating update-package-sources
    return result

Re: Detection of a new version of an executable (upgrade_package)

Published: September 9, 2022 - 11:25 AM
by dcardon
Hello,

the comparison is based on the packages referenced in the store selected in the console (by default https://store.wapt.fr). It does not use information from the update package. If you want to make comparisons against the source Git repository, the information can be retrieved from https://luti.tranquil.it/ , but it is not currently integrated into the console display.

If a new version of the package is available on the publisher's website, it may already be in the wapt-testing repository, https://wapt.tranquil.it/wapt-testing/ , which you should check.

Regards,

Denis

Re: Detection of a new version of an executable (upgrade_package)

Published: September 9, 2022 - 2:00 PM
by alain17
Hello,

thank you for your reply. It's a shame that it's not possible yet, but is it something that could be implemented in a future version? For example, via a function that could be implemented in the package?

Best regards

Re: Detection of a new version of an executable (upgrade_package)

Published: September 9, 2022 - 4:10 PM
by dcardon
For software version retrieval, there's always a bit of workaround involved, even for sites with JSON APIs (which don't adhere to their own format), and it requires regular patching. Many software programs don't even provide a consistent version on their website, and you have to monitor changes altogether...

The best solution would be to integrate the repository interface into LUTI, but if the package isn't yet available (because the developer has been more creative than usual with their website or software), that doesn't help much either. Normally, once the new software is listed in LUTI, the package is built, tested, validated, and then uploaded to wapt-testing, so it's already available.

Best regards,

Denis