LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   RPM Building in RHEL6 (https://www.linuxquestions.org/questions/linux-software-2/rpm-building-in-rhel6-928622/)

anas_lko 02-10-2012 04:50 AM

RPM Building in RHEL6
 
hi not able to create RPM... getting error while building RPM, if possible guide me in sequence steps...

here is some confuguration i hv done..
[root@station4 ~]# mkdir rpmbuild
[root@station4 ~]# mkdir rpmbuild/SOURCES
[root@station4 ~]# mkdir rpmbuild/SPECS
[root@station4 ~]# mkdir test-0.1
[root@station4 ~]# vim test-0.1/test1
#!/bin/bash
echo "Hello"

[root@station4 ~]# vim test-0.1/test2
#!/bin/bash
echo "How"

[root@station4 ~]# vim test-0.1/test3
#!/bin/bash
echo "Are You..??"

[root@station4 ~]# tar -cvzf test-0.1.tar.gz test-0.1/
[root@station4 ~]# cp test-0.1.tar.gz ~/rpmbuild/SOURCES/
[root@station4 ~]# vim rpmbuild/SPECS/test.spec

Name: Test
Version: 0.1
Release: 1%{?dist}
Summary: Good

Group: System Enviroment/Base
License: GPLv2
Source0: test-0.1.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)


%description
This is Awesome

%prep
%setup -q


%build
echo "OK"


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/root/bin
cp test1 $RPM_BUILD_ROOT/root/bin
cp test2 $RPM_BUILD_ROOT/root/bin
cp test3 $RPM_BUILD_ROOT/root/bin



%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%attr(0777,root,root)/root/bin/test1
%attr(0777,root,root)/root/bin/test2
%attr(0777,root,root)/root/bin/test3



%changelog
* Fri Feb 10 2012 test<test@example.com>-0.1
TYPE ANY COMMENT WHAT YOU LIKE

[root@station4 ~]# rpmbuild -ba rpmbuild/SPECS/test.spec

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.cIPmSL
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf Test-0.1
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/test-0.1.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Test-0.1
/var/tmp/rpm-tmp.cIPmSL: line 34: cd: Test-0.1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.cIPmSL (%prep)


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


Please help me out where is did mistake..:)

knudfl 02-10-2012 05:01 AM

Edit line 1 from : Name: Test
To : Name: test


And : It's not a good idea to build packages as root.
'root' is for administrative tasks only.

Please log in as <user-name>, and set up an unprivileged
rpm build account in /home/<user-name>/ :
http://www.linuxquestions.org/questi...1-a-766486/#13
> Post #13.

anas_lko 02-10-2012 05:33 AM

getting the same error after updating the 1st line
 
getting the same error after updating the 1st line "Name: Test" to "Name: test" and tested through the user account "student"

[student@station4 ~]$ rpmbuild -ba rpmbuild/SPECS/test.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.O4TFQ1
+ umask 022
+ cd /home/student/rpmbuild/BUILD
+ cd /home/student/rpmbuild/BUILD
+ rm -rf test-0.1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/student/rpmbuild/SOURCES/test-0.1.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd test-0.1
/var/tmp/rpm-tmp.O4TFQ1: line 34: cd: test-0.1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.O4TFQ1 (%prep)



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

knudfl 02-10-2012 05:14 PM

Using the file .rpmmacros , etc. from
http://www.linuxquestions.org/questi...1-a-766486/#13

.. And edited your file test.spec, line 9 to
BuildRoot: %{_tmppath}/%{name}-%{version}-build
( And line 1 to : Name: test )

.. Then no errors on "EL6" : ( rpmbuild -bb test.spec ( No 'su' ))
Code:

Wrote: /home/knudfl/rpms/RPMS/i686/test-0.1-1.el6.i686.rpm
Wrote: /home/knudfl/rpms/RPMS/i686/test-debuginfo-0.1-1.el6.i686.rpm


anas_lko 02-11-2012 07:17 AM

error has changed..
 
Done the changes in '/home/student/rpmbuild/SPECS/test.spec' in the 1st and 9th line
Name: test
BuildRoot: %{_tmppath}/%{name}-%{version}-x86_64


and created
[student@server1 ~]$ echo "%_topdir `echo $HOME/rpmbuild`" > $HOME/.rpmmacros

file in the homedir of 'student' with the entries:

%_topdir /home/student/rpmbuild
%_tmppath %{_topdir}/tmp


But after that while running the rpmbuild command getting the output but now the output has changed.

[student@server1 ~]$ rpmbuild -bb rpmbuild/SPECS/test.spec
Executing(%prep): /bin/sh -e /home/student/rpmbuild/tmp/rpm-tmp.Yf6ZOt
+ umask 022
+ cd /home/student/rpmbuild/BUILD
+ cd /home/student/rpmbuild/BUILD
+ rm -rf test-0.1
+ /usr/bin/gzip -dc /home/student/rpmbuild/SOURCES/test-0.1.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd test-0.1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /home/student/rpmbuild/tmp/rpm-tmp.cK1H9C
+ umask 022
+ cd /home/student/rpmbuild/BUILD
+ cd test-0.1
+ echo OK
OK
+ CFLAGS='-O2 -g'
+ export CFLAGS
+ CXXFLAGS='-O2 -g'
+ export CXXFLAGS
+ FFLAGS='-O2 -g'
+ export FFLAGS
+ ./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
/home/student/rpmbuild/tmp/rpm-tmp.cK1H9C: line 33: ./configure: No such file or directory
error: Bad exit status from /home/student/rpmbuild/tmp/rpm-tmp.cK1H9C (%build)


