~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to build/generator/gen_make.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
      build_path_basename, build_path_dirname, build_path_retreat, unique
54
54
 
55
55
 
 
56
def _normstr(x):
 
57
  if os.sep == '/':
 
58
    return os.path.normpath(str(x))
 
59
  else:
 
60
    return os.path.normpath(str(x).replace('/', os.sep)).replace(os.sep, '/')
 
61
 
56
62
class Generator(gen_base.GeneratorBase):
57
63
 
58
64
  _extension_map = {
62
68
    ('lib', 'object'): '.lo',
63
69
    ('pyd', 'target'): '.la',
64
70
    ('pyd', 'object'): '.lo',
 
71
    ('so', 'target'): '.la',
 
72
    ('so', 'object'): '.lo',
65
73
    }
66
74
 
67
75
  def __init__(self, fname, verfname, options=None):
230
238
 
231
239
      # get the source items (.o and .la) for the link unit
232
240
      objects = [ ]
 
241
      objdeps = [ ]
233
242
      object_srcs = [ ]
234
243
      headers = [ ]
235
244
      header_classes = [ ]
236
245
      header_class_filenames = [ ]
237
246
      deps = [ ]
238
247
      libs = [ ]
 
248
      add_deps = target_ob.add_deps.split()
239
249
 
240
250
      for link_dep in self.graph.get_sources(gen_base.DT_LINK, target_ob.name):
241
251
        if isinstance(link_dep, gen_base.TargetJava):
260
270
        elif isinstance(link_dep, gen_base.ObjectFile):
261
271
          # link in the object file
262
272
          objects.append(link_dep.filename)
 
273
          objdeps.append(_normstr(link_dep.filename))
263
274
          for dep in self.graph.get_sources(gen_base.DT_OBJECT, link_dep, gen_base.SourceFile):
264
275
            object_srcs.append(
265
276
              build_path_join('$(abs_srcdir)', dep.filename))
286
297
                            varname=targ_varname,
287
298
                            path=path,
288
299
                            install=None,
289
 
                            add_deps=target_ob.add_deps,
 
300
                            add_deps=add_deps,
290
301
                            objects=objects,
 
302
                            objdeps=objdeps,
291
303
                            deps=deps,
292
304
                            when=target_ob.when,
293
305
                            )
379
391
          dirname, fname = build_path_splitfile(file.filename)
380
392
          return _eztdata(mode=None,
381
393
                          dirname=dirname, fullname=file.filename,
382
 
                          filename=fname, when=file.when)
 
394
                          filename=fname, when=file.when,
 
395
                          pc_fullname=None,
 
396
                          pc_installdir=None,
 
397
                          pc_install_fname=None,)
383
398
 
384
399
      def apache_file_to_eztdata(file):
385
400
          # cd to dirname before install to work around libtool 1.4.2 bug.
412
427
            else:
413
428
              ezt_file.install_fname = build_path_join('$(%sdir)' % area_var,
414
429
                                                       ezt_file.filename)
 
430
 
 
431
          # Install pkg-config files
 
432
          if (isinstance(file.target, gen_base.TargetLib) and
 
433
              ezt_file.fullname.startswith('subversion/libsvn_')):
 
434
            ezt_file.pc_fullname = ezt_file.fullname.replace('-1.la', '.pc')
 
435
            ezt_file.pc_installdir = '$(pkgconfig_dir)'
 
436
            pc_install_fname = ezt_file.filename.replace('-1.la', '.pc')
 
437
            ezt_file.pc_install_fname = build_path_join(ezt_file.pc_installdir,
 
438
                                                        pc_install_fname)
415
439
          ezt_area.files.append(ezt_file)
416
440
 
417
441
        # certain areas require hooks for extra install rules defined
452
476
                      key=lambda t: t[0].filename)
453
477
 
454
478
    for objname, sources in obj_deps:
