libgphoto2: update 2.5.8 -> 2.5.14

changes from patches

* 0001-scripts-remove-bashisms.patch
* 0002-correct-jpeg-memsrcdest-support.patch
* avoid_using_sprintf.patch

were found in the code so assume they are upstream

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Andreas Müller
2017-11-11 14:29:39 +01:00
committed by Armin Kuster
parent 54f6f64bca
commit 6757fc3c88
8 changed files with 3 additions and 341 deletions
@@ -1,149 +0,0 @@
From c00e63e97d8718836ba011d9172128732eecf001 Mon Sep 17 00:00:00 2001
From: Ismo Puustinen <ismo.puustinen@intel.com>
Date: Tue, 24 Jan 2017 22:24:05 +0200
Subject: [PATCH] scripts: remove bashisms.
Convert bash scripts to more generic shell scripts. This removes the
strict bash dependency and the scripts should now run with any posix
shell. Also fix the issues reported by shellcheck while at it.
Upstream-status: Accepted [https://github.com/gphoto/libgphoto2/commit/39b4395532058c0edb9a56d0ff04e48a472e4743]
---
packaging/generic/check-ptp-camera | 12 ++++++------
packaging/linux-hotplug/gphoto-set-procperm | 14 +++++++-------
packaging/linux-hotplug/usbcam.console | 4 ++--
packaging/linux-hotplug/usbcam.group | 2 +-
packaging/linux-hotplug/usbcam.user | 2 +-
packaging/linux-hotplug/usbcam.x11-app | 4 ++--
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/packaging/generic/check-ptp-camera b/packaging/generic/check-ptp-camera
index 1793fc8..bc3c6ac 100644
--- a/packaging/generic/check-ptp-camera
+++ b/packaging/generic/check-ptp-camera
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -20,13 +20,13 @@ INTERFACE="${1:-06/01/01}"
BASENAME=${DEVPATH##*/}
for d in /sys/${DEVPATH}/${BASENAME}:*; do
- [[ -d ${d} ]] || continue
- INTERFACEID="$(< ${d}/bInterfaceClass)"
- INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceSubClass)"
- INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceProtocol)"
+ [ -d "${d}" ] || continue
+ INTERFACEID="$(cat "${d}"/bInterfaceClass)"
+ INTERFACEID="${INTERFACEID}/$(cat "${d}"/bInterfaceSubClass)"
+ INTERFACEID="${INTERFACEID}/$(cat "${d}"/bInterfaceProtocol)"
#echo ${d}: ${INTERFACEID}
- if [[ ${INTERFACE} == ${INTERFACEID} ]]; then
+ if [ "${INTERFACE}" = "${INTERFACEID}" ]; then
# Found interface
exit 0
fi
diff --git a/packaging/linux-hotplug/gphoto-set-procperm b/packaging/linux-hotplug/gphoto-set-procperm
index d72ee68..977cbf5 100644
--- a/packaging/linux-hotplug/gphoto-set-procperm
+++ b/packaging/linux-hotplug/gphoto-set-procperm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -18,22 +18,22 @@
# This is taken from Fedora Core gphoto2 package.
# http://cvs.fedora.redhat.com/viewcvs/*checkout*/devel/gphoto2/gphoto-set-procperm
-console_user=`cat /var/run/console/console.lock`
+console_user=$(cat /var/run/console/console.lock)
if [ -z "$console_user" ] ; then
exit 1
fi
-if [ -z "$HAL_PROP_USB_BUS_NUMBER" -o -z "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" ] ; then
+if [ -z "$HAL_PROP_USB_BUS_NUMBER" ] || [ -z "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" ] ; then
exit 1
fi
-if [ $HAL_PROP_USB_BUS_NUMBER -lt 0 -o $HAL_PROP_USB_LINUX_DEVICE_NUMBER -lt 0 ] ; then
+if [ "$HAL_PROP_USB_BUS_NUMBER" -lt 0 ] || [ "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" -lt 0 ] ; then
exit 1
fi
-bus_num=`printf %.3u $HAL_PROP_USB_BUS_NUMBER`
-dev_num=`printf %.3u $HAL_PROP_USB_LINUX_DEVICE_NUMBER`
+bus_num=$(printf %.3u "$HAL_PROP_USB_BUS_NUMBER")
+dev_num=$(printf %.3u "$HAL_PROP_USB_LINUX_DEVICE_NUMBER")
-chown $console_user /proc/bus/usb/$bus_num/$dev_num
+chown "$console_user" /proc/bus/usb/"$bus_num"/"$dev_num"
diff --git a/packaging/linux-hotplug/usbcam.console b/packaging/linux-hotplug/usbcam.console
index d72128f..7ac6dc5 100755
--- a/packaging/linux-hotplug/usbcam.console
+++ b/packaging/linux-hotplug/usbcam.console
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -50,7 +50,7 @@ then
/var/lock/console.lock
do
if [ -f "$conlock" ]; then
- CONSOLEOWNER=`cat $conlock`
+ CONSOLEOWNER=$(cat $conlock)
fi
done
if [ -n "$CONSOLEOWNER" ]
diff --git a/packaging/linux-hotplug/usbcam.group b/packaging/linux-hotplug/usbcam.group
index f96c33d..8761fac 100755
--- a/packaging/linux-hotplug/usbcam.group
+++ b/packaging/linux-hotplug/usbcam.group
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
diff --git a/packaging/linux-hotplug/usbcam.user b/packaging/linux-hotplug/usbcam.user
index c46f155..a3ba71a 100644
--- a/packaging/linux-hotplug/usbcam.user
+++ b/packaging/linux-hotplug/usbcam.user
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
diff --git a/packaging/linux-hotplug/usbcam.x11-app b/packaging/linux-hotplug/usbcam.x11-app
index 023ae9b..618e7db 100644
--- a/packaging/linux-hotplug/usbcam.x11-app
+++ b/packaging/linux-hotplug/usbcam.x11-app
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -69,7 +69,7 @@ then
if [ "${USER}" != "root" ]
then
# we don't want to run this as root. definitely not.
- cd "${DIRECTORY}"
+ cd "${DIRECTORY}" || exit 1
usrhome=~${USER}
"${SU}" "${USER}" -c "${ENV} DISPLAY=${DISPLAY} HOME=${usrhome} ${X11_APP}"
fi
--
2.9.3
@@ -1,54 +0,0 @@
--- libgphoto2-2.5.8/camlibs/ax203/jpeg_memsrcdest.h.orig 2016-06-15 09:03:20.625774684 -0400
+++ libgphoto2-2.5.8/camlibs/ax203/jpeg_memsrcdest.h 2016-06-15 09:03:47.049774148 -0400
@@ -1,5 +1,7 @@
#include <jpeglib.h>
+#if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED)
+
void
jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * buffer,
unsigned long bufsize);
@@ -7,3 +9,5 @@
void
jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
unsigned long * outsize);
+
+#endif
--- libgphoto2-2.5.8/camlibs/ax203/jpeg_memsrcdest.c.orig 2016-06-15 09:03:58.689773913 -0400
+++ libgphoto2-2.5.8/camlibs/ax203/jpeg_memsrcdest.c 2016-06-15 09:04:17.769773526 -0400
@@ -26,7 +26,7 @@
/* libjpeg8 and later come with their own (API compatible) memory source
and dest */
-#if JPEG_LIB_VERSION < 80
+#if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED)
/* Expanded data source object for memory input */
--- libgphoto2-2.5.8/camlibs/jl2005c/jpeg_memsrcdest.h.orig 2016-06-15 09:05:01.893772632 -0400
+++ libgphoto2-2.5.8/camlibs/jl2005c/jpeg_memsrcdest.h 2016-06-15 09:05:17.433772318 -0400
@@ -1,5 +1,7 @@
#include <jpeglib.h>
+#if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED)
+
void
jpeg_mem_src (j_decompress_ptr cinfo, unsigned char * buffer,
unsigned long bufsize);
@@ -7,3 +9,5 @@
void
jpeg_mem_dest (j_compress_ptr cinfo, unsigned char ** outbuffer,
unsigned long * outsize);
+
+#endif
--- libgphoto2-2.5.8/camlibs/jl2005c/jpeg_memsrcdest.c.orig 2016-06-15 09:04:42.641773022 -0400
+++ libgphoto2-2.5.8/camlibs/jl2005c/jpeg_memsrcdest.c 2016-06-15 09:04:48.657772901 -0400
@@ -26,7 +26,7 @@
/* libjpeg8 and later come with their own (API compatible) memory source
and dest */
-#if JPEG_LIB_VERSION < 80
+#if JPEG_LIB_VERSION < 80 && !defined(MEM_SRCDST_SUPPORTED)
/* Expanded data source object for memory input */
@@ -1,133 +0,0 @@
From 4adfe5a6c9db07537df302f3c17713515bf23a2e Mon Sep 17 00:00:00 2001
From: Marcus Meissner <marcus@jet.franken.de>
Date: Sat, 11 Jul 2015 09:38:13 +0000
Subject: [PATCH] avoid use of sprintf to convert %% to %, duplicate the macro
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15490 67ed7778-7388-44ab-90cf-0a291f65f57c
---
camlibs/ptp2/chdk.c | 8 ++---
camlibs/ptp2/chdk_ptp.h | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 6 deletions(-)
diff --git a/camlibs/ptp2/chdk.c b/camlibs/ptp2/chdk.c
index 5fb84ea..3b8a995 100644
--- a/camlibs/ptp2/chdk.c
+++ b/camlibs/ptp2/chdk.c
@@ -1119,18 +1119,14 @@ chdk_camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *pat
int ret, retint;
char *table, *s;
PTPParams *params = &camera->pl->params;
- char *lua;
- const char *luascript = PTP_CHDK_LUA_SERIALIZE_MSGS \
+ const char *luascript = PTP_CHDK_LUA_SERIALIZE_MSGS_SIMPLEQUOTE \
PTP_CHDK_LUA_RLIB_SHOOT \
"return rlib_shoot({info=true});\n";
ret = camera_prepare_chdk_capture(camera, context);
if (ret != GP_OK) return ret;
- lua = malloc(strlen(luascript)+1);
- sprintf(lua,luascript); /* This expands the %q inside the string too ... do not optimize away. */
- ret = chdk_generic_script_run (params, lua, &table, &retint, context);
- free (lua);
+ ret = chdk_generic_script_run (params, luascript, &table, &retint, context);
GP_LOG_D("rlib_shoot returned table %s, retint %d\n", table, retint);
s = strstr(table, "exp=");
if (s) {
diff --git a/camlibs/ptp2/chdk_ptp.h b/camlibs/ptp2/chdk_ptp.h
index d11e0b7..65dcfd7 100644
--- a/camlibs/ptp2/chdk_ptp.h
+++ b/camlibs/ptp2/chdk_ptp.h
@@ -198,10 +198,92 @@ function serialize(v,opts)\n\
return table.concat(r)\n\
end\n"
+#define PTP_CHDK_LUA_SERIALIZE_SIMPLEQUOTE "\n\
+serialize_r = function(v,opts,r,seen,depth)\n\
+ local vt = type(v)\n\
+ if vt == 'nil' or vt == 'boolean' or vt == 'number' then\n\
+ table.insert(r,tostring(v))\n\
+ return\n\
+ end\n\
+ if vt == 'string' then\n\
+ table.insert(r,string.format('%q',v))\n\
+ return\n\
+ end\n\
+ if vt == 'table' then\n\
+ if not depth then\n\
+ depth = 1\n\
+ end\n\
+ if depth >= opts.maxdepth then\n\
+ error('serialize: max depth')\n\
+ end\n\
+ if not seen then\n\
+ seen={}\n\
+ elseif seen[v] then\n\
+ if opts.err_cycle then\n\
+ error('serialize: cycle')\n\
+ else\n\
+ table.insert(r,'\"cycle:'..tostring(v)..'\"')\n\
+ return\n\
+ end\n\
+ end\n\
+ seen[v] = true;\n\
+ table.insert(r,'{')\n\
+ for k,v1 in pairs(v) do\n\
+ if opts.pretty then\n\
+ table.insert(r,'\\n'..string.rep(' ',depth))\n\
+ end\n\
+ if type(k) == 'string' and string.match(k,'^[_%a][%a%d_]*$') then\n\
+ table.insert(r,k)\n\
+ else\n\
+ table.insert(r,'[')\n\
+ serialize_r(k,opts,r,seen,depth+1)\n\
+ table.insert(r,']')\n\
+ end\n\
+ table.insert(r,'=')\n\
+ serialize_r(v1,opts,r,seen,depth+1)\n\
+ table.insert(r,',')\n\
+ end\n\
+ if opts.pretty then\n\
+ table.insert(r,'\\n'..string.rep(' ',depth-1))\n\
+ end\n\
+ table.insert(r,'}')\n\
+ return\n\
+ end\n\
+ if opts.err_type then\n\
+ error('serialize: unsupported type ' .. vt, 2)\n\
+ else\n\
+ table.insert(r,'\"'..tostring(v)..'\"')\n\
+ end\n\
+end\n\
+serialize_defaults = {\n\
+ maxdepth=10,\n\
+ err_type=true,\n\
+ err_cycle=true,\n\
+ pretty=false,\n\
+}\n\
+function serialize(v,opts)\n\
+ if opts then\n\
+ for k,v in pairs(serialize_defaults) do\n\
+ if not opts[k] then\n\
+ opts[k]=v\n\
+ end\n\
+ end\n\
+ else\n\
+ opts=serialize_defaults\n\
+ end\n\
+ local r={}\n\
+ serialize_r(v,opts,r)\n\
+ return table.concat(r)\n\
+end\n"
+
#define PTP_CHDK_LUA_SERIALIZE_MSGS \
PTP_CHDK_LUA_SERIALIZE\
"usb_msg_table_to_string=serialize\n"
+#define PTP_CHDK_LUA_SERIALIZE_MSGS_SIMPLEQUOTE \
+PTP_CHDK_LUA_SERIALIZE_SIMPLEQUOTE\
+"usb_msg_table_to_string=serialize\n"
+
#define PTP_CHDK_LUA_EXTEND_TABLE \
"function extend_table(target,source,deep)\n\
if type(target) ~= 'table' then\n\
@@ -14,13 +14,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gphoto/libgphoto2-${PV}.tar.bz2;name=libgphoto2
file://10-camera-libgphoto2.fdi \
file://40-libgphoto2.rules \
file://0001-configure.ac-remove-AM_PO_SUBDIRS.patch \
file://0002-correct-jpeg-memsrcdest-support.patch \
file://avoid_using_sprintf.patch \
file://0001-scripts-remove-bashisms.patch \
"
SRC_URI[libgphoto2.md5sum] = "873ab01aced49c6b92a98e515db5dcef"
SRC_URI[libgphoto2.sha256sum] = "031a262e342fae43f724afe66787947ce1fb483277dfe5a8cf1fbe92c58e27b6"
SRC_URI[libgphoto2.md5sum] = "65acb6cbd2b4f3f46829599f5dabd89c"
SRC_URI[libgphoto2.sha256sum] = "d3ce70686fb87d6791b9adcbb6e5693bfbe1cfef9661c23c75eb8a699ec4e274"
inherit autotools pkgconfig gettext lib_package
@@ -54,3 +51,4 @@ FILES_libgphotoport = "${libdir}/libgphoto2_port.so.*"
FILES_${PN} += "${nonarch_base_libdir}/udev/* ${datadir}/hal"
FILES_${PN}-dbg += "${libdir}/*/*/.debug"
FILES_${PN}-dev += "${libdir}/*/*/*.la"
FILES_${PN}-doc += "${datadir}/libgphoto2_port/0.12.0/vcamera/README.txt"