Rpm packaging on Suse Linux

Hi All,
I am new to linux. Still I am asked to package a war file as an RPM package. That is an unusual RPM packaging(To me). If you guys could guide me, on how to do that, will be great. I have a war file inside a folder, that folder is inside a tar file as a SOURCE for RPM package. The structure is like below.

--RPMS
--SOURCES
--tasmportlets-1.tar.gz(its a tar file)
--tasmportlets-1(its a folder)
--tasmportlets.war
--BUILD
--SPECS
--mySpecs.spec
--SRPMS

I simply want that the war file from sources is transferred to the web app of my tomcat server through RPM. I try to package it as an RPM, but its always giving me errors in %build stage. When I try to remove %build from stage from the spec file, then it says command missing.

Can anyone please help me here Or point me in the right direction? An example will be great.

My system details are:
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 1
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-x86_64:core-3.0-x86_64"

Thanks in advance.

Without any knowledge of the commands in your spec file and the exact error you're getting I doubt we can help you.

Hi,
Thanks for the reply.
This is the error.

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.52497
+ umask 022
+ cd /usr/src/packages/BUILD
+ cd /usr/src/packages/BUILD
+ rm -rf tasmportlets-1
+ /usr/bin/gzip -dc /usr/src/packages/SOURCES/tasmportlets-1.tar.gz
+ tar -xvvf -
drwxr-xr-x 0/0               0 2011-02-09 18:59 tasmportlets-1/
-rw-r--r-- 0/0            1476 2011-02-09 18:59 tasmportlets-1/LinuxProj.war
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd tasmportlets-1
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.52497
+ umask 022
+ cd /usr/src/packages/BUILD
+ /bin/rm -rf /tmp/tasmportlets-1-buildroot
++ dirname /tmp/tasmportlets-1-buildroot
+ /bin/mkdir -p /tmp
+ /bin/mkdir /tmp/tasmportlets-1-buildroot
+ cd tasmportlets-1
+ $'\r'
: command not found497: line 27: 
error: Bad exit status from /var/tmp/rpm-tmp.52497 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.52497 (%build)

The spec file has been attached as tasmportlet_original.txt and the /var/tmp/rpm-tmp.52497 has been attached as tmp.txt.

2 things I've noticed:

  • Create empty lines between the prep, setup, and build sections. I'm not 100% sure on this, but I think those are required.
  • It seems the file was created on Windows. Convert it to UNIX-style first (SuSE probably has the dos2unix command available.

Heyei Thanks for your help. It looks that we are getting nearer to the solution. The problem is with ./configure stage of the %build. It says

No such file or directoryerror: Bad exit status

Now I dont know what this .configure is as I already said that I am newby to linux. But so far I know that it is some config file needed for installation but in my case I am only copying and pasting the war file from one place to another. I dont know how to write this config file.

I tried your way as well, which is at the same point, the %build. I cleaned the code below this stage but then it threw this error:

command not founderror: Bad exit status 

The configure script (./configure means the file/script named configure in the current directory) is usually generated by autoconf for use with automake. Since you don't need to invoke make you probably won't need it. So you can clear the build section (although the keyword still has to be there).

Hi,
The problem is how to clear/ skip the %build section. I tried the following combinations but no benefit.

%build
%build
:

Can you tell me how to skip the %build stage? And thanks for looking into the matter.

Have a look at the --short-circuit option.

1 Like

Hi Guys,
Finally I did it. I skipped the %build stage bu just writing echo "1" in the stage like

%build
echo "1"

HTH someone else.