libraries/libgphoto2: Updated for version 2.4.0

This commit is contained in:
Frank Caraballo 2010-05-11 19:45:15 +02:00 committed by Robby Workman
parent e1512087c9
commit 66d5bcb5b2
6 changed files with 122 additions and 143 deletions

View file

@ -1,45 +1,5 @@
libgphoto2 is a library that can be used by applications to access
various digital cameras.
The resulting package checks /var/log/packages for your installed udev
version and generates udev rules in the post-install stage. For those
of you still using the old hotplug subsystem, it also adds the file
/etc/hotplug/usb/usbcam during the packaging and appends some text to
/etc/hotplug/usb.usermap in the post-install stage. This appending is
not normally something that we would do with any of our scripts, but in
this case, it should be completely harmless; however, a backup copy of
the file is left in the same directory just in case.
Since version 2.3.1 build 3, there are two different groups granting
access to your digital camera for non-root users via udev and hotplug.
From now on the udev rules generated during install set device ownership
to the 'plugdev' group. If this group does not yet exist (users of HAL
should have this group already), you will need to create it and add any
users that may access the camera. A recommended way for adding the 'plugdev'
group would be:
/usr/sbin/groupadd -g 83 plugdev
Hotplug users still have to use the group 'camera' and add any users that
should be permitted to access the camera to this group. Alternatively,
you can edit the included doinst.sh file to change "group plugdev" to
"group users" (if you're using udev) or edit /etc/hotplug/usb/usbcam after
the package is installed and change "camera" to "users" (if you're using
hotplug) if you want all users to have access to cameras.
The resulting package *should* work without any manual setup, but in our
testing here, it seems that some cameras aren't recognized by the installed
udev rules. There is at least one reliable report of a change that *may* be
needed if you're using udev-097 from Slackware 11.0:
This:
BUS!="usb*", GOTO="libgphoto2_rules_end"
should perhaps be this:
SUBSYSTEM!="usb*", GOTO="libgphoto2_rules_end"
However, if the rules installed by libgphoto2 work for you, don't change
anything - this should only be done if they don't work. Note that this is
*not* a bug in the build script or implementation - we just use the provided
tools with libgphoto2 to generate the udev rules; as such, any bug reports
with the udev rules should go to them (feel free to CC our -users list).
The udev rules generated during install set device ownership to the
'plugdev' group.

View file

@ -1,36 +1,12 @@
#!/bin/sh
#!/bin/bash
# Check to see if udev package is installed
if [ -e var/log/packages/udev-* ]; then
# Get udev version
UDEV_VERSION=$(basename var/log/packages/udev-* | cut -d- -f2)
# Generate udev rules files
if [ "$UDEV_VERSION" -lt "098" ]; then
usr/bin/print-camera-list udev-rules mode 0660 owner root group plugdev \
>> etc/udev/rules.d/90-libgphoto2.rules
elif [ "$UDEV_VERSION" -ge "098" ]; then
usr/bin/print-camera-list udev-rules-0.98 mode 0660 owner root group plugdev \
>> etc/udev/rules.d/90-libgphoto2.rules
fi
fi
# Generate udev rules files
usr/bin/print-camera-list udev-rules mode 0660 group plugdev \
>> etc/udev/rules.d/90-libgphoto2.rules
# Generate files for old hotplug support
if [ -e etc/hotplug/usb.usermap ]; then
cat etc/hotplug/usb.usermap > etc/hotplug/usb.usermap.bak
rm -rf tmp/.usermap
grep -v usbcam etc/hotplug/usb.usermap > tmp/.usermap
usr/bin/print-camera-list usb-usermap usbcam >> tmp/.usermap
cat tmp/.usermap > etc/hotplug/usb.usermap
rm -f tmp/.usermap
else
usr/bin/print-camera-list usb-usermap usbcam > etc/hotplug/usb.usermap
fi
# Check to see if hal is installed and generate fdi files
if [ -e var/log/packages/hal-[0-9]* ]; then
usr/bin/print-camera-list hal-fdi \
>> usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
usr/bin/print-camera-list hal-fdi-device \
>> usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2-device.fdi
fi
# Install hal device information files
usr/bin/print-camera-list hal-fdi \
> usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
usr/bin/print-camera-list hal-fdi-device \
> usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2-device.fdi

View file

@ -2,32 +2,31 @@
# Slackware build script for libgphoto2
# Written by MagicMan <MagicMan07@bluebottle.com>
# Written by Frank Caraballo <fecaraballo[AT]gmail.com>
# No Guarantees. Use this SlackBuild at your own risk.
# Public Domain
# Modified by the SlackBuilds.org project
# Modified by Michael Wagner <lapinours@web.de>
# (include hal device information files, change group ownership
# for udev rules to plugdev, adjust README)
# (change group ownership for udev rules to plugdev, adjust README)
# Do not blame the original author if anything goes wrong with these changes.
# Modified by Robby Workman <rworkman@slackbuilds.org> to fix a bug in
# the way the fdi files are created (the xml header must be the first line,
# so we can't append the autogenerated rules - they must overwrite the file)
# Thanks to amrit for the report.
PRGNAM=libgphoto2
VERSION=2.3.1
VERSION=2.4.0
ARCH=${ARCH:-i486}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
PDOCS="ABOUT-NLS ChangeLog HACKING INSTALL MAINTAINERS README.in TESTERS"
# If you have HAL installed, pass HAL=YES when running the build script
# HAL=YES ./libgphoto2.SlackBuild
HAL=${HAL:-NO}
DOCS="ABOUT-NLS ChangeLog HACKING INSTALL MAINTAINERS README.in TESTERS"
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
@ -44,18 +43,14 @@ cd $PRGNAM-$VERSION || exit 1
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Patch print-camera-list.c to ignore zero vendor IDs on udev >= 098
# https://bugs.launchpad.net/ubuntu/+source/udev/+bug/76077
# This is a harmless patch for stock 11.0
# Patch print-camera-list.c for newer kernels
patch -p0 < $CWD/print-camera-list.c.diff || exit 1
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-static=no \
--disable-static \
--mandir=/usr/man \
--with-doc-dir=/usr/doc/$PRGNAM-$VERSION \
|| exit 1
@ -70,45 +65,30 @@ make \
install-strip DESTDIR=$PKG \
|| exit 1
# Install usbcam file for old hotplug subsystem to work properly
install -D -m 0755 packaging/linux-hotplug/usbcam.group \
$PKG/etc/hotplug/usb/usbcam
# Install "dummy" udev rules files and (maybe) HAL device information files so
# they will be removed later if the package is uninstalled; the post-install
# script will append auto-generated rules to these files
mkdir -p $PKG/etc/udev/rules.d
# Install "dummy" udev rules file so it will be removed later if the package
# is uninstalled; the post-install script will append auto-generated rules
mkdir -p $PKG/etc/udev/rules.d
cat << EOF > $PKG/etc/udev/rules.d/90-libgphoto2.rules
# DO NOT EDIT THIS FILE!
# Any custom changes will be lost if the libgphoto package is upgraded.
EOF
# If HAL is installed, then also install the fdi files for it
if [ "$HAL" = "YES" ]; then
mkdir -p $PKG/usr/share/hal/fdi/information/20thirdparty
cat << EOF > $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
<!-- DO NOT EDIT THIS FILE! -->
<!-- Any custom changes will be lost if the libgphoto package is upgraded. -->
EOF
cat << EOF > $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2-device.fdi
<!-- DO NOT EDIT THIS FILE! -->
<!-- Any custom changes will be lost if the libgphoto package is upgraded. -->
EOF
fi
touch $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
touch $PKG/usr/share/hal/fdi/information/20thirdparty/10-camera-libgphoto2-device.fdi
# Compress man pages
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $PDOCS $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# We don't need these
rm -rf $PKG/usr/doc/$PRGNAM-$VERSION/{apidocs.html,linux-hotplug,README.apidocs}
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

View file

@ -1,8 +1,8 @@
PRGNAM="libgphoto2"
VERSION="2.3.1"
VERSION="2.4.0"
HOMEPAGE="http://www.gphoto.org/"
DOWNLOAD="http://dl.sourceforge.net/gphoto/libgphoto2-2.3.1.tar.bz2"
MD5SUM="37f85e34e5b6031ddf6cac8b8782ac4f"
MAINTAINER="MagicMan"
EMAIL="MagicMan07@bluebottle.com"
DOWNLOAD="http://downloads.sourceforge.net/gphoto/libgphoto2-2.4.0.tar.bz2"
MD5SUM="a60154772635b693ff08b4f34dea7f61"
MAINTAINER="Frank Caraballo"
EMAIL="fecaraballo[AT]gmail.com"
APPROVED="rworkman"

View file

@ -1,20 +1,75 @@
--- packaging/generic/print-camera-list.c (Revision 9959)
+++ packaging/generic/print-camera-list.c (Revision 9960)
@@ -333,7 +333,7 @@
| GP_USB_HOTPLUG_MATCH_PRODUCT_ID);
usb_vendor = a->usb_vendor;
usb_product = a->usb_product;
- } else if ((a->usb_class) && (a->usb_class != 666)) {
+ } else if (a->usb_class) {
class = a->usb_class;
subclass = a->usb_subclass;
proto = a->usb_protocol;
@@ -446,7 +446,7 @@
| GP_USB_HOTPLUG_MATCH_PRODUCT_ID);
usb_vendor = a->usb_vendor;
usb_product = a->usb_product;
- } else if ((a->usb_class) && (a->usb_class != 666)) {
+ } else if (a->usb_class) {
class = a->usb_class;
subclass = a->usb_subclass;
proto = a->usb_protocol;
--- packaging/generic/print-camera-list.c 2007-07-27 02:35:28.000000000 +0200
+++ packaging/generic/print-camera-list.c.new 2008-02-22 20:24:35.000000000 +0100
@@ -382,14 +382,31 @@
char *owner;
char *group;
char *script;
- char *begin_string;
- char *usbcam_string;
+ const char *begin_string;
+ const char *usbcam_string;
} udev_persistent_data_t;
static void
udev_parse_params (const func_params_t *params, void **data)
{
+ /* Note: 2 lines because we need to use || ... having them on the same
+ * line would mean &&.
+ */
+ static const char * const begin_strings[] = {
+ /* UDEV_PRE_0_98 */
+ "BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
+ "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
+ /* UDEV_0_98 */
+ "SUBSYSTEM!=\"usb|usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
+ "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"
+ };
+ static const char * const usbcam_strings[] = {
+ /* UDEV_PRE_0_98 */
+ "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ",
+ /* UDEV_0_98 */
+ "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ",
+ };
udev_persistent_data_t *pdata;
pdata = calloc(1, sizeof(udev_persistent_data_t));
pdata->version = UDEV_0_98;
@@ -436,37 +453,12 @@
FATAL("The <script> parameter conflicts with the <mode,group,owner> parameters.");
}
- /* Note: 2 lines because we need to use || ... having them on the same
- * line would mean &&.
- */
- static char *begin_strings[] = {
- /* UDEV_PRE_0_98 */
- "BUS!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
- "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
- /* UDEV_0_98 */
- "SUBSYSTEM!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
- "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"
- };
- static char *usbcam_strings[] = {
- /* UDEV_PRE_0_98 */
- "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ",
- /* UDEV_0_98 */
- "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ",
- };
pdata->begin_string = begin_strings[pdata->version];
pdata->usbcam_string = usbcam_strings[pdata->version];
}
-static void
-version_str_func(const char *str, void *data)
-{
- const char **foo = (const char **)data;
- fprintf(stdout, "V[%s]", str);
- fflush(stdout);
- *foo = str;
-}
-static inline const char *
+static const char *
get_version_str(udev_version_t version)
{
return gpi_enum_to_string(version, udev_version_t_map);

View file

@ -1,7 +1,15 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler-------------------------------------------------|
libgphoto2: libgphoto2 (Digital Camera Library)
libgphoto2:
libgphoto2: libgphoto2 is a library that can be used by applications
libgphoto2: to access various digital cameras.
libgphoto2: libgphoto2 is a library that can be used by
libgphoto2: applications to access various digital cameras.
libgphoto2:
libgphoto2: Homepage: http://www.gphoto.org/
libgphoto2: