Find the answer to your Linux question:
Results 1 to 6 of 6
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 ...
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6

    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.

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,100
    Can you post the specfile in [code] tags?
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6
    Yes Sure. Here is the code.


    %define name tasmportlets
    %define release 1
    %define version 1
    Name: %{name}
    Summary: Teradata Active System Management Portlets for Teradata Viewpoint
    Version: %{version}
    Release: %{release}
    Source0: %{name}-%{version}.tar.gz
    Vendor: Teradata
    License: Commerical
    Group: System Environment/Daemons
    BuildArch: noarch
    BuildRoot: /tmp/%{name}-%{version}-buildroot
    Requires: viewpoint >= %{version}

    %description
    Teradata Active System Management Portlets for Teradata Viewpoint. This portlet bundle
    provides DBAs with tools for monitoring workloads on Teradata.

    %prep
    %setup
    %build
    ./configure
    make

    %clean
    rm -rf $RPM_BUILD_ROOT

    %install
    PORTLET_BUILD_ROOT=$RPM_BUILD_ROOT/var/opt/teradata/portlets/%{name}-%{version}
    mkdir -p $PORTLET_BUILD_ROOT
    cp -R * $PORTLET_BUILD_ROOT/
    %files
    %defattr(-,root,root)
    /var/opt/teradata/portlets/%{name}-%{version}

    %post
    VIEWPOINTDIR=/opt/teradata/viewpoint
    PORTLETSDIR=/var/opt/teradata/portlets/%{name}-%{version}
    cd $VIEWPOINTDIR/webapps
    rm -rf 'ls $PORTLETSDIR | awk '/.war$/' | sed s/.war$//'
    cp -p $PORTLETSDIR/* $VIEWPOINTDIR/viewpoint-working/liferay-autodeploy

    %preun
    if [ "$1" == "0" ]; then
    VIEWPOINTDIR=/opt/teradata/viewpoint
    PORTLETSDIR=/var/opt/teradata/portlets/%{name}-%{version}
    VIEWPOINT_DEPLOYED_PORTLETS=/var/opt/teradata/deployed-portlets
    cd $VIEWPOINTDIR/webapps
    rm -rf 'ls $PORTLETSDIR | awk '/.war$/' | sed s/.war$//'
    cd $VIEWPOINT_DEPLOYED_PORTLETS
    rm -rf 'ls $PORTLETSDIR | awk '/.war$/''
    fi

  4. #4
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,100
    Hmm, if I understand the issue correctly, then there is nothing to do in the %build section.
    But you have written
    Code:
    ./configure
    make
    I suspect, this fails?

    You can <do nothing> in %build with something like
    Code:
    %build
     :

    If that doesnt help, maybe you can paste the output of rpmbuild here?
    This output shows every line, that is executed in the spec file.
    So it should provide some hints on what is going wrong.
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6
    Hi,
    I followed your advice.
    Code:
    %build
     :
    But still I am getting error of command not found. This is the error.
    [rpm] Building the RPM based on the tasmportlets.spec file
    [rpm] Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.59191
    [rpm] + umask 022
    [rpm] + cd /opt/RPM_Faw/RPMProject/rpmbuild/BUILD
    [rpm] + cd /opt/RPM_Faw/RPMProject/rpmbuild/BUILD
    [rpm] + rm -rf linuxProj-1
    [rpm] + /usr/bin/gzip -dc /opt/RPM_Faw/RPMProject/rpmbuild/SOURCES/linuxProj-1.tar.gz
    [rpm] + tar -xvvf -
    [rpm] drwxr-xr-x 0/0 0 2031-12-09 08:38 linuxProj-1/
    [rpm] -rw-r--r-- 0/0 1471 2031-12-09 08:38 linuxProj-1/linuxProj.war
    [rpm] tar: linuxProj-1/linuxProj.war: time stamp 2031-12-09 08:38:31 is 222837.591477181 s in the future
    [rpm] tar: linuxProj-1: time stamp 2031-12-09 08:38:31 is 222837.590296863 s in the future
    [rpm] + STATUS=0
    [rpm] + '[' 0 -ne 0 ']'
    [rpm] + cd linuxProj-1
    [rpm] ++ /usr/bin/id -u
    [rpm] + '[' 0 = 0 ']'
    [rpm] + /bin/chown -Rhf root .
    [rpm] ++ /usr/bin/id -u
    [rpm] + '[' 0 = 0 ']'
    [rpm] + /bin/chgrp -Rhf root .
    [rpm] + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    [rpm] + exit 0
    [rpm] Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.59191
    [rpm] + umask 022
    [rpm] + cd /opt/RPM_Faw/RPMProject/rpmbuild/BUILD
    [rpm] + /bin/rm -rf /tmp/linuxProj-1-buildroot
    [rpm] ++ dirname /tmp/linuxProj-1-buildroot
    [rpm] + /bin/mkdir -p /tmp
    [rpm] + /bin/mkdir /tmp/linuxProj-1-buildroot
    [rpm] + cd linuxProj-1
    [rpm] + $':\r'
    [rpm] /var/tmp/rpm-tmp.59191: line 27: :
    [rpm]
    [rpm]
    [rpm] RPM build errors:
    [rpm] : command not founderror: Bad exit status from /var/tmp/rpm-tmp.59191 (%build)
    [rpm] Bad exit status from /var/tmp/rpm-tmp.59191 (%build)
    I know the problem is in the build stage but I dont know how to skip the stage.
    Its really nice that you are replying.

  6. #6
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6

    Solved

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

    Code:
    %build
    echo "1"
    HTH someone else.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...