]> git.decadent.org.uk Git - dak.git/blob - daklib/regexes.py
Merge commit 'ftpmaster/master' into psycopg2
[dak.git] / daklib / regexes.py
1 #!/usr/bin/env python
2 # vim:set et sw=4:
3
4 """Central repository of regexes for dak"""
5 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006  James Troup <james@nocrew.org>
6 # Copyright (C) 2009  Mark Hymers <mhy@debian.org>
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
22 ###############################################################################
23
24 import re
25
26 re_isanum = re.compile (r"^\d+$")
27 re_default_answer = re.compile(r"\[(.*)\]")
28 re_fdnic = re.compile(r"\n\n")
29 re_bin_only_nmu = re.compile(r"\+b\d+$")
30
31 re_comments = re.compile(r"\#.*")
32 re_no_epoch = re.compile(r"^\d+\:")
33 re_no_revision = re.compile(r"-[^-]+$")
34 re_arch_from_filename = re.compile(r"/binary-[^/]+/")
35 re_extract_src_version = re.compile (r"(\S+)\s*\((.*)\)")
36 re_isadeb = re.compile (r"(.+?)_(.+?)_(.+)\.u?deb$")
37
38 re_issource = re.compile (r"(.+)_(.+?)\.(orig\.tar\.gz|diff\.gz|tar\.gz|dsc)$")
39
40 re_single_line_field = re.compile(r"^(\S*)\s*:\s*(.*)")
41 re_multi_line_field = re.compile(r"^\s(.*)")
42 re_taint_free = re.compile(r"^[-+~/\.\w]+$")
43
44 re_parse_maintainer = re.compile(r"^\s*(\S.*\S)\s*\<([^\>]+)\>")
45 re_gpg_uid = re.compile('^uid.*<([^>]*)>')
46
47 re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$")
48 re_verwithext = re.compile(r"^(\d+)(?:\.(\d+))(?:\s+\((\S+)\))?$")
49
50 re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$")
51
52 html_escaping = {'"':'&quot;', '&':'&amp;', '<':'&lt;', '>':'&gt;'}
53 re_html_escaping = re.compile('|'.join(map(re.escape, html_escaping.keys())))
54
55 # From clean_proposed_updates.py
56 re_isdeb = re.compile (r"^(.+)_(.+?)_(.+?).u?deb$")
57
58 # From examine_package.py
59 re_package = re.compile(r"^(.+?)_.*")
60 re_doc_directory = re.compile(r".*/doc/([^/]*).*")
61
62 re_contrib = re.compile('^contrib/')
63 re_nonfree = re.compile('^non\-free/')
64
65 re_localhost = re.compile("localhost\.localdomain")
66 re_version = re.compile('^(.*)\((.*)\)')
67
68 re_newlinespace = re.compile('\n')
69 re_spacestrip = re.compile('(\s)')
70
71 # From import_archive.py
72 re_arch_from_filename = re.compile(r"binary-[^/]+")
73
74 # From import_ldap_fingerprints.py
75 re_gpg_fingerprint = re.compile(r"^\s+Key fingerprint = (.*)$", re.MULTILINE)
76 re_debian_address = re.compile(r"^.*<(.*)@debian\.org>$", re.MULTILINE)
77
78 # From new_security_install.py
79 re_taint_free = re.compile(r"^['/;\-\+\.~\s\w]+$")
80
81 # From process_unchecked.py
82 re_valid_version = re.compile(r"^([0-9]+:)?[0-9A-Za-z\.\-\+:~]+$")
83 re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$")
84 re_changelog_versions = re.compile(r"^\w[-+0-9a-z.]+ \([^\(\) \t]+\)")
85 re_strip_revision = re.compile(r"-([^-]+)$")
86 re_strip_srcver = re.compile(r"\s+\(\S+\)$")
87 re_spacestrip = re.compile('(\s)')
88
89 # From dak/rm.py
90 re_strip_source_version = re.compile (r'\s+.*$')
91 re_build_dep_arch = re.compile(r"\[[^]]+\]")
92
93 # From dak/transitions.py
94 re_broken_package = re.compile(r"[a-zA-Z]\w+\s+\-.*")