From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QTOeM-0002HE-Vk for garchives@archives.gentoo.org; Mon, 06 Jun 2011 01:30:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0356A1C078; Mon, 6 Jun 2011 01:30:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A24471C078 for ; Mon, 6 Jun 2011 01:30:31 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 13EC02AC06D for ; Mon, 6 Jun 2011 01:30:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2AD288003C for ; Mon, 6 Jun 2011 01:30:30 +0000 (UTC) From: "Sebastian Pipping" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sebastian Pipping" Message-ID: <7e1322197f2dcf66990ec75a162cd066ef400591.sping@gentoo> Subject: [gentoo-commits] proj/betagarden:master commit in: profiles/, media-gfx/cataract/, media-gfx/cataract/files/ X-VCS-Repository: proj/betagarden X-VCS-Files: media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.patch media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporting.patch profiles/package.mask X-VCS-Directories: profiles/ media-gfx/cataract/ media-gfx/cataract/files/ X-VCS-Committer: sping X-VCS-Committer-Name: Sebastian Pipping X-VCS-Revision: 7e1322197f2dcf66990ec75a162cd066ef400591 Date: Mon, 6 Jun 2011 01:30:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 147c657f6814a897fc8ba0ad301107cd commit: 7e1322197f2dcf66990ec75a162cd066ef400591 Author: Sebastian Pipping pipping org> AuthorDate: Mon Jun 6 01:29:23 2011 +0000 Commit: Sebastian Pipping gentoo org> CommitDate: Mon Jun 6 01:29:23 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/betagarden.gi= t;a=3Dcommit;h=3D7e132219 media-gfx/cataract: 1.1.0_p20110326_p2 --- .../cataract/cataract-1.1.0_p20110326_p2.ebuild | 48 ++++ ...cataract-1.1.0_p20110326-exif-orientation.patch | 286 ++++++++++++++= ++++++ ...aract-1.1.0_p20110326-setup.xml-reporting.patch | 123 +++++++++ profiles/package.mask | 4 + 4 files changed, 461 insertions(+), 0 deletions(-) diff --git a/media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild b/medi= a-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild new file mode 100644 index 0000000..721a328 --- /dev/null +++ b/media-gfx/cataract/cataract-1.1.0_p20110326_p2.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3D"2" + +inherit versionator autotools + +MY_PV=3D$(get_version_component_range 1-4) +MY_P=3D"${PN}-${MY_PV}" + +DESCRIPTION=3D"Simple static web photo gallery, designed to be clean and= easily usable." +HOMEPAGE=3D"http://cgg.bzatek.net/" +SRC_URI=3D"http://www.hartwork.org/public/${MY_P}.tar.bz2" + +LICENSE=3D"|| ( GPL-2 GPL-3 )" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86" +IUSE=3D"" + +RDEPEND=3D"dev-libs/glib + dev-libs/libxml2 + media-gfx/imagemagick + media-gfx/exiv2" +DEPEND=3D"${RDEPEND} + dev-util/pkgconfig" + +S=3D"${WORKDIR}"/${MY_P} + +src_prepare() { + epatch "${FILESDIR}"/${MY_P}-setup.xml-reporting.patch \ + "${FILESDIR}"/${MY_P}-exif-orientation.patch + + mkdir m4 # Workaround for aclocal + eautoreconf +} + +src_install() { + emake DESTDIR=3D"${D}" install || die + dodoc NEWS README AUTHORS || die + + # Install sample + rm sample/{gen.sh,Makefile*} || die + sed 's|../../templates|/usr/share/cgg|' \ + -i sample/src/setup.xml || die + insinto /usr/share/cgg/ + doins -r sample || die +} diff --git a/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orien= tation.patch b/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-ori= entation.patch new file mode 100644 index 0000000..553a618 --- /dev/null +++ b/media-gfx/cataract/files/cataract-1.1.0_p20110326-exif-orientation.= patch @@ -0,0 +1,286 @@ +From c73706517be3141742f575aa2f18050aa78954f4 Mon Sep 17 00:00:00 2001 +From: Sebastian Pipping +Date: Mon, 6 Jun 2011 02:45:56 +0200 +Subject: [PATCH 2/2] Add support for EXIF orientation tags + +--- + src/generators.c | 16 ++++--- + src/jpeg-utils.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++++= ++++-- + src/jpeg-utils.h | 8 +++- + 3 files changed, 118 insertions(+), 14 deletions(-) + +diff --git a/src/generators.c b/src/generators.c +index 95bed37..1a865a5 100644 +--- a/src/generators.c ++++ b/src/generators.c +@@ -1,5 +1,6 @@ + /* Cataract - Static web photo gallery generator + * Copyright (C) 2008 Tomas Bzatek ++ * Copyright (C) 2011 Sebastian Pipping + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -158,7 +159,8 @@ generate_image (TGallerySetup *setup, +=20 + /* Do something when necessary */ + if (res) { +- get_image_sizes (img_src_full, &new_w, &new_h); ++ OrientationType orientation =3D UndefinedOrientation; ++ get_image_sizes (img_src_full, &new_w, &new_h, &orientation); +=20 + if (new_w > 0 && new_h > 0) { + stats_images_inc (); +@@ -166,7 +168,7 @@ generate_image (TGallerySetup *setup, +=20 + /* Generate thumbnail */ + g_assert (thumb_src_full !=3D NULL); +- get_image_sizes (thumb_src_full, &thumb_w, &thumb_h); ++ get_image_sizes (thumb_src_full, &thumb_w, &thumb_h, NULL); +=20 + if (thumb_w > 0 && thumb_h > 0) { + if (! item->hidden) { +@@ -180,7 +182,7 @@ generate_image (TGallerySetup *setup, + calculate_sizes (setup->thumbnail_portrait_width, setup->th= umbnail_portrait_height, &thumb_w, &thumb_h); + else + calculate_sizes (setup->thumbnail_landscape_width, setup->t= humbnail_landscape_height, &thumb_w, &thumb_h); +- if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb= _h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type)) ++ if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb= _h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type, orient= ation)) + log_error ("generate_image: error resizing thumbnail %s\n",= thumb_src_full); + } + } else { +@@ -215,7 +217,7 @@ generate_image (TGallerySetup *setup, + } +=20 + g_assert (img_src_full !=3D NULL); +- if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq= , FALSE, 0)) ++ if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq= , FALSE, 0, orientation)) + log_error ("generate_image: error resizing big image %s\n",= img_src_full); + } + else { +@@ -465,7 +467,7 @@ write_html_album (TGallerySetup *setup, + s2 =3D item_get_thumbnail_src (setup, items, item, i); + if (s2 !=3D NULL) { + s4 =3D g_build_filename (path_info->dest_dir, setup->th= umbnail_dir, s2, NULL); +- get_image_sizes (s4, &img_thumb_w, &img_thumb_h); ++ get_image_sizes (s4, &img_thumb_w, &img_thumb_h, NULL); + g_free (s4); + s1 =3D (img_thumb_h > img_thumb_w) ? "IMG_LIST_PORTRAIT= " : "IMG_LIST_LANDSCAPE"; + } +@@ -649,12 +651,12 @@ write_html_image (TGallerySetup *setup, + log_error ("write_html_image: error getting exif data from file \"%= s\"\n", orig_dst); +=20 + /* Retrieve image sizes of preview and original image */ +- get_image_sizes (big_dst, &img_big_w, &img_big_h); ++ get_image_sizes (big_dst, &img_big_w, &img_big_h, NULL); + image_fullsize =3D item->force_fullsize || setup->override_nofullsize= || + (parent_items->fullsize && ! item->force_nofullsize)= || + (! item->force_nofullsize && ! parent_items->nofulls= ize && ! setup->nofullsize); + if (image_fullsize) +- get_image_sizes (orig_dst, &img_orig_w, &img_orig_h); ++ get_image_sizes (orig_dst, &img_orig_w, &img_orig_h, NULL); +=20 + /* Get title and description from IPTC/EXIF/JPEG if not defined */ + title =3D g_strdup (item->title); +diff --git a/src/jpeg-utils.cpp b/src/jpeg-utils.cpp +index 55e3442..0e057b3 100644 +--- a/src/jpeg-utils.cpp ++++ b/src/jpeg-utils.cpp +@@ -1,5 +1,6 @@ + /* Cataract - Static web photo gallery generator + * Copyright (C) 2008 Tomas Bzatek ++ * Copyright (C) 2011 Sebastian Pipping + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -22,8 +23,6 @@ + #include + #include +=20 +-#include +- + #include +=20 + #include "jpeg-utils.h" +@@ -225,6 +224,47 @@ free_exif_data (TExifData *data) + } +=20 +=20 ++OrientationType get_image_orientation(const char * filename) { ++ OrientationType lookup[] =3D { ++ UndefinedOrientation, ++ TopLeftOrientation, ++ TopRightOrientation, ++ BottomRightOrientation, ++ BottomLeftOrientation, ++ LeftTopOrientation, ++ RightTopOrientation, ++ RightBottomOrientation, ++ LeftBottomOrientation ++ }; ++ ++ unsigned long val =3D 0; ++ try ++ { ++ Exiv2::Image::AutoPtr image =3D Exiv2::ImageFactory::open (filenam= e); ++ g_assert (image.get() !=3D 0); ++ image->readMetadata(); ++ ++ Exiv2::ExifData &exifData =3D image->exifData(); ++ try { ++ if (! exifData.empty()) { ++ val =3D exifData["Exif.Image.Orientation"].toLong(); ++ } ++ } catch (...) { } ++ } ++ catch (Exiv2::AnyError& e) ++ { ++ log_error ("get_exif: Caught Exiv2 exception: '%s'\n", e.what()); ++ } ++ ++ if (val >=3D sizeof(lookup)/sizeof(OrientationType)) { ++ return UndefinedOrientation; ++ } else { ++ return lookup[val]; ++ } ++} ++ ++ ++ + /* + * resize_image: resize image pointed by src and save result to dst + */ +@@ -233,7 +273,8 @@ resize_image (const gchar *src, const gchar *dst, + unsigned long size_x, unsigned long size_y, + int quality, + gboolean thumbnail, +- ThumbnailSquareType squared_thumbnail_type) ++ ThumbnailSquareType squared_thumbnail_type, ++ OrientationType orientation) + { + MagickWand *magick_wand; + ExceptionType severity; +@@ -251,6 +292,40 @@ resize_image (const gchar *src, const gchar *dst, + return FALSE; + } +=20 ++ ++ /* http://sylvana.net/jpegcrop/exif_orientation.html */ ++ PixelWand *dummy_background =3D NewPixelWand(); ++ switch (orientation) { ++ case TopRightOrientation: ++ MagickFlopImage(magick_wand); ++ break; ++ case BottomRightOrientation: ++ MagickRotateImage(magick_wand, dummy_background, 180.0); ++ break; ++ case BottomLeftOrientation: ++ MagickFlipImage(magick_wand); ++ break; ++ case LeftTopOrientation: ++ MagickTransposeImage(magick_wand); ++ break; ++ case RightTopOrientation: ++ MagickRotateImage(magick_wand, dummy_background, 90.0); ++ break; ++ case RightBottomOrientation: ++ MagickTransverseImage(magick_wand); ++ break; ++ case LeftBottomOrientation: ++ MagickRotateImage(magick_wand, dummy_background, 270.0); ++ break; ++ case TopLeftOrientation: ++ case UndefinedOrientation: ++ default: ++ break; ++ } ++ DestroyPixelWand(dummy_background); ++ dummy_background =3D NULL; ++ ++ + /* Don't resize if smaller than desired size */ + if (MagickGetImageWidth (magick_wand) > size_x || + MagickGetImageHeight (magick_wand) > size_y) +@@ -291,11 +366,11 @@ resize_image (const gchar *src, const gchar *dst, +=20 +=20 + /* +- * get_image_sizes: retrieve image dimensions ++ * get_image_sizes: retrieve image dimensions (respecting EXIF orient= ation) + */ + void + get_image_sizes (const gchar *img, +- unsigned long *width, unsigned long *height) ++ unsigned long *width, unsigned long *height, Orientati= onType *orientation) + { + MagickWand *magick_wand; + ExceptionType severity; +@@ -316,6 +391,29 @@ get_image_sizes (const gchar *img, + *height =3D MagickGetImageHeight (magick_wand); +=20 + magick_wand =3D DestroyMagickWand (magick_wand); ++ ++ /* ImageMagick's MagickGetOrientation() seems to always return 0 ++ * (even with full image read) so I use exiv2 instead */ ++ const OrientationType recorded_orientation =3D get_image_orientation(= img); ++ ++ switch (recorded_orientation) { ++ case LeftTopOrientation: ++ case RightTopOrientation: ++ case RightBottomOrientation: ++ case LeftBottomOrientation: ++ { /* Swap dimensions */ ++ unsigned long c =3D *height; ++ *height =3D *width; ++ *width =3D c; ++ } ++ break; ++ default: ++ break; ++ } ++ ++ if (orientation) { ++ *orientation =3D recorded_orientation; ++ } + } +=20 +=20 +diff --git a/src/jpeg-utils.h b/src/jpeg-utils.h +index e5845bc..5e16502 100644 +--- a/src/jpeg-utils.h ++++ b/src/jpeg-utils.h +@@ -1,5 +1,6 @@ + /* Cataract - Static web photo gallery generator + * Copyright (C) 2008 Tomas Bzatek ++ * Copyright (C) 2011 Sebastian Pipping + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -19,6 +20,7 @@ + #define __CGG__JPEG_UTILS_H__ +=20 + #include ++#include /* for OrientationType */ + #include "setup.h" +=20 + G_BEGIN_DECLS +@@ -73,13 +75,15 @@ gboolean resize_image (const gchar *src, const gchar= *dst, + unsigned long size_x, unsigned long size_y, + int quality, + gboolean thumbnail, +- ThumbnailSquareType squared_thumbnail_type); ++ ThumbnailSquareType squared_thumbnail_type, ++ OrientationType orientation); +=20 + /* + * get_image_sizes: retrieve image dimensions + */ + void get_image_sizes (const gchar *img, +- unsigned long *width, unsigned long *height); ++ unsigned long *width, unsigned long *height, ++ OrientationType *orientation); +=20 + /* + * calculate_sizes: calculate maximal image sizes within specified li= mits keeping aspect ratio +--=20 +1.7.5.3 + diff --git a/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-= reporting.patch b/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup= .xml-reporting.patch new file mode 100644 index 0000000..c530149 --- /dev/null +++ b/media-gfx/cataract/files/cataract-1.1.0_p20110326-setup.xml-reporti= ng.patch @@ -0,0 +1,123 @@ +From 43577828a097c6f0cc0fe651e3d78b7a9259e248 Mon Sep 17 00:00:00 2001 +From: Sebastian Pipping +Date: Sun, 5 Jun 2011 22:01:09 +0200 +Subject: [PATCH 1/2] Improve error reporting for missing setup.xml, stic= k to + first setup.xml found + +--- + src/cgg.c | 18 ++++++++++++++++-- + src/setup.c | 39 +++++++++++++++++---------------------- + 2 files changed, 33 insertions(+), 24 deletions(-) + +diff --git a/src/cgg.c b/src/cgg.c +index 0f72fb3..ca980ed 100644 +--- a/src/cgg.c ++++ b/src/cgg.c +@@ -1,5 +1,6 @@ + /* Cataract - Static web photo gallery generator + * Copyright (C) 2008 Tomas Bzatek ++ * Copyright (C) 2011 Sebastian Pipping + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -109,6 +110,7 @@ main (int argc, char* argv[]) + time_t time_stop; + gchar *s; + TPathInfo *path_info; ++ gchar *setup_xml_path =3D NULL; +=20 + /* + * this initialize the library and check potential ABI mismatches +@@ -136,11 +138,23 @@ main (int argc, char* argv[]) + } +=20 + /* Read gallery settings */ +- setup =3D find_setup_xml (); ++ setup =3D find_setup_xml (&setup_xml_path); + if (! setup) { +- fprintf (stderr, "error: could not parse gallery settings file\n"); ++ if (! setup_xml_path) { ++ gchar *cwd =3D g_get_current_dir (); ++ gchar *home_cgg =3D g_build_filename (g_getenv ("HOME"), ".cgg", = NULL); ++ gchar *datadir_cgg =3D g_build_filename (DATADIR, "cgg", NULL); ++ fprintf (stderr, "error: could not find setup.xml in\n1) %s\n2) %= s\n3) %s\n", cwd, home_cgg, datadir_cgg); ++ g_free (datadir_cgg); ++ g_free (home_cgg); ++ g_free (cwd); ++ } + return -2; + } ++ if (setup_xml_path) { ++ g_free(setup_xml_path); ++ setup_xml_path =3D NULL; ++ } +=20 + setup->real_templates_dir =3D find_templates_directory (setup); + if (setup->real_templates_dir =3D=3D NULL) { +diff --git a/src/setup.c b/src/setup.c +index 68c3cd3..71553c7 100644 +--- a/src/setup.c ++++ b/src/setup.c +@@ -1,5 +1,6 @@ + /* Cataract - Static web photo gallery generator + * Copyright (C) 2008 Tomas Bzatek ++ * Copyright (C) 2011 Sebastian Pipping + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License +@@ -41,36 +42,30 @@ + * find_setup_xml: try to find setup.xml in standard paths + */ + TGallerySetup * +-find_setup_xml () ++find_setup_xml (gchar **setup_xml_path) + { +- gchar *pth; + gchar *cwd; +- TGallerySetup *setup; +- +- setup =3D NULL; + cwd =3D g_get_current_dir (); +- pth =3D g_build_filename (cwd, SETUP_XML, NULL); ++ ++ *setup_xml_path =3D g_build_filename (cwd, SETUP_XML, NULL); + g_free (cwd); +=20 +- if (g_access (pth, R_OK) =3D=3D 0) +- setup =3D parse_setup_xml (pth); +- g_free (pth); ++ if (g_access (*setup_xml_path, R_OK) =3D=3D 0) ++ return parse_setup_xml (*setup_xml_path); +=20 +- if (! setup) { +- pth =3D g_build_filename (g_getenv ("HOME"), ".cgg", SETUP_XML, NUL= L); +- if (g_access (pth, R_OK) =3D=3D 0) +- setup =3D parse_setup_xml (pth); +- g_free (pth); +- } ++ g_free (*setup_xml_path); ++ *setup_xml_path =3D g_build_filename (g_getenv ("HOME"), ".cgg", SETU= P_XML, NULL); ++ if (g_access (*setup_xml_path, R_OK) =3D=3D 0) ++ return parse_setup_xml (*setup_xml_path); +=20 +- if (! setup) { +- pth =3D g_build_filename (DATADIR, "cgg", SETUP_XML, NULL); +- if (g_access (pth, R_OK) =3D=3D 0) +- setup =3D parse_setup_xml (pth); +- g_free (pth); +- } ++ g_free (*setup_xml_path); ++ *setup_xml_path =3D g_build_filename (DATADIR, "cgg", SETUP_XML, NULL= ); ++ if (g_access (*setup_xml_path, R_OK) =3D=3D 0) ++ return parse_setup_xml (*setup_xml_path); +=20 +- return setup; ++ g_free (*setup_xml_path); ++ *setup_xml_path =3D NULL; ++ return NULL; + } +=20 +=20 +--=20 +1.7.5.3 + diff --git a/profiles/package.mask b/profiles/package.mask index 17f8b40..814916e 100644 --- a/profiles/package.mask +++ b/profiles/package.mask @@ -1 +1,5 @@ ~sys-apps/dbus-9999 + +# 2011-06-06 Sebastian Pipping +# Experimental downstream patches +=3Dmedia-gfx/cataract-1.1.0_p20110326_p2