Instead of using the custom 'rpm' target of setup.py,
generate a dist archive using the 'sdist' target and then
call rpmbuild ourselves: this way we can define _topdir
and stop artifacts from ending up in ~/rpmbuild.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
jobs/python-distutils.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/jobs/python-distutils.yaml b/jobs/python-distutils.yaml
index 0b20b17..5601d26 100644
--- a/jobs/python-distutils.yaml
+++ b/jobs/python-distutils.yaml
@@ -122,7 +122,9 @@
{global_env}
{local_env}
sed -i -e 's/BuildRequires: libvirt.*devel.*//' *.spec.in
- $PYTHON ./setup.py rpm
+ rm -f dist/*.tar.{{ archive_format }}
+ $PYTHON ./setup.py sdist
+ rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta dist/*.tar.{{ archive_format }}
publishers:
- email:
recipients: '{obj:spam}'
--
2.17.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Aug 10, 2018 at 03:37:41PM +0200, Andrea Bolognani wrote: > Instead of using the custom 'rpm' target of setup.py, > generate a dist archive using the 'sdist' target and then > call rpmbuild ourselves: this way we can define _topdir > and stop artifacts from ending up in ~/rpmbuild. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- > jobs/python-distutils.yaml | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/jobs/python-distutils.yaml b/jobs/python-distutils.yaml > index 0b20b17..5601d26 100644 > --- a/jobs/python-distutils.yaml > +++ b/jobs/python-distutils.yaml > @@ -122,7 +122,9 @@ > {global_env} > {local_env} > sed -i -e 's/BuildRequires: libvirt.*devel.*//' *.spec.in > - $PYTHON ./setup.py rpm > + rm -f dist/*.tar.{{ archive_format }} > + $PYTHON ./setup.py sdist > + rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta dist/*.tar.{{ archive_format }} So what if you used a standard bdist_rpm command from distutils core, I believe $PYTHON ./setup.py bdist_rpm --bdist-base <foo> would be equal to your _topdir. Although, that's just what I've digested from distutils docs, so even though bdist_rpm has a plethora of options you can specify there can always be one we'll be missing :P Erik > publishers: > - email: > recipients: '{obj:spam}' > -- > 2.17.1 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, 2018-08-20 at 16:01 +0200, Erik Skultety wrote: > On Fri, Aug 10, 2018 at 03:37:41PM +0200, Andrea Bolognani wrote: > > - $PYTHON ./setup.py rpm > > + rm -f dist/*.tar.{{ archive_format }} > > + $PYTHON ./setup.py sdist > > + rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta dist/*.tar.{{ archive_format }} > > So what if you used a standard bdist_rpm command from distutils core, I believe > $PYTHON ./setup.py bdist_rpm --bdist-base <foo> would be equal to your _topdir. > Although, that's just what I've digested from distutils docs, so even though > bdist_rpm has a plethora of options you can specify there can always be one > we'll be missing :P I haven't been able to find any bdist_rpm documentation that is not filed under Python 2, which leads me to believe it might not be as supported (if at all) under Python 3; moreover, the current documentation[1] seems to point to FPM as the preferred way to generate RPM packages, but that process doesn't looks like it involves spec files at all and bundle a whole lot of other stuff along with your actual software, so I'd say it's not really suitable for our purpose. In any case, I would still prefer the two-step approach (dist plus rpmbuild) to building RPMs because it is consistent with what we do for all other build systems (autotools and Perl's Module::Build). [1] https://packaging.python.org/overview/#operating-system-packages -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Mon, Aug 20, 2018 at 04:37:13PM +0200, Andrea Bolognani wrote: > On Mon, 2018-08-20 at 16:01 +0200, Erik Skultety wrote: > > On Fri, Aug 10, 2018 at 03:37:41PM +0200, Andrea Bolognani wrote: > > > - $PYTHON ./setup.py rpm > > > + rm -f dist/*.tar.{{ archive_format }} > > > + $PYTHON ./setup.py sdist > > > + rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta dist/*.tar.{{ archive_format }} > > > > So what if you used a standard bdist_rpm command from distutils core, I believe > > $PYTHON ./setup.py bdist_rpm --bdist-base <foo> would be equal to your _topdir. > > Although, that's just what I've digested from distutils docs, so even though > > bdist_rpm has a plethora of options you can specify there can always be one > > we'll be missing :P > > I haven't been able to find any bdist_rpm documentation that is not > filed under Python 2, which leads me to believe it might not be as > supported (if at all) under Python 3; moreover, the current > documentation[1] seems to point to FPM as the preferred way to > generate RPM packages, but that process doesn't looks like it > involves spec files at all and bundle a whole lot of other stuff > along with your actual software, so I'd say it's not really suitable > for our purpose. > > In any case, I would still prefer the two-step approach (dist plus > rpmbuild) to building RPMs because it is consistent with what we do > for all other build systems (autotools and Perl's Module::Build). > > > [1] https://packaging.python.org/overview/#operating-system-packages Fair enough, Reviewed-by: Erik Skultety <eskultet@redhat.com> -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.