Trees | Indices | Help |
|
---|
|
1 """Helper functions for the various source formats 2 3 @contact: Debian FTPMaster <ftpmaster@debian.org> 4 @copyright: 2009, 2010 Joerg Jaspert <joerg@debian.org> 5 @copyright: 2009 Chris Lamb <lamby@debian.org> 6 @license: GNU General Public License version 2 or later 7 """ 8 9 # This program is free software; you can redistribute it and/or modify 10 # it under the terms of the GNU General Public License as published by 11 # the Free Software Foundation; either version 2 of the License, or 12 # (at your option) any later version. 13 14 # This program is distributed in the hope that it will be useful, 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 # GNU General Public License for more details. 18 19 # You should have received a copy of the GNU General Public License 20 # along with this program; if not, write to the Free Software 21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 ################################################################################ 24 25 # <sgran> hey, I think something's wrong with your git repo 26 # <sgran> when I git pulled this last time, I got something that looked almost 27 # like python instead of dak 28 # <mhy> sgran: slander 29 # <sgran> sorry, I take it back, I've had a better look now 30 31 ################################################################################ 32 33 import re 34 35 from .dak_exceptions import UnknownFormatError 36 37 srcformats: "list[SourceFormat]" = []41 """ 42 Returns the SourceFormat class that corresponds to the specified .changes 43 Format value. If the string does not match any class, UnknownFormatError 44 is raised. 45 """ 46 47 for format in srcformats: 48 if format.re_format.match(txt): 49 return format 50 51 raise UnknownFormatError("Unknown format %r" % txt)527556 klass = super(SourceFormat, cls).__new__(cls, name, bases, attrs) 57 srcformats.append(klass) 58 59 assert str(klass.name) 60 assert iter(klass.requires) 61 assert iter(klass.disallowed) 62 63 klass.re_format = re.compile(klass.format) 64 65 return klass66 67 @classmethod69 if len(cls.requires) != len([x for x in cls.requires if has[x]]): 70 yield "lack of required files for format %s" % cls.name 71 72 for key in cls.disallowed: 73 if has[key]: 74 yield "contains source files not allowed in format %s" % cls.name78 name = "1.0" 79 format = r"1\.0" 80 81 requires = () 82 disallowed = ("debian_tar", "more_orig_tar") 83 84 @classmethod9786 if not (has["native_tar_gz"] or (has["orig_tar_gz"] and has["debian_diff"])): 87 yield "no .tar.gz or .orig.tar.gz+.diff.gz in 'Files' field." 88 if has["native_tar_gz"] and has["debian_diff"]: 89 yield "native package with diff makes no sense" 90 if (has["orig_tar_gz"] != has["orig_tar"]) or ( 91 has["native_tar_gz"] != has["native_tar"] 92 ): 93 yield "contains source files not allowed in format %s" % cls.name 94 95 for msg in super(FormatOne, cls).reject_msgs(has): 96 yield msg100 name = "3.x (native)" 101 format = r"3\.\d+ \(native\)" 102 103 requires = ("native_tar",) 104 disallowed = ("orig_tar", "debian_diff", "debian_tar", "more_orig_tar")105108 name = "3.x (quilt)" 109 format = r"3\.\d+ \(quilt\)" 110 111 requires = ("orig_tar", "debian_tar") 112 disallowed = ("debian_diff", "native_tar")113
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 30 12:42:53 2025 | http://epydoc.sourceforge.net |