~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to buildtools/wafsamba/gccdeps.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# encoding: utf-8
 
3
# Thomas Nagy, 2008-2010 (ita)
 
4
 
 
5
"""
 
6
Execute the tasks with gcc -MD, read the dependencies from the .d file
 
7
and prepare the dependency calculation for the next run
 
8
"""
 
9
 
 
10
import os, re, threading
 
11
import Task, Logs, Utils, preproc
 
12
from TaskGen import before, after, feature
 
13
 
 
14
lock = threading.Lock()
 
15
 
 
16
preprocessor_flag = '-MD'
 
17
 
 
18
@feature('cc')
 
19
@before('apply_core')
 
20
def add_mmd_cc(self):
 
21
        if self.env.get_flat('CCFLAGS').find(preprocessor_flag) < 0:
 
22
                self.env.append_value('CCFLAGS', preprocessor_flag)
 
23
 
 
24
@feature('cxx')
 
25
@before('apply_core')
 
26
def add_mmd_cxx(self):
 
27
        if self.env.get_flat('CXXFLAGS').find(preprocessor_flag) < 0:
 
28
                self.env.append_value('CXXFLAGS', preprocessor_flag)
 
29
 
 
30
def scan(self):
 
31
        "the scanner does not do anything initially"
 
32
        nodes = self.generator.bld.node_deps.get(self.unique_id(), [])
 
33
        names = []
 
34
        return (nodes, names)
 
35
 
 
36
re_o = re.compile("\.o$")
 
37
re_src = re.compile("^(\.\.)[\\/](.*)$")
 
38
 
 
39
def post_run(self):
 
40
        # The following code is executed by threads, it is not safe, so a lock is needed...
 
41
 
 
42
        if getattr(self, 'cached', None):
 
43
                return Task.Task.post_run(self)
 
44
 
 
45
        name = self.outputs[0].abspath(self.env)
 
46
        name = re_o.sub('.d', name)
 
47
        txt = Utils.readf(name)
 
48
        #os.unlink(name)
 
49
 
 
50
        txt = txt.replace('\\\n', '')
 
51
 
 
52
        lst = txt.strip().split(':')
 
53
        val = ":".join(lst[1:])
 
54
        val = val.split()
 
55
 
 
56
        nodes = []
 
57
        bld = self.generator.bld
 
58
 
 
59
        f = re.compile("^("+self.env.variant()+"|\.\.)[\\/](.*)$")
 
60
        for x in val:
 
61
                if os.path.isabs(x):
 
62
 
 
63
                        if not preproc.go_absolute:
 
64
                                continue
 
65
 
 
66
                        lock.acquire()
 
67
                        try:
 
68
                                node = bld.root.find_resource(x)
 
69
                        finally:
 
70
                                lock.release()
 
71
                else:
 
72
                        g = re.search(re_src, x)
 
73
                        if g:
 
74
                                x = g.group(2)
 
75
                                lock.acquire()
 
76
                                try:
 
77
                                        node = bld.bldnode.parent.find_resource(x)
 
78
                                finally:
 
79
                                        lock.release()
 
80
                        else:
 
81
                                g = re.search(f, x)
 
82
                                if g:
 
83
                                        x = g.group(2)
 
84
                                        lock.acquire()
 
85
                                        try:
 
86
                                                node = bld.srcnode.find_resource(x)
 
87
                                        finally:
 
88
                                                lock.release()
 
89
 
 
90
                if id(node) == id(self.inputs[0]):
 
91
                        # ignore the source file, it is already in the dependencies
 
92
                        # this way, successful config tests may be retrieved from the cache
 
93
                        continue
 
94
 
 
95
                if not node:
 
96
                        raise ValueError('could not find %r for %r' % (x, self))
 
97
                else:
 
98
                        nodes.append(node)
 
99
 
 
100
        Logs.debug('deps: real scanner for %s returned %s' % (str(self), str(nodes)))
 
101
 
 
102
        bld.node_deps[self.unique_id()] = nodes
 
103
        bld.raw_deps[self.unique_id()] = []
 
104
 
 
105
        try:
 
106
                del self.cache_sig
 
107
        except:
 
108
                pass
 
109
 
 
110
        Task.Task.post_run(self)
 
111
 
 
112
import Constants, Utils
 
113
def sig_implicit_deps(self):
 
114
        try:
 
115
                return Task.Task.sig_implicit_deps(self)
 
116
        except Utils.WafError:
 
117
                return Constants.SIG_NIL
 
118
 
 
119
for name in 'cc cxx'.split():
 
120
        try:
 
121
                cls = Task.TaskBase.classes[name]
 
122
        except KeyError:
 
123
                pass
 
124
        else:
 
125
                cls.post_run = post_run
 
126
                cls.scan = scan
 
127
                cls.sig_implicit_deps = sig_implicit_deps
 
128