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

« back to all changes in this revision

Viewing changes to tools/dev/gen-py-errors.py

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# ====================================================================
24
24
#
25
25
#
26
 
#  Meant to be run from the root of a Subversion working copy.  If anybody
27
 
#  wants to do some path magic to improve that use, feel free.
28
 
 
29
 
import sys, os
30
 
sys.path.append(os.path.join('subversion', 'bindings', 'swig',
31
 
                             'python', 'tests'))
32
 
 
33
 
 
34
 
import setup_path
35
 
 
36
 
header = '''#!/usr/bin/env python
37
 
### This file automatically generated by tools/dev/gen-py-error.py,
 
26
# Locates svn_error_codes.h based on its relative location to this script.
 
27
#
 
28
# Generates to STDOUT. Typically, redirect this into svntest/err.py
 
29
#
 
30
 
 
31
import sys
 
32
import os
 
33
import re
 
34
 
 
35
HEADER = '''#!/usr/bin/env python
 
36
### This file automatically generated by tools/dev/gen-py-errors.py,
38
37
### which see for more information
39
38
###
40
39
### It is versioned for convenience.
41
 
 
42
40
'''
43
41
 
44
 
 
45
 
def write_output(errs, filename):
46
 
  out = open(filename, 'w')
47
 
  out.write(header)
48
 
 
49
 
  for name, val in errs:
50
 
    out.write('%s = %d\n' % (name, val))
51
 
 
52
 
  out.close()
53
 
 
54
 
 
55
 
def main(output_filename):
56
 
  import core
57
 
 
58
 
  errs = [e for e in dir(core.svn.core) if e.startswith('SVN_ERR_')]
59
 
  codes = []
60
 
  for e in errs:
61
 
    codes.append((e[8:], getattr(core.svn.core, e)))
62
 
  write_output(codes, output_filename)
 
42
# Established by svn 1.0. May as well hard-code these.
 
43
APR_OS_START_ERROR = 20000
 
44
APR_OS_START_USERERR = APR_OS_START_ERROR + 50000 * 2
 
45
SVN_ERR_CATEGORY_SIZE = 5000
 
46
 
 
47
RE_CAT_NAME = re.compile(r'SVN_ERR_([A-Z_]+)_CATEG')
 
48
RE_CAT_VALUE = re.compile(r'\d+')
 
49
 
 
50
RE_DEF_NAME = re.compile(r'SVN_ERRDEF\(([A-Z0-9_]+)')
 
51
RE_DEF_VALUE = re.compile(r'SVN_ERR_([A-Z_]+)_CATEG[^0-9]*([0-9]+)')
 
52
 
 
53
 
 
54
def write_output(codes):
 
55
  print HEADER
 
56
 
 
57
  for name, value in codes:
 
58
    # skip SVN_ERR_ on the name
 
59
    print '%s = %d' % (name[8:], value)
 
60
 
 
61
 
 
62
def main(codes_fname):
 
63
  categ = { }
 
64
  codes = [ ]
 
65
 
 
66
  f = open(codes_fname)
 
67
 
 
68
  # Parse all the category start values
 
69
  while True:
 
70
    line = f.next()
 
71
    m = RE_CAT_NAME.search(line)
 
72
    if m:
 
73
      name = m.group(1)
 
74
      m = RE_CAT_VALUE.search(f.next())
 
75
      assert m
 
76
      value = int(m.group(0))
 
77
      categ[name] = APR_OS_START_USERERR + value * SVN_ERR_CATEGORY_SIZE
 
78
 
 
79
    elif line.strip() == 'SVN_ERROR_START':
 
80
      break
 
81
 
 
82
  # Parse each of the error values
 
83
  while True:
 
84
    line = f.next()
 
85
    m = RE_DEF_NAME.search(line)
 
86
    if m:
 
87
      name = m.group(1)
 
88
      line = f.next()
 
89
      m = RE_DEF_VALUE.search(line)
 
90
      if not m:
 
91
        # SVN_ERR_WC_NOT_DIRECTORY is defined as equal to NOT_WORKING_COPY
 
92
        # rather than relative to SVN_ERR_WC_CATEGORY_START
 
93
        #print 'SKIP:', line
 
94
        continue
 
95
      cat = m.group(1)
 
96
      value = int(m.group(2))
 
97
      codes.append((name, categ[cat] + value))
 
98
 
 
99
    elif line.strip() == 'SVN_ERROR_END':
 
100
      break
 
101
 
 
102
  write_output(sorted(codes))
63
103
 
64
104
 
65
105
if __name__ == '__main__':
66
 
  main(os.path.join('subversion', 'tests', 'cmdline', 'svntest', 'err.py'))
 
106
  this_dir = os.path.dirname(os.path.abspath(__file__))
 
107
  codes_fname = os.path.join(this_dir, os.path.pardir, os.path.pardir,
 
108
                             'subversion', 'include', 'svn_error_codes.h')
 
109
  main(codes_fname)