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

Version constraining - Multiple != #363

Open
kevinlekiller opened this issue Apr 26, 2023 · 4 comments
Open

Version constraining - Multiple != #363

kevinlekiller opened this issue Apr 26, 2023 · 4 comments

Comments

@kevinlekiller
Copy link

Is there any way to ignore 2 release versions, but allow older / newer releases.

I'll use the example of https://github.com/flathub/io.mpv.Mpv below:

yt-dlp's versions 2023.03.04 (the latest version) and 2023.03.03 have issues, the previous version before that (2023.02.17) works fine.

This doesn't work :

versions: {'!=': '2023.03.03', '!=': '2023.03.04'} (since we can't have multiple not equals)

Being able to have multiple not equals or regex would be nice, like this:

versions: {'!=': '2023.03.0[34]'}

Or maybe there's another way?

@wjt
Copy link
Contributor

wjt commented Apr 26, 2023

I ran into this limitation the other day. Possible syntaxes if someone wanted to extend the "versions" feature to support this, none of which are exactly beautiful, and none of which work today:

versions:
  '&&': [
    {'!=': '2023.03.03'},
    {'!=': '2023.03.04'},
  ]
versions: {'!=': ['2023.03.03', '2023.03.04'}
versions: {'∉': ['2023.03.03', '2023.03.04'}
versions: {'not in': ['2023.03.03', '2023.03.04'}

You could do this as a gross but functional workaround:

    sources:
      - type: archive
        url: https://github.com/yt-dlp/yt-dlp/releases/download/2023.02.17/yt-dlp.tar.gz
        sha256: 81f607b8754b1bc67e6592a4e316c015d720e7118757a5afd4ef2aaf37d2ef29
        x-checker-data:
          type: json
          url: https://api.github.com/repos/yt-dlp/yt-dlp/releases
          version-query: map(select( .draft | not )) | map(select(.tag_name != "2023.03.03" and .tag_name != "2023.03.04")) | .[0].tag_name
          url-query: "https://github.com/yt-dlp/yt-dlp/releases/download/" + $version + "/yt-dlp.tar.gz"

YAML quoting left as an exercise to the reader, I only tested these at the jq command line.

@gasinvein
Copy link
Collaborator

gasinvein commented Apr 27, 2023

Is there any way to ignore 2 release versions, but allow older / newer releases.

How about

versions:
  '<': 2023.03.03
  '>': 2023.03.04

?

@kevinlekiller
Copy link
Author

Thanks for the reply.

I did try that initially, but it returns the latest version, I think because https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest only returns one version, I'm guessing this is because versions expects multiple versions:

- name: yt-dlp
  no-autogen: true
  no-make-install: true
  make-args:
    - yt-dlp
    - PYTHON=/usr/bin/python3
  post-install:
    - install yt-dlp /app/bin
  sources:
    - type: archive
      url: https://github.com/yt-dlp/yt-dlp/releases/download/2023.02.17/yt-dlp.tar.gz
      sha256: 81f607b8754b1bc67e6592a4e316c015d720e7118757a5afd4ef2aaf37d2ef29
      x-checker-data:
       type: json
       url: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
       versions:
        '<': 2023.03.03
        '>': 2023.03.04
       version-query: .tag_name
       url-query: .assets[] | select(.name=="yt-dlp.tar.gz") | .browser_download_url

;

...
INFO    src.lib.externaldata: Source yt-dlp.tar.gz: got new version 2023.03.04
DEBUG   src.manifest: Source archive yt-dlp/yt-dlp.tar.gz: got new State.OUTDATED from JSONChecker, skipping remaining checkers
...
OUTDATED: yt-dlp.tar.gz
 Has a new version:
  URL:       https://github.com/yt-dlp/yt-dlp/releases/download/2023.03.04/yt-dlp.tar.gz
  MD5:       392ead72a00cda0ade947af40fb91039
  SHA1:      8cb9bf641fc4be077e4d61533df25e923807da98
  SHA256:    771d2abefcd5f1e6f3ab6d6d18cdae98be4ab73538d1174e7e7236640418e150
  SHA512:    3220ad0d7445351e5786b5ff1634b633a601f64216813129056d0c8470ce8afa2e6df6d402a9381980df6611e9341039cb7f576dfd444b05fbb1417ba1aced52
  Size:      5125843
  Version:   2023.03.04
  Timestamp: 2023-03-04 22:29:58

@wjt
Copy link
Contributor

wjt commented Apr 27, 2023

Thinking again – I don't think the json checker supports the versions property at all. And I don't think it really can do – the version-query just returns one result. What would the versions predicates be matched against?

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

No branches or pull requests

3 participants