Getting Error while Building RPM

General support questions including new installations
Post Reply
VikramRM
Posts: 5
Joined: 2015/05/26 08:57:18

Getting Error while Building RPM

Post by VikramRM » 2015/05/26 09:09:51

Hi,

I am trying to build a RPM from the ear file. I installed the rpmbuild software. In the source directory I have placed my ear file. In the SPECS directory I have my spec file.
When I run rpmbuild -ba build-rpm.spec, i am getting below error. Could someone suggest some idea?

[root@clab756node02 SPECS]# rpmbuild -ba build-rpm.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.2813
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf sample
+ /usr/bin/unzip -qq /usr/src/redhat/SOURCES/sample-application-ear-1.0.ear
replace META-INF/MANIFEST.MF? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd sample
/var/tmp/rpm-tmp.2813: line 30: cd: sample: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.2813 (%prep)


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

Thanks,
Vikram RM

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Getting Error while Building RPM

Post by MartinR » 2015/05/26 10:22:19

I'm no expert on build_rpm, but

Code: Select all

+ rm -rf sample
might explain why

Code: Select all

+ cd sample
can't find the directory, unless of course you are expecting the unzip to recreate it.

VikramRM
Posts: 5
Joined: 2015/05/26 08:57:18

Re: Getting Error while Building RPM

Post by VikramRM » 2015/05/26 11:04:37

Code: Select all

Name:               sample
Version:            1.0
Release:            21%{?dist}
License:            GPLv2+
Group:              System Environment/Base
Source:             sample-application-ear-1.0.ear
URL:                http://www.pobox.com/~tranter
BuildRoot:          /var/tmp/sample-1.0
ExcludeArch:        s390 s390x
BuildRequires:      gettext

%description
The eject program allows the user to eject removable media (typically
CD-ROMs, floppy disks or Iomega Jaz or Zip disks) using software
control. Eject can also control some multi-disk CD changers and even
some devices' auto-eject features.

Install eject if you'd like to eject removable media using software
control.

%prep
%setup -q -n sample


%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/man/man1

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README TODO COPYING ChangeLog

/usr/bin/sample
/usr/man/man1/sample.1

%changelog
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 3)

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

[ Some changelog entries trimmed for brevity.  -Editor. ]
Hi MartinR, this is the spec file i am using. I am building it for first time. Could you please check is something wrong with the file?

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Getting Error while Building RPM

Post by MartinR » 2015/05/26 11:25:40

Sorry, but as I said I'm no expert on rpm building. I was just "another pair of eyes" reading the log and trying to learn from others.

VikramRM
Posts: 5
Joined: 2015/05/26 08:57:18

Re: Getting Error while Building RPM

Post by VikramRM » 2015/05/26 11:32:13

Yes I understand, But In the spec file i have not given "rm -rf sample" anywhere. But i am not sure why it is getting executed.

I will wait for some experts to reply.

Thanks for replying.

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Getting Error while Building RPM

Post by remirepo » 2015/05/26 11:54:40

[root@clab756node02 SPECS]# rpmbuild -ba build-rpm.spec
1st : NEVER build RPM as root.

2st : is unzip doesn't create the folder, you should use %setup -q -c
Remi's Repository - Forum - Blog

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: Getting Error while Building RPM

Post by AlanBartlett » 2015/05/26 15:26:36

Please consult the CentOS wiki.

The following two pages will get you started --

* http://wiki.centos.org/HowTos/SetupRpmBuildEnvironment

* http://wiki.centos.org/HowTos/RebuildSRPM

The Fedora Project's RPM Guide is essential reading.
Image 100% Linux and, previously, Unix. Co-founder of the ELRepo Project.

VikramRM
Posts: 5
Joined: 2015/05/26 08:57:18

Re: Getting Error while Building RPM

Post by VikramRM » 2015/05/27 06:31:10

Thanks remirepo and AlanBartlet for replying.

@remirepo I have modified my spec file as below with "-c"

Code: Select all

%setup -q -c sample
But getting the below error.

Code: Select all

[vikram@clab756node02 SPECS]$ rpmbuild -ba build-rpm.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.82296
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf sample-1.0
+ /bin/mkdir -p sample-1.0
/bin/mkdir: cannot create directory `sample-1.0': Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.82296 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.82296 (%prep)
[vikram@clab756node02 SPECS]$ vi build-rpm.spec
[vikram@clab756node02 SPECS]$ rpmbuild -bp build-rpm.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.55266
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf sample-1.0
+ /bin/mkdir -p sample-1.0
/bin/mkdir: cannot create directory `sample-1.0': Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.55266 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.55266 (%prep)
permission denied for creating the directory. Am i missing something? where will this spec fill will be creating the 'sample-1.0 directory?

VikramRM
Posts: 5
Joined: 2015/05/26 08:57:18

Re: Getting Error while Building RPM

Post by VikramRM » 2015/05/27 11:23:13

Now I can able to build a RPM. but i cannot see inside the cpio file to see the source packaged in it. :(

this is my new spec file, could someone look into the file and tel me is something wrong with the file?

Code: Select all

Name:           oneconsole
Version:        1.0
Release:        1%{?dist}
Summary:        One Console

Group:          System Environment/Base
License:        GPLv2+
URL:            http://www.pobox.com/~tranter
Source0:        oneconsole-application-ear-1.0.ear
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildRequires:  gettext

%description
One console


%prep
%setup -q -c


%build

%install
rm -rf %{buildroot}


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc



%changelog
I have one more doubt. What is the make command for? do we need to provide any make file for Building RPM? if so what is the content of the make file?

Post Reply