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

WIP: rpm building #316

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

WIP: rpm building #316

wants to merge 3 commits into from

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Aug 16, 2023

  • Make tox -e rpm testing easier to use
  • WIP: ensure tox -e rpm produces rpms

Related: #315

@ssbarnea
Copy link
Member Author

@daaitudian As rpm building is currently not working at all, I cannot test your change about changelog generation.

I will need you help to ensure we can build an rpm using tox -e rpm first.

@daaitudian
Copy link

daaitudian commented Aug 23, 2023

Hi @ssbarnea :
I tried tox -e rpm and the main problem with the pip was a timeout. I manually executed commands and added timeout options to install packages.

eg: python -I -m pip --default-timeout 1000 install PyYAML 'ansible-core>=2.12' coverage 'jsonschema>=4.6.0' packaging pip-tools pytest-mock pytest-plus 'pytest>=7.2.0' 'subprocess-tee>=0.4.1' 'typing-extensions>=4.5.0; python_version < "3.10"'

Fedora RPM build failed due to the lack of "spec.in".

rpm: commands[0]> packit build locally
2023-08-22 18:32:19.548 base_git.py       INFO   Using user-defined script for ActionName.post_upstream_clone: [['rm', '-f', 'dist/*.tar.gz', '||', 'true'], ['./tools/update-version.sh']]
023-08-22 18:32:19.770 logging.py        INFO   sed:Unable to read ./tools/../dist/python-ansible-compat.spec.in:No file or directory 
2023-08-22 18:32:19.771 commands.py       ERROR  Command './tools/update-version.sh' failed. 
2023-08-22 18:32:19.771 utils.py          ERROR  Command './tools/update-version.sh' failed.  
rpm: exit 2 (1.61 seconds) /home/github/ansible-compat> packit build locally pid=94985 

Then, I think we should be added "rpm" in the tox.ini "dnf install -y" and "allowlist_externals" content.

In addition, Redhat and CentOS lack "packit" and related packages causes the "dnf install" to fail. I think this has also caused some impacts. Maybe we should replace "test -f /etc/redhat-release" with "uname -a|grep fedora". For Redhat and CentOS we can omit the build process or use other methods.

@ssbarnea
Copy link
Member Author

ssbarnea commented Aug 23, 2023

On fedora I see this failing and I do not understand what is causing it:

+ '[' 1 -ne 1 ']'
+ /usr/bin/find-debuginfo -j4 --strict-build-id -m -i --build-id-seed 4.1.8.dev3-1.20230823131544455968.chorerpm.3.g1190a46.fc38 --unique-debug-suffix -4.1.8.dev3-1.20230823131544455968.chorerpm.3.g1190a46.fc38.aarch64 --unique-debug-src-base ansible-compat-4.1.8.dev3-1.20230823131544455968.chorerpm.3.g1190a46.fc38.aarch64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 50000000 -S debugsourcefiles.list /media/psf/c/a/ansible-compat/dist/ansible-compat-4.1.8.dev3
find: 'debug': No such file or directory
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
+ /usr/lib/rpm/brp-remove-la-files
+ env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j4
error: Bad exit status from /var/tmp/rpm-tmp.GiWDyr (%install)
    Bad exit status from /var/tmp/rpm-tmp.GiWDyr (%install)

PS. I am making the other changes you suggested, to make it usable on all 3 distros.

@daaitudian
Copy link

I'm sorry I forgot this question. We should disable the debug package build.
We should modify the “spec.in” file, and add " %define defug_package %{nil}" to the beginning.

@daaitudian
Copy link

daaitudian commented Aug 24, 2023

When I used tox -e rpm testing, I found that
rpmbuild -bb --define _sourcedir /home/github/ansible-compat/dist --define _srcdir /home/github/ansible-compat/dist --define _specdir /home/github/ansible-compat/dist --define _topdir /home/github/ansible-compat/dist --define _builddir /home/github/ansible-compat/dist --define _rpmdir /home/github/ansible-compat --define _buildrootdir /home/github/ansible-compat/dist dist/python-ansible-compat.spec
report an error.

If execute it manually, we can create a SPECS file and a SOURCES file in the dist file, then put the .spec file into the SPECS and the tar.gz file into the SOURCES file, then execute the command
rpmbuild -ba SPECS/python-ansible-compat.spec -D "_topdir `pwd`"
in the dist file

@ssbarnea ssbarnea added the help wanted Extra attention is needed label Aug 29, 2023
@ssbarnea
Copy link
Member Author

I will need some help here, so if someone can takeover the WIP PR and make it work at least on Fedora it would be awesome.

@ssbarnea ssbarnea marked this pull request as draft October 30, 2023 10:12
@ssbarnea
Copy link
Member Author

/packit build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants