x11-misc/mugshot: New package
authorConrad Kostecki <conrad@kostecki.com>
Sat, 7 Jul 2018 22:11:08 +0000 (00:11 +0200)
committerTony Vroon <chainsaw@gentoo.org>
Wed, 11 Jul 2018 08:29:25 +0000 (09:29 +0100)
Closes: https://bugs.gentoo.org/571382
Package-Manager: Portage-2.3.41, Repoman-2.3.9
Closes: https://github.com/gentoo/gentoo/pull/9103
Closes: https://bugs.gentoo.org/571382

x11-misc/mugshot/Manifest [new file with mode: 0644]
x11-misc/mugshot/files/fix_env_spawn_args.patch [new file with mode: 0644]
x11-misc/mugshot/files/missing_default_face.patch [new file with mode: 0644]
x11-misc/mugshot/files/use_office_phone.patch [new file with mode: 0644]
x11-misc/mugshot/metadata.xml [new file with mode: 0644]
x11-misc/mugshot/mugshot-0.4.0.ebuild [new file with mode: 0644]

diff --git a/x11-misc/mugshot/Manifest b/x11-misc/mugshot/Manifest
new file mode 100644 (file)
index 0000000..6328edd
--- /dev/null
@@ -0,0 +1 @@
+DIST mugshot-0.4.0.tar.gz 126101 BLAKE2B be0d84fd09a1ff6477d32a77d979b1606597b2ca38524b9cc65c254dd9d5d43697123b10d2b836c1193a9ba0f3dadebb15d1fe89ab7fb1743cc7b4d177ace65d SHA512 5936ec3def5a70db21f9bcc7fce873ce374f8df0795fb944593f398704dcba8c81be30393603e1753e176da87f4a6fd8a3218de2aeb7f33ea6018735ce1b2c09
diff --git a/x11-misc/mugshot/files/fix_env_spawn_args.patch b/x11-misc/mugshot/files/fix_env_spawn_args.patch
new file mode 100644 (file)
index 0000000..bb24418
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/mugshot_lib/SudoDialog.py        2018-04-12 00:23:21.000000000 +0200
++++ b/mugshot_lib/SudoDialog.py        2018-06-22 22:21:10.876589365 +0200
+@@ -48,7 +48,7 @@
+             return False
+     # Check for LANG requirements
+-    child = env_spawn('sudo -v', 1)
++    child = env_spawn('sudo', ['-v'], 1)
+     if child.expect([".*ssword.*", "Sorry",
+                      pexpect.EOF,
+                      pexpect.TIMEOUT]) == 3:
+@@ -57,7 +57,7 @@
+     child.close()
+     # Check for sudo rights
+-    child = env_spawn('sudo -v', 1)
++    child = env_spawn('sudo', ['-v'], 1)
+     try:
+         index = child.expect([".*ssword.*", "Sorry",
+                               pexpect.EOF, pexpect.TIMEOUT])
+@@ -76,14 +76,14 @@
+     return False
+-def env_spawn(command, timeout):
++def env_spawn(command, args, timeout):
+     """Use pexpect.spawn, adapt for timeout and env requirements."""
+     env = os.environ
+     env["LANG"] = "C"
+     if use_env:
+-        child = pexpect.spawn(command, env)
++        child = pexpect.spawn(command, args, env)
+     else:
+-        child = pexpect.spawn(command)
++        child = pexpect.spawn(command, args)
+     child.timeout = timeout
+     return child
+@@ -304,7 +304,7 @@
+         Return True if successful.
+         '''
+         # Set the pexpect variables and spawn the process.
+-        child = env_spawn('sudo /bin/true', 1)
++        child = env_spawn('sudo', ['/bin/true'], 1)
+         try:
+             # Check for password prompt or program exit.
+             child.expect([".*ssword.*", pexpect.EOF])
diff --git a/x11-misc/mugshot/files/missing_default_face.patch b/x11-misc/mugshot/files/missing_default_face.patch
new file mode 100644 (file)
index 0000000..0d25fb6
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/mugshot/MugshotWindow.py 2018-04-12 00:23:21.000000000 +0200
++++ b/mugshot/MugshotWindow.py 2018-06-22 22:27:05.515588012 +0200
+@@ -257,10 +257,11 @@
+             logger.debug('Found profile image: %s' % str(image))
+             if os.path.isfile(face):
+-                if os.path.samefile(image, face):
+-                    self.updated_image = face
+-                else:
+-                    self.updated_image = None
++                if os.path.exists(image):
++                    if os.path.samefile(image, face):
++                        self.updated_image = face
++                    else:
++                        self.updated_image = None
+                 self.set_user_image(face)
+             elif os.path.isfile(image):
+                 self.updated_image = image
diff --git a/x11-misc/mugshot/files/use_office_phone.patch b/x11-misc/mugshot/files/use_office_phone.patch
new file mode 100644 (file)
index 0000000..bea3f7c
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/mugshot/MugshotWindow.py 2018-06-22 22:33:03.980586645 +0200
++++ b/mugshot/MugshotWindow.py 2018-06-22 22:41:44.120584661 +0200
+@@ -614,10 +614,14 @@
+         logger.debug('Updating Office Phone...')
+         command = "%s -w \"%s\" %s" % (chfn, office_phone, username)
++        command2 = "%s -o \"%s\" %s" % (chfn, office_phone, username)
+         if self.process_terminal_password(command, password):
+             self.office_phone = office_phone
+         else:
+-            success = False
++            if self.process_terminal_password(command2, password):
++                self.office_phone = office_phone
++            else:
++                success = False
+         return (success, response)
diff --git a/x11-misc/mugshot/metadata.xml b/x11-misc/mugshot/metadata.xml
new file mode 100644 (file)
index 0000000..9e14366
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>ck+gentoo@bl4ckb0x.de</email>
+               <name>Conrad Kostecki</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               Mugshot is a lightweight user configuration utility.
+               Mugshot allows you to easily set profile image
+               and user details for your user profile and any supported applications.
+       </longdescription>
+       <use>
+               <flag name="gnome">Add support for <pkg>gnome-base/gnome-control-center</pkg></flag>
+               <flag name="libreoffice">Add support for <pkg>app-office/libreoffice</pkg> and <pkg>app-office/libreoffice-bin</pkg></flag>
+               <flag name="pidgin">Add support for setting the avatar in <pkg>net-im/pidgin</pkg> </flag>
+               <flag name="webcam">Add support for setting a profile photo in <pkg>media-video/cheese</pkg></flag>
+       </use>
+       <upstream>
+               <bugs-to>https://bugs.launchpad.net/mugshot</bugs-to>
+               <remote-id type="launchpad">mugshot</remote-id>
+       </upstream>
+</pkgmetadata>
diff --git a/x11-misc/mugshot/mugshot-0.4.0.ebuild b/x11-misc/mugshot/mugshot-0.4.0.ebuild
new file mode 100644 (file)
index 0000000..23ceab5
--- /dev/null
@@ -0,0 +1,54 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1 eapi7-ver gnome2-utils
+
+DESCRIPTION="A lightweight user-configuration application"
+HOMEPAGE="https://launchpad.net/mugshot"
+SRC_URI="https://launchpad.net/${PN}/$(ver_cut 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="gnome libreoffice pidgin webcam"
+
+RDEPEND="dev-libs/gobject-introspection
+       dev-python/dbus-python[${PYTHON_USEDEP}]
+       dev-python/pexpect[${PYTHON_USEDEP}]
+       dev-python/pycairo[${PYTHON_USEDEP}]
+       dev-python/pygobject:3[${PYTHON_USEDEP}]
+       sys-apps/accountsservice
+       x11-libs/gtk+:3
+       gnome? ( gnome-base/gnome-control-center )
+       libreoffice? ( || ( app-office/libreoffice-bin app-office/libreoffice ) )
+       pidgin? ( net-im/pidgin[${PYTHON_USEDEP}] )
+       webcam? ( media-libs/gstreamer:1.0
+               media-libs/gst-plugins-good:1.0
+               gnome? ( media-libs/clutter-gtk[introspection]
+                       media-video/cheese[introspection] ) )"
+
+DEPEND="dev-python/python-distutils-extra[${PYTHON_USEDEP}]
+       dev-util/intltool
+       ${RDEPEND}"
+
+PATCHES=(
+       # https://bugs.launchpad.net/ubuntu/+source/mugshot/+bug/1443283
+       "${FILESDIR}/fix_env_spawn_args.patch"
+       # Both patches are taken from Arch Linux
+       "${FILESDIR}/missing_default_face.patch"
+       "${FILESDIR}/use_office_phone.patch"
+)
+
+pkg_postinst() {
+       gnome2_schemas_update
+       gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+       gnome2_schemas_update
+       gnome2_icon_cache_update
+}