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

Bug#565295: dpkg-cross: dependency_libs mangling fails to handle quoting



Package: dpkg-cross
Version: 2.5.3
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch lucid

dpkg-cross mishandles the dependency_libs lines in many .la files.
Attached are two examples.

libusb:

  in:   dependency_libs=' -L/usr/arm-linux-gnueabi/lib'
  out:  dependency_libs='
  want: dependency_libs=''

libanthy:

  in:   dependency_libs=' -lm /usr/lib/libanthydic.la'
  out:  dependency_libs=' -lm /usr/lib/libanthydic.la'
  want: dependency_libs=' -lm /usr/arm-linux-gnueabi/lib/libanthydic.la'

This is no doubt another cause of a number of problems such as
http://lists.debian.org/debian-devel/2007/12/msg00416.html.  I spent
quite a bit of time scratching my head over this before realising that
dpkg-cross wasn't behaving as it's clearly intended to behave ...

Here's a patch to correct this.

=== modified file 'dpkg-cross'
--- dpkg-cross	2010-01-07 23:47:08 +0000
+++ dpkg-cross	2010-01-14 16:20:48 +0000
@@ -664,10 +664,11 @@ sub sub_build {
 		while (<FROM>) {
 			if (/^libdir=/) {
 				print TO "libdir=\'$crosslib\'\n";
-			} elsif (/^dependency_libs=/) {
-				s/( )?-L\S+//g;
-				s:\S+/([\w\.\-]+\.la)$:$crosslib/$1:g;
-				print TO;
+			} elsif (/^dependency_libs='(.*)'$/ or /^dependency_libs=(.*)/) {
+				my $deplibs = $1;
+				$deplibs =~ s/( )?-L\S+//g;
+				$deplibs =~ s:\S+/([\w\.\-]+\.la)$:$crosslib/$1:g;
+				print TO "dependency_libs='$deplibs'\n";
 			} else {
 				print TO;
 			}

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
# libusb.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.26 Debian 1.5.26-4 (1.1220.2.493 2008/02/01 16:58:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libusb-0.1.so.4'

# Names of this library.
library_names='libusb-0.1.so.4.4.4 libusb-0.1.so.4 libusb.so'

# The name of the static archive.
old_library='libusb.a'

# Libraries that this one depends upon.
dependency_libs=' -L/usr/arm-linux-gnueabi/lib'

# Version information for libusb.
current=8
age=4
revision=4

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib'
# libanthy.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.5.6 (1.1220.2.95 2004/04/11 05:50:42) Debian: 224 $
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libanthy.so.0'

# Names of this library.
library_names='libanthy.so.0.1.0 libanthy.so.0 libanthy.so'

# The name of the static archive.
old_library='libanthy.a'

# Libraries that this one depends upon.
dependency_libs=' -lm /usr/lib/libanthydic.la'

# Version information for libanthy.
current=1
age=1
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib'

Reply to: