changeset 864:d47aa2977d7a

Auto dependencies
author Chris Cannam
date Wed, 24 Sep 2014 12:15:58 +0100
parents ac805901f02a
children 8215909b74d2
files deploy/linux/debian-dependencies.sh deploy/linux/deploy-deb.sh misc/debian-dependencies.sh
diffstat 3 files changed, 46 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/linux/debian-dependencies.sh	Wed Sep 24 12:15:58 2014 +0100
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+target=$1
+
+if [ ! -f "$target" ]; then 
+    echo "Usage: $0 target-executable"
+    exit 1
+fi
+
+pfile=/tmp/packages_$$
+rfile=/tmp/redundant_$$
+
+trap "rm -f $pfile $rfile" 0
+echo 1>&2
+
+ldd "$target" | awk '{ print $3; }' | grep '^/' | while read lib; do
+    if test -n "$lib" ; then
+	dpkg-query -S "$lib"
+    fi
+    done | grep ': ' | awk -F: '{ print $1 }' | sort | uniq > $pfile
+
+echo "Packages providing required libraries:" 1>&2
+cat $pfile 1>&2
+echo 1>&2
+
+for p in `cat $pfile`; do 
+    echo Looking at $p 1>&2
+    apt-cache showpkg "$p" | grep '^  ' | grep ',' | awk -F, '{ print $1; }' | \
+	while read d; do 
+	    if grep -q '^'$d'$' $pfile; then
+		echo $p 1>&2
+	    fi
+    done
+done | sort | uniq > $rfile
+
+echo "Packages that can be eliminated because other packages depend on them:" 1>&2
+cat $rfile 1>&2
+echo 1>&2
+
+cat $pfile $rfile | sort | uniq -u | sed 's/$/,/' | fmt -1000 | sed 's/^/Depends: /'
+
+
--- a/deploy/linux/deploy-deb.sh	Wed Sep 24 12:12:20 2014 +0100
+++ b/deploy/linux/deploy-deb.sh	Wed Sep 24 12:15:58 2014 +0100
@@ -46,6 +46,10 @@
 
 perl -i -p -e "s/Architecture: .*/Architecture: $arch/" "$targetdir"/DEBIAN/control
 
+deps=`bash "$depdir"/debian-dependencies.sh "$program"`
+
+perl -i -p -e "s/Depends: .*/$deps/" "$targetdir"/DEBIAN/control
+
 bash "$depdir"/fix-lintian-bits.sh "$targetdir"
 
 sudo dpkg-deb --build "$targetdir" && lintian "$targetdir".deb
--- a/misc/debian-dependencies.sh	Wed Sep 24 12:12:20 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-target=$1
-
-if [ ! -f "$target" ]; then 
-    echo "Usage: $0 target-executable"
-    exit 1
-fi
-
-pfile=/tmp/packages_$$
-rfile=/tmp/redundant_$$
-
-trap "rm -f $pfile $rfile" 0
-echo 1>&2
-
-ldd "$target" | awk '{ print $3; }' | grep '^/' | while read lib; do
-    if test -n "$lib" ; then
-	dpkg-query -S "$lib"
-    fi
-    done | grep ': ' | awk -F: '{ print $1 }' | sort | uniq > $pfile
-
-echo "Packages providing required libraries:" 1>&2
-cat $pfile 1>&2
-echo 1>&2
-
-for p in `cat $pfile`; do 
-    echo Looking at $p 1>&2
-    apt-cache showpkg "$p" | grep '^  ' | grep ',' | awk -F, '{ print $1; }' | \
-	while read d; do 
-	    if grep -q '^'$d'$' $pfile; then
-		echo $p 1>&2
-	    fi
-    done
-done | sort | uniq > $rfile
-
-echo "Packages that can be eliminated because other packages depend on them:" 1>&2
-cat $rfile 1>&2
-echo 1>&2
-
-cat $pfile $rfile | sort | uniq -u | sed 's/$/,/' | fmt -1000 | sed 's/^/Depends: /'
-
-