[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to find software dependencies while building a RPM ?



Hello,
thanks for all your answers,
As I subscribed to this list in digest mode, I'll answer to all messages in one time, sorry...


I tryed to rebuild my package, but rpmbuild doesn't semm to add all dependencies automaticaly. It only adds rpm dependecies :
when I run # rpm -qp --requires Developpement/packages/RPMS/i586/rapidsvn-0.7.0-1.i586.rpm


it outputs :

subversion
/bin/sh
/bin/sh
/bin/sh
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(CompressedFileNames) <= 3.0.4-1

where subversion and /bin/sh are dependencies that I manualy put in the spec file (but I don't know why /bin/sh is output 3 times)

So I used lsof to lists all open files, and as I was not able to distinguish if a file was used or not by my program. and which package it belongs to, I made a little shell script. I think it works well but I submit it here to hear what you think about it and if it returns wrong results...
And in case it really works, perhaps it can help someone else here...


Here is the script, it uses a temp file, sorry but I didn't see how to do without it...
If you whant to try it with another software than rapidsvn, dont forget to change the value of the SOFTWARE variable.


#!/bin/bash
# script to find packages owning files used by a runing software

# software name (as it displays in lsof output)
SOFTWARE="rapidsvn";
# dependant files type (as it displays in lsof output)
FILESTYPE="REG";
# fichier temporaire
TEMPFILE=/var/tmp/soft-dep-tmp.`date +%s`

# output a list of regular files used by rapidsvn
# 9 in {print $9} is the position of the used file name in lsof output
# lsof output items a separated by spaces
filelist=`lsof | grep $SOFTWARE | grep $FILESTYPE | gawk -F" " '{print $9}'`;


# creates and/or empty a text file for final rpm list
cat /dev/null > $TEMPFILE;

# look for packages wich own each file from file list
for file in $filelist; do
rpmname=`rpm -qf $file` > /dev/null;
if [ $? = 0 ]; then # if the file is owned by a package
# don't keep duplicated packages names
grep "$rpmname" $TEMPFILE > /dev/null;# check if package name is already in the list
if [ $? != 0 ]; then #if the name is not in the list
echo "$rpmname" >> $TEMPFILE;# add the package name to the list
echo "$rpmname"; #display the RPM name.
fi
fi
done
#efface le fichier temporaire
rm -f $TEMPFILE;
exit 0;
# EOF


I get the following output :

rapidsvn-0.7.0-1
glibc-2.3.3-93
subversion-1.0.0-73.11
neon-0.24.4-66.3
openssl-0.9.7d-15.13
libxml2-2.6.7-28
zlib-1.2.1-70.6
libapr0-2.0.49-27.14
glibc-locale-2.3.3-98
gdbm-1.8.3-225
db-4.2.52-86
expat-1.95.7-37
wxGTK-2.4.2.4-138
libstdc++-3.3.3-41
libgcc-3.3.3-41
gtk2-2.2.4-125.4
atk-1.4.1-124
pango-1.2.5-170
glib2-2.2.3-117
libpng-1.2.5-182.10
libjpeg-6.2.0-731
libtiff-3.6.1-38.3
XFree86-libs-4.3.99.902-43.31
fontconfig-2.2.92.20040221-28
freetype2-2.1.7-53
QtPixmap-0.28-22

escept rapidsvn-0.7.0-1 wich is the package I made and wich is listed because it contains the the executable, I think that I have to add all other packages to the dependency list in my spec file.

Shears,
Nicolas.
begin:vcard
fn:Nicolas MASSART
n:MASSART;Nicolas
org:Association Ohana
adr:;;51, rue du Caire;Paris;;75002;FRANCE
email;internet:association-ohana@noos.fr
title:Administrateur
tel;work:01 55 65 34 87
tel;home:01 42 36 15 24
tel;cell:06 61 95 87 97
x-mozilla-html:FALSE
url:HTTP://www.association-ohana.net/
version:2.1
end:vcard


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]