~ubuntu-branches/ubuntu/quantal/samba/quantal

« back to all changes in this revision

Viewing changes to buildtools/wafadmin/Tools/ruby.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-05-15 17:00:56 UTC
  • mfrom: (178.1.1 precise-security) (0.39.27 sid)
  • Revision ID: package-import@ubuntu.com-20120515170056-gludtas4257eb61q
Tags: 2:3.6.5-2ubuntu1
* Merge from Debian unstable, remaining changes: 
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + 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.
    - Other changes now in Debian packaging.
  + 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.install: install profile.
    - debian/control: have samba suggest ufw.
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba-common-bin.install: install hook.
  + Switch to upstart:
    - Added debian/samba.{nmbd,smbd}.upstart.
    - debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
      Make upstart compatible.
* d/samba.install, d/samba-common-bin.install: Restore apport hook and ufw
  profile (LP: #999764).
* Dropped:
  + debian/patches/CVE-2012-1182-*.patch: fixed in upstream release 3.6.4.
  + debian/patches/CVE-2012-2111.patch: fixed in upstream release 3.6.5.
  + debian/patches/fix-debuglevel-name-conflict.patch: fixed upstream -
    debug_level is no longer used as a global variable name.
  + debian/patches/error-trans.fix-276472: fixed upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# encoding: utf-8
 
3
# daniel.svensson at purplescout.se 2008
 
4
 
 
5
import os
 
6
import Task, Options, Utils
 
7
from TaskGen import before, feature, after
 
8
from Configure import conf
 
9
 
 
10
@feature('rubyext')
 
11
@before('apply_incpaths', 'apply_type_vars', 'apply_lib_vars', 'apply_bundle')
 
12
@after('default_cc', 'vars_target_cshlib')
 
13
def init_rubyext(self):
 
14
        self.default_install_path = '${ARCHDIR_RUBY}'
 
15
        self.uselib = self.to_list(getattr(self, 'uselib', ''))
 
16
        if not 'RUBY' in self.uselib:
 
17
                self.uselib.append('RUBY')
 
18
        if not 'RUBYEXT' in self.uselib:
 
19
                self.uselib.append('RUBYEXT')
 
20
 
 
21
@feature('rubyext')
 
22
@before('apply_link')
 
23
def apply_ruby_so_name(self):
 
24
        self.env['shlib_PATTERN'] = self.env['rubyext_PATTERN']
 
25
 
 
26
@conf
 
27
def check_ruby_version(conf, minver=()):
 
28
        """
 
29
        Checks if ruby is installed.
 
30
        If installed the variable RUBY will be set in environment.
 
31
        Ruby binary can be overridden by --with-ruby-binary config variable
 
32
        """
 
33
 
 
34
        if Options.options.rubybinary:
 
35
                conf.env.RUBY = Options.options.rubybinary
 
36
        else:
 
37
                conf.find_program("ruby", var="RUBY", mandatory=True)
 
38
 
 
39
        ruby = conf.env.RUBY
 
40
 
 
41
        try:
 
42
                version = Utils.cmd_output([ruby, '-e', 'puts defined?(VERSION) ? VERSION : RUBY_VERSION']).strip()
 
43
        except:
 
44
                conf.fatal('could not determine ruby version')
 
45
        conf.env.RUBY_VERSION = version
 
46
 
 
47
        try:
 
48
                ver = tuple(map(int, version.split(".")))
 
49
        except:
 
50
                conf.fatal('unsupported ruby version %r' % version)
 
51
 
 
52
        cver = ''
 
53
        if minver:
 
54
                if ver < minver:
 
55
                        conf.fatal('ruby is too old')
 
56
                cver = ".".join([str(x) for x in minver])
 
57
 
 
58
        conf.check_message('ruby', cver, True, version)
 
59
 
 
60
@conf
 
61
def check_ruby_ext_devel(conf):
 
62
        if not conf.env.RUBY:
 
63
                conf.fatal('ruby detection is required first')
 
64
 
 
65
        if not conf.env.CC_NAME and not conf.env.CXX_NAME:
 
66
                conf.fatal('load a c/c++ compiler first')
 
67
 
 
68
        version = tuple(map(int, conf.env.RUBY_VERSION.split(".")))
 
69
 
 
70
        def read_out(cmd):
 
71
                return Utils.to_list(Utils.cmd_output([conf.env.RUBY, '-rrbconfig', '-e', cmd]))
 
72
 
 
73
        def read_config(key):
 
74
                return read_out('puts Config::CONFIG[%r]' % key)
 
75
 
 
76
        ruby = conf.env['RUBY']
 
77
        archdir = read_config('archdir')
 
78
        cpppath = archdir
 
79
        if version >= (1, 9, 0):
 
80
                ruby_hdrdir = read_config('rubyhdrdir')
 
81
                cpppath += ruby_hdrdir
 
82
                cpppath += [os.path.join(ruby_hdrdir[0], read_config('arch')[0])]
 
83
 
 
84
        conf.check(header_name='ruby.h', includes=cpppath, mandatory=True, errmsg='could not find ruby header file')
 
85
 
 
86
        conf.env.LIBPATH_RUBYEXT = read_config('libdir')
 
87
        conf.env.LIBPATH_RUBYEXT += archdir
 
88
        conf.env.CPPPATH_RUBYEXT = cpppath
 
89
        conf.env.CCFLAGS_RUBYEXT = read_config("CCDLFLAGS")
 
90
        conf.env.rubyext_PATTERN = '%s.' + read_config('DLEXT')[0]
 
91
 
 
92
        # ok this is really stupid, but the command and flags are combined.
 
93
        # so we try to find the first argument...
 
94
        flags = read_config('LDSHARED')
 
95
        while flags and flags[0][0] != '-':
 
96
                flags = flags[1:]
 
97
 
 
98
        # we also want to strip out the deprecated ppc flags
 
99
        if len(flags) > 1 and flags[1] == "ppc":
 
100
                flags = flags[2:]
 
101
 
 
102
        conf.env.LINKFLAGS_RUBYEXT = flags
 
103
        conf.env.LINKFLAGS_RUBYEXT += read_config("LIBS")
 
104
        conf.env.LINKFLAGS_RUBYEXT += read_config("LIBRUBYARG_SHARED")
 
105
 
 
106
        if Options.options.rubyarchdir:
 
107
                conf.env.ARCHDIR_RUBY = Options.options.rubyarchdir
 
108
        else:
 
109
                conf.env.ARCHDIR_RUBY = read_config('sitearchdir')[0]
 
110
 
 
111
        if Options.options.rubylibdir:
 
112
                conf.env.LIBDIR_RUBY = Options.options.rubylibdir
 
113
        else:
 
114
                conf.env.LIBDIR_RUBY = read_config('sitelibdir')[0]
 
115
 
 
116
def set_options(opt):
 
117
        opt.add_option('--with-ruby-archdir', type='string', dest='rubyarchdir', help='Specify directory where to install arch specific files')
 
118
        opt.add_option('--with-ruby-libdir', type='string', dest='rubylibdir', help='Specify alternate ruby library path')
 
119
        opt.add_option('--with-ruby-binary', type='string', dest='rubybinary', help='Specify alternate ruby binary')
 
120