WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Creating dependency lists  (Read 4434 times)

Offline helander

  • Full Member
  • ***
  • Posts: 183
Creating dependency lists
« on: January 10, 2010, 04:49:33 AM »
I have created a  script that allows me to find out dependencies for a specific extension based on the content of the extension.

It relies on having access to the *.tcz.list for all extensions in the repository and since people do mirror the repository in different ways and at different locations it has to be adjusted for each users particular environment.

The principle of operation is:

Loop through all files of the extension and use ldd to find out for each file the libraries it depends on (if any). Once the dependent libraries are found then the *.tcz.list files are visited to find out in what package the library is found.

I have found that some libraries are found in multiple extensions, which in principle should be wrong, so I think there could be a task here for the repository responsibles to have a look at this, e.g. the lilypond package contains fontconfig libraries and these should be fetched from the fontconfig extension instead.

As of now the files of the extension are fetched from my build environment but could be fetched from its .tcz file instead in order to make the script independent of the build environment.

I find this script very useful and if nothing similar is available elsewhere I propose to extend the "Creating extensions" part of the wiki with information about how one could go about to create the information needed for .dep files.

The script:
Quote
#!/bin/sh
package=$1
files=`cat /mnt/hda1/BUILD/tmp/bin/$package/$package.tcz.list`
rm -f /tmp/$package.lsdeps
for f in $files; do
  fpath="/mnt/hda1/BUILD/tmp/bin/$package/root/$f"
  ldd $fpath 2>/dev/null | \
    grep -e "=> /usr/local" -e "=> not found" | \
    awk '{print $1}' >>/tmp/$package.lsdeps 
done
fdeps=`sort -u /tmp/$package.lsdeps`
rm -f /tmp/$package.lsdeps
rm -f $package.tcz.dep
for f in $fdeps; do
 echo $f "----->"
 deps=`grep -l $f /mnt/hda1/MIRROR/tcz/*.tcz.list`
 many=""
 for d in $deps; do
   bd=`basename $d | sed "s/.tcz.list//"`
   if [ "$bd" != "$package" ]; then
     echo "  " $bd
     echo "$bd.tcz" >> /tmp/$package.lsdeps
   fi
   if [ -n "$many" ]; then
     echo "WARNING!!!!!!!!! $f is found in multiple extensions !!!!!WARNING"
   fi
   many="yes"
 done
done
if [ -f /tmp/$package.lsdeps ]; then
  sort -u /tmp/$package.lsdeps > $package.dep
fi

Kind Regards
Lars

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Creating dependency lists
« Reply #1 on: January 10, 2010, 05:10:02 AM »
Lars,

did you check your result on existing dep files?

Also, there are dependencies can't be detected on this way, like icon themes, etc. So for sure it is very useful, but can't be used exclusively but a good tool to detect missing libs.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline helander

  • Full Member
  • ***
  • Posts: 183
Re: Creating dependency lists
« Reply #2 on: January 10, 2010, 05:19:42 AM »
Bela,

No, I have not used it to check the dependencies in general in the repository. I have not had the time to do that, but it is something that should be done, I think.

I am fully aware that this method does not catch all dependencies as you point out. Another thing not covered are scripts in the packages that calls binaries from other extensions. This is why I did not call the resulting file $package.tcz.dep but just $package.dep :). My intention if adding this to the wiki was to be more elaborate on these issues.

/Lars

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Creating dependency lists
« Reply #3 on: January 12, 2010, 08:19:36 PM »
If users find it useful, a link to this thread can always placed as an optional suggestion.