summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/which
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/which')
-rw-r--r--meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch51
-rw-r--r--meta/recipes-extended/which/which-2.20/remove-declaration.patch16
-rw-r--r--meta/recipes-extended/which/which_2.18.bb40
-rw-r--r--meta/recipes-extended/which/which_2.20.bb35
4 files changed, 142 insertions, 0 deletions
diff --git a/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch b/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
new file mode 100644
index 0000000000..568d4233fd
--- /dev/null
+++ b/meta/recipes-extended/which/which-2.18/fix_name_conflict_group_member.patch
@@ -0,0 +1,51 @@
1# glibc also implements the function group_member. To avoid name conflict,
2# here let us append a "_" to which's version.
3#
4# Signed-off-by Dexuan Cui <dexuan.cui@intel.com>, 2010-08-20
5# (this patch is licensed under GPLv2)
6
7--- which-2.18/bash.c
8+++ which-2.18/bash.c
9@@ -45,7 +45,12 @@
10 * - changed all occurences of 'gid_t' into 'GID_T'.
11 * - exported functions needed in which.c
12 */
13-static int group_member (GID_T gid);
14+
15+/*
16+ * glibc also implements the function group_member. To avoid name conflict,
17+ * here let us append a "_" to which's version.
18+ */
19+static int _group_member (GID_T gid);
20 static char* extract_colon_unit (char const* string, int *p_index);
21
22 /*===========================================================================
23@@ -200,8 +205,8 @@
24
25 /* From bash-2.05b / general.c / line 805 */
26 /* Return non-zero if GID is one that we have in our groups list. */
27-int
28-group_member (GID_T gid)
29+static int
30+_group_member (GID_T gid)
31 {
32 #if defined (HAVE_GETGROUPS)
33 register int i;
34@@ -290,7 +295,7 @@
35 return (X_BIT (u_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
36
37 /* Otherwise, if we are in the owning group, the group permissions apply. */
38- if (group_member (finfo.st_gid))
39+ if (_group_member (finfo.st_gid))
40 return (X_BIT (g_mode_bits (finfo.st_mode))) ? (FS_EXISTS | FS_EXECABLE) : FS_EXISTS;
41
42 /* Otherwise, if we are in the other group, the other permissions apply. */
43@@ -331,7 +336,7 @@
44 /* Given a string containing units of information separated by colons,
45 return the next one pointed to by (P_INDEX), or NULL if there are no more.
46 Advance (P_INDEX) to the character after the colon. */
47-char*
48+static char*
49 extract_colon_unit (char const* string, int* p_index)
50 {
51 int i, start, len;
diff --git a/meta/recipes-extended/which/which-2.20/remove-declaration.patch b/meta/recipes-extended/which/which-2.20/remove-declaration.patch
new file mode 100644
index 0000000000..09b81439b6
--- /dev/null
+++ b/meta/recipes-extended/which/which-2.20/remove-declaration.patch
@@ -0,0 +1,16 @@
1Remove the declaration of group_member since it has already been
2declared in unistd.h
3
4Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
5
6diff -ruN which-2.20-orig/bash.c which-2.20/bash.c
7--- which-2.20-orig/bash.c 2010-08-03 12:59:08.897088878 +0800
8+++ which-2.20/bash.c 2010-08-03 13:17:23.406097212 +0800
9@@ -46,7 +46,6 @@
10 * - changed all occurences of 'gid_t' into 'GID_T'.
11 * - exported functions needed in which.c
12 */
13-static int group_member (GID_T gid);
14 static char* extract_colon_unit (char const* string, int* p_index);
15
16 /*===========================================================================
diff --git a/meta/recipes-extended/which/which_2.18.bb b/meta/recipes-extended/which/which_2.18.bb
new file mode 100644
index 0000000000..b177949788
--- /dev/null
+++ b/meta/recipes-extended/which/which_2.18.bb
@@ -0,0 +1,40 @@
1DESCRIPTION = "Which is a utility that prints out the full path of the \
2executables that bash(1) would execute when the passed \
3program names would have been entered on the shell prompt. \
4It does this by using the exact same algorithm as bash."
5HOMEPAGE = "http://www.xs4all.nl/~carlo17/which/"
6BUGTRACKER = "n/a"
7
8LICENSE = "GPLv2+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
10
11PR = "r0"
12
13SRC_URI = "http://www.xs4all.nl/~carlo17/which/which-${PV}.tar.gz \
14 file://fix_name_conflict_group_member.patch"
15
16DEPENDS = "cwautomacros-native"
17
18inherit autotools
19
20do_configure_prepend() {
21 OLD="@ACLOCAL_CWFLAGS@"
22 NEW="-I ${STAGING_DIR_NATIVE}/${datadir}/cwautomacros/m4"
23 sed -i "s#${OLD}#${NEW}#g" `grep -rl ${OLD} ${S}`
24}
25do_install_append() {
26 mv ${D}/${bindir}/which ${D}/${bindir}/which.${PN}
27}
28
29pkg_postinst_${PN}() {
30 if [ "${PN}" = "${BPN}" ] ; then
31 update-alternatives --install ${bindir}/which which which.${PN} 100
32 fi
33}
34
35pkg_prerm_${PN}() {
36 if [ "${PN}" = "${BPN}" ] ; then
37 update-alternatives --remove which which.${PN}
38 fi
39}
40
diff --git a/meta/recipes-extended/which/which_2.20.bb b/meta/recipes-extended/which/which_2.20.bb
new file mode 100644
index 0000000000..b7730de3b3
--- /dev/null
+++ b/meta/recipes-extended/which/which_2.20.bb
@@ -0,0 +1,35 @@
1DESCRIPTION = "which - shows the full path of (shell) commands."
2SECTION = "libs"
3LICENSE = "GPLv3+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\
5 file://which.c;beginline=1;endline=17;md5=a9963693af2272e7a8df6f231164e7a2"
6HOMEPAGE = "http://ftp.gnu.org/gnu/which/"
7DEPENDS = "cwautomacros-native"
8
9inherit autotools
10
11PR = "r0"
12
13SRC_URI = "http://ftp.gnu.org/gnu/which/which-${PV}.tar.gz \
14 file://remove-declaration.patch"
15
16do_configure_prepend() {
17 sed -i -e 's%@ACLOCAL_CWFLAGS@%-I ${STAGING_DIR_NATIVE}/usr/share/cwautomacros/m4%g' ${S}/Makefile.am ${S}/tilde/Makefile.am
18}
19
20do_install() {
21 autotools_do_install
22 mv ${D}${bindir}/which ${D}${bindir}/which.${PN}
23}
24
25pkg_postinst_${PN} () {
26 if [ "${PN}" = "${BPN}" ] ; then
27 update-alternatives --install ${bindir}/which which which.${PN} 100
28 fi
29}
30
31pkg_prerm_${PN} () {
32 if [ "${PN}" = "${BPN}" ] ; then
33 update-alternatives --remove which which.${PN}
34 fi
35}