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

Unable to select version for range #1009

Closed
SirLynix opened this issue Nov 4, 2020 · 9 comments
Closed

Unable to select version for range #1009

SirLynix opened this issue Nov 4, 2020 · 9 comments

Comments

@SirLynix
Copy link
Member

SirLynix commented Nov 4, 2020

Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.

Hi!

I was trying to use the version system of xmake packages, which works except when I try to specify a version.

Describe the bug

Specifying a package version doesn't work and cause a Lua error.

Example script (from the console example)

add_rules("mode.debug", "mode.release")
add_requires("pcre 1.3.x")

target("test2")
    set_kind("binary")
    add_files("src/*.c")

I used "pcre 1.3.x" version from xmake documentation.

Expected behavior

I was expecting it to work and includes a package with a specified version.

Error output

test2$ xmake.exe -v -D
checking for architecture ... x64
checking for Microsoft Visual Studio (x64) version ... 2019
checkinfo: cannot runv(unzip.exe -v), No such file or directory
error: @programdir\core\main.lua:284: @programdir\core\sandbox\modules\import\core\base\task.lua:65: ...gramdir\core\sandbox\modules\import\core\base\semver.lua:88: unable to select version for range '1.3.x'
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:792]: in function 'raise'
    [...gramdir\core\sandbox\modules\import\core\base\semver.lua:88]: in function 'select'
    [@programdir\actions\require\impl\package.lua:260]: in function '_select_package_version'
    [@programdir\actions\require\impl\package.lua:353]: in function '_load_package'
    [@programdir\actions\require\impl\package.lua:395]: in function '_load_packages'
    [@programdir\actions\require\impl\package.lua:741]: in function 'load_packages'
    [@programdir\actions\require\impl\package.lua:759]: in function 'install_packages'
    [@programdir\actions\require\install.lua:162]: in function 'install_requires'
    [@programdir\actions\config\main.lua:272]:
    [C]: in function 'load'
    [@programdir\core\base\task.lua:520]: in function 'run'
    [@programdir\core\sandbox\modules\import\core\base\task.lua:63]: in function 'run'
    [@programdir\actions\build\main.lua:99]:
    [C]: in function 'load'
    [@programdir\core\base\task.lua:520]: in function 'run'
    [@programdir\core\main.lua:282]: in function 'cotask'
    [@programdir\core\base\scheduler.lua:317]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:792: in function 'raise'
        @programdir\core\main.lua:284: in function 'cotask'
        @programdir\core\base\scheduler.lua:317: in function <@programdir\core\base\scheduler.lua:315>

Related Environment

Please provide compiling and running environment information:

  • xmake version: v2.3.8+202010172345
  • os: Windows 10 2004 (same with Linux)
  • target platform: Windows 10 2004 (same with Linux)
@waruqi
Copy link
Member

waruqi commented Nov 4, 2020

Sorry, I wrote this version number casually. It is incorrect. You can go to pcre official website or go to https://github.com/xmake-io/xmake-repo/blob/master/packages/p/pcre/xmake.lua to view the actual version number.

add_requires("pcre 8.x")

or

add_requires("pcre 8.40")

or

add_requires("pcre")

@waruqi
Copy link
Member

waruqi commented Nov 4, 2020

And you need write add_packages("pcre") to bind pcre package to the given target (it will add links/includedirs).

add_rules("mode.debug", "mode.release")
add_requires("pcre 8.x")

target("test2")
    set_kind("binary")
    add_files("src/*.c")
    add_packages("pcre")

@SirLynix
Copy link
Member Author

SirLynix commented Nov 4, 2020

Oh ok, I though it was a version parsing problem, alright.

Actually I was having this problem with curl, the version on xmake-repo doesn't compile on Windows because of an empty testing file. So I wrote a little script to fetch and download all curls versions.

Generating something like

add_versions("7.73.0", "cf34fe0b07b800f1c01a499a6e8b2af548f6d0e044dca4a29d88a4bee146d131")
add_versions("7.72.0", "ad91970864102a59765e20ce16216efc9d6ad381471f7accceceab7d905703ef")
add_versions("7.71.1", "9d52a4d80554f9b0d460ea2be5d7be99897a1a9f681ffafe739169afd6b4f224")
add_versions("7.71.0", "600f00ac2481a89548a4141ddf983fd9386165e1960bac91d0a1c81dca5dd341")
add_versions("7.70.0", "a50bfe62ad67a24f8b12dd7fd655ac43a0f0299f86ec45b11354f25fbb5829d0")
add_versions("7.69.1", "2ff5e5bd507adf6aa88ff4bbafd4c7af464867ffb688be93b9930717a56c4de8")
add_versions("7.69.0", "668d451108a7316cff040b23c79bc766e7ed84122074e44f662b8982f2e76739")
add_versions("7.68.0", "207f54917dd6a2dc733065ccf18d61bb5bebeaceb5df49cd9445483e8623eeb9")
add_versions("7.67.0", "dd5f6956821a548bf4b44f067a530ce9445cc8094fd3e7e3fc7854815858586c")
add_versions("7.66.0", "6618234e0235c420a21f4cb4c2dd0badde76e6139668739085a70c4e2fe7a141")
add_versions("7.65.3", "0a855e83be482d7bc9ea00e05bdb1551a44966076762f9650959179c89fce509")
add_versions("7.65.2", "8093398b51e7d8337dac6f8fa6f1f77d562bdd9eca679dff9d9c3b8160ebfd28")
add_versions("7.65.1", "cbd36df60c49e461011b4f3064cff1184bdc9969a55e9608bf5cadec4686e3f7")
...

I suppose there's no best way to register many versions at once? (sorry for asking here, I'm gonna make a pull request on https://github.com/xmake-io/xmake-repo when my script finishes)

@waruqi
Copy link
Member

waruqi commented Nov 4, 2020

Although xmake supports the installation of multi-version packages, the long version list is not convenient for maintenance. A package in xmake-repo only accepts no more than 10 versions. We can select the latest 10 versions or 10 major versions to add to xmake-repo

If you want to install any version, you can define package("curl") in your own project xmake.lua to use it, then you can add any version number in it. You can refer https://github.com/tboox/benchbox, this project example will give priority to the package defined in its own local repository

you can also remove all ʻadd_versions`, which will allow users to choose any version package, it will ignore sha256 checksum.

@SirLynix
Copy link
Member Author

SirLynix commented Nov 4, 2020

Oh okay. But wouldn't be good to add a way to specify a package version that isn't listed? I couldn't find a way to install libcurl 7.65 because only libcurl 7.64 is listed. I'll check to make my own private repository but I find it a bit sad that I have to make a whole xmake repository just to select a new version. Maybe I missed a way to do that?

Thank you.

@waruqi
Copy link
Member

waruqi commented Nov 4, 2020

In the package in the self-built repository, you can install any version package without defining add_versions.

But for the official repository xmake-repo, we will consider the integrity and security of the package, so we need to strictly set the version and sha256 verification.

But you can also specify any branch name, If this package (curl) exists git url.

package("curl")
    add_urls("https://github.com/curl/curl.git")
    -- ...
add_requires("curl branchxx")

@waruqi
Copy link
Member

waruqi commented Nov 4, 2020

Of course, I can also consider adding a parameter to allow users to ignore version verification, so that we can choose any version. for example:

add_requires("curl 7.67.0", {verify = false})

But you need to wait a day or two to get this new feature, because i need to rest now.

@waruqi waruqi added this to the v2.3.9 milestone Nov 4, 2020
@SirLynix
Copy link
Member Author

SirLynix commented Nov 4, 2020

No problem, thanks for the quick answers and solution!

@waruqi
Copy link
Member

waruqi commented Nov 5, 2020

I have supported {verify = false} option to ignore sha256sum to install any version package. you can update to dev version and try it again. xmake update -s dev

But to disable verify you need to know the following some points

  • Semantic version selection is not supported, so you must write a clear version number, for example: 7.67.0
  • The downloaded package has no integrity check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants