How to "rpmbuild --rebuild redhat.package.src.rpm" ?

When it comes to more than “rpm -i package.rpm” I’m very much an rpm newbie.
In general I’m very dependent on repository based package management tools
such as zypper with opensuze or apt-get with debian based distros, or equo
with sabayon, and very recently urpmi with my new mageia linux installation.

I can usually find what I want in the repositories, so this generally works
for me. However I recently became fairly addicted to a tetris like game that
was available on most of my installed distros. The exception was opensuse…
I tried http://software.opensuse.org/search with no luck {at least not for
opensuse 12.2} at which point I settled for the idea that I only needed to
reboot into one of the other distros to play it… :sigh:

Then as I was busy configuring, updating, etc… my new mageia install I
noticed that the game wasn’t in their repositories either. But an online
search found an mandriva rpm. So since I understand mageia to be forked from
mandriva, I started a thread on there forum to find out if I could safely
install it on mageia. Which thread quickly grew into something a mageia forum
moderator decided to rename as:

[SOLVED] How to rebuild an src.rpm, using amoebax as example

Which he added to their tips and tricks section…

see:
https://forums.mageia.org/en/viewtopic.php?f=41&t=5530#p37711

His method did the heavy lifting with urpmi (which opensuse doesn’t use) but
that was mostly to automate the process of installing the required dependencies.
{Please tell me there is a good howto for that using opensuse tools?}

But the real workhorse of the process of rebuilding an src.rpm from another
distro was done with the user command to:


rpmbuild --rebuild package.src.rpm

Is this something I {as a NON-expert with rpm} I might reasonably expect to do
on opensuse??

Is there a good howto?

Thanks to a thread about opera, I’ve already seen:
http://doc.opensuse.org/documentation/html/openSUSE/opensuse-startup/cha.sw_cl.html#sec.rpm

But I don’t think it addresses importing src.rpm from other distros…
I did note one difference that I’m curious about in the requirements for
using rpmbuild as listed in the above url and the equivalent section of
mageia’s wiki, where:

[quote=“https://wiki.mageia.org/en/Packagers_RPM_tutorial”]


mkdir -p ~/rpm/{BUILD,BUILDROOT,RPMS/$ARCH,RPMS/noarch,SOURCES,SRPMS,SPECS,tmp}

While the doc.opensuse.org document wants those directories to be located in
“/usr/src/packages” rather than in the user’s $HOME dir?

Does that mean that opensuse’s binaries expect rpmbuild to be run as root??


JtWdyP

The joys of RPMs: they often work regardless of platform.

Download one of the RPMs here:

http://rpm.pbone.net/index.php3/stat/4/idpl/21533583/dir/fedora_19/com/amoebax-0.2.1-1.fc19.i686.rpm.html

Use zypper to install it:

Code:

sudo zypper in /path/to/downloaded/amoebax*.rpm

Post back results. At least on my system zypper is properly finding
dependencies (openSUSE 12.2 x86_64) so I am optimistic it will all work
when installed.

Good luck.

You need the rpmbuild package
then try

rpmbuild --rebuild package.src.rpm

If it works the package will be built in /usr/src/packages/RPMS… just look for the proper folder.

It would appear that on Jul 11, ab did say:

> The joys of RPMs: they often work regardless of platform.
>
> Download one of the RPMs here:
>
> http://rpm.pbone.net/index.php3/stat/4/idpl/21533583/dir/fedora_19/com/amoebax-0.2.1-1.fc19.i686.rpm.html

So then, even if the rpm was optimized for a different distribution it may
work anyway? Wonders why there are often several separate distro specific rpms
available at software-homepage download sites?

Have you ever seen, in the case where one didn’t work, that attempting to
install it broke other things?

> Use zypper to install it:
>
> Code:
> ----------
> sudo zypper in /path/to/downloaded/amoebax*.rpm
> ----------
>
> Post back results. At least on my system zypper is properly finding
> dependencies (openSUSE 12.2 x86_64) so I am optimistic it will all work
> when installed.

Interesting. I hadn’t realized I could point zypper at a downloaded rpm…

Do you know if installing from source rpms is a two step process with zypper?

I may, or may not, need to do this for amoebax, but for future reference,
in case, where I do need to use:

Code:

rpmbuild --rebuild package.src.rpm

to rebuild a source rpm.

Then, if I first did a:

Code:

sudo zypper in /path/to/downloaded/*.src.rpm

would zypper, realize it was a source rpm & simply install the sources,
or would it attempt to install the package itself before I could optimize
it with rpmbuild?

If it would only install the sources, then it would save a lot of manual labor
extracting all the unmet dependencies that a package might have prior to
attempting the rpmbuild command… Which would be a parallel function to what
the instructions in the Mageia thread used urpmi for.

It would appear that on Jul 11, conram did say:

> You need the rpmbuild package
> then try
>
>
> Code:
> --------------------
> rpmbuild --rebuild package.src.rpm
> --------------------
>

Yes, that much I knew.

> If it works the package will be built in /usr/src/packages/RPMS…
> just look for the proper folder.

I’m thinking that for it to work, I need to have installed all of it’s
dependencies first? I know that would be needed for Mageia’s rpmbuild.

I’m hoping zypper will do that for me if I point it at an source rpm that I
want to rebuild…


JtWdyP

On 07/12/2013 05:07 AM, JtWdyP wrote:
>
> It would appear that on Jul 11, ab did say:
>
>> The joys of RPMs: they often work regardless of platform.
>>
>> Download one of the RPMs here:
>>
>> http://rpm.pbone.net/index.php3/stat/4/idpl/21533583/dir/fedora_19/com/amoebax-0.2.1-1.fc19.i686.rpm.html
>
> So then, even if the rpm was optimized for a different distribution it may
> work anyway? Wonders why there are often several separate distro specific rpms
> available at software-homepage download sites?

Sure; Linux is Linux, and assuming you have a similar kernel and other
dependencies, not much difference. If you can convince the packages to
install, you can even install software from systems using different
packaging systems, like Debian on openSUSE, maybe using the ‘alien’
command to convert from Debian packages to openSUSE packages. In the end
a package just holds files, and files are just written in a language that
rarely cares if you advertise yourself as being openSUSE, Debian,
Mandriva, or jtwdypLinux.

> Have you ever seen, in the case where one didn’t work, that attempting to
> install it broke other things?

Yes; buyer beware. With that caveat, it’s rare that it breaks other
things; most (99.9%) often, the thing installed will not work but
everything else is just fine.

>> Use zypper to install it:
>>
>> Code:
>> ----------
>> sudo zypper in /path/to/downloaded/amoebax*.rpm
>> ----------
>>
>> Post back results. At least on my system zypper is properly finding
>> dependencies (openSUSE 12.2 x86_64) so I am optimistic it will all work
>> when installed.
>
> Interesting. I hadn’t realized I could point zypper at a downloaded rpm…

Yup; zypper is great.

> Do you know if installing from source rpms is a two step process with zypper?

Yes, and yes it is. zypper will not do anything other than install the
RPM, but the link I provided actually had compiled RPMs I believe, so use
those if using zypper.

> I may, or may not, need to do this for amoebax, but for future reference,
> in case, where I do need to use:
>
> Code:
> --------------------
> rpmbuild --rebuild package.src.rpm
> --------------------
>
> to rebuild a source rpm.
>
> Then, if I first did a:
>
> Code:
> ----------
> sudo zypper in /path/to/downloaded/*.src.rpm
> ----------

Again, zypper doesn’t treat source specially and compile it; point it to
precompiled stuff, or just compile after installed.

> would zypper, realize it was a source rpm & simply install the sources,
> or would it attempt to install the package itself before I could optimize
> it with rpmbuild?

zypper just installs the RPMs, and dependencies, and hen of course does
updates in the future if from a repository.

> If it would only install the sources, then it would save a lot of manual labor
> extracting all the unmet dependencies that a package might have prior to
> attempting the rpmbuild command… Which would be a parallel function to what
> the instructions in the Mageia thread used urpmi for.

Yes… sources installed and then it’s your job to find the ‘configure’ (or
equivalent) script and really build things.

Good luck.

It would appear that on Jul 12, ab did say:

> On 07/12/2013 05:07 AM, JtWdyP wrote:
> > So then, even if the rpm was optimized for a different distribution it may
> > work anyway? Wonders why there are often several separate distro specific rpms
> > available at software-homepage download sites?
>
> Sure; Linux is Linux, and assuming you have a similar kernel and other
> dependencies, not much difference. If you can convince the packages to
> install, you can even install software from systems using different
> packaging systems, like Debian on openSUSE, maybe using the ‘alien’
> command to convert from Debian packages to openSUSE packages. In the end
> a package just holds files, and files are just written in a language that
> rarely cares if you advertise yourself as being openSUSE, Debian,
> Mandriva, or jtwdypLinux.

I used to think it should be like that. Then I learned that differences like
one distro keeping a library in /lib that another puts in /usr/lib can be
enough to brake something. And I mostly got used to letting whatever package
management software was supported by any given distro do the heavy lifting…
all of which added up to trying not to install stuff that was optimized for a
different distro.

> > Have you ever seen, in the case where one didn’t work, that attempting to
> > install it broke other things?
>
> Yes; buyer beware. With that caveat, it’s rare that it breaks other
> things; most (99.9%) often, the thing installed will not work but
> everything else is just fine.

> > Do you know if installing from source rpms is a two step process with zypper?
>
> Yes, and yes it is. zypper will not do anything other than install the
> RPM, but the link I provided actually had compiled RPMs I believe, so use
> those if using zypper.

<snip>

> > to rebuild a source rpm.
> >
> > Then, if I first did a:
> >
> > Code:
> > ----------
> > sudo zypper in /path/to/downloaded/*.src.rpm
> > ----------
>
> Again, zypper doesn’t treat source specially and compile it; point it to
> precompiled stuff, or just compile after installed.
>
> > would zypper, realize it was a source rpm & simply install the sources,
> > or would it attempt to install the package itself before I could optimize
> > it with rpmbuild?
>
> zypper just installs the RPMs, and dependencies, and hen of course does
> updates in the future if from a repository.
>
> > If it would only install the sources, then it would save a lot of manual labor
> > extracting all the unmet dependencies that a package might have prior to
> > attempting the rpmbuild command… Which would be a parallel function to what
> > the instructions in the Mageia thread used urpmi for.
>
> Yes… sources installed and then it’s your job to find the ‘configure’ (or
> equivalent) script and really build things.

Well I wanted to find out about rebuilding an rpm anyway, so found a
downloadable source rpm on line:

amoebax-0.2.1-2.fc20.src.rpm

But:

Code:

sudo zypper in ~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

failed. I forget the exact error messages… But at the time I gave up and
moved on to working with rpmbuild. I’ve since had a look at
http://en.opensuse.org/openSUSE:Libzypp_URIs And suspect it might
have worked if I’d instead done:

Code:

sudo zypper in dir:~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

But anyway, I wound up instead using the error messages from the;

Code:

rpmbuild --rebuild ~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

to discover the missing dependencies to {from a root shell}

Code:

zypper wp MISSING-REQUIREMENT

Then:

Code:

zypper in ACTUAL-PACKAGE-NAME

Until rpmbuild stopped throwing errors…

I note that the resulting rpm works just fine, But I’d need a lot more skill
to rebuild one for uploading…

Code:

JtWdyP -> ~/rpmbuild/RPMS/x86_64
> rpmlint amoebax-0.2.1-2.x86_64.rpm
amoebax.x86_64: W: non-standard-group Amusements/Games
amoebax.x86_64: W: invalid-license GPLv2+
amoebax.x86_64: W: invalid-license Free Art
amoebax.x86_64: W: unstripped-binary-or-object /usr/bin/amoebax
amoebax.x86_64: E: suse-branding-unversioned-requires hicolor-icon-theme
1 packages and 0 specfiles checked; 1 errors, 4 warnings.
JtWdyP -> ~/rpmbuild/RPMS/x86_64
>

But none of which stopped zypper from installing it. So I have a working
amoebax game on my laptop.

Now I just need to repeat the process on my desktop and I’ll have my favorite
time waster available in all my installed Linux.

I think I’ll see if using dir: as a URI prefix will help zypper deal with the
downloaded src.rpm first, but if not I’ll just install the binary rpm I just
made on my laptop. Both machines have 64bit amd processors…


JtWdyP

On Fri 12 Jul 2013 05:12:04 PM CDT, JtWdyP wrote:

It would appear that on Jul 12, ab did say:

> On 07/12/2013 05:07 AM, JtWdyP wrote:
> > So then, even if the rpm was optimized for a different distribution
> > it may work anyway? Wonders why there are often several separate
> > distro specific rpms available at software-homepage download sites?
>
> Sure; Linux is Linux, and assuming you have a similar kernel and other
> dependencies, not much difference. If you can convince the packages
> to install, you can even install software from systems using different
> packaging systems, like Debian on openSUSE, maybe using the ‘alien’
> command to convert from Debian packages to openSUSE packages. In the
> end a package just holds files, and files are just written in a
> language that rarely cares if you advertise yourself as being
> openSUSE, Debian, Mandriva, or jtwdypLinux.

I used to think it should be like that. Then I learned that differences
like one distro keeping a library in /lib that another puts in /usr/lib
can be enough to brake something. And I mostly got used to letting
whatever package management software was supported by any given distro
do the heavy lifting… all of which added up to trying not to install
stuff that was optimized for a different distro.

> > Have you ever seen, in the case where one didn’t work, that
> > attempting to install it broke other things?
>
> Yes; buyer beware. With that caveat, it’s rare that it breaks other
> things; most (99.9%) often, the thing installed will not work but
> everything else is just fine.

> > Do you know if installing from source rpms is a two step process
> > with zypper?
>
> Yes, and yes it is. zypper will not do anything other than install
> the RPM, but the link I provided actually had compiled RPMs I
> believe, so use those if using zypper.

<snip>

> > to rebuild a source rpm.
> >
> > Then, if I first did a:
> >
> > Code:
> > ----------
> > sudo zypper in /path/to/downloaded/*.src.rpm
> > ----------
>
> Again, zypper doesn’t treat source specially and compile it; point it
> to precompiled stuff, or just compile after installed.
>
> > would zypper, realize it was a source rpm & simply install the
> > sources, or would it attempt to install the package itself before I
> > could optimize it with rpmbuild?
>
> zypper just installs the RPMs, and dependencies, and hen of course
> does updates in the future if from a repository.
>
> > If it would only install the sources, then it would save a lot of
> > manual labor extracting all the unmet dependencies that a package
> > might have prior to attempting the rpmbuild command… Which would
> > be a parallel function to what the instructions in the Mageia
> > thread used urpmi for.
>
> Yes… sources installed and then it’s your job to find the
> ‘configure’ (or equivalent) script and really build things.

Well I wanted to find out about rebuilding an rpm anyway, so found a
downloadable source rpm on line:

amoebax-0.2.1-2.fc20.src.rpm

But:

Code:

sudo zypper in ~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

failed. I forget the exact error messages… But at the time I gave up
and moved on to working with rpmbuild. I’ve since had a look at
http://en.opensuse.org/openSUSE:Libzypp_URIs And suspect it
might have worked if I’d instead done:

Code:

sudo zypper in dir:~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

But anyway, I wound up instead using the error messages from the;

Code:

rpmbuild --rebuild ~/Downloads/amoebax-0.2.1-2.fc20.src.rpm

to discover the missing dependencies to {from a root shell}

Code:

zypper wp MISSING-REQUIREMENT

Then:

Code:

zypper in ACTUAL-PACKAGE-NAME

Until rpmbuild stopped throwing errors…

I note that the resulting rpm works just fine, But I’d need a lot more
skill to rebuild one for uploading…

Code:

JtWdyP -> ~/rpmbuild/RPMS/x86_64
> rpmlint amoebax-0.2.1-2.x86_64.rpm
amoebax.x86_64: W: non-standard-group Amusements/Games
amoebax.x86_64: W: invalid-license GPLv2+
amoebax.x86_64: W: invalid-license Free Art
amoebax.x86_64: W: unstripped-binary-or-object /usr/bin/amoebax
amoebax.x86_64: E: suse-branding-unversioned-requires hicolor-icon-theme
1 packages and 0 specfiles checked; 1 errors, 4 warnings.
JtWdyP -> ~/rpmbuild/RPMS/x86_64
>

But none of which stopped zypper from installing it. So I have a working
amoebax game on my laptop.

Now I just need to repeat the process on my desktop and I’ll have my
favorite time waster available in all my installed Linux.

I think I’ll see if using dir: as a URI prefix will help zypper deal
with the downloaded src.rpm first, but if not I’ll just install the
binary rpm I just made on my laptop. Both machines have 64bit amd
processors…

Hi
So everyone can enjoy :wink:
https://build.opensuse.org/package/show/home:malcolmlewis:Miscellanous/amoebax

It’s easier to just unpack the rpm (right click and extract and build
from there…) else you can’t beat OBS and osc…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.16-desktop
up 15:37, 3 users, load average: 1.61, 0.85, 0.61
CPU AMD E2-1800@1.70GHz | GPU Radeon HD 7340

It would appear that on Jul 12, JtWdyP did say:

>
> Code:
> --------------
> sudo zypper in ~/Downloads/amoebax-0.2.1-2.fc20.src.rpm
> --------------
>
> failed. I forget the exact error messages… But at the time I gave up and
> moved on to working with rpmbuild. I’ve since had a look at
> http://en.opensuse.org/openSUSE:Libzypp_URIs And suspect it might
> have worked if I’d instead done:
>
> Code:
> --------------
> sudo zypper in dir:~/Downloads/amoebax-0.2.1-2.fc20.src.rpm
> --------------

Nah that wasn’t it…

This time when I went to download the src.rpm I used pkg.org instead of
{I think it was rpmfind} and decided top settle for the fc19 version…

This time I captured the error messages… :wink:

Code:

/etc
UnderTree=-> zypper in dir:/home/jtwdyp/Downloads/amoebax-0.2.1-1.fc19.src.rpm
Loading repository data…
Reading installed packages…
tmpRPMcache:amoebax=0:0.2.1-1.fc19’ not found in package names. Trying capabilities.
No provider of ‘amoebax = 0:0.2.1-1.fc19’ found.
Resolving package dependencies…

Nothing to do.
/etc
UnderTree=->

Note got the same exact result both with and without the “dir:” prefix.

But anyway, the rpmbuild process worked the same way, I used the clipboard
to copy whatever rpmbuild said “is needed by amoebax-0.2.1-1.x86_64” to a
root shell where I fed it first to “zypper wp” then fed the result to
“zypper in”

And now I’ve got amoebax there as well.

Mageia’s urpmi method has a cute automated way of installing all those
dependencies which may be a little less tedious. But this works easily
enough.

Thanks!


JtWdyP

Did you ever try the non-source RPM? Those were the ones I’d intended you
to try, and were the ones for which zypper, on my 12.2 system, found all
of the dependencies. That should have worked afaik.

Good luck.

It would appear that on Jul 12, malcolmlewis did say:

> Hi
> So everyone can enjoy :wink:
> https://build.opensuse.org/package/show/home:malcolmlewis:Miscellanous/amoebax

On behalf of everyone… Thanks!

> It’s easier to just unpack the rpm (right click and extract and build
> from there…) else you can’t beat OBS and osc…

Ummmnnn OBS/osc is above my current skill level with this stuff…

But

“unpack the rpm (right click and extract”

In what context? this is what right-clicking on an rpm looks like to me:

http://i39.tinypic.com/2whqvte.jpg

I’m guessing that if I find the time to bang my head against the wall for a
couple weeks worth of trying to figure out the output of “man rpm” I’ll
eventually figure out the cli to unpack an rpm.

(I only ever seem to understand quotable cli examples, rather than jargon
loaded descriptions of what a command does… and even then, unless I
use it every day, my memory of what ever I figured out, is only as good
as my ability to find an example of how I did it last time… :sigh: )

It would appear that on Jul 13, ab did say:

> Did you ever try the non-source RPM? Those were the ones I’d intended you
> to try, and were the ones for which zypper, on my 12.2 system, found all
> of the dependencies. That should have worked afaik.

No I didn’t… I was more focused on figuring out how to rebuild one for opensuze…

But I suspect your right that zypper would have managed to install one of
the non-source rpm.


JtWdyP

On Sat 13 Jul 2013 09:39:45 AM CDT, JtWdyP wrote:

> It’s easier to just unpack the rpm (right click and extract and build
> from there…) else you can’t beat OBS and osc…

Ummmnnn OBS/osc is above my current skill level with this stuff…

But [quote] “unpack the rpm (right click and extract”

In what context? this is what right-clicking on an rpm looks like to me:

http://i39.tinypic.com/2whqvte.jpg

I’m guessing that if I find the time to bang my head against the wall
for a couple weeks worth of trying to figure out the output of “man
rpm” I’ll eventually figure out the cli to unpack an rpm.

(I only ever seem to understand quotable cli examples, rather than
jargon loaded descriptions of what a command does… and even then,
unless I use it every day, my memory of what ever I figured out, is
only as good as my ability to find an example of how I did it last
time… :sigh: )
[/QUOTE]
Hi
I use the GNOME DE :wink: so in Nautilus I can right-click → extract;

http://thumbnails106.imagebam.com/26524/3d3542265235877.jpg](http://www.imagebam.com/image/3d3542265235877)

From the command line rpm2cpio…
http://thumbnails103.imagebam.com/26524/d9812e265235878.jpg](http://www.imagebam.com/image/d9812e265235878)
http://thumbnails107.imagebam.com/26524/0657a1265235879.jpg](http://www.imagebam.com/image/0657a1265235879)


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.16-desktop
up 11:20, 4 users, load average: 0.48, 0.29, 0.23
CPU AMD E2-1800@1.70GHz | GPU Radeon HD 7340

It would appear that on Jul 13, malcolmlewis did say:

> Hi
> I use the GNOME DE :wink: so in Nautilus I can right-click -> extract;

Some how I knew it was something like that… It might be that if I
installed nautilus that shortcut would work even under the E17 DE…

But that wouldn’t help me much cause I’d still be browsing my files with
mc… On the other hand mc does (if the mc.ext file is configured correctly)
let me browse an rpm as a virtual filesystem.
http://i40.tinypic.com/2vkkdu0.png

> From the command line rpm2cpio…
> http://thumbnails103.imagebam.com/26524/d9812e265235878.jpg](http://www.imagebam.com/image/d9812e265235878)
> http://thumbnails107.imagebam.com/26524/0657a1265235879.jpg](http://www.imagebam.com/image/0657a1265235879)

Good example presentation… Not sure if I’ll retain it better cause I had
to transcribe the command syntax from the image, for my notes, vs using the clipboard
to paste a text based command example, or not…

But either way the results look interesting. Of course, for it to do me
much good I’ll need a lot of time to study up on rpms in general.

Still, it seems to me somebody pointed me at a gui tutorial on the subject. So
maybe, just maybe…

In any case. I’ll be preserving this discussion in my linux clues
folder.

Thanks!


JtWdyP