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