RPM build errors:
Bad exit status from /home/student/rpmbuild/tmp/rpm-tmp.cK1H9C (%build)

unSpawn 02-11-2012 08:47 AM

You have a %build section but you don't actually './configure; make' something so comment it out.

anas_lko 02-11-2012 09:11 AM

its already commented in '/home/student/rpmbuild/SPECS/test.spec'

#%configure
#make %{?_smp_mflags}

knudfl 02-11-2012 09:45 AM

1 Attachment(s)
Don't know what is happening.

Your original spec file from post #1 works OK,
with the two edits.
I don't think I changed anything else,
but please try for yourself :
The file is attached.
.

knudfl 02-11-2012 09:56 AM

#7
Quote:

#%configure
OK, I can see the error now :
Why have any words like configure and make added to a spec file
when you don't want to do 'configure' or 'make' ? ?

! A line starting with % cannot be commented out !


.

unSpawn 02-11-2012 10:21 AM

Quote:

Originally Posted by knudfl (Post 4599745)
A line starting with % cannot be commented out

Sure but you'll have to make the %section read %%section ;-p

anas_lko 02-11-2012 12:48 PM

getting issue while signing the package
 
well guys knudfl and unSpawn thanks alot for yr concern i hv removed both the lines "configure" and "make" and im succeed to build the RPM but not the probem occured in signing that RPM...when trying to sigh the RPM with the command "gpg --gen-key" but getting error "/home/student/.gnupg/S.gpg-agent': No such file or directory"
[student@server1 ~]$ gpg --gen-key
gpg (GnuPG) 2.0.14; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: Student
Email address: student@server1.example.com
Comment: IT
You selected this USER-ID:
"Student (IT) <student@server1.example.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

can't connect to `/home/student/.gnupg/S.gpg-agent': No such file or directory
No protocol specified
xprop: unable to open display ':0.0'
No protocol specified

(pinentry-gtk-2:5490): Gtk-WARNING **: cannot open display: :0.0
gpg-agent[5489]: can't connect server: ec=4.16383
gpg-agent[5489]: can't connect to the PIN entry module: End of file
gpg-agent[5489]: command get_passphrase failed: No pinentry
gpg: problem with the agent: No pinentry
gpg: Key generation canceled.

anas_lko 02-11-2012 01:09 PM

pinentry issue :(
 
chkd my running the command "eval $(gpg-agent --daemon)"
issue resolved but now its showing
gpg: problem with the agent: No pinentry
gpg: Key generation canceled.

unSpawn 02-12-2012 09:41 AM

"pinentry is a small collection of dialog programs that allow GnuPG to read passphrases and PIN numbers in a secure manner. There are versions for the common GTK and Qt toolkits as well as for the text terminal (Curses)."

Check if there is a 'ls -al /usr/bin/pinentry*' and if the "pinentry-program" directive in ~/.gnupg/gpg-agent.conf points to it?

anas_lko 02-12-2012 01:30 PM

[student@server1 ~]$ ls -al /usr/bin/pinentry*
-rwxr-xr-x. 1 root root 2135 Oct 10 2009 /usr/bin/pinentry
-rwxr-xr-x. 1 root root 52296 Apr 29 2010 /usr/bin/pinentry-curses
lrwxrwxrwx. 1 root root 14 Feb 4 19:31 /usr/bin/pinentry-gtk -> pinentry-gtk-2
-rwxr-xr-x. 1 root root 119488 Apr 29 2010 /usr/bin/pinentry-gtk-2
-rwxr-xr-x. 1 root root 222344 Apr 29 2010 /usr/bin/pinentry-qt


no "gpg-agent.conf" file found in "~/.gnupg/"

[student@server1 ~]$ ll -a ~/.gnupg/
total 28
drwx------. 3 student student 4096 Feb 12 00:02 .
drwx------. 7 student student 4096 Feb 13 01:00 ..
-rw-------. 1 student student 7856 Feb 11 23:56 gpg.conf
drwx------. 2 student student 4096 Feb 11 23:58 private-keys-v1.d
-rw-------. 1 student student 0 Feb 11 23:56 pubring.gpg
-rw-------. 1 student student 600 Feb 12 14:43 random_seed
-rw-------. 1 student student 0 Feb 11 23:56 secring.gpg
-rw-------. 1 student student 40 Feb 12 00:00 trustdb.gpg

unSpawn 02-12-2012 01:46 PM

Quote:

Originally Posted by anas_lko (Post 4600689)
Code:

~]$ ls -al /usr/bin/pinentry*
-rwxr-xr-x. 1 root root  2135 Oct 10  2009 /usr/bin/pinentry
-rwxr-xr-x. 1 root root  52296 Apr 29  2010 /usr/bin/pinentry-curses
lrwxrwxrwx. 1 root root    14 Feb  4 19:31 /usr/bin/pinentry-gtk -> pinentry-gtk-2
-rwxr-xr-x. 1 root root 119488 Apr 29  2010 /usr/bin/pinentry-gtk-2
-rwxr-xr-x. 1 root root 222344 Apr 29  2010 /usr/bin/pinentry-qt


AFAIK /usr/bin/pinentry should be a link to one of /usr/bin/pinentry-{gtk,qt,curses}.


Quote:

Originally Posted by anas_lko (Post 4600689)
no "gpg-agent.conf" file found in "~/.gnupg/"

OK. Maybe try 'grep -r ~/.gnupg/ -e pinentry' then?


All times are GMT -5. The time now is 12:03 PM.