rpm-software-management / mock

Mock is a tool for a reproducible build of RPM packages.
GNU General Public License v2.0
378 stars 222 forks source link

Building rpms from tarballs #3

Open nkk1 opened 7 years ago

nkk1 commented 7 years ago

rpmbuild man

   BUILDING PACKAGES:
       rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [rpmbuild-options] SPECFILE ...

       rpmbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [rpmbuild-options] TARBALL ...

       rpmbuild {--rebuild|--recompile} SOURCEPKG ...

mock should support building RPMs from TARBALL basically to download the source tarball

rpmbuild -ts $SRC
yum-builddep $generated_src
rpmbuild -tb $SRC

classic example is building httpd rpm

https://httpd.apache.org/docs/2.4/platform/rpm.html rpmbuild -ts httpd-2.4.x.tar.bz2 rpmbuild -tb httpd-2.4.x.tar.bz2

njh commented 6 years ago

Would you accept a Pull Request that adds support for this?

xsuchy commented 6 years ago

@njh Yes.

nkadel commented 4 years ago

I'd not expect this to work very often as Fedora discards python2 and RHEL 7.u will include python3. .spec files will have to be written very carefully to make support for this more common.

nkadel commented 4 years ago

The usual approach is to run "rpmbuild -ts" on the tarball, and run "mock build" from that. The only .spec files I've ever seen that I know will mess that up are from SuSE, which had a very peculiar habit of including or excluding files in the SRPM depending on the release of the host building the RPMs. And I don't that applies to any sane tarball distributed software.

A preiliminary equivalent of building an SRPM from the tarball shouldn't run into the python2/python3 issues, SRPM's do not rely on other complex dependencies. Now, .spec files do. And there are examples of workable structures in my py2pack updated files at https://github.com/nkadel/py2packrepo/blob/master/python-py2pack-srpm/fedora.spec.in .