LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-15-2011, 07:20 AM   #1
eidbadrlt
LQ Newbie
 
Registered: Nov 2011
Posts: 11

Rep: Reputation: Disabled
rpm package from a compiled source


Hi all,

I have a compiled source and I'm trying to pack it into an rpm package,

I followed some tutorial
here: http://www.ibm.com/developerworks/li...pm1/#resources

but the source is already compiled and I use ./install.sh to install the software.

I tried some configurations for the spec file, but I got a 1.5 kB rpm file (i guess its empty) and it does not install anything!

please I need some help !
 
Old 11-15-2011, 03:51 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
To package prebuild binaries you can just ignore the %build section, to give you other pointers on why your rpm isn't building we'd need to see the spec file.
 
Old 11-15-2011, 04:45 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...and just in case: building packages from already compiled sources is not the RPM way. If you still want to, then best not publicly distribute the package as you will undermine the trust people place in packaging in terms of the source being known, available and having been validated before building and packaging.
 
Old 11-15-2011, 06:12 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
.. there's no issue making the spec file publicly available though, creating packages from prebuilt binaries is a common practice for deploying 3rd party (closed source) apps within an organisation.
 
Old 11-16-2011, 05:39 AM   #5
eidbadrlt
LQ Newbie
 
Registered: Nov 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
Hi,
i have created the files:
BUILD RPMS SOURCES SPECS SRPMS (inside the directory rpm)

and I put zisagent-_5.3.32124_setup_unix.r_2011.06.15.tar.gz in the SOURCES folder and its already compiled.


in the spec file i have the following:

Code:
# This is a sample spec file for wget

%define _topdir	 	/opt/rmp
%define name		zisagent 
%define release		1
%define version 	_5.3.32124_setup_unix.r_2011.06.15
%define buildroot %{_topdir}/%{name}-%{version}-root

BuildRoot:	%{buildroot}
Summary: 		agent
License: 		Commercial
Name: 			%{name}
Version: 		%{version}
Release: 		%{release}
Source: 		%{name}-%{version}.tar.gz
Prefix: 		/usr
Group: 			Development/Tools

%description
testing......

%prep
%setup -q


%install
./install.sh

%files
after running the command
rpmbuild -v -bb --clean SPECS/zisagent.spec

the program was installed and now i have RPMS/i568/zisagent-_5.3.32124_setup_unix.r_2011.06.15-i568.rpm but its only 1.4 KiB
rpm/BUILD is empty
rpm/SRPMS contains zisagent-_5.3.32124_setup_unix.r_2011.06.15-1.src.rmp



also six folders were created in the directory /usr/src/packages:
BUILD RPMS SOURCES SPECS SRPMS BUILDROOT
and they are all empty!

whats wrong?
what should i add under %files
the tutorial says:
Quote:
%files lists the files that should be bundled into the RPM and optionally sets permissions and other information.
but which files are those? and under which directory??!!
 
Old 11-16-2011, 06:22 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by eidbadrlt View Post
whats wrong?
0. RPM packages should be built as unprivileged user. If you need directions see for instance http://www.linuxquestions.org/questi...c-file-648210/ (few posts down) or http://www-106.ibm.com/developerworks/library/l-rpm2/ or the "Maximum RPM" site.
1. Your .spec file is incomplete. Please use a minimally conforming .spec file to avoid easily avoidable errors. See for instance http://www.linuxquestions.org/questi...5/#post4517221 (which also holds the answer to your "%files" question).
2. Also please read the packaging documentation for your distribution or else the RHEL or Fedora packagers documentation.
3. Attaching (as plain text file) output of 'rpmbuild -bb zisagent.spec' and the contents of the "install.sh" may help.
 
Old 11-16-2011, 09:38 AM   #7
eidbadrlt
LQ Newbie
 
Registered: Nov 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
Hi,
I followed the instructions in http://www.linuxquestions.org/questi...c-file-648210/

but i still have a problem am I doing it correctly? is the program running?

the spec-file: its a tar.gz file so i used %setup instead of %prep
i also changed %attr(755,root,root) /usr/local/bin/%{name} to %attr(755,root,root) /usr/local/bin/


Code:
Name: zisagent
Version: _5.3.32124_setup_unix.r_2011.06.15
Release: 1
Summary: %{name} is zisagent
Group: Utilities/System # See /usr/share/docs/rpm-*/GROUPS
License: Comercial
Source: $RPM_SOURCE_DIR/%{name}-%{version}.%{release}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}.%{release}
Provides: %{name}

%description
This package contains a "zis agent" example binary.

# or %setup if a tarball
#%prep # This preps dir $RPM_BUILD_DIR/%{name}-%{version}.%{release}/.

#%setup -n $RPM_BUILD_DIR/%{name}-%{version}.%{release}
%setup -n $RPM_BUILD_DIR/%{name}-%{version}.%{release}

