aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei@gherzan.ro>2019-05-28 19:40:48 +0100
committerKhem Raj <raj.khem@gmail.com>2019-05-29 02:21:42 -0700
commit061953143db837f637d41e7902978a4afe211ed7 (patch)
treea4747c857d15cee2235beb4122eb097e1ab86fd9 /meta-networking
parent656ef4220513d4f75f19236eeda9a62e857fe589 (diff)
downloadmeta-openembedded-061953143db837f637d41e7902978a4afe211ed7.tar.gz
networkmanager: Update to 1.18.0
One patch was dropped (0003-dlopen-failure.patch) as a similar one was merged upstream. See: https://github.com/NetworkManager/NetworkManager/commit/bd4957fcd78a0e64d26459e94ab3b84c91cd6f5f Refreshed musl patches as well. Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/0003-dlopen-failure.patch34
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch128
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch20
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager_1.18.0.bb (renamed from meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb)6
4 files changed, 70 insertions, 118 deletions
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/0003-dlopen-failure.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/0003-dlopen-failure.patch
deleted file mode 100644
index e99c22710c..0000000000
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager/0003-dlopen-failure.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 57239fda56b68a8f3e413f7b6af5290ba0d86636 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
-Date: Thu, 22 Mar 2018 18:18:06 +0100
-Subject: [PATCH] musl: dlopen is included so LD_LIBS="" instead of
- LD_LIBS="none required"
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream-Status: Pending
-
-Stolen from [1] and prettyfied slightly
-
-[1] https://github.com/voidlinux/void-packages/tree/master/srcpkgs/NetworkManager/patches
-
-Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
----
- configure.ac | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/configure.ac b/configure.ac
-index 487a266..96ae4f7 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -235,6 +235,7 @@ dnl
- dnl Checks for libdl - on certain platforms its part of libc
- dnl
- AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
-+AS_IF([test "$ac_cv_search_dlopen" = "none required"],[ac_cv_search_dlopen=""])
- AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
-
- PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
---
-2.14.3
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
index accd2f2569..af6f938ced 100644
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
@@ -1,7 +1,7 @@
-From 7b09945585e6ce65049fa4039f26caee8daa44b9 Mon Sep 17 00:00:00 2001
+From a89c2e6d40606f563467a83fb98933e990e71377 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Tue, 2 Apr 2019 01:34:35 +0200
-Subject: [PATCH 1/2] Fix build with musl - systemd specific
+Subject: [PATCH] Fix build with musl - systemd specific
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -14,27 +14,27 @@ Upstream-Status: Pending
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
shared/systemd/src/basic/in-addr-util.c | 1 +
- shared/systemd/src/basic/process-util.c | 9 ++++++++
- shared/systemd/src/basic/socket-util.h | 6 +++++
+ shared/systemd/src/basic/process-util.c | 9 +++++++++
+ shared/systemd/src/basic/socket-util.h | 6 ++++++
+ shared/systemd/src/basic/sort-util.h | 27 ++++---------------------
shared/systemd/src/basic/stdio-util.h | 2 ++
shared/systemd/src/basic/string-util.h | 5 +++++
- shared/systemd/src/basic/util.h | 29 +++++--------------------
- 6 files changed, 28 insertions(+), 24 deletions(-)
+ 6 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/shared/systemd/src/basic/in-addr-util.c b/shared/systemd/src/basic/in-addr-util.c
-index 5ced350..c6b52b8 100644
+index 5899f62..0adb248 100644
--- a/shared/systemd/src/basic/in-addr-util.c
+++ b/shared/systemd/src/basic/in-addr-util.c
-@@ -13,6 +13,7 @@
+@@ -14,6 +14,7 @@
#include "in-addr-util.h"
#include "macro.h"
#include "parse-util.h"
+#include "string-util.h"
+ #include "random-util.h"
+ #include "strxcpyx.h"
#include "util.h"
-
- bool in4_addr_is_null(const struct in_addr *a) {
diff --git a/shared/systemd/src/basic/process-util.c b/shared/systemd/src/basic/process-util.c
-index b0afb5c..7adc8bd 100644
+index 7431be3..189060a 100644
--- a/shared/systemd/src/basic/process-util.c
+++ b/shared/systemd/src/basic/process-util.c
@@ -21,6 +21,9 @@
@@ -47,7 +47,7 @@ index b0afb5c..7adc8bd 100644
#if 0 /* NM_IGNORED */
#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
-@@ -1168,11 +1171,13 @@ void reset_cached_pid(void) {
+@@ -1183,11 +1186,13 @@ void reset_cached_pid(void) {
cached_pid = CACHED_PID_UNSET;
}
@@ -61,7 +61,7 @@ index b0afb5c..7adc8bd 100644
pid_t getpid_cached(void) {
static bool installed = false;
-@@ -1201,7 +1206,11 @@ pid_t getpid_cached(void) {
+@@ -1216,7 +1221,11 @@ pid_t getpid_cached(void) {
* only half-documented (glibc doesn't document it but LSB does — though only superficially)
* we'll check for errors only in the most generic fashion possible. */
@@ -74,7 +74,7 @@ index b0afb5c..7adc8bd 100644
cached_pid = CACHED_PID_UNSET;
return new_pid;
diff --git a/shared/systemd/src/basic/socket-util.h b/shared/systemd/src/basic/socket-util.h
-index d2246a8..76f257f 100644
+index 15443f1..4807198 100644
--- a/shared/systemd/src/basic/socket-util.h
+++ b/shared/systemd/src/basic/socket-util.h
@@ -13,6 +13,12 @@
@@ -90,55 +90,13 @@ index d2246a8..76f257f 100644
#include "macro.h"
#include "missing_socket.h"
#include "sparse-endian.h"
-diff --git a/shared/systemd/src/basic/stdio-util.h b/shared/systemd/src/basic/stdio-util.h
-index dc67b6e..6336243 100644
---- a/shared/systemd/src/basic/stdio-util.h
-+++ b/shared/systemd/src/basic/stdio-util.h
-@@ -1,7 +1,9 @@
- /* SPDX-License-Identifier: LGPL-2.1+ */
- #pragma once
+diff --git a/shared/systemd/src/basic/sort-util.h b/shared/systemd/src/basic/sort-util.h
+index e029f86..1e8b6e1 100644
+--- a/shared/systemd/src/basic/sort-util.h
++++ b/shared/systemd/src/basic/sort-util.h
+@@ -5,15 +5,10 @@
-+#if defined(__GLIBC__)
- #include <printf.h>
-+#endif
- #include <stdarg.h>
- #include <stdio.h>
- #include <sys/types.h>
-diff --git a/shared/systemd/src/basic/string-util.h b/shared/systemd/src/basic/string-util.h
-index 38070ab..6b918e0 100644
---- a/shared/systemd/src/basic/string-util.h
-+++ b/shared/systemd/src/basic/string-util.h
-@@ -27,6 +27,11 @@
- #define strcaseeq(a,b) (strcasecmp((a),(b)) == 0)
- #define strncaseeq(a, b, n) (strncasecmp((a), (b), (n)) == 0)
-
-+/* musl does not know strndupa */
-+#if !defined(__GLIBC__)
-+#define strndupa(x,s) strncpy(alloca(strlen(x)+1),x,s)
-+#endif
-+
- int strcmp_ptr(const char *a, const char *b) _pure_;
-
- static inline bool streq_ptr(const char *a, const char *b) {
-diff --git a/shared/systemd/src/basic/util.h b/shared/systemd/src/basic/util.h
-index dc33d66..cc768e9 100644
---- a/shared/systemd/src/basic/util.h
-+++ b/shared/systemd/src/basic/util.h
-@@ -27,6 +27,11 @@
#include "macro.h"
- #include "time-util.h"
-
-+#if !defined(__GLIBC__)
-+typedef int (*__compar_fn_t) (const void*, const void*);
-+typedef __compar_fn_t comparison_fn_t;
-+#endif
-+
- size_t page_size(void) _pure_;
- #define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
-
-@@ -66,16 +71,6 @@ int prot_from_flags(int flags) _const_;
- bool in_initrd(void);
- void in_initrd_force(bool value);
-void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
- __compar_d_fn_t compar, void *arg);
@@ -149,14 +107,18 @@ index dc33d66..cc768e9 100644
- int (*_func_)(const typeof(b[0])*, const typeof(b[0])*, typeof(userdata)) = func; \
- xbsearch_r((const void*) _k, (b), (n), sizeof((b)[0]), (__compar_d_fn_t) _func_, userdata); \
- })
--
++#if !defined(__GLIBC__)
++typedef int (*__compar_fn_t) (const void*, const void*);
++typedef __compar_fn_t comparison_fn_t;
++#endif
+
/**
* Normal bsearch requires base to be nonnull. Here were require
- * that only if nmemb > 0.
-@@ -116,20 +111,6 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn
+@@ -54,17 +49,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn
+ int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
})
-
+-
-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
- if (nmemb <= 1)
- return;
@@ -170,10 +132,36 @@ index dc33d66..cc768e9 100644
- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
- })
--
- /* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */
- static inline void memcpy_safe(void *dst, const void *src, size_t n) {
- if (n == 0)
+diff --git a/shared/systemd/src/basic/stdio-util.h b/shared/systemd/src/basic/stdio-util.h
+index c3b9448..e80a938 100644
+--- a/shared/systemd/src/basic/stdio-util.h
++++ b/shared/systemd/src/basic/stdio-util.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1+ */
+ #pragma once
+
++#if defined(__GLIBC__)
+ #include <printf.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+diff --git a/shared/systemd/src/basic/string-util.h b/shared/systemd/src/basic/string-util.h
+index b23f4c8..8f2f6e0 100644
+--- a/shared/systemd/src/basic/string-util.h
++++ b/shared/systemd/src/basic/string-util.h
+@@ -27,6 +27,11 @@
+ #define strcaseeq(a,b) (strcasecmp((a),(b)) == 0)
+ #define strncaseeq(a, b, n) (strncasecmp((a), (b), (n)) == 0)
+
++/* musl does not know strndupa */
++#if !defined(__GLIBC__)
++#define strndupa(x,s) strncpy(alloca(strlen(x)+1),x,s)
++#endif
++
+ int strcmp_ptr(const char *a, const char *b) _pure_;
+
+ static inline bool streq_ptr(const char *a, const char *b) {
--
-2.20.1
+2.17.1
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
index 25f9a4a001..e0973af1e9 100644
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
@@ -1,4 +1,4 @@
-From 0b0f2d5abe27b2c9587f449795f0ae3568fc3e38 Mon Sep 17 00:00:00 2001
+From 3d1307735667758f44378585482fe421db086af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Mon, 8 Apr 2019 23:10:43 +0200
Subject: [PATCH 2/2] Fix build with musl
@@ -23,7 +23,7 @@ The build issues caused by definition conflicts musl vs linux-libc headers
Note:
Be aware that this is still nasty business: We have to trust that musl headers
define same signatures as linux would do - just because musl-makers consider
-linux-libc headers 'notoriously broken for userspace' [2] (search for
+linux-libc headers 'notoriously broken for userspace' [2] (search for
'error: redefinition of').
[1] http://lists.openembedded.org/pipermail/openembedded-core/2019-March/280440.html
@@ -53,7 +53,7 @@ index 43fbbc1..3eae286 100644
#include "nmtui.h"
diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
-index 2b5baba..8a50131 100644
+index 2b5baba..f7abab6 100644
--- a/libnm-core/nm-utils.h
+++ b/libnm-core/nm-utils.h
@@ -25,6 +25,10 @@
@@ -68,7 +68,7 @@ index 2b5baba..8a50131 100644
#include <netinet/in.h>
diff --git a/shared/nm-default.h b/shared/nm-default.h
-index 26d6476..b29e8af 100644
+index 54e9916..26e9f4e 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -211,6 +211,9 @@
@@ -82,7 +82,7 @@ index 26d6476..b29e8af 100644
/*****************************************************************************/
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
-index 7514fa7..d305fa5 100644
+index bd4fbcc..f70b309 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -24,6 +24,7 @@
@@ -102,17 +102,17 @@ index 7514fa7..d305fa5 100644
#include <linux/pkt_sched.h>
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
-index 2f5c75b..d6ca6d9 100644
+index d4b0115..22a3a90 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
-@@ -27,7 +27,6 @@
- #include <fcntl.h>
+@@ -28,7 +28,6 @@
#include <libudev.h>
+ #include <linux/fib_rules.h>
#include <linux/ip.h>
-#include <linux/if_arp.h>
+ #include <linux/if_bridge.h>
#include <linux/if_link.h>
#include <linux/if_tun.h>
- #include <linux/if_tunnel.h>
--
-2.20.1
+2.17.1
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb b/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.18.0.bb
index 9f01f1bc1a..9215a86765 100644
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.18.0.bb
@@ -26,15 +26,13 @@ SRC_URI = " \
${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManager-${PV}.tar.xz \
file://0001-Fixed-configure.ac-Fix-pkgconfig-sysroot-locations.patch \
file://0002-Do-not-create-settings-settings-property-documentati.patch \
- file://0003-dlopen-failure.patch \
"
SRC_URI_append_libc-musl = " \
file://musl/0001-Fix-build-with-musl-systemd-specific.patch \
file://musl/0002-Fix-build-with-musl.patch \
"
-
-SRC_URI[md5sum] = "10abacaafb162a67d2942adf03e7e9e4"
-SRC_URI[sha256sum] = "8e962833b6ca03edda1bc57ed6614a7b8c2339531b44acef098d05f2324c5d2c"
+SRC_URI[md5sum] = "c8c27116a8083bab5d5fcca0d03e988a"
+SRC_URI[sha256sum] = "c6e8df25e5a3c7309bc17664be8971689314884cdd08afdd6b0847d29d2a8ba6"
UPSTREAM_CHECK_URI = "${GNOME_MIRROR}/NetworkManager/1.16/"
UPSTREAM_CHECK_REGEX = "NetworkManager\-(?P<pver>1\.10(\.\d+)+).tar.xz"
> OpenEmbedded Core user contribution treesGrokmirror user
summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/clearcase.py
blob: 3a6573d0b23b2aa859416c6472574ccc0547e896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' clearcase implementation

The clearcase fetcher is used to retrieve files from a ClearCase repository.

Usage in the recipe:

    SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
    SRCREV = "EXAMPLE_CLEARCASE_TAG"
    PV = "${@d.getVar("SRCREV", False).replace("/", "+")}"

The fetcher uses the rcleartool or cleartool remote client, depending on which one is available.

Supported SRC_URI options are:

- vob
    (required) The name of the clearcase VOB (with prepending "/")

- module
    The module in the selected VOB (with prepending "/")

    The module and vob parameters are combined to create
    the following load rule in the view config spec:
                load <vob><module>

- proto
    http or https

Related variables:

    CCASE_CUSTOM_CONFIG_SPEC
            Write a config spec to this variable in your recipe to use it instead
            of the default config spec generated by this fetcher.
            Please note that the SRCREV loses its functionality if you specify
            this variable. SRCREV is still used to label the archive after a fetch,
            but it doesn't define what's fetched.

User credentials:
    cleartool:
            The login of cleartool is handled by the system. No special steps needed.

    rcleartool:
            In order to use rcleartool with authenticated users an `rcleartool login` is
            necessary before using the fetcher.
"""
# Copyright (C) 2014 Siemens AG
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

import os
import sys
import shutil
import bb
from   bb.fetch2 import FetchMethod
from   bb.fetch2 import FetchError
from   bb.fetch2 import runfetchcmd
from   bb.fetch2 import logger

class ClearCase(FetchMethod):
    """Class to fetch urls via 'clearcase'"""
    def init(self, d):
        pass

    def supports(self, ud, d):
        """
        Check to see if a given url can be fetched with Clearcase.
        """
        return ud.type in ['ccrc']

    def debug(self, msg):
        logger.debug(1, "ClearCase: %s", msg)

    def urldata_init(self, ud, d):
        """
        init ClearCase specific variable within url data
        """
        ud.proto = "https"
        if 'protocol' in ud.parm:
            ud.proto = ud.parm['protocol']
        if not ud.proto in ('http', 'https'):
            raise fetch2.ParameterError("Invalid protocol type", ud.url)

        ud.vob = ''
        if 'vob' in ud.parm:
            ud.vob = ud.parm['vob']
        else:
            msg = ud.url+": vob must be defined so the fetcher knows what to get."
            raise MissingParameterError('vob', msg)

        if 'module' in ud.parm:
            ud.module = ud.parm['module']
        else:
            ud.module = ""

        ud.basecmd = d.getVar("FETCHCMD_ccrc") or "/usr/bin/env cleartool || rcleartool"

        if d.getVar("SRCREV") == "INVALID":
          raise FetchError("Set a valid SRCREV for the clearcase fetcher in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your choice.")

        ud.label = d.getVar("SRCREV", False)
        ud.customspec = d.getVar("CCASE_CUSTOM_CONFIG_SPEC")

        ud.server     = "%s://%s%s" % (ud.proto, ud.host, ud.path)

        ud.identifier = "clearcase-%s%s-%s" % ( ud.vob.replace("/", ""),
                                                ud.module.replace("/", "."),
                                                ud.label.replace("/", "."))

        ud.viewname         = "%s-view%s" % (ud.identifier, d.getVar("DATETIME", d, True))
        ud.csname           = "%s-config-spec" % (ud.identifier)
        ud.ccasedir         = os.path.join(d.getVar("DL_DIR"), ud.type)
        ud.viewdir          = os.path.join(ud.ccasedir, ud.viewname)
        ud.configspecfile   = os.path.join(ud.ccasedir, ud.csname)
        ud.localfile        = "%s.tar.gz" % (ud.identifier)

        self.debug("host            = %s" % ud.host)
        self.debug("path            = %s" % ud.path)
        self.debug("server          = %s" % ud.server)
        self.debug("proto           = %s" % ud.proto)
        self.debug("type            = %s" % ud.type)
        self.debug("vob             = %s" % ud.vob)
        self.debug("module          = %s" % ud.module)
        self.debug("basecmd         = %s" % ud.basecmd)
        self.debug("label           = %s" % ud.label)
        self.debug("ccasedir        = %s" % ud.ccasedir)
        self.debug("viewdir         = %s" % ud.viewdir)
        self.debug("viewname        = %s" % ud.viewname)
        self.debug("configspecfile  = %s" % ud.configspecfile)
        self.debug("localfile       = %s" % ud.localfile)

        ud.localfile = os.path.join(d.getVar("DL_DIR"), ud.localfile)

    def _build_ccase_command(self, ud, command):
        """
        Build up a commandline based on ud
        command is: mkview, setcs, rmview
        """
        options = []

        if "rcleartool" in ud.basecmd:
            options.append("-server %s" % ud.server)

        basecmd = "%s %s" % (ud.basecmd, command)

        if command is 'mkview':
            if not "rcleartool" in ud.basecmd:
                # Cleartool needs a -snapshot view
                options.append("-snapshot")
            options.append("-tag %s" % ud.viewname)
            options.append(ud.viewdir)

        elif command is 'rmview':
            options.append("-force")
            options.append("%s" % ud.viewdir)

        elif command is 'setcs':
            options.append("-overwrite")
            options.append(ud.configspecfile)

        else:
            raise FetchError("Invalid ccase command %s" % command)

        ccasecmd = "%s %s" % (basecmd, " ".join(options))
        self.debug("ccasecmd = %s" % ccasecmd)
        return ccasecmd

    def _write_configspec(self, ud, d):
        """
        Create config spec file (ud.configspecfile) for ccase view
        """
        config_spec = ""
        custom_config_spec = d.getVar("CCASE_CUSTOM_CONFIG_SPEC", d)
        if custom_config_spec is not None:
            for line in custom_config_spec.split("\\n"):
                config_spec += line+"\n"
            bb.warn("A custom config spec has been set, SRCREV is only relevant for the tarball name.")
        else:
            config_spec += "element * CHECKEDOUT\n"
            config_spec += "element * %s\n" % ud.label
            config_spec += "load %s%s\n" % (ud.vob, ud.module)

        logger.info("Using config spec: \n%s" % config_spec)

        with open(ud.configspecfile, 'w') as f:
            f.write(config_spec)

    def _remove_view(self, ud, d):
        if os.path.exists(ud.viewdir):
            cmd = self._build_ccase_command(ud, 'rmview');
            logger.info("cleaning up [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname)
            bb.fetch2.check_network_access(d, cmd, ud.url)
            output = runfetchcmd(cmd, d, workdir=ud.ccasedir)
            logger.info("rmview output: %s", output)

    def need_update(self, ud, d):
        if ("LATEST" in ud.label) or (ud.customspec and "LATEST" in ud.customspec):
            ud.identifier += "-%s" % d.getVar("DATETIME",d, True)
            return True
        if os.path.exists(ud.localpath):
            return False
        return True

    def supports_srcrev(self):
        return True

    def sortable_revision(self, ud, d, name):
        return False, ud.identifier

    def download(self, ud, d):
        """Fetch url"""

        # Make a fresh view
        bb.utils.mkdirhier(ud.ccasedir)
        self._write_configspec(ud, d)
        cmd = self._build_ccase_command(ud, 'mkview')
        logger.info("creating view [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname)
        bb.fetch2.check_network_access(d, cmd, ud.url)
        try:
            runfetchcmd(cmd, d)
        except FetchError as e:
            if "CRCLI2008E" in e.msg:
                raise FetchError("%s\n%s\n" % (e.msg, "Call `rcleartool login` in your console to authenticate to the clearcase server before running bitbake."))
            else:
                raise e

        # Set configspec: Setting the configspec effectively fetches the files as defined in the configspec
        cmd = self._build_ccase_command(ud, 'setcs');
        logger.info("fetching data [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname)
        bb.fetch2.check_network_access(d, cmd, ud.url)
        output = runfetchcmd(cmd, d, workdir=ud.viewdir)
        logger.info("%s", output)

        # Copy the configspec to the viewdir so we have it in our source tarball later
        shutil.copyfile(ud.configspecfile, os.path.join(ud.viewdir, ud.csname))

        # Clean clearcase meta-data before tar

        runfetchcmd('tar -czf "%s" .' % (ud.localpath), d, cleanup = [ud.localpath])

        # Clean up so we can create a new view next time
        self.clean(ud, d);

    def clean(self, ud, d):
        self._remove_view(ud, d)
        bb.utils.remove(ud.configspecfile)