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

Improve dependencies in the packaging #69

Merged
merged 1 commit into from
May 6, 2021

Conversation

nhosoi
Copy link
Contributor

@nhosoi nhosoi commented Apr 28, 2021

collection_requirements.txt - added
collection_readme.md - make dependencies programmable.

@nhosoi nhosoi requested a review from richm April 29, 2021 17:24
@richm
Copy link
Contributor

richm commented Apr 29, 2021

Can you give a usage example?

@pcahyna
Copy link
Member

pcahyna commented Apr 29, 2021

Can you give a usage example?

I would be interested in that too. It is not clear where will the information come from.

@nhosoi
Copy link
Contributor Author

nhosoi commented Apr 29, 2021

Can you give a usage example?

I would be interested in that too. It is not clear where will the information come from.

This dist-git pr/7 is the beneficiary of this pr/69.
https://src.fedoraproject.org/fork/nhosoi/rpms/linux-system-roles/c/baeafb4778304fc58bbd83f5ff52b2426a392bf3

I was hoping to update the dist-git pr/7, once this pr is merged. But I guess it'd be better to discuss on the both pr's to make them in sync...

@richm
Copy link
Contributor

richm commented Apr 30, 2021

I don't think we should be trying to parse the python requirements format into individual names and operations in the spec file, then put them back together in the correct python format in gen-requirements.py. I think the --requirements argument value should be a file in the correct python requirements.txt format. I also think it should be in the canonical form, which is one package per line:

ansible ; python_version > "2.6"
ansible<2.7 ; python_version < "2.7"
idna<2.8 ; python_version < "2.7"
PyYAML<5.1 ; python_version < "2.7"

For upstream, we should have a requirements.txt file in the lsr_role2collection/ subdirectory. The galaxy_transform.py script could update the %dependencies% in collection_readme.md with the contents of requirements.txt.

For downstream - the spec file should create a requirements.txt file in the correct python format.

@nhosoi
Copy link
Contributor Author

nhosoi commented May 1, 2021

collection_readme.md - make dependencies programmable.
collection_requirements.txt - added

@richm
Copy link
Contributor

richm commented May 6, 2021

Ok. We'll need this in the Galaxy collection as well, so please update https://github.com/linux-system-roles/auto-maintenance/blob/master/release_collection.py to add these two files as well, and update the collection README.md

The following dependency is required for the Ansible Controller:
* jmespath
The following dependencies are required for the Ansible Controller:
%dependencies%
Copy link
Contributor

@richm richm May 6, 2021

Choose a reason for hiding this comment

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

After thinking about this some more,

If the user is installing from Galaxy or Automation Hub, the user should know to look in requirements.txt and/or bindep.txt if the tooling doesn't use those files automatically (e.g. if you do ansible-galaxy collection install fedora.system_roles does it know to look in requirements.txt and ensure those dependencies? If not, then it is the responsibility of the user).

If installing from RPM, the dependencies should automatically be installed - in that case, we should tell the user that.

Perhaps this wording:

## Dependencies

If installing from RPM, the dependencies will be installed with the package.  Otherwise, the dependencies are listed
in `requirements.txt` and/or `bindep.txt`.

@nhosoi
Copy link
Contributor Author

nhosoi commented May 6, 2021

Ok. We'll need this in the Galaxy collection as well, so please update https://github.com/linux-system-roles/auto-maintenance/blob/master/release_collection.py to add these two files as well, and update the collection README.md

I'll follow your next suggestion. So, I guess it's not an issue any more. But out of curiosity, to upload to Galaxy, don't we (or can't we) use the collection artifact, e.g., fedora-linux_system_roles-1.1.0.tar.gz? It can be built using the same way in the linux-system-roles dist-git. In creating the package, we could update the README.md for the both fedora and redhat here https://src.fedoraproject.org/rpms/linux-system-roles/pull-request/7#_2__14-26.

@richm
Copy link
Contributor

richm commented May 6, 2021

Ok. We'll need this in the Galaxy collection as well, so please update https://github.com/linux-system-roles/auto-maintenance/blob/master/release_collection.py to add these two files as well, and update the collection README.md

I'll follow your next suggestion. So, I guess it's not an issue any more. But out of curiosity, to upload to Galaxy, don't we (or can't we) use the collection artifact, e.g., fedora-linux_system_roles-1.1.0.tar.gz?

We can, but why would we go through the trouble of building a Fedora rpm just to get the collection bits out of it to upload to Galaxy?

I suppose at some point in the future when we can do:

  • github merge to a role repo triggers a Fedora event
  • the Fedora event updates the Fedora spec file with the latest role commit hash
  • the Fedora event triggers an RPM build using the role commit hash
  • the Fedora event extracts the collection bits out and publishes to Galaxy

but it might be easier to have a github action that triggers on the github role repo merge to build and publish the collection

It can be built using the same way in the linux-system-roles dist-git. In creating the package, we could update the README.md for the both fedora and redhat here https://src.fedoraproject.org/rpms/linux-system-roles/pull-request/7#_2__14-26.

richm
richm previously approved these changes May 6, 2021
Copy link
Contributor

@richm richm left a comment

Choose a reason for hiding this comment

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

lgtm

collection_readme.md - modified the wording in the Dependencies section.
collection_requirements.txt - added.
release_collection.py - added a support for {requirements,bindep}.txt.
                        removed copying collection_readme.md, which is
                        redundant.
@nhosoi
Copy link
Contributor Author

nhosoi commented May 6, 2021

lgtm

Sorry, @richm. I had to fix the black error (;_;). Could you approve one more time? Thank you!!

Copy link
Contributor

@richm richm left a comment

Choose a reason for hiding this comment

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

lgtm

@nhosoi nhosoi merged commit 7d09317 into linux-system-roles:master May 6, 2021
@nhosoi nhosoi deleted the build_tools branch June 8, 2021 17:16
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.

3 participants