# We're in the BuildRoot now. Make certain:
#cd $RPM_BUILD_DIR/%{name}-%{version}.%{release}/

# Copy files in that aren't packaged:
#cp $RPM_SOURCE_DIR/%{name}.c .

#%build
#gcc -o %{name} %{name}.c

%install
cd $RPM_BUILD_DIR/%{name}-%{version}.%{release}/
# Create dirs leading up to if necessary:
#[ -d /usr/local/bin ] || 
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
install -m 0755 ./install.sh $RPM_BUILD_ROOT/usr/local/bin

%clean
[ "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}-%{version}" ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%attr(755,root,root) /usr/local/bin/

%changelog
* Wed Nov 10 2011 %{packager}
- Initialise .spec file for %{name}-%{ver}.

after using rpmbuild -ba SPECS/zisagent.spec
i got an rpm package but its only 2.6 Kib
also in the $RPM_BUILD_ROOT/usr/local/bin there was only install.sh

and the install.sh file is


Code:
#!/bin/sh

MY_PATH=`dirname "$0"`
ZISAGENT_PATH=`cd "${MY_PATH}" && pwd -P` || exit 3

DO_SETUID=0
if [ -u "${ZISAGENT_PATH}/start.sh" ]; then
	DO_SETUID=1
fi

if [ -f "${ZISAGENT_PATH}/lib/commands.sh" ]; then
	ls -l "${ZISAGENT_PATH}/start.sh" > "${ZISAGENT_PATH}/tmp/owner.txt"
	"${ZISAGENT_PATH}/stop.sh" || exit 2
fi

FIND_SH_SCRIPT=${ZISAGENT_PATH}/bin/find-sh.sh
SH_FILE=${ZISAGENT_PATH}/lib/shell.sh
MAIN_CFG_SCRIPT=${ZISAGENT_PATH}/bin/sh-cfg.sh
UPDATE_SCRIPT=${ZISAGENT_PATH}/update.sh

"${FIND_SH_SCRIPT}" "${ZISAGENT_PATH}" || exit 2

. "${SH_FILE}"

cp -f "${ZISAGENT_PATH}/zisagent.sh.tmpl" "${ZISAGENT_PATH}/zisagent.sh"

"${SHELL}" "${MAIN_CFG_SCRIPT}" "${ZISAGENT_PATH}" || exit 2

"${SHELL}" "${UPDATE_SCRIPT}" || exit 2

if [ ${DO_SETUID} -ne 0 ]; then
	"${SHELL}" "${ZISAGENT_PATH}/bin/setuid.sh" "${ZISAGENT_PATH}"
fi

"${SHELL}" "${ZISAGENT_PATH}/config.sh" $1 || exit 2

exit 0
now i tried the following i installed the software on a different directory and copied all the files to $RPM_BUILD_ROOT/usr/local/bin

and the result of using rpmbuild -ba SPECS/zisagent.spec is a 1.4 MiB file
now i installed the rpm package (rpm -i {package-name}) it installed a 12 MiB program. now how do i make sure this is correct and how to run the program, i mean how do i find it? its not under utilities or system or other directory!
 
Old 11-16-2011, 11:40 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by eidbadrlt View Post
i got an rpm package but its only 2.6 Kib
...and that's why I also suggested you attach (as plain text file) the output of running 'rpmbuild -bb zisagent.spec'. While you're at it please also include output of 'tar -vtf zisagent_5.3.32124_setup_unix.r_2011.06.15.tar.gz'. With that it should be easier to get the .spec file right.



Quote:
Originally Posted by eidbadrlt View Post
now i tried the following i installed the software on a different directory and copied all the files to $RPM_BUILD_ROOT/usr/local/bin
If you provide input I'll show you how the .spec file could look like but I do not support kludges like that.



Quote:
Originally Posted by eidbadrlt View Post
now i installed the rpm package (rpm -i {package-name}) it installed a 12 MiB program. now how do i make sure this is correct
Compare the contents of the package with the contents of your original tarball.


Quote:
Originally Posted by eidbadrlt View Post
and how to run the program, i mean how do i find it? its not under utilities or system or other directory!
Could it be you haven't read any of the documentation I suggested? Are you even vaguely familiar with RPM packaging or RHEL?. 'rpm -ql [name]'(|grep bin/) should show you the package contents and so the path to default installation path for the binary.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Question] remove package compiled from source hitomi_doaxbv Linux - Software 4 04-06-2008 03:10 AM
Converting a compiled program in tgz format into an rpm package. xode Linux - Software 1 01-04-2008 12:54 PM
How to build a pre compiled kernel with source as a single rpm? sundarhere Linux - Kernel 0 10-26-2006 02:27 AM
RPM vs compiled source Yell0w_c0w Linux - Software 2 03-09-2004 12:15 PM
What is the name of the package (rpm/source) containing ./confiugre? Rampage2884 Linux - General 5 05-19-2002 05:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration