3
# Dynamic Kernel Module Support (DKMS) <dkms-devel@dell.com>
4
# Copyright (C) 2009 Dell, Inc.
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
from apport.hookutils import *
25
import subprocess, optparse
27
optparser = optparse.OptionParser('%prog [options]')
28
optparser.add_option('-m', help="Specify the DKMS module to find the package for",
29
action='store', type='string', dest='module')
30
optparser.add_option('-v', help="Specify the DKMS version to find the package for",
31
action='store', type='string', dest='version')
32
options=optparser.parse_args()[0]
34
if not options.module or not options.version:
35
print >> sys.stderr, 'ERROR, both -m and -v are required'
38
package=packaging.get_file_package('/usr/src/' + options.module + '-' + options.version)
40
print >> sys.stderr, 'ERROR: binary package for %s: %s not found' % (options.module,options.version)
43
make_log=os.path.join('/var','lib','dkms',options.module,options.version,'build','make.log')
45
report = apport.Report('Package')
46
report['Package'] = package
47
report['SourcePackage'] = apport.packaging.get_source(package)
48
report['ErrorMessage'] = "%s kernel module failed to build" % options.module
50
version = packaging.get_version(package)
55
report['PackageVersion'] = version
56
attach_file_if_exists(report, make_log, 'DKMSBuildLog')
57
report.write(open(apport.fileutils.make_report_path(report), 'w'))