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

[automake] Added support for conan v2 #12834

Closed
wants to merge 3 commits into from

Conversation

jellespijker
Copy link
Contributor

Use modern Autotools toolchain and add buildenv_info

Simplified test_package No need to actually compile
something with this tool we simply need to know if it
runs.

The win_bash for the run in the test_package needs to be
set explicitly due to the conf not working properly in
the test_package see conan-io/conan#11975

This PR is dependent on:


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the conan-center hook activated.

Use modern Autotools toolchain and add buildenv_info

Simplified test_package No need to actually compile
something with this tool we simply need to know if it
runs.

The win_bash for the run in the test_package needs to be
set explicitly due to the conf not working properly in
the test_package see conan-io/conan#11975
@jellespijker jellespijker mentioned this pull request Sep 5, 2022
4 tasks
@conan-center-bot

This comment has been minimized.

subsystem isn't know at this time
Comment on lines +62 to +67
@lru_cache(1)
def _autotools(self):
autotool = Autotools(self)
autotool.configure()
autotool.make()
return autotool
Copy link
Contributor

Choose a reason for hiding this comment

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

please follow the same patterns than other AutotoolsToolchain recipes in CCI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this pattern from Another recipe. Can you point toward an example so I can follow that pattern

Comment on lines +81 to +84
def package(self):
autotools = self._autotools()
# KB-H013 we're packaging an application, place everything under bin
autotools.install(args=[f"DESTDIR={unix_path(self, path.join(self.package_folder, 'bin'))}"])
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the specifications of the destdir? This was the only way for me to make sure that the Autotools used the correct Unix path when run on windows with a subsystem.

Also needed because the whole tool is Installed in its entirety in the bindirs.

# KB-H013 we're packaging an application, hence the nested bin
bin_dir = path.join(self.package_folder, "bin", "bin")
self.output.info(f"Appending PATH environment variable:: {bin_dir}")
self.buildenv_info.prepend_path("PATH", bin_dir)
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.buildenv_info.prepend_path("PATH", bin_dir)

useless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Points towards a nested bin dir inside the bindirs therefore not automatically added. Might be better if I renamed this variable, although i'm not immediately sure what name it should have.

Copy link
Contributor

@SpaceIm SpaceIm Sep 5, 2022

Choose a reason for hiding this comment

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

But why didn't you keep the previous layout in package folder? Anyway it's not the conan v2 way to add paths to PATH.

Copy link
Contributor Author

@jellespijker jellespijker Sep 5, 2022

Choose a reason for hiding this comment

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

KB-H013 state:

If you are packaging an application put all the contents inside the bin folder.

And the "old" recipe did that as well I believed. Including the resources etc.

self.user_info.compile = os.path.join(self._automake_libdir, "compile")
self.user_info.ar_lib = os.path.join(self._automake_libdir, "ar-lib")
def package_info(self):
# KB-H013 we're packaging an application, hence the nested bin
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure comment is useful, maintainers know that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The audience is more then just maintainers. You also have semi layman maintainers such as I, with just enough knowledge to mess things up. See the first attempt of my Autoconf PR, were I treated that recipe like a regular run recipe and not a build application.

I just recently came to this knowledge, because of a linter warning in the PR for my Autoconf recipe. while I have been wondering for over half a year what was "wrong" with the cpython recipe because everything was placed in the the bin dir for that as well.

Just give the word if the comment does more harm then good and I will remove it.

Copy link
Contributor

@SpaceIm SpaceIm Sep 5, 2022

Choose a reason for hiding this comment

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

Actually the comment is wrong, there is no reason to nest bin folder.

Copy link
Contributor Author

@jellespijker jellespijker Sep 6, 2022

Choose a reason for hiding this comment

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

is the comment wrong or the linting warning?

In other words: would the package_folder for an application have to follow layout

package_folder
|
|- bin
|- share
|- libs

or (as far as I understand it by reading KB-H013) and implemented it

package_folder
|
|- bin
    |- bin
    |- share
    |- libs

Comment on lines +103 to +108
for var in [("ACLOCAL", path.join(self.package_folder, "bin", "aclocal")),
("AUTOMAKE_DATADIR", self._datarootdir),
("AUTOMAKE_LIBDIR", self._automake_libdir),
("AUTOMAKE_PERLLIBDIR", self._automake_libdir),
("AUTOMAKE", path.join(self.package_folder, "bin", "automake"))]:
self._set_env(*var)
Copy link
Contributor

Choose a reason for hiding this comment

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

No, your function _set_env always relies on define_path, it's not what we want for ACLOCAL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have limited experience with Autotools in general except for my current attempts to make these recipes work on Windows with msys2.

Could you elaborate a bit why ACLOCAL should not use define_path?

Isn't it just the path to a single binary?

test_type = "explicit"
win_bash = True
Copy link
Contributor

Choose a reason for hiding this comment

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

