New package: gphoto2 (#2831)

* New package: gphoto2

* Adding popt as dependency
This commit is contained in:
Peter Budai
2017-09-03 20:46:53 +02:00
committed by Алексей
parent 1828f84db5
commit 7eb5bec0aa
2 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
commit ca4768323365cf347c7c7be59dbb04c51ae0a6a1
Author: peterbud <peterbudai@hotmail.com>
Date: Mon Aug 28 14:10:49 2017 +0200
Close temp files before rename
diff --git a/gphoto2/actions.c b/gphoto2/actions.c
index f34088e..8c8b51f 100644
--- a/gphoto2/actions.c
+++ b/gphoto2/actions.c
@@ -978,6 +978,9 @@ _action_camera_capture_preview (GPParams *p, int viewasciiart)
return (r);
}
+ //close the temp file as you cannot rename it later
+ if (fd) close (fd);
+
/* name it file_%filename if --filename is set, otherwise capture_preview */
r = save_camera_file_to_file (NULL, "capture_preview", p->filename?GP_FILE_TYPE_PREVIEW:GP_FILE_TYPE_NORMAL, file, tmpfilename);
gp_file_unref (file);
@@ -1016,7 +1019,7 @@ action_camera_capture_movie (GPParams *p, const char *arg)
fd = dup(fileno(stdout));
xname = "stdout";
} else {
- fd = open("movie.mjpg",O_WRONLY|O_CREAT,0660);
+ fd = open("movie.mjpg",O_WRONLY | O_CREAT | O_BINARY,0660);
if (fd == -1) {
cli_error_print(_("Could not open 'movie.mjpg'."));
return GP_ERROR;
@@ -1070,6 +1073,9 @@ action_camera_capture_movie (GPParams *p, const char *arg)
}
gp_file_unref (file);
+ //close the temp file as you cannot rename it later
+ if (fd) close (fd);
+
fprintf(stderr,_("Movie capture finished (%d frames)\n"), captured_frames);
return GP_OK;
}
diff --git a/gphoto2/main.c b/gphoto2/main.c
index 01a045e..383ac28 100644
--- a/gphoto2/main.c
+++ b/gphoto2/main.c
@@ -688,9 +688,14 @@ save_file_to_file (Camera *camera, GPContext *context, Flags flags,
unlink (tmpname);
return (GP_OK);
}
- res = save_camera_file_to_file (folder, filename, type, file, tmpfilename);
+
+ //close the temp file as you cannot rename it later
if (ps && ps->fd) close (ps->fd);
free (ps);
+ ps = NULL;
+ if (fd) close (fd);
+
+ res = save_camera_file_to_file (folder, filename, type, file, tmpfilename);
gp_file_unref (file);
if ((res!=GP_OK) && tmpfilename)
unlink (tmpfilename);

View File

@@ -0,0 +1,44 @@
# Maintainer: Peter Budai <peterbudai at hotmail dot com>
_realname=gphoto2
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.5.14
pkgrel=1
pkgdesc="The gphoto2 commandline tool for accessing and controlling digital cameras. (mingw-w64)"
arch=('any')
url='http://www.gphoto.org/'
license=('GNU')
depends=("${MINGW_PACKAGE_PREFIX}-libgphoto2"
"${MINGW_PACKAGE_PREFIX}-popt")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-libtool")
validpgpkeys=('7C4AFD61D8AAE7570796A5172209D6902F969C95') # Marcus Meissner
source=("https://sourceforge.net/projects/gphoto/files/gphoto/2.5.14/${_realname}-${pkgver}.tar.gz"
"01_gphoto_close_before_rename.patch")
sha256sums=('b85dcdf127b201a705f8c766e172b85191894cdc6b993a3821df3f40f7d01bed'
'ca4e431c4f2bca1272a6580ebab7d81a82fa38fad07624cc8c6328b458293b19')
prepare() {
cd $srcdir/${_realname}-${pkgver}
patch -p1 -i ${srcdir}/01_gphoto_close_before_rename.patch
}
build() {
cd "$srcdir"/${_realname}-${pkgver}
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST}
make
}
package() {
cd "${srcdir}"/build-${CARCH}
make install DESTDIR="${pkgdir}"
}