| 1 |
# /usr/bin/env python |
# /usr/bin/env python |
| 2 |
# Last-Modified: <Sat Jul 26 12:58:43 2008> |
# Last-Modified: <Fri Aug 8 12:42:28 2008> |
| 3 |
# This file is a part of the Ultimate Debian Database project |
# This file is a part of the Ultimate Debian Database project |
| 4 |
|
|
| 5 |
import debian_bundle.deb822 |
import debian_bundle.deb822 |
| 144 |
raise ConfigException('distribution not specified for source %s' % |
raise ConfigException('distribution not specified for source %s' % |
| 145 |
(source)) |
(source)) |
| 146 |
|
|
| 147 |
|
if not 'packages-table' in src_cfg: |
| 148 |
|
raise ConfigException('packages-table not specified for source %s' % (source)) |
| 149 |
|
|
| 150 |
aux.debug = self.config['general']['debug'] |
aux.debug = self.config['general']['debug'] |
| 151 |
|
table = src_cfg['packages-table'] |
| 152 |
|
|
| 153 |
# Get distribution ID |
# Get distribution ID |
| 154 |
self._distr = src_cfg['distribution'] |
self._distr = src_cfg['distribution'] |
| 157 |
|
|
| 158 |
# For every part and every architecture, import the packages into the DB |
# For every part and every architecture, import the packages into the DB |
| 159 |
for comp in src_cfg['components']: |
for comp in src_cfg['components']: |
| 160 |
cur.execute("DELETE FROM packages WHERE distribution = '%s' AND release = '%s' AND component = '%s'" %\ |
cur.execute("DELETE FROM %s WHERE distribution = '%s' AND release = '%s' AND component = '%s'" %\ |
| 161 |
(self._distr, src_cfg['release'], comp)) |
(table, self._distr, src_cfg['release'], comp)) |
| 162 |
for arch in src_cfg['archs']: |
for arch in src_cfg['archs']: |
| 163 |
path = os.path.join(src_cfg['directory'], comp, 'binary-' + arch, 'Packages.gz') |
path = os.path.join(src_cfg['directory'], comp, 'binary-' + arch, 'Packages.gz') |
| 164 |
try: |
try: |
| 165 |
cur.execute("""PREPARE package_insert AS INSERT INTO Packages |
cur.execute("""PREPARE package_insert AS INSERT INTO %s |
| 166 |
(Package, Version, Architecture, Maintainer, Description, Source, |
(Package, Version, Architecture, Maintainer, Description, Source, |
| 167 |
Source_Version, Essential, Depends, Recommends, Suggests, Enhances, |
Source_Version, Essential, Depends, Recommends, Suggests, Enhances, |
| 168 |
Pre_Depends, Installed_Size, Homepage, Size, MD5Sum, Distribution, |
Pre_Depends, Installed_Size, Homepage, Size, MD5Sum, Distribution, |
| 170 |
VALUES |
VALUES |
| 171 |
( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, |
( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, |
| 172 |
$16, $17, '%s', '%s', '%s') |
$16, $17, '%s', '%s', '%s') |
| 173 |
""" % (self._distr, src_cfg['release'], comp)) |
""" % (table, self._distr, src_cfg['release'], comp)) |
| 174 |
aux.print_debug("Reading file " + path) |
aux.print_debug("Reading file " + path) |
| 175 |
# Copy content from gzipped file to temporary file, so that apt_pkg is |
# Copy content from gzipped file to temporary file, so that apt_pkg is |
| 176 |
# used by debian_bundle |
# used by debian_bundle |