diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2018-09-09 10:42:47 -0400 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2018-09-09 22:09:42 -0700 |
commit | 2d5b455f09e68be1c3c5c0e06696e8d5ffc12b06 (patch) | |
tree | ed8399443948e58948acca3523f31665134dd2b4 | |
parent | 8705570331c3ac5af2e36bdb6f8db3c2bea1f5b5 (diff) | |
download | meta-openembedded-2d5b455f09e68be1c3c5c0e06696e8d5ffc12b06.tar.gz |
sanlock: add version 3.6.0
A shared storage lock manager.
- Fix compile failure with musl
- Fix installed-vs-shipped QA issue
- Fix ldflags QA issue
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-extended/sanlock/sanlock/0001-fix-compile-failure-with-libc-musl.patch | 80 | ||||
-rw-r--r-- | meta-oe/recipes-extended/sanlock/sanlock_3.6.0.bb | 36 |
2 files changed, 116 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/sanlock/sanlock/0001-fix-compile-failure-with-libc-musl.patch b/meta-oe/recipes-extended/sanlock/sanlock/0001-fix-compile-failure-with-libc-musl.patch new file mode 100644 index 000000000..e4bde80a0 --- /dev/null +++ b/meta-oe/recipes-extended/sanlock/sanlock/0001-fix-compile-failure-with-libc-musl.patch | |||
@@ -0,0 +1,80 @@ | |||
1 | From c51c2c543f3c78b2a68acc61f786f903f2e0fec8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Sun, 9 Sep 2018 07:28:09 -0400 | ||
4 | Subject: [PATCH] fix compile failure with libc musl | ||
5 | |||
6 | The lack of random_r in musl: | ||
7 | [snip] | ||
8 | |main.c:1393:7: warning: implicit declaration of function 'random_r'; | ||
9 | did you mean 'random'? [-Wimplicit-function-declaration] | ||
10 | | rv = random_r(&rand_data, &val); | ||
11 | | ^~~~~~~~ | ||
12 | | random | ||
13 | |main.c:1408:30: error: invalid application of 'sizeof' to incomplete | ||
14 | type 'struct random_data' | ||
15 | | memset(&rand_data, 0, sizeof(rand_data)); | ||
16 | [snip] | ||
17 | |||
18 | s/random_r/random/, s/initstate_r/initstate/ and remove `static struct | ||
19 | random_data rand_data' | ||
20 | |||
21 | Here is the man of `random_r()': | ||
22 | [snip] | ||
23 | The random_r() function is like random(3), except that instead of using | ||
24 | state information maintained in a global variable | ||
25 | [snip] | ||
26 | |||
27 | So use random without state information is OK. | ||
28 | |||
29 | Upstream-Status: Submitted [sanlock-devel@lists.fedorahosted.org] | ||
30 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
31 | --- | ||
32 | src/main.c | 12 ++++-------- | ||
33 | 1 file changed, 4 insertions(+), 8 deletions(-) | ||
34 | |||
35 | diff --git a/src/main.c b/src/main.c | ||
36 | index f60b4d3..602c400 100644 | ||
37 | --- a/src/main.c | ||
38 | +++ b/src/main.c | ||
39 | @@ -84,7 +84,6 @@ static char command[COMMAND_MAX]; | ||
40 | static int cmd_argc; | ||
41 | static char **cmd_argv; | ||
42 | static struct thread_pool pool; | ||
43 | -static struct random_data rand_data; | ||
44 | static char rand_state[32]; | ||
45 | static pthread_mutex_t rand_mutex = PTHREAD_MUTEX_INITIALIZER; | ||
46 | static const char *run_dir = NULL; | ||
47 | @@ -1386,16 +1385,15 @@ int get_rand(int a, int b); | ||
48 | |||
49 | int get_rand(int a, int b) | ||
50 | { | ||
51 | - int32_t val; | ||
52 | - int rv; | ||
53 | + long int rv; | ||
54 | |||
55 | pthread_mutex_lock(&rand_mutex); | ||
56 | - rv = random_r(&rand_data, &val); | ||
57 | + rv = random(); | ||
58 | pthread_mutex_unlock(&rand_mutex); | ||
59 | if (rv < 0) | ||
60 | return rv; | ||
61 | |||
62 | - return a + (int) (((float)(b - a + 1)) * val / (RAND_MAX+1.0)); | ||
63 | + return a + (int) (((float)(b - a + 1)) * rv / (RAND_MAX+1.0)); | ||
64 | } | ||
65 | |||
66 | static void setup_host_name(void) | ||
67 | @@ -1405,9 +1403,7 @@ static void setup_host_name(void) | ||
68 | uuid_t uu; | ||
69 | |||
70 | memset(rand_state, 0, sizeof(rand_state)); | ||
71 | - memset(&rand_data, 0, sizeof(rand_data)); | ||
72 | - | ||
73 | - initstate_r(time(NULL), rand_state, sizeof(rand_state), &rand_data); | ||
74 | + initstate(time(NULL), rand_state, sizeof(rand_state)); | ||
75 | |||
76 | /* use host name from command line */ | ||
77 | |||
78 | -- | ||
79 | 2.8.1 | ||
80 | |||
diff --git a/meta-oe/recipes-extended/sanlock/sanlock_3.6.0.bb b/meta-oe/recipes-extended/sanlock/sanlock_3.6.0.bb new file mode 100644 index 000000000..c51bccce3 --- /dev/null +++ b/meta-oe/recipes-extended/sanlock/sanlock_3.6.0.bb | |||
@@ -0,0 +1,36 @@ | |||
1 | SUMMARY = "A shared storage lock manager" | ||
2 | DESCRIPTION = "sanlock is a lock manager built on shared storage. Hosts with access \ | ||
3 | to the storage can perform locking. An application running on the \ | ||
4 | hosts is given a small amount of space on the shared block device or \ | ||
5 | file, and uses sanlock for its own application-specific synchronization. \ | ||
6 | Internally, the sanlock daemon manages locks using two disk-based \ | ||
7 | lease algorithms: delta leases and paxos leases." | ||
8 | HOMEPAGE = "https://pagure.io/sanlock" | ||
9 | SECTION = "utils" | ||
10 | |||
11 | LICENSE = "LGPLv2+ & GPLv2 & GPLv2+" | ||
12 | LIC_FILES_CHKSUM = "file://README.license;md5=60487bf0bf429d6b5aa72b6d37a0eb22" | ||
13 | |||
14 | SRC_URI = "git://pagure.io/sanlock.git;protocol=http \ | ||
15 | file://0001-fix-compile-failure-with-libc-musl.patch \ | ||
16 | " | ||
17 | SRCREV = "90b2ffa77edd46bea007b7bb39bfd4d2db2ff7af" | ||
18 | S = "${WORKDIR}/git" | ||
19 | |||
20 | DEPENDS = "libaio util-linux" | ||
21 | |||
22 | inherit distutils | ||
23 | |||
24 | do_configure[noexec] = "1" | ||
25 | |||
26 | do_compile_prepend () { | ||
27 | oe_runmake -C wdmd CMD_LDFLAGS="${LDFLAGS}" LIB_LDFLAGS="${LDFLAGS}" | ||
28 | oe_runmake -C src CMD_LDFLAGS="${LDFLAGS}" LIB_ENTIRE_LDFLAGS="${LDFLAGS}" LIB_CLIENT_LDFLAGS="${LDFLAGS}" | ||
29 | cd ${S}/python | ||
30 | } | ||
31 | |||
32 | do_install_prepend () { | ||
33 | oe_runmake -C wdmd DESTDIR=${D} LIBDIR=${libdir} install | ||
34 | oe_runmake -C src DESTDIR=${D} LIBDIR=${libdir} install | ||
35 | cd ${S}/python | ||
36 | } | ||