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

Prepare nodejs for v18 #16966

Conversation

KozhinovAlexander
Copy link
Contributor

Prepare nodjs package for version 18


@ghost
Copy link

ghost commented Apr 11, 2023

I detected other pull requests that are modifying nodejs/all recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@conan-center-bot

This comment has been minimized.

@KozhinovAlexander KozhinovAlexander force-pushed the package/prepare_for_nodejs_v18 branch 3 times, most recently from 07cf61b to 1b5f10e Compare April 11, 2023 10:19
@conan-center-bot

This comment has been minimized.

@KozhinovAlexander KozhinovAlexander force-pushed the package/prepare_for_nodejs_v18 branch 2 times, most recently from f2725fc to ad013a5 Compare April 11, 2023 11:53
@conan-center-bot

This comment has been minimized.

@KozhinovAlexander KozhinovAlexander force-pushed the package/prepare_for_nodejs_v18 branch from 92a6b68 to bb3ca5f Compare April 11, 2023 13:25
@conan-center-bot

This comment has been minimized.

@KozhinovAlexander KozhinovAlexander force-pushed the package/prepare_for_nodejs_v18 branch 2 times, most recently from 1510196 to ee4342b Compare April 11, 2023 14:42
@conan-center-bot

This comment has been minimized.

@KozhinovAlexander KozhinovAlexander force-pushed the package/prepare_for_nodejs_v18 branch from ee4342b to f45d3ea Compare April 11, 2023 15:30
@conan-center-bot

This comment has been minimized.

SSE4
SSE4 previously approved these changes Apr 12, 2023
Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to submit this PR, there's a quiet a fe things i was not expecting so there are lots of questions if you dont mind answering that would be great

recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved

@property
def _source_subfolder(self):
return os.path.join(self.source_folder, "source_subfolder")

@property
def _nodejs_arch(self):
if str(self.settings.os) == "Linux":
if str(self.settings.arch).startswith("armv7"):
if str(self.info.settings.os) == "Linux":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.info should only be used in package_info this looks very bizarre 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the reason here: conan-io/conan#13506 Basically it is a bug in conan itself ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, it's usually a sign of doing something funky that probably has a different solution.

There are checks that need to happen in both generate and package_id

return str(self.info.settings.arch)

@property
def _glibc_version(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required?

Copy link
Contributor Author

@KozhinovAlexander KozhinovAlexander Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test will fail otherwise. See supported platforms here: https://github.com/nodejs/node/blob/main/BUILDING.md#platform-list It states glibc>=2.17

not (str(self.settings.os) in self.conan_data["sources"][self.version]) or
not (self._nodejs_arch in self.conan_data["sources"][self.version][str(self.settings.os)] ) ):
if not self.version in self.conan_data["sources"] or \
not str(self.info.settings.os) in self.conan_data["sources"][self.version] or \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

info should not be add here 🤔

Copy link
Contributor Author

@KozhinovAlexander KozhinovAlexander Apr 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the reason here: conan-io/conan#13506 Basically it is a bug in conan itself ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No no, that issue was specific to using it in package for validate the recommendation is to access self.settings directly.

recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/test_package/conanfile.py Outdated Show resolved Hide resolved
@KozhinovAlexander
Copy link
Contributor Author

KozhinovAlexander commented Apr 13, 2023

Thanks for taking the time to submit this PR, there's a quiet a fe things i was not expecting so there are lots of questions if you dont mind answering that would be great

Thank you for your review. I've added some changes and comments. The usage self.info.settings is commented with reference to the thread with a bug in conan itself. Please consider it as a necessary workaround at the moment. Otherwise I do not know, how to push this PR through build stage. And waiting half a year for a bugfix is somehow not works for me :)

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@prince-chrismc
Copy link
Contributor

Oh wow. the recipe was just bad before? pre compiled binaries should be downloaded in the build folder not the source method

Check the cmake recipe for an example

get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][arch],

recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
recipes/nodejs/all/conanfile.py Outdated Show resolved Hide resolved
@KozhinovAlexander
Copy link
Contributor Author

Oh wow. the recipe was just bad before? pre compiled binaries should be downloaded in the build folder not the source method

Check the cmake recipe for an example

get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][arch],

Sometimes I am wondering the restrictions you tell me :) I've never seen thouse in conan docs. And I am using conan v1 already 1,5 years in my company :D

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 43 (7650f237cb9548d7c61ccdac6ac685eef9c47648):

  • nodejs/12.14.1@:
    All packages built successfully! (All logs)

  • nodejs/13.6.0@:
    All packages built successfully! (All logs)

  • nodejs/16.3.0@:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds may be required once they are on the v2 ready list

All green in build 43 (7650f237cb9548d7c61ccdac6ac685eef9c47648):

  • nodejs/12.14.1@:
    All packages built successfully! (All logs)

  • nodejs/16.3.0@:
    All packages built successfully! (All logs)

  • nodejs/13.6.0@:
    All packages built successfully! (All logs)

@gjasny
Copy link
Contributor

gjasny commented Apr 29, 2023

Sometimes I am wondering the restrictions you tell me :) I've never seen thouse in conan docs. And I am using conan v1 already 1,5 years in my company :D

Actually, there is a package template named prebuild_tool_package, which does it the same way:

# do not cache as source, instead, use build folder
def source(self):
pass
# download the source here, than copy to package folder
def build(self):
get(
self,
**self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)],
strip_root=True,
)

I always try to follow one of the templates.

