Support short version like tmux/ijg#101
Support short version like tmux/ijg#101mxcl merged 2 commits intopkgxdev:mainfrom uesyn:support-uploading-tmux-versioning
Conversation
|
😬 that regex. Not your fault. But scary for me. @jhheider thoughts? |
|
There's also software like I'd be happier if we had a unit/integration test that ensured reasonable results out of: |
|
@mxcl @jhheider |
|
I will definitely need to test how it's handled throughout If you want to combine those regexen, btw, I think this is the right one: const cacheRegex = `^(.*)-(\\d+(\\.\\d+)*[:alpha:]?)(\\+(darwin|linux)\\+(aarch64|x86-64))?\\.$`Of note: I believe the version schema we're accepting is |
In case of arch matches regex testimport { assertEquals } from "https://deno.land/std@0.185.0/testing/asserts.ts";
Deno.test(function regexTest() {
const cacheRegex = `^(.*)-(\\d+(\\.\\d+)*[:alpha:]?)(\\+(darwin|linux)\\+(aarch64|x86-64))?\\.tar.[gx]z$`
const path = "project∕foo-1.2.3+linux+x86-64.tar.gz";
const match = path.match(cacheRegex)!
const {pkg, version, platform} = {pkg: match[0], version: match[1], platform: match[2]}
assertEquals(pkg, "project∕foo")
assertEquals(version, "1.2.3")
assertEquals(platform, "+linux+x86-64")
});running 1 test from ./main_test.ts
regexTest ... FAILED (9ms)
ERRORS
regexTest => ./main_test.ts:3:6
error: AssertionError: Values are not equal.
[Diff] Actual / Expected
- project∕foo-1.2.3+linux+x86-64.tar.gz
+ project∕foo
throw new AssertionError(message);
^
at assertEquals (https://deno.land/std@0.185.0/testing/asserts.ts:189:9)
at regexTest (file:///home/uesyn/src/tmp/ts/main_test.ts:8:3)
FAILURES
regexTest => ./main_test.ts:3:6
FAILED | 0 passed | 1 failed (35ms)
error: Test failed
For now, these extention is not used because it is not acceptable by the current regex, but should I also support these extention too in this PR? This PR only makes bottles having shorter version uploaded correctly(e.g. tmux), and I believe this PR doesn't bring breaking changes to tea cli. |
|
I think you're getting it right. You might be able to solve the I would say we probably need to be permissive w.r.t. the file extensions, so we don't introduce future maintenance issues. Adding |
|
It looks really good. It seems to work with versions:
url: https://ijg.org/files/
match: /jpegsrc\.v\d+[a-z]?\.tar\.gz/
strip:
- /jpegsrc\.v/
- /\.tar\.gz/as well (built 9a and 9e locally). I'm ready to sign-off and see if/what it breaks, since this is brewkit and cli already seems to accept it. |
jhheider
left a comment
There was a problem hiding this comment.
Willing to roll the dice!
|
Hm. Interestingly, |
|
ah, right, it breaks down on upload. Fortunately, this will be fixed before the next release of |
|
Interesting; it looks like it has fixed x86-64, but not aarch64. we might need to take another crack at the regex. https://github.com/teaxyz/pantry/actions/runs/4876470207/jobs/8720571042 |
|
Though it worked just fine for tmux. So, the specific case of |
|
I recommend doing |
|
I made the PR to fix it: #106 |
It was failed to upload tmux, because tmux is released with shorter versions like 3.3a.
In this PR, support uploading tmux short version.
refs: pkgxdev/pantry#1665 https://github.com/teaxyz/pantry/actions/runs/4823537544/jobs/8592369144#logs