import os
import sys
import apt_pkg
-from commands import getstatusoutput
from glob import glob
from shutil import rmtree
from daklib.dbconn import *
from daklib import utils
from daklib.config import Config
+from daklib.contents import UnpackedSource
from daklib.regexes import re_no_epoch
################################################################################
print upload[index]
prev_upload = upload[0]
-def export_files(session, pool, clpool, temppath):
+def export_files(session, pool, clpool):
"""
Export interesting files from source packages.
"""
pass
os.link(os.path.join(path, file), os.path.join(path, link))
- tempdir = utils.temp_dirname(parent=temppath)
- os.rmdir(tempdir)
-
for p in unpack.keys():
package = os.path.splitext(os.path.basename(p))[0].split('_')
- cmd = 'dpkg-source --no-check --no-copy -x %s %s' % (p, tempdir)
- (result, output) = getstatusoutput(cmd)
- if not result:
+ try:
+ unpacked = UnpackedSource(p)
+ tempdir = unpacked.get_root_directory()
stats['unpack'] += 1
for file in files:
- for f in glob(os.path.join(tempdir, 'debian', '*%s*' % file)):
+ for f in glob(os.path.join(tempdir, 'debian', '*%s' % file)):
for s in unpack[p][1]:
suite = os.path.join(unpack[p][0], '%s.%s' \
% (s, os.path.basename(f)))
pass
os.link(version, suite)
stats['created'] += 1
- else:
- print 'make-changelog: unable to unpack %s_%s: %s' \
- % (package[0], package[1], output)
+ unpacked.cleanup()
+ except Exception as e:
+ print 'make-changelog: unable to unpack %s\n%s' % (p, e)
stats['errors'] += 1
- rmtree(tempdir)
-
for root, dirs, files in os.walk(clpool):
if len(files):
if root.split('/')[-1] not in sources.keys():
if not Cnf.has_key('Make-Changelog::Options::%s' % (i)):
Cnf['Make-Changelog::Options::%s' % (i)] = ''
- apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
- Options = Cnf.SubTree('Make-Changelog::Options')
+ apt_pkg.parse_commandline(Cnf, Arguments, sys.argv)
+ Options = Cnf.subtree('Make-Changelog::Options')
suite = Cnf['Make-Changelog::Options::Suite']
base_suite = Cnf['Make-Changelog::Options::Base-Suite']
binnmu = Cnf['Make-Changelog::Options::binNMU']
if export:
if cnf.exportpath:
exportpath = os.path.join(Cnf['Dir::Export'], cnf.exportpath)
- export_files(session, Cnf['Dir::Pool'], exportpath, Cnf['Dir::TempPath'])
+ export_files(session, Cnf['Dir::Pool'], exportpath)
else:
utils.fubar('No changelog export path defined')
elif binnmu: