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

Requesting for comments: automatically and mechanically obtaining shared library package names



Hi, 

The following script is a script to obtain a shared library package name that 
would be feasible to be used within Debian package.
It outputs a pseudo-debian/control file.

There are quite a few people, and quite a few packages that aren't currently done
in this way (i.e. many library packages contain multiple shared libraries in one package),
but this could be a start for something.
(and there are other things that need work in this script, ignore the Depends: field
for now).


USAGE:

$ libinfodump.sh  /usr/lib/libdmachinemon.so.1.0.0
Package: libdmachinemon1
Section: libs
Depends: ${shlibs:Depends}

Package: libdmachinemon1-dev
Section: devel
Depends: libpthread0-dev,libc6-dev


For discussion on best-practice in library packaging, see
http://www.netfort.gr.jp/~dancer/column/libpkg-guide/libpkg-guide.html





#!/bin/bash

function getname () {
    local SONAMELIBNAME
    local SONAMEVERSION
    local SONAME
    SONAME=$1
    SONAMELIBNAME=$(echo $SONAME | sed 's/\.so\..*$//')
    SONAMEVERSION=$(echo $SONAME | sed 's/^.*\.so\.//')
    if echo $SONAMELIBNAME | grep '[0-9]$' > /dev/null ; then
        RETURN=$SONAMELIBNAME-$SONAMEVERSION
    else
        RETURN=$SONAMELIBNAME$SONAMEVERSION
    fi
}

LIBNAME="$1"

SONAME=$(objdump -p $LIBNAME |sed -n 's/^.*SONAME *//p' )
getname $SONAME
SONAMEPKGNAME=$RETURN

DEPENDS=$(objdump -p $LIBNAME |sed -n 's/^.*NEEDED *//p')

cat <<EOF
Package: $SONAMEPKGNAME
Section: libs
Depends: \${shlibs:Depends}

Package: $SONAMEPKGNAME-dev
Section: devel
EOF

printf "Depends: "
for A in $DEPENDS; do
    getname "$A"
    printf $RETURN-dev' '
done | sed 's/ $//' | tr ' ' ','
printf "\n"

-- 
dancer@debian.org  http://www.netfort.gr.jp/~dancer




-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: