dennisvang / tufup

Automated updates for stand-alone Python applications.
MIT License
90 stars 1 forks source link

Can the repository/client support multiple target plaforms? #79

Open Slarag opened 1 year ago

Slarag commented 1 year ago

I have an app which is bundeled using PyInstaller. The bundle is created for multiple target platforms (Windows, Linux, x86 64bit, arm v7, etc.) each. This means I'm having platform-specific bundles for each version.

Is it possible to serve those platform-specific bundles in one repository? If yes, how does the client know which bundle it should download and use? If not, what do you think would be a good approach? Serve seperate repositories for each target platform? For example in settings.py:

import os
import platform

prefix = ''
if os.name == 'nt':
    prefix = 'windows'
elif os.name == 'posix':
    if platform.machine() == 'armv7l':
        prefix = 'linux-armv7'
    elif platform.machine() == 'x86_64':
        prefix = 'linux-x86-64'
if prefix:
    METADATA_BASE_URL = f'http://localhost:8000/{prefix}/metadata/'
    TARGET_BASE_URL = f'http://localhost:8000/{prefix}/targets/'
else:
    # platform not supported
    pass
dennisvang commented 1 year ago

@Slarag That's a good question.

Is it possible to serve those platform-specific bundles in one repository?

No, not yet, unfortunately.

In principle, as far as the underlying TUF (python-tuf) repository is concerned, it should be perfectly fine to put all your platform-specific bundles in a single repository, as long as there is some way to distinguish the bundles by filename.

However, tufup does not yet know how to deal with these filenames on the repository side:

Currently, tufup assumes that the filename is composed of an app name and a version specifier:

https://github.com/dennisvang/tufup/blob/6d2c707adc66fd7637739f31f9859b0298a4053d/src/tufup/common.py#L16

There is no platform specifier in there (yet).

If yes, how does the client know which bundle it should download and use?

In any case, the client would need to use some mechanism, like the one you proposed above, to determine a platform specifier (your prefix).

If not, what do you think would be a good approach? Serve seperate repositories for each target platform? ...

For now, I think your best option would indeed be to serve separate repositories for each platform, as you proposed.

I am planning to look into options for adding platform specifiers, similar to wheel filenames (specifically the platform tag), but that is going to take some time.