~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to buildtools/wafsamba/pkgconfig.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
# handle substitution of variables in pc files
 
2
 
 
3
import Build, sys, Logs
 
4
from samba_utils import *
 
5
 
 
6
def subst_at_vars(task):
 
7
    '''substiture @VAR@ style variables in a file'''
 
8
    src = task.inputs[0].srcpath(task.env)
 
9
    tgt = task.outputs[0].bldpath(task.env)
 
10
 
 
11
    f = open(src, 'r')
 
12
    s = f.read()
 
13
    f.close()
 
14
    # split on the vars
 
15
    a = re.split('(@\w+@)', s)
 
16
    out = []
 
17
    done_var = {}
 
18
    back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
 
19
    for v in a:
 
20
        if re.match('@\w+@', v):
 
21
            vname = v[1:-1]
 
22
            if not vname in task.env and vname.upper() in task.env:
 
23
                vname = vname.upper()
 
24
            if not vname in task.env:
 
25
                Logs.error("Unknown substitution %s in %s" % (v, task.name))
 
26
                sys.exit(1)
 
27
            v = SUBST_VARS_RECURSIVE(task.env[vname], task.env)
 
28
            # now we back substitute the allowed pc vars
 
29
            for (b, m) in back_sub:
 
30
                s = task.env[b]
 
31
                if s == v[0:len(s)]:
 
32
                    if not b in done_var:
 
33
                        # we don't want to substitute the first usage
 
34
                        done_var[b] = True
 
35
                    else:
 
36
                        v = m + v[len(s):]
 
37
                    break
 
38
        out.append(v)
 
39
    contents = ''.join(out)
 
40
    f = open(tgt, 'w')
 
41
    s = f.write(contents)
 
42
    f.close()
 
43
    return 0
 
44
 
 
45
 
 
46
def PKG_CONFIG_FILES(bld, pc_files, vnum=None):
 
47
    '''install some pkg_config pc files'''
 
48
    dest = '${PKGCONFIGDIR}'
 
49
    dest = bld.EXPAND_VARIABLES(dest)
 
50
    for f in TO_LIST(pc_files):
 
51
        base=os.path.basename(f)
 
52
        t = bld.SAMBA_GENERATOR('PKGCONFIG_%s' % base,
 
53
                                rule=subst_at_vars,
 
54
                                source=f+'.in',
 
55
                                target=f)
 
56
        t.vars = []
 
57
        if t.env.RPATH_ON_INSTALL:
 
58
            t.env.LIB_RPATH = t.env.RPATH_ST % t.env.LIBDIR
 
59
        else:
 
60
            t.env.LIB_RPATH = ''
 
61
        if vnum:
 
62
            t.env.PACKAGE_VERSION = vnum
 
63
        for v in [ 'PREFIX', 'EXEC_PREFIX', 'LIB_RPATH' ]:
 
64
            t.vars.append(t.env[v])
 
65
        bld.INSTALL_FILES(dest, f, flat=True, destname=base)
 
66
Build.BuildContext.PKG_CONFIG_FILES = PKG_CONFIG_FILES
 
67
 
 
68