Srpm sources

Download the sangoma devel rpm (warning this will give you ‘pre-release’ testing rpms, not for production):

yum install sangoma-devel

Then, for rpm rebuilding, always switch to an unprivileged user to prevent system manipulation

su asterisk

If you read the thread I linked you would have seen I made mention of “yumdownloader --source”. If you then took that information and simply ran the command I gave you would have seen:

bash-4.2$ yumdownloader --source
Loaded plugins: fastestmirror, versionlock
Usage: "yumdownloader [options] package1 [package2] [package..]

Which means

yumdownloader --source <rpm>

Therefore you could have inferred that maybe you could try

yumdownloader --source asterisk13

bash-4.2$ yumdownloader --source asterisk13
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
asterisk13-13.19.0-2.sng7.src.rpm                                                                                                                                                                                                              |  32 MB  00:00:03

Which would then give you the srpm which you could then patch.

bash-4.2$ ls
asterisk13-13.19.0-2.sng7.src.rpm

Now you can run:

rpm -i asterisk13-13.19.0-2.sng7.src.rpm

bash-4.2$ rpm -i asterisk13-13.19.0-2.sng7.src.rpm
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: user mockbuild does not exist - using root

PS: We build using jenkins in a mock. So that is the mockbuild user

Now you have a folder called rpmbuild

bash-4.2$ ls
asterisk13-13.19.0-2.sng7.src.rpm  rpmbuild

In rpmbuild you have SOURCES and SPEC

bash-4.2$ ls
SOURCES  SPECS

SOURCES

bash-4.2$ ls SOURCES
asterisk-13.19.0.tar.gz  asterisk.logrotate  ASTERISK-rb3984.patch  increase-max-stack.patch  lazymembers.patch  voicemail-splitopts-imapstorage.patch	voicemail-splitopts-odbcstorage.patch  voicemail-splitopts.patch

SPECS

bash-4.2$ ls SPECS
asterisk13.spec

You can then go into the SPECS folder and run

rpmbuild -ba asterisk13.spec

Which fails. So just install the missing rpms

error: Failed build dependencies:
	subversion is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	lua-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	iksemel-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	portaudio-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	neon-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	libxml2-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	spandsp-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	libical-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	radiusclient-ng-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	jack-audio-connection-kit-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64
	libresample-devel is needed by asterisk13-13.19.0-2.el7.sangoma.x86_64

Once you’ve got the missing rpms to be able to build the RPM then you can rerun:

rpmbuild -ba asterisk13.spec

Want more information??

Check this out!

https://wiki.centos.org/HowTos/RebuildSRPM

Or even this:

http://www.owlriver.com/tips/patching_srpms/

1 Like