I have been trying to create an rpm using a spec file. I want to use github code with that. I am providing Source0: as http://github.com/some_project.tat.gz, but it's downloading that, it's looking for tat.gz in /root/rpmbuild/SOURCES.
I want my spec file to download the source code from git and not get it from SOURCE directory. Any idea how can I do that? Do I need to add some other option to the spec file?
TIA.
It's not built-in. You're telling rpm where to claim the source can be found, but rpmbuild doesn't pull it for you. You'll need a wrapper script to do that, or look into something like spectool which should do it for you (I haven't used it myself, sorry).
You can do the checkout in %prep without using %setup. Here are the important details to do a checkout of libbson before building (the main issue is that you need to add an explicit "cd %{NVdir}" to script lets and to %doc when not using %setup).
It's not too hard to do either a git clone or a git pull, depending on whether the %{NVdir} directory exists.
%define NVdir %{name}-%{version}
...
URL: https://github.com/mongodb/libbson
...
%prep
rm -rf %{NVdir}
git clone %{url}.git %{Nadir}
cd %{NVdir}
...
%build
cd %{NVdir}
make %{?_smp_mflags}
...
%files
%doc %{NVdir}/COPYING %{NVdir}/NEWS %{NVdir}/README
%{_libdir}/*.so.*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With