to remove when msys2 fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add a fixme comment here, is there an issue nummer which I can reference?

Comment on lines -66 to -74
def _build_autotools(self):
"""Test autoreconf + configure + make"""
with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}):
self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows)
self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows)
autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
with self._build_context():
autotools.configure()
autotools.make()
Copy link
Contributor

@SpaceIm SpaceIm Sep 5, 2022

Choose a reason for hiding this comment

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

keep the build please, translate it to conan v2 helpers

Also, test_v1_package is missing here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add a test_v1_package.

Please be aware that Conan v2 is difficult to test on Windows with a subsystemen due to issue conan-io/conan#11975

Copy link
Contributor

Choose a reason for hiding this comment

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

if it doesn't work on window, then PR shouldn't be merged.

@conan-center-bot

This comment has been minimized.

@jellespijker jellespijker reopened this Sep 6, 2022
@jellespijker jellespijker marked this pull request as draft September 6, 2022 16:29
@conan-center-bot
Copy link
Collaborator

Failure in build 4 (8af95dfcaacfa8ac78f85209fe9eb042422000c1):

  • automake/1.16.5@:
    Didn't run or was cancelled before finishing

  • automake/1.16.4@:
    CI failed to create some packages (All logs)

    Logs for packageID 3475bd55b91ae904ac96fde0f106a136ab951a5e:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=Visual Studio
    compiler.runtime=MT
    compiler.version=15
    os=Windows
    
    [...]
    automake/1.16.4: Generator 'AutotoolsToolchain' calling 'generate()'
    automake/1.16.4: Aggregating env generators
    [HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] 'fPIC' option not found
    [HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
    automake/1.16.4: Calling build()
    automake/1.16.4: Calling:
     > "/c/j/w/prod/buildsinglereference/.conan/data/automake/1.16.4/_/_/build/3475bd55b91ae904ac96fde0f106a136ab951a5e/source/configure" --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib 
    
    ----Running------
    > "C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\conanbuild.bat" && "C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\msys2_mode.bat" && C:\J\w\prod\BuildSingleReference/s\c5811a\1\bin\msys64\usr\bin\bash.exe -c ^". \^"C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\conanbuild.sh\^" ^&^& \^"/c/j/w/prod/buildsinglereference/.conan/data/automake/1.16.4/_/_/build/3475bd55b91ae904ac96fde0f106a136ab951a5e/source/configure\^" --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib ^"
    -----------------
    **********************************************************************
    ** Visual Studio 2017 Developer Command Prompt v15.9.49
    ** Copyright (c) 2017 Microsoft Corporation
    **********************************************************************
    [vcvarsall.bat] Environment initialized for: 'x64'
    Capturing current environment in C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\deactivate_msys2_mode.bat
    Configuring environment variables
    Capturing current environment in C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\deactivate_conanbuildenv-release-x86_64.sh
    Configuring environment variables
    Capturing current environment in C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\deactivate_conanautotoolsdeps.sh
    Configuring environment variables
    Capturing current environment in C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release\conan\deactivate_conanautotoolstoolchain.sh
    Configuring environment variables
    checking whether make supports nested variables... yes
    checking build system type... x86_64-pc-mingw64
    checking host system type... x86_64-pc-mingw64
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a race-free mkdir -p... /usr/bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether ln -s works... no, using cp -pR
    checking for perl... /usr/bin/perl
    checking for tex... no
    checking for yacc... yacc
    checking for lex... lex
    checking whether autoconf is installed... no
    automake/1.16.4: 
    configure: error: Autoconf 2.65 or better is required.
        Please make sure it is installed and in your PATH.
    automake/1.16.4: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    automake/1.16.4: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    automake/1.16.4: ERROR: Package '3475bd55b91ae904ac96fde0f106a136ab951a5e' build failed
    automake/1.16.4: WARN: Build folder C:\J\w\prod\BuildSingleReference\.conan\data\automake\1.16.4\_\_\build\3475bd55b91ae904ac96fde0f106a136ab951a5e\build-release
    ERROR: automake/1.16.4: Error in build() method, line 79
    	_ = self._autotools()
    while calling '_autotools', line 65
    	autotool.configure()
    	ConanException: Error 1 while executing "/c/j/w/prod/buildsinglereference/.conan/data/automake/1.16.4/_/_/build/3475bd55b91ae904ac96fde0f106a136ab951a5e/source/configure" --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib 
    
  • automake/1.16.2@:
    Didn't run or was cancelled before finishing

  • automake/1.16.1@:
    Didn't run or was cancelled before finishing

  • automake/1.16.3@:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@jellespijker jellespijker changed the title [autotools] Added support for conan v2 [automake] Added support for conan v2 Sep 11, 2022
@jellespijker
Copy link
Contributor Author

Superseded by #12898 I will close this one in favor the new PR

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

Successfully merging this pull request may close these issues.

3 participants