455
 
      dep = _eztdata(name=str(objname),
 
479
      dep = _eztdata(name=_normstr(objname),
456
480
                     when=objname.when,
457
 
                     deps=list(map(str, sources)),
 
481
                     deps=list(map(_normstr, sources)),
458
482
                     cmd=objname.compile_cmd,
459
 
                     source=str(sources[0]))
 
483
                     source=_normstr(sources[0]))
460
484
      data.deps.append(dep)
461
485
      dep.generated = ezt.boolean(getattr(objname, 'source_generated', 0))
462
486
 
469
493
 
470
494
    self.write_transform_libtool_scripts(install_sources)
471
495
 
 
496
    self.write_pkg_config_dot_in_files(install_sources)
 
497
 
472
498
  def write_standalone(self):
473
499
    """Write autogen-standalone.mk"""
474
500
 
580
606
      libdep_cache[target_name] = sorted(libs)
581
607
    return libdep_cache[target_name]
582
608
 
 
609
  def write_pkg_config_dot_in_files(self, install_sources):
 
610
    """Write pkg-config .pc.in files for Subversion libraries."""
 
611
    for target_ob in install_sources:
 
612
      if not (isinstance(target_ob, gen_base.TargetLib) and
 
613
              target_ob.path.startswith('subversion/libsvn_')):
 
614
        continue
 
615
 
 
616
      lib_name = target_ob.name
 
617
      lib_path = self.sections[lib_name].options.get('path')
 
618
      lib_deps = self.sections[lib_name].options.get('libs')
 
619
      lib_desc = self.sections[lib_name].options.get('description')
 
620
      output_path = build_path_join(lib_path, lib_name + '.pc.in')
 
621
      template = ezt.Template(os.path.join('build', 'generator', 'templates',
 
622
                                           'pkg-config.in.ezt'),
 
623
                              compress_whitespace=False)
 
624
      class _eztdata(object):
 
625
        def __init__(self, **kw):
 
626
          vars(self).update(kw)
 
627
 
 
628
      data = _eztdata(
 
629
        lib_name=lib_name,
 
630
        lib_desc=lib_desc,
 
631
        lib_deps=[],
 
632
        lib_required=[],
 
633
        lib_required_private=[],
 
634
        )
 
635
      # libsvn_foo -> -lsvn_foo
 
636
      data.lib_deps.append('-l%s' % lib_name.replace('lib', '', 1))
 
637
      for lib_dep in lib_deps.split():
 
638
        if lib_dep == 'apriconv':
 
639
          # apriconv is part of apr-util, skip it
 
640
          continue
 
641
        external_lib = self.sections[lib_dep].options.get('external-lib')
 
642
        if external_lib:
 
643
          ### Some of Subversion's internal libraries can appear as external
 
644
          ### libs to handle conditional compilation. Skip these for now.
 
645
          if external_lib in ['$(SVN_RA_LIB_LINK)', '$(SVN_FS_LIB_LINK)']:
 
646
            continue
 
647
          # If the external library is known to support pkg-config,
 
648
          # add it to the Required: or Required.private: section.
 
649
          # Otherwise, add the external library to linker flags.
 
650
          pkg_config = self.sections[lib_dep].options.get('pkg-config')
 
651
          if pkg_config:
 
652
            private = self.sections[lib_dep].options.get('pkg-config-private')
 
653
            if private:
 
654
              data.lib_required_private.append(pkg_config)
 
655
            else:
 
656
              data.lib_required.append(pkg_config)
 
657
          else:
 
658
            # $(EXTERNAL_LIB) -> @EXTERNAL_LIB@
 
659
            data.lib_deps.append('@%s@' % external_lib[2:-1])
 
660
        else:
 
661
          data.lib_required_private.append(lib_dep)
 
662
 
 
663
      template.generate(open(output_path, 'w'), data)
 
664
 
583
665
class UnknownDependency(Exception):
584
666
  "We don't know how to deal with the dependent to link it in."
585
667
  pass