Hi List, I just started working on RPM Packaging and had few questions.
1. Where can i find good "WORKING" Examples of packages.spec 2. Is mach, or mock, really the better version of rpmbiuld ?
OK, so you want to build a binary RPM package for deployment on your servers. You have a .spec file or .src.rpm that you got from one of the many repositories such as freshrpms.net or dag.wieers.com, or that you wrote yourself. Why not just build it using rpmbuild? There are several problems you may come across. 1. Given a spec file, rpmbuild won't download the source tarball and/or patches. You have to fetch those yourself into the SOURCES directory. 2. rpmbuild will abort if any build-time dependencies are missing, forcing you to stop what you're doing, and go and build and install those packages too. 3. When your package configures itself, it may auto-detect libraries which are available on your build system, but which are not going to be available on the target system. For example, if openldap-devel is present then openldap may be linked into your binaries, but if the RPM doesn't declare openldap as a dependency, then it will fail to run on the target system. This is an insiduous problem, which I call "the curse of autoconf". 4. You can only build packages for the same type of system as your build machine (e.g. CentOS 4 binaries on a CentOS 4 build system) If you want an example of how bad the problem is, try building the package perl-SOAP-Lite from its spec file. You will quickly find yourself in dependency hell, with 16 other packages needing to be installed or built, all in the correct order. The solution: mach
3. Can i install "use sudo yum install <package name> , inside a SPEC file ? 4. How can do a CHROOT inside a SPEC File 5. How do i introduce versions, r=for RPMs, when there is NO version in the SCM ( we are using Mercurial )
6. Is there a working automation framework for rpmbuild ? 7. I tried using autospec , but it includes all the source files as well. I used it as: tar tzf myapp-0.1.tar.gz | autospec -bd -c GPL -g Utilities/System -n myapp-0.1 -l '' > myapp.spec
Thanks, -Kamal.
What is your really confusion?I can't understand what you asked.
On Thursday, April 12, 2012, Kamal Ahmed wrote:
Hi List, I just started working on RPM Packaging and had few questions.
- Where can i find good "WORKING" Examples of packages.spec
- Is mach, or mock, really the better version of rpmbiuld ?
OK, so you want to build a binary RPM package for deployment on your servers. You have a .spec file or .src.rpm that you got from one of the many repositories such as freshrpms.net or dag.wieers.comhttp://dag.wieers.com/rpm/, or that you wrote yourself. Why not just build it using rpmbuild? There are several problems you may come across.
- Given a spec file, rpmbuild won't download the source tarball
and/or patches. You have to fetch those yourself into the SOURCES directory. 2. rpmbuild will abort if any build-time dependencies are missing, forcing you to stop what you're doing, and go and build and install * those* packages too. 3. When your package configures itself, it may auto-detect libraries which are available on your build system, but which are not going to be available on the target system. For example, if openldap-devel is present then openldap may be linked into your binaries, but if the RPM doesn't declare openldap as a dependency, then it will fail to run on the target system. This is an insiduous problem, which I call "the curse of autoconf". 4. You can only build packages for the same type of system as your build machine (e.g. CentOS 4 binaries on a CentOS 4 build system)
If you want an example of how bad the problem is, try building the package perl-SOAP-Lite from its spec filehttp://svn.rpmforge.net/svn/trunk/rpms/perl-SOAP-Lite/. You will quickly find yourself in dependency hell, with 16 other packages needing to be installed or built, all in the correct order. The solution: mach http://thomas.apestaart.org/download/mach/
- Can i install "use sudo yum install <package name> , inside a SPEC file
? 4. How can do a CHROOT inside a SPEC File 5. How do i introduce versions, r=for RPMs, when there is NO version in the SCM ( we are using Mercurial ) 6. Is there a working automation framework for rpmbuild ? 7. I tried using autospec , but it includes all the source files as well. I used it as: tar tzf myapp-0.1.tar.gz | autospec -bd -c GPL -g Utilities/System -n myapp-0.1 -l '' > myapp.spec
Thanks, -Kamal.
Is it ok to have the following in the %prep section
%prep sudo yum -y groupinstall "Development Tools" echo "Installing Development Tools" sudo yum -y install python-devel.i386 sudo yum -y install postgresql84-server.i386 postgresql84-devel.i386 postgresql84-python.i386
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
Is it ok to have the following in the %prep section
%prep sudo yum -y groupinstall "Development Tools" echo "Installing Development Tools" sudo yum -y install python-devel.i386 sudo yum -y install postgresql84-server.i386 postgresql84-devel.i386 postgresql84-python.i386
No, you should never call sudo, yum, or rpm in a spec. If you need packages installed at build time, use BuildRequires.
-J
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
On Thu, Apr 12, 2012 at 06:48:27AM -0700, Kamal Ahmed wrote:
Is it ok to have the following in the %prep section
%prep sudo yum -y groupinstall "Development Tools" echo "Installing Development Tools" sudo yum -y install python-devel.i386 sudo yum -y install postgresql84-server.i386 postgresql84-devel.i386 postgresql84-python.i386
Don't use sudo because it's not non-interactive (asking for a password) and grant you with root access which rise the dange of demanging the system. This may be very bad for a user which try to rebuild your package from a SRPM and may get a system demage.
One reason why the SuSE Build server is bad is the fact, that builds are executed in a root environment. So some kinds of errors may be not find, which may be dangerous for users which try to rebuild the created SRPMs on thier own systems.
Instead of using yum and rpm to install packages requires for build time, please use BuidRequires:. Mock and koji can analyze the package can install the requires package in the build environemnt.
Best Regards:
Jochen Schmitt
I have the following spec file:
Summary: pcore binary Name: pcore Version: 0.1 Release: Beta Epoch: 0 License: Commercial Group: Applications/Telecommunications Packager: Kamal Ahmed kamal.ahmed@unleashbts.com URL: http://pcore.bts.md/ Source: pcore-0.1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description ElementalCORE
%prep mkdir %{name}-%{version} %setup -q
%build #%configure make
%install rm -rf "$RPM_BUILD_ROOT" %makeinstall rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%clean rm -rf "$RPM_BUILD_ROOT"
%files %defattr(-,root,root) %doc NEWS
but when i do an rpmbuild -bb pcore.spec, i get:
rpmbuild -bb pcore.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518 + umask 022 + cd /home/kahmed/rpmbuild/BUILD + LANG=C + export LANG + unset DISPLAY + mkdir pcore-0.1 + cd /home/kahmed/rpmbuild/BUILD + rm -rf pcore-0.1 + /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz + tar -xf - + STATUS=0 + '[' 0 -ne 0 ']' + cd pcore-0.1 /var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
I have the following spec file:
Summary: pcore binary Name: pcore Version: 0.1 Release: Beta Epoch: 0 License: Commercial Group: Applications/Telecommunications Packager: Kamal Ahmed kamal.ahmed@unleashbts.com URL: http://pcore.bts.md/ Source: pcore-0.1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description ElementalCORE
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
-J
%build #%configure make
%install rm -rf "$RPM_BUILD_ROOT" %makeinstall rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%clean rm -rf "$RPM_BUILD_ROOT"
%files %defattr(-,root,root) %doc NEWS
but when i do an rpmbuild -bb pcore.spec, i get:
rpmbuild -bb pcore.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...).
i found out the directory name "pcore" but outside of rpm/spec I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make in any case.
now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission
ibcm_td.a ./libmt_td.a -lpthread -lnsl -lrt -o ./hnbgw make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw' + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400 + umask 022 + cd /home/kahmed/rpmbuild/BUILD + cd pcore + LANG=C + export LANG + unset DISPLAY + cp obj/ggsnc/ggsnc /usr/bin cp: cannot create regular file `/usr/bin/ggsnc': Permission denied error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
1. Am i doing the right thing which is to copy the binaries ( since we do NOT have a make install ) to /usr/bin or this should be done in chroot
2. i am copying binaries in %install section, is this ok ?
%install cp obj/ggsnc/ggsnc %{_bindir}
Thanks, -Kamal.
From: zxq9 zxq9@zxq9.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 11:00 AM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
i found out the directory name "pcore" but outside of rpm/spec I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make in any case.
now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission
ibcm_td.a ./libmt_td.a -lpthread -lnsl -lrt -o ./hnbgw make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw'
- exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- cd pcore
- LANG=C
- export LANG
- unset DISPLAY
- cp obj/ggsnc/ggsnc /usr/bin
cp: cannot create regular file `/usr/bin/ggsnc': Permission denied error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
You need to copy it to the buildroot, rather than the running system, so it should be:
cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
Or the like.
-J
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
- Am i doing the right thing which is to copy the binaries ( since we do
NOT have a make install ) to /usr/bin or this should be done in chroot 2. i am copying binaries in %install section, is this ok ?
%install cp obj/ggsnc/ggsnc %{_bindir}
Thanks, -Kamal.
From: zxq9 zxq9@zxq9.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 11:00 AM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
Jon,
with: cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
i get:
+ cp obj/ggsnc/ggsnc /pcore-0.1/usr/bin/ cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.93551 (%install)
The problem being that even though my Version is 0.1 , but when i untar , the directory gets created is pcore and not pcore-0.1. Any solution for this ?
-Kamal.
From: Jon Ciesla limburgher@gmail.com To: Kamal Ahmed kamal2222ahmed@yahoo.com; Discussion of RPM packaging standards and practices for Fedora packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 3:01 PM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
i found out the directory name "pcore" but outside of rpm/spec I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make in any case.
now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission
ibcm_td.a ./libmt_td.a -lpthread -lnsl -lrt -o ./hnbgw make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw'
- exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- cd pcore
- LANG=C
- export LANG
- unset DISPLAY
- cp obj/ggsnc/ggsnc /usr/bin
cp: cannot create regular file `/usr/bin/ggsnc': Permission denied error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
You need to copy it to the buildroot, rather than the running system, so it should be:
cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
Or the like.
-J
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
- Am i doing the right thing which is to copy the binaries ( since we do
NOT have a make install ) to /usr/bin or this should be done in chroot 2. i am copying binaries in %install section, is this ok ?
%install cp obj/ggsnc/ggsnc %{_bindir}
Thanks, -Kamal.
From: zxq9 zxq9@zxq9.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 11:00 AM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- in your fear, seek only peace in your fear, seek only love
-d. bowie
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
Jon,
with: cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
i get:
- cp obj/ggsnc/ggsnc /pcore-0.1/usr/bin/
cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.93551 (%install)
The problem being that even though my Version is 0.1 , but when i untar , the directory gets created is pcore and not pcore-0.1. Any solution for this ?
use: %setup -qn pcore
-Kamal.
From: Jon Ciesla limburgher@gmail.com To: Kamal Ahmed kamal2222ahmed@yahoo.com; Discussion of RPM packaging standards and practices for Fedora packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 3:01 PM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
i found out the directory name "pcore" but outside of rpm/spec I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make in any case.
now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission
ibcm_td.a ./libmt_td.a -lpthread -lnsl -lrt -o ./hnbgw make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw'
- exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- cd pcore
- LANG=C
- export LANG
- unset DISPLAY
- cp obj/ggsnc/ggsnc /usr/bin
cp: cannot create regular file `/usr/bin/ggsnc': Permission denied error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
You need to copy it to the buildroot, rather than the running system, so it should be:
cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
Or the like.
-J
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
- Am i doing the right thing which is to copy the binaries ( since we do
NOT have a make install ) to /usr/bin or this should be done in chroot 2. i am copying binaries in %install section, is this ok ?
%install cp obj/ggsnc/ggsnc %{_bindir}
Thanks, -Kamal.
From: zxq9 zxq9@zxq9.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 11:00 AM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- in your fear, seek only peace in your fear, seek only love
-d. bowie
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
i did %prep %setup -qn pcore
that is how i got make to run.
but i get : cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file
as a result of : %install
cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
What i want to know id that ( as far as i think ) that %install
happens in a chroot and if i give the correct folder, the copy should happen ? plus i WANT to copy the binary executable in /usr/bin not sure HOW to do that
Thanks, -Kamal.
From: Jon Ciesla limburgher@gmail.com To: Kamal Ahmed kamal2222ahmed@yahoo.com; Discussion of RPM packaging standards and practices for Fedora packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 3:48 PM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
Jon,
with: cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
i get:
- cp obj/ggsnc/ggsnc /pcore-0.1/usr/bin/
cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.93551 (%install)
The problem being that even though my Version is 0.1 , but when i untar , the directory gets created is pcore and not pcore-0.1. Any solution for this ?
use: %setup -qn pcore
-Kamal.
From: Jon Ciesla limburgher@gmail.com To: Kamal Ahmed kamal2222ahmed@yahoo.com; Discussion of RPM packaging standards and practices for Fedora packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 3:01 PM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
i found out the directory name "pcore" but outside of rpm/spec I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make in any case.
now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission
ibcm_td.a ./libmt_td.a -lpthread -lnsl -lrt -o ./hnbgw make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw'
- exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- cd pcore
- LANG=C
- export LANG
- unset DISPLAY
- cp obj/ggsnc/ggsnc /usr/bin
cp: cannot create regular file `/usr/bin/ggsnc': Permission denied error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
You need to copy it to the buildroot, rather than the running system, so it should be:
cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
Or the like.
-J
RPM build errors: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
- Am i doing the right thing which is to copy the binaries ( since we do
NOT have a make install ) to /usr/bin or this should be done in chroot 2. i am copying binaries in %install section, is this ok ?
%install cp obj/ggsnc/ggsnc %{_bindir}
Thanks, -Kamal.
From: zxq9 zxq9@zxq9.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 11:00 AM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
2012/4/12 Kamal Ahmed kamal2222ahmed@yahoo.com:
%prep mkdir %{name}-%{version}
Find out what the directory is really called after extraction, i.e. foo-somethingelse and change
%setup -q
to
%setup -qn foo-somethingelse
Whatever the extraction directory is gets removed prior to the build to keep the space clean. So what he's saying is that your problem (isolated below) will stop happening if you name the build one something else.
rpmbuild -bb pcore.spec
Everything is fine here...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
- umask 022
- cd /home/kahmed/rpmbuild/BUILD
- LANG=C
- export LANG
- unset DISPLAY
- mkdir pcore-0.1
And here the working directory is made based on the default extraction directory (that is, {% name %}-{% version %}).
- cd /home/kahmed/rpmbuild/BUILD
- rm -rf pcore-0.1
And here it gets removed! So you need to name the one you really want to use something different, which is what Jon is saying about "setup -qn something-else".
- /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
- tar -xf -
- STATUS=0
- '[' 0 -ne 0 ']'
- cd pcore-0.1
And of course this step doesn't work because pcore-0.1 has already been "rm -rf"d
/var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory
Hope this makes more sense now. Packaging is a little mysterious until you play with it a bit on your own. And once you do, you'll find that Fedora has the best all-around guidelines for it, all told. They are strict and a little difficult to understand "why" at first, but there is a *lot* of experience expressed in the packaging guidelines, tutorials, rpm itself and this list (most of the time...). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- in your fear, seek only peace in your fear, seek only love
-d. bowie
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
-- in your fear, seek only peace in your fear, seek only love
-d. bowie
On Thu, 12 Apr 2012 12:43:17 -0700 (PDT), KA (Kamal) wrote:
Jon,
with: cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
i get:
- cp obj/ggsnc/ggsnc /pcore-0.1/usr/bin/
cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.93551 (%install)
That makes no sense, because $RPM_BUILD_ROOT should evaluate to the value defined in the "BuildRoot:" tag. It seems you inserted a mistake somewhere.
The problem being that even though my Version is 0.1 , but when i untar , the directory gets created is pcore and not pcore-0.1. Any solution for this ?
Read up on the %setup macro's options. It seems you want to add -n %{name} so it enters the existing "pcore" directory instead of the default (which is %{name}-%{version}).
resolved by using : %setup -qn pcore Thanks, -Kamal.
From: Michael Schwendt mschwendt@gmail.com To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 3:49 PM Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}
On Thu, 12 Apr 2012 12:43:17 -0700 (PDT), KA (Kamal) wrote:
Jon,
with: cp obj/ggsnc/ggsnc $RPM_BUILD_ROOT%{_bindir}/
i get:
- cp obj/ggsnc/ggsnc /pcore-0.1/usr/bin/
cp: cannot create regular file `/pcore-0.1/usr/bin/': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.93551 (%install)
That makes no sense, because $RPM_BUILD_ROOT should evaluate to the value defined in the "BuildRoot:" tag. It seems you inserted a mistake somewhere.
The problem being that even though my Version is 0.1 , but when i untar , the directory gets created is pcore and not pcore-0.1. Any solution for this ?
Read up on the %setup macro's options. It seems you want to add -n %{name} so it enters the existing "pcore" directory instead of the default (which is %{name}-%{version}). -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
That's right.BuildRequires is the most important thing you should set up.
On Thursday, April 12, 2012, Jochen Schmitt wrote:
On Thu, Apr 12, 2012 at 06:48:27AM -0700, Kamal Ahmed wrote:
Is it ok to have the following in the %prep section
%prep sudo yum -y groupinstall "Development Tools" echo "Installing Development Tools" sudo yum -y install python-devel.i386 sudo yum -y install postgresql84-server.i386 postgresql84-devel.i386
postgresql84-python.i386
Don't use sudo because it's not non-interactive (asking for a password) and grant you with root access which rise the dange of demanging the system. This may be very bad for a user which try to rebuild your package from a SRPM and may get a system demage.
One reason why the SuSE Build server is bad is the fact, that builds are executed in a root environment. So some kinds of errors may be not find, which may be dangerous for users which try to rebuild the created SRPMs on thier own systems.
Instead of using yum and rpm to install packages requires for build time, please use BuidRequires:. Mock and koji can analyze the package can install the requires package in the build environemnt.
Best Regards:
Jochen Schmitt
packaging mailing list packaging@lists.fedoraproject.org javascript:; https://admin.fedoraproject.org/mailman/listinfo/packaging
On 04/12/2012 03:35 AM, Kamal Ahmed wrote:
or dag.wieers.com http://dag.wieers.com/rpm/,
this one is a bit outdated...
one more thing,you can take a look at 'how to create a rpm package' in fedoraproject wiki.
On Thursday, April 12, 2012, Mihamina Rakotomandimby wrote:
On 04/12/2012 03:35 AM, Kamal Ahmed wrote:
or dag.wieers.com http://dag.wieers.com/rpm/,
this one is a bit outdated...
-- RMA. -- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.**org/mailman/listinfo/packaginghttps://admin.fedoraproject.org/mailman/listinfo/packaging
sorry but that does not answr aNY of my questions, since all of my queries relate to HOW ot build an RPM. not how ot use an existing one.
From: Mihamina Rakotomandimby mihamina@rktmb.org To: packaging@lists.fedoraproject.org Sent: Thursday, April 12, 2012 2:52 AM Subject: Re: [Fedora-packaging] Basic Questions
On 04/12/2012 03:35 AM, Kamal Ahmed wrote:
or dag.wieers.com http://dag.wieers.com/rpm/,
this one is a bit outdated...
-- RMA.
packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
On 04/11/2012 09:35 PM, Kamal Ahmed wrote:
Hi List, I just started working on RPM Packaging and had few questions.
- Where can i find good "WORKING" Examples of packages.spec
Use those form Fedora. Try this:
$ yumdownloader --source packagename
$ rpm2cpio packagename | cpio -ivd
and you will get the spec file, the source tarball and, eventually, patches. Then you can work with that spec file.
HTH, Germán.
- Is mach, or mock, really the better version of rpmbiuld ?
OK, so you want to build a binary RPM package for deployment on your servers. You have a .spec file or .src.rpm that you got from one of the many repositories such as freshrpms.net http://freshrpms.net/ or dag.wieers.com http://dag.wieers.com/rpm/, or that you wrote yourself. Why not just build it using |rpmbuild|? There are several problems you may come across.
- Given a spec file, rpmbuild won't download the source tarball and/or patches. You have to fetch those yourself into the SOURCES directory.
- rpmbuild will abort if any build-time dependencies are missing, forcing you to stop what you're doing, and go and build and install /those/ packages too.
- When your package configures itself, it may auto-detect libraries which are available on your build system, but which are not going to be available on the target system. For example, if openldap-devel is present then openldap may be linked into your binaries, but if the RPM doesn't declare openldap as a dependency, then it will fail to run on the target system. This is an insiduous problem, which I call "the curse of autoconf".
- You can only build packages for the same type of system as your build machine (e.g. CentOS 4 binaries on a CentOS 4 build system)
If you want an example of how bad the problem is, try building the package perl-SOAP-Lite from its spec file http://svn.rpmforge.net/svn/trunk/rpms/perl-SOAP-Lite/. You will quickly find yourself in dependency hell, with 16 other packages needing to be installed or built, all in the correct order.
The solution: mach <http://thomas.apestaart.org/download/mach/>
- Can i install "use sudo yum install <package name> , inside a SPEC file ?
- How can do a CHROOT inside a SPEC File
- How do i introduce versions, r=for RPMs, when there is NO version in
the SCM ( we are using Mercurial ) 6. Is there a working automation framework for rpmbuild ? 7. I tried using autospec , but it includes all the source files as well. I used it as: tar tzf myapp-0.1.tar.gz | autospec -bd -c GPL -g Utilities/System -n myapp-0.1 -l '' > myapp.spec
Thanks, -Kamal.
-- packaging mailing list packaging@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/packaging
packaging@lists.fedoraproject.org