self.output.info("Node version:")
self.run("node --version", run_environment=True)
self.run("node --version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.run("node --version")
self.run("node --version")
self.run("npm --version")
self.run("npx --version")

def test(self):
if not cross_building(self):
self.output.info("Node version:")
self.run("node --version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.run("node --version")
self.run("node --version")
self.run("npm --version")
self.run("npx --version")

@gjasny
Copy link
Contributor

gjasny commented Apr 29, 2023

And thank you for all your work and patience! 🐝

@prince-chrismc
Copy link
Contributor

Sometimes I am wondering the restrictions you tell me :) I've never seen thouse in conan docs. And I am using conan v1 already 1,5 years in my company :D

The biggest sin of 1.x was letting you do anything even thought it was not recommended or error prone.
In CCI we have 100s of PRs a week and to double checking every corner case is just not possible...
I personally just ask author to change it to the way I know it's going to work so we do not have awkward work arounds... just because you can does not mean you should.

Reviewing PRs is not my job but I actually enjoy it so I make a few hours a week to do them.

As for the docs, they are never complete of finished so there's a done of things missing. Completely features are just undocumented still so as much as they are a source of truth they are sometimes missing things.

On the flip side CCI's community has a difference of opinion when it comes to writing recipes, not all of the conventions here are the "recommendation" from Conan itself... for example how we apply patches... it's easier to review and maintain the CCI way but not necessarily required.

But it's super hard to explain and looks and review for corner cases.

Lastly you have all the enterprise users who build packages from CCI, they prefer constancy so they can more easily patch and fix large amount of recipes at once. We do not support this but the more uniform a recipe gets the easier they re to wrk with.

@KozhinovAlexander
Copy link
Contributor Author

Sometimes I am wondering the restrictions you tell me :) I've never seen thouse in conan docs. And I am using conan v1 already 1,5 years in my company :D

The biggest sin of 1.x was letting you do anything even thought it was not recommended or error prone.
In CCI we have 100s of PRs a week and to double checking every corner case is just not possible...
I personally just ask author to change it to the way I know it's going to work so we do not have awkward work arounds... just because you can does not mean you should.

Reviewing PRs is not my job but I actually enjoy it so I make a few hours a week to do them.

As for the docs, they are never complete of finished so there's a done of things missing. Completely features are just undocumented still so as much as they are a source of truth they are sometimes missing things.

On the flip side CCI's community has a difference of opinion when it comes to writing recipes, not all of the conventions here are the "recommendation" from Conan itself... for example how we apply patches... it's easier to review and maintain the CCI way but not necessarily required.

But it's super hard to explain and looks and review for corner cases.

Lastly you have all the enterprise users who build packages from CCI, they prefer constancy so they can more easily patch and fix large amount of recipes at once. We do not support this but the more uniform a recipe gets the easier they re to wrk with.

Thank you very much for detailed explanation and taking time for review. Basically I am okay with it and happy to do the things right way. Some stuff was just very new to me, I've never seen in that context. But now, I can say, that a lot of developers writing recipes ...hmmh... not completely right :D

@prince-chrismc
Copy link
Contributor

❤️ Just trying to fill in the context since this project has changed over the last almost 4 years :)

@KozhinovAlexander
Copy link
Contributor Author

@gjasny @SSE4 would you please approve?

@KozhinovAlexander KozhinovAlexander requested a review from gjasny May 2, 2023 11:41
@conan-center-bot conan-center-bot merged commit 89fa481 into conan-io:master May 2, 2023
pezy pushed a commit to pezy/conan-center-index that referenced this pull request Jun 1, 2023
* nodejs: conanfile.py: prepare for v18

Signed-off-by: Alexander Kozhinov <[email protected]>

* test_package: conanfile.py: update for conan v2 usage

Signed-off-by: Alexander Kozhinov <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* nodejs: conanfile.py: remove compiler verification

Signed-off-by: Alexander Kozhinov <[email protected]>

* nodejs: test_package: rework for v1 and v2

Signed-off-by: Alexander Kozhinov <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* nodejse: conanfile.py: rework conan_version test

Signed-off-by: Alexander Kozhinov <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Gregor Jasny <[email protected]>

* Update recipes/nodejs/all/test_package/conanfile.py

Co-authored-by: Gregor Jasny <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Gregor Jasny <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Gregor Jasny <[email protected]>

* nodejs: conanfile.py: use self.settings instead of self.info.settings

Signed-off-by: Alexander Kozhinov <[email protected]>

* nodejs: conanfile.py: do not use self.settings in source() method

Signed-off-by: Alexander Kozhinov <[email protected]>

* nodejs: conanfile.py: use subprocess in _glibc_version

Signed-off-by: Alexander Kozhinov <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* Update recipes/nodejs/all/conanfile.py

Co-authored-by: Chris Mc <[email protected]>

* nodejs: conanfile.py: fix arch / revert _glibc_version

Signed-off-by: Alexander Kozhinov <[email protected]>

* nodejs: conanfile.py: remove dobule defined build() method

Signed-off-by: Alexander Kozhinov <[email protected]>

* nodejs: conanfile.py: fix glibc version aquisition

Signed-off-by: Alexander Kozhinov <[email protected]>

---------

Signed-off-by: Alexander Kozhinov <[email protected]>
Co-authored-by: Chris Mc <[email protected]>
Co-authored-by: Gregor Jasny <[email protected]>
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

Successfully merging this pull request may close these issues.

5 participants