... |
... |
@@ -46,6 +46,7 @@ import subprocess |
46
|
46
|
import traceback
|
47
|
47
|
|
48
|
48
|
from datetime import datetime, timedelta
|
|
49
|
+from debian.debfile import Deb822
|
49
|
50
|
from errno import ENOENT
|
50
|
51
|
from tempfile import mkstemp, mkdtemp
|
51
|
52
|
from tarfile import TarFile
|
... |
... |
@@ -1536,62 +1537,6 @@ __all__.append('SrcContents') |
1536
|
1537
|
|
1537
|
1538
|
################################################################################
|
1538
|
1539
|
|
1539
|
|
-from debian.debfile import Deb822
|
1540
|
|
-
|
1541
|
|
-# Temporary Deb822 subclass to fix bugs with : handling; see #597249
|
1542
|
|
-
|
1543
|
|
-
|
1544
|
|
-class Dak822(Deb822):
|
1545
|
|
- def _internal_parser(self, sequence, fields=None):
|
1546
|
|
- # The key is non-whitespace, non-colon characters before any colon.
|
1547
|
|
- key_part = r"^(?P<key>[^: \t\n\r\f\v]+)\s*:\s*"
|
1548
|
|
- single = re.compile(key_part + r"(?P<data>\S.*?)\s*$")
|
1549
|
|
- multi = re.compile(key_part + r"$")
|
1550
|
|
- multidata = re.compile(r"^\s(?P<data>.+?)\s*$")
|
1551
|
|
-
|
1552
|
|
- wanted_field = lambda f: fields is None or f in fields
|
1553
|
|
-
|
1554
|
|
- if isinstance(sequence, basestring):
|
1555
|
|
- sequence = sequence.splitlines()
|
1556
|
|
-
|
1557
|
|
- curkey = None
|
1558
|
|
- content = ""
|
1559
|
|
- for line in self.gpg_stripped_paragraph(sequence):
|
1560
|
|
- m = single.match(line)
|
1561
|
|
- if m:
|
1562
|
|
- if curkey:
|
1563
|
|
- self[curkey] = content
|
1564
|
|
-
|
1565
|
|
- if not wanted_field(m.group('key')):
|
1566
|
|
- curkey = None
|
1567
|
|
- continue
|
1568
|
|
-
|
1569
|
|
- curkey = m.group('key')
|
1570
|
|
- content = m.group('data')
|
1571
|
|
- continue
|
1572
|
|
-
|
1573
|
|
- m = multi.match(line)
|
1574
|
|
- if m:
|
1575
|
|
- if curkey:
|
1576
|
|
- self[curkey] = content
|
1577
|
|
-
|
1578
|
|
- if not wanted_field(m.group('key')):
|
1579
|
|
- curkey = None
|
1580
|
|
- continue
|
1581
|
|
-
|
1582
|
|
- curkey = m.group('key')
|
1583
|
|
- content = ""
|
1584
|
|
- continue
|
1585
|
|
-
|
1586
|
|
- m = multidata.match(line)
|
1587
|
|
- if m:
|
1588
|
|
- content += '\n' + line # XXX not m.group('data')?
|
1589
|
|
- continue
|
1590
|
|
-
|
1591
|
|
- if curkey:
|
1592
|
|
- self[curkey] = content
|
1593
|
|
-
|
1594
|
|
-
|
1595
|
1540
|
class DBSource(ORMObject):
|
1596
|
1541
|
def __init__(self, source=None, version=None, maintainer=None,
|
1597
|
1542
|
changedby=None, poolfile=None, install_date=None, fingerprint=None):
|
... |
... |
@@ -1620,7 +1565,7 @@ class DBSource(ORMObject): |
1620
|
1565
|
@return: fields is the dsc information in a dictionary form
|
1621
|
1566
|
'''
|
1622
|
1567
|
fullpath = self.poolfile.fullpath
|
1623
|
|
- fields = Dak822(open(self.poolfile.fullpath, 'r'))
|
|
1568
|
+ fields = Deb822(open(self.poolfile.fullpath, 'r'))
|
1624
|
1569
|
return fields
|
1625
|
1570
|
|
1626
|
1571
|
metadata = association_proxy('key', 'value')
|