Merge asn2deb and idl2deb from official Debian package

svn path=/trunk/; revision=48133
This commit is contained in:
Balint Reczey 2013-03-06 13:31:08 +00:00
parent 974c0e18b9
commit a8f543b56b
11 changed files with 644 additions and 7 deletions

View File

@ -700,6 +700,8 @@ set(INSTALL_FILES
${CMAKE_BINARY_DIR}/dftest.html
${CMAKE_BINARY_DIR}/dumpcap.html
${CMAKE_BINARY_DIR}/editcap.html
${CMAKE_BINARY_DIR}/asn2deb.html
${CMAKE_BINARY_DIR}/idl2deb.html
${CMAKE_BINARY_DIR}/idl2wrs.html
ipmap.html
manuf
@ -1059,6 +1061,8 @@ pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dftest 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/dumpcap 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/editcap 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/asn2deb 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2deb 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/idl2wrs 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/mergecap 1 )
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/randpkt 1 )
@ -1077,6 +1081,8 @@ add_custom_target(
dftest.html
dumpcap.html
editcap.html
asn2deb.html
idl2deb.html
idl2wrs.html
mergecap.html
randpkt.html

View File

@ -1,5 +1,3 @@
#01_idl2deb
#02_asn2deb
03_preferences
#04_drop-capabilities
#05_plugin-libdir

5
debian/rules vendored
View File

@ -75,7 +75,7 @@ install: build
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
mkdir -p $(CURDIR)/debian/tmp/usr/share/applications/
cp debian/wireshark.desktop $(CURDIR)/debian/tmp/usr/share/applications/
cp tools/idl2wrs $(CURDIR)/debian/tmp/usr/bin/
cp tools/asn2deb tools/idl2deb tools/idl2wrs $(CURDIR)/debian/tmp/usr/bin/
#cp debian/wireshark-root.desktop $(CURDIR)/debian/tmp/usr/share/applications/
mkdir -p $(CURDIR)/debian/tmp/usr/share/pixmaps/
cp image/hi48-app-wireshark.png $(CURDIR)/debian/tmp/usr/share/pixmaps/
@ -93,8 +93,9 @@ install: build
cp --parents $$F $(CURDIR)/debian/tmp/usr/include/wireshark; \
done
-rm -rf $(CURDIR)/debian/tmp/usr/man
mkdir -p $(CURDIR)/debian/tmp/usr/man
dh_installman
cp doc/idl2wrs.1 $(CURDIR)/debian/tmp/usr/man
cp doc/asn2deb.1 doc/idl2deb.1 doc/idl2wrs.1 $(CURDIR)/debian/tmp/usr/man
dh_movefiles
dh_pysupport

View File

@ -1,3 +1,5 @@
/usr/bin/asn2deb
/usr/bin/idl2deb
/usr/bin/idl2wrs
/usr/lib/wireshark/libwireshark.so
/usr/lib/wireshark/libwireshark.la

View File

@ -1 +1,3 @@
doc/asn2deb.1
doc/idl2deb.1
doc/idl2wrs.1

View File

@ -79,7 +79,7 @@ man_MANS =
# Build these in case a developer wants to read them and for the Debian
# development package.
# (The former arguably should be in noinst_MANS but it didn't work for me.)
noinst_DATA = idl2wrs.1 idl2wrs.html
noinst_DATA = asn2deb.1 asn2deb.html idl2deb.1 idl2deb.html idl2wrs.1 idl2wrs.html
pkgdata_DATA = AUTHORS-SHORT $(top_srcdir)/docbook/ws.css wireshark.html \
tshark.html wireshark-filter.html capinfos.html editcap.html \
@ -117,6 +117,20 @@ AM_V_POD2HTML = $(am__v_POD2HTML_@AM_V@)
am__v_POD2HTML_ = $(am__v_POD2HTML_@AM_DEFAULT_V@)
am__v_POD2HTML_0 = @echo " POD2HTML" $@;
%.1: %.pod ../config.h
$(AM_V_POD2MAN)$(POD2MAN) \
--center="The Wireshark Network Analyzer" \
--release=$(VERSION) \
$< > $@
%.html: %.pod ../config.h
$(AM_V_POD2HTML)$(POD2HTML) \
--title="The Wireshark Network Analyzer $(VERSION)" \
--css=$(top_srcdir)/docbook/ws.css \
--noindex \
$< > $@
wireshark.1: wireshark.pod ../config.h
$(AM_V_POD2MAN)$(POD2MAN) \
--center="The Wireshark Network Analyzer" \
@ -301,6 +315,10 @@ CLEANFILES = \
dumpcap.html \
editcap.1 \
editcap.html \
asn2deb.1 \
asn2deb.html \
idl2deb.1 \
idl2deb.html \
idl2wrs.1 \
idl2wrs.html \
mergecap.1 \

View File

@ -28,10 +28,10 @@ include ../config.nmake
doc: wireshark.html tshark.html wireshark-filter.html capinfos.html \
editcap.html idl2wrs.html mergecap.html reordercap.html text2pcap.html dumpcap.html \
rawshark.html
rawshark.html idl2deb.html asn2deb.html
man: wireshark.1 tshark.1 wireshark-filter.4 capinfos.1 editcap.1 \
idl2wrs.1 mergecap.1 reordercap.1 text2pcap.1 dumpcap.1 rawshark.1
idl2wrs.1 mergecap.1 reordercap.1 text2pcap.1 dumpcap.1 rawshark.1 idl2deb.1 asn2deb.1
wireshark.pod: wireshark.pod.template AUTHORS-SHORT-FORMAT
copy /B wireshark.pod.template + AUTHORS-SHORT-FORMAT wireshark.pod
@ -118,6 +118,32 @@ editcap.html: editcap.pod ../config.h ws.css
--noindex \
editcap.pod > editcap.html
asn2deb.1: asn2deb.pod ../config.h
$(POD2MAN) \
--center="The Wireshark Network Analyzer" \
--release=$(VERSION) \
asn2deb.pod > asn2deb.1
asn2deb.html: asn2deb.pod ../config.h ws.css
$(POD2HTML) \
--title="asn2deb - The Wireshark Network Analyzer $(VERSION)" \
--css=ws.css \
--noindex \
asn2deb.pod > asn2deb.html
idl2deb.1: idl2deb.pod ../config.h
$(POD2MAN) \
--center="The Wireshark Network Analyzer" \
--release=$(VERSION) \
idl2deb.pod > idl2deb.1
idl2deb.html: idl2deb.pod ../config.h ws.css
$(POD2HTML) \
--title="idl2deb - The Wireshark Network Analyzer $(VERSION)" \
--css=ws.css \
--noindex \
idl2deb.pod > idl2deb.html
idl2wrs.1: idl2wrs.pod ../config.h
$(POD2MAN) \
--center="The Wireshark Network Analyzer" \

75
doc/asn2deb.pod Normal file
View File

@ -0,0 +1,75 @@
=head1 NAME
asn2deb - create a Debian package for BER monitoring from ASN.1
=head1 SYNOPSIS
B<asn2deb> [-a I<ASN.1 file>] [--asn=I<ASN.1 file>] [B<-d >I<opts>] [B<--dbopts=>I<opts>] [B<-e >I<address>]
[B<--email=>I<address>] [B<-h>] [B<--help>] [B<-n >I<name>] [B<--name=>I<name>] [B<-p>] [B<--preserve>] [B<-v>] [B<--version>]
=head1 DESCRIPTION
This manual page documents briefly the B<asn2deb> command. B<asn2deb>
takes an ASN.1 file as input and creates a Debian package from it. The package
contains a loadable type table file for the wireshark network analyser.
The type table is generated by the ASN.1 compiler B<snacc>.
=head1 OPTIONS
=over 4
=item B<-a >I<ASN.1 file> B<--asn=>I<ASN.1 file>
ASN.1 file to use (mandatory).
=item B<-d >I<opts> B<--dbopts=>I<opts>
options for dpkg-buildpackage.
=item B<-e >I<address> B<--email=>I<address>
use e-mail address.
=item B<-h> B<--help>
print help and exit.
=item B<-n >I<name> B<--name=>I<name>
use user name.
=item B<-p> B<--preserve>
do not overwrite files.
=item B<-v> B<--version>
print version and exit.
=back
=head1 EXAMPLES
/usr/bin/asn2deb -e me@foo.net -a bar.asn1 \-n "My Name" -d "-rfakeroot -uc -us"-d "-rfakeroot -uc -us"
=head1 SEE ALSO
A lot of tools are used, which you have to B<apt-get install>: wireshark-dev, python, cdbs, autotools-dev, debhelper, dpkg-dev,
snacc.
=head1 COPYING
This manual page was written by W. Borgert debacle@debian.org
for Debian GNU/Linux (but may be used by others). Permission is granted
to copy, distribute and/or modify this document under the terms of the
GNU General Public License, Version 2 or any later version published by
the Free Software Foundation.
=head1 AUTHOR
B<W. Borgert> Author.
=head1 COPYRIGHT
Copyright (C) 2003, 2005 W. Borger

74
doc/idl2deb.pod Normal file
View File

@ -0,0 +1,74 @@
=head1 NAME
idl2deb - create a Debian package for CORBA monitoring from IDL
=head1 SYNOPSIS
B<idl2deb> [B<-d >I<opts>] [B<--dbopts=>I<opts>] [B<-e >I<address>] [B<--email=>I<address>] [-i I<idlfile>]
[--idl=I<idlfile>] [B<-h>] [B<--help>] [B<-n >I<name>] [B<--name=>I<name>] [B<-p>] [B<--preserve>] [B<-v>] [B<--version>]
=head1 DESCRIPTION
This manual page documents briefly the B<idl2deb> command. B<idl2deb>
takes an CORBA IDL file as input and creates a Debian package from it. The
package contains a loadable module for the wireshark network analyser.
=head1 OPTIONS
=over 4
=item B<-d>I<opts> B<--dbopts=>I<opts>
options for dpkg-buildpackage.
=item B<-e >I<address> B<--email=>I<address>
use e-mail address.
=item B<-i >I<idlfile> B<--idl=>I<idlfile>
IDL file to use (mandatory)
=item B<-h> B<--help>
print help and exit.
=item B<-n >I<name> B<--name=>I<name>
use user name.
=item B<-p> B<--preserve>
do not overwrite files.
=item B<-v> B<--version>
print version and exit.
=back
=head1 EXAMPLES
/usr/bin/idl2deb -e me@foo.net -i bar.idl \-n "My Name" -d "-rfakeroot -uc -us"-d "-rfakeroot -uc -us"
=head1 SEE ALSO
A lot of tools are used, which you have to B<apt-get install>: wireshark-dev, python, cdbs, autotools-dev, debhelper, dpkg-dev.
=head1 COPYING
This manual page was written by W. Borgert debacle@debian.org
for Debian GNU/Linux (but may be used by others). Permission is granted
to copy, distribute and/or modify this document under the terms of the
GNU General Public License, Version 2 or any later version published by
the Free Software Foundation.
=head1 AUTHOR
B<W. Borgert> Author.
=head1 COPYRIGHT
Copyright (C) 2003, 2005 W. Borger

219
tools/asn2deb Executable file
View File

@ -0,0 +1,219 @@
#!/usr/bin/env python
# asn2deb - quick hack by W. Borgert <debacle@debian.org> to create
# Debian GNU/Linux packages from ASN.1 files for Wireshark.
# Copyright 2004, W. Borgert
# ASN.1 module for Wireshark, use of snacc type table:
# Copyright 2003, Matthijs Melchior <matthijs.melchior@xs4all.nl>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.com>
# Copyright 1998 Gerald Combs
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import getopt, os, string, sys, time
scriptinfo = """asn2deb version 2004-02-17
Copyright 2004, W. Borgert
Free software, released under the terms of the GPL."""
options = {'asn': None,
'dbopts': "",
'email': "invalid@invalid.invalid",
'help': 0,
'name': "No Name",
'preserve': 0,
'version': 0}
def bootstrap():
"""Generate Makefile.in and configure script."""
os.system("aclocal-1.7")
os.system("autoconf")
os.system("automake-1.7 --add-missing --copy --foreign")
def create_file(filename, content, mode = None):
"""Create a file with given content."""
global options
if options['preserve'] and os.path.isfile(filename):
return
f = open(filename, 'w')
f.write(content)
f.close()
if mode:
os.chmod(filename, mode)
def create_files(version, deb, email, asn, name, iso, rfc):
"""Create all files for the .deb build process."""
base = asn.lower()[:-5]
create_file("Makefile.am", """#
BUILT_SOURCES = %s.tt
asn1ttdir = $(datadir)/wireshark/asn1
asn1tt_DATA = %s.tt
%s.tt: """ % ((base,) * 3) + asn + """
snacc -u /usr/include/snacc/asn1/asn-useful.asn1 -T $@ $<
""")
create_file("configure.ac", """AC_INIT(%s, 1.0)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_PROG_INSTALL
SNACC=\"`type -p snacc`\"
AC_SUBST(SNACC)
dnl WIRESHARK_VERSION=\"%s\"
dnl plugindir=\"$prefix/share/wireshark/asn.1\"
dnl AC_SUBST(plugindir)
AC_OUTPUT([Makefile])
""" % (base, version))
if not os.path.isdir("debian"):
os.mkdir("debian")
create_file("debian/rules", """#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
PREFIX=`pwd`/debian/wireshark-asn1-%s
binary-post-install/wireshark-asn1-%s::
rm -f $(PREFIX)/usr/lib/wireshark/plugins/%s/*.a
""" % (base, base, version), 0755)
create_file("debian/control", """Source: wireshark-asn1-%s
Section: net
Priority: optional
Maintainer: %s <%s>
Standards-Version: 3.6.1.0
Build-Depends: snacc, autotools-dev, debhelper, cdbs
Package: wireshark-asn1-%s
Architecture: all
Depends: wireshark (= %s)
Description: ASN.1/BER dissector for %s
This package provides a type table for decoding BER (Basic Encoding
Rules) data over TCP or UDP, described by an ASN.1 (Abstract Syntax
Notation 1) file '%s.asn1'.
""" % (base, name, email, base, deb, base, base))
create_file("debian/changelog",
"""wireshark-asn1-%s (0.0.1-1) unstable; urgency=low
* Automatically created package.
-- %s <%s> %s
""" % (base, name, email, rfc + "\n (" + iso + ")"))
create_file("debian/copyright",
"""This package has been created automatically be asn2deb on
%s for Debian GNU/Linux.
Wireshark: http://www.wireshark.com/
Copyright:
GPL, as evidenced by existence of GPL license file \"COPYING\".
(the GNU GPL may be viewed on Debian systems in
/usr/share/common-licenses/GPL)
""" % (iso))
def get_wrs_version():
"""Detect version of wireshark-dev package."""
deb = os.popen(
"dpkg-query -W --showformat='${Version}' wireshark-dev").read()
debv = string.find(deb, "-")
if debv == -1: debv = len(deb)
version = deb[string.find(deb, ":")+1:debv]
return version, deb
def get_time():
"""Detect current time and return ISO and RFC time string."""
currenttime = time.gmtime()
return time.strftime("%Y-%m-%d %H:%M:%S +0000", currenttime), \
time.strftime("%a, %d %b %Y %H:%M:%S +0000", currenttime)
def main():
global options
process_opts(sys.argv)
iso, rfc = get_time()
version, deb = get_wrs_version()
create_files(version, deb,
options['email'], options['asn'], options['name'],
iso, rfc)
bootstrap()
os.system("dpkg-buildpackage " + options['dbopts'])
def process_opts(argv):
"""Process command line options."""
global options
try:
opts, args = getopt.getopt(argv[1:], "a:d:e:hn:pv",
["asn=",
"dbopts=",
"email=",
"help",
"name=",
"preserve",
"version"])
except getopt.GetoptError:
usage(argv[0])
sys.exit(1)
for o, a in opts:
if o in ("-a", "--asn"):
options['asn'] = a
if o in ("-d", "--dbopts"):
options['dbopts'] = a
if o in ("-e", "--email"):
options['email'] = a
if o in ("-h", "--help"):
options['help'] = 1
if o in ("-n", "--name"):
options['name'] = a
if o in ("-p", "--preserve"):
options['preserve'] = 1
if o in ("-v", "--version"):
options['version'] = 1
if options['help']:
usage(argv[0])
sys.exit(0)
if options['version']:
print scriptinfo
sys.exit(0)
if not options['asn']:
print "mandatory ASN.1 file parameter missing"
sys.exit(1)
if not os.access(options['asn'], os.R_OK):
print "ASN.1 file not accessible"
sys.exit(1)
def usage(name):
"""Print usage help."""
print "Usage: " + name + " <parameters>\n" + \
"Parameters are\n" + \
" --asn -a asn1file, ASN.1 file to use (mandatory)\n" + \
" --dbopts -d opts, options for dpkg-buildpackage\n" + \
" --email -e address, use e-mail address\n" + \
" --help -h, print help and exit\n" + \
" --name -n name, use user name\n" + \
" --preserve -p, do not overwrite files\n" + \
" --version -v, print version and exit\n" + \
"Example:\n" + \
name + " -e me@foo.net -a bar.asn1 -n \"My Name\" " + \
"-d \"-rfakeroot -uc -us\""
if __name__ == '__main__':
main()

216
tools/idl2deb Executable file
View File

@ -0,0 +1,216 @@
#!/usr/bin/env python
# idl2deb - quick hack by W. Martin Borgert <debacle@debian.org> to create
# Debian GNU/Linux packages from idl2wrs modules for Wireshark.
# Copyright 2003, 2008, W. Martin Borgert
# Makefile.am and configure.ac code by:
# Copyright 2001, Ericsson Inc.
# Frank Singleton <frank.singleton@ericsson.com>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.com>
# Copyright 1998 Gerald Combs
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import optparse
import os
import string
import sys
import time
scriptinfo = """idl2deb version 2008-03-10
Copyright 2003, 2008, W. Martin Borgert
Free software, released under the terms of the GPL."""
def bootstrap():
"""Generate Makefile.in and configure script."""
os.system("aclocal")
os.system("autoconf")
os.system("libtoolize --automake --copy --force")
os.system("automake --add-missing --copy --foreign")
def create_file(preserve, filename, content, mode = None):
"""Create a file with given content."""
if preserve and os.path.isfile(filename):
return
f = open(filename, 'w')
f.write(content)
f.close()
if mode:
os.chmod(filename, mode)
def create_files(version, deb, email, idl, name, preserve, iso, rfc):
"""Create all files for the .deb build process."""
base = os.path.basename(idl.lower().split(".idl")[0])
create_file(preserve, "Makefile.am", """#
plugindir = @plugindir@
plugin_LTLIBRARIES = %s.la
%s_la_SOURCES = packet-%s.c
%s_la_LDFLAGS = -module -avoid-version
GLIB_CFLAGS = `pkg-config --cflags glib-2.0`
GLIB_LIBS = `pkg-config --libs glib-2.0`
BUILT_SOURCES = packet-%s.c
INCLUDES = -DHAVE_CONFIG -DHAVE_SYS_TYPES_H -DHAVE_SYS_TIME_H \\
-DHAVE_STDARG_H -D_U_=\"__attribute__((unused))\" \\
-I/usr/include/wireshark -DWS_VAR_IMPORT=extern $(GLIB_CFLAGS)
LDADD = $(GLIB_LIBS)
# Libs must be cleared, or else libtool won't create a shared module.
# If your module needs to be linked against any particular libraries,
# add them here.
LIBS =
%s_la_DEPENDENCIES = packet-%s-static.o
packet-%s-static.o: packet-%s.c
$(LTCOMPILE) -c -o packet-%s-static.o \\
-D__WIRESHARK_STATIC__ packet-%s.c
packet-%s.c: """ % ((base,) * 12) + idl + """
$(IDL2WRS) -I. $< > $@
""")
create_file(preserve, "configure.ac", """AC_INIT(%s, 1.0)
AC_PROG_LIBTOOL
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_PROG_CC
AC_STDC_HEADERS
AC_PROG_INSTALL
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.2.2)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
IDL2WRS=\"`type -p idl2wrs`\"
AC_SUBST(IDL2WRS)
WIRESHARK_VERSION=\"%s\"
plugindir=\"$libdir/wireshark/plugins/$WIRESHARK_VERSION\"
AC_SUBST(plugindir)
AC_OUTPUT([Makefile])
""" % (base, version))
if not os.path.isdir("debian"):
os.mkdir("debian")
create_file(preserve, "debian/rules", """#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
PREFIX=`pwd`/debian/wireshark-giop-%s
binary-post-install/wireshark-giop-%s::
rm -f $(PREFIX)/usr/lib/wireshark/plugins/%s/*.a
""" % (base, base, version), 0755)
create_file(preserve, "debian/control", """Source: wireshark-giop-%s
Section: net
Priority: optional
Maintainer: %s <%s>
Standards-Version: 3.6.1.0
Build-Depends: wireshark-dev, autotools-dev, debhelper, cdbs
Package: wireshark-giop-%s
Architecture: any
Depends: wireshark (= %s), ${shlibs:Depends}
Description: GIOP dissector for CORBA interface %s
This package provides a dissector for GIOP (General Inter-ORB
Protocol) for the Wireshark protocol analyser. It decodes the CORBA
(Common Object Request Broker Architecture) interfaces described
in the IDL (Interface Definition Language) file '%s.idl'.
""" % (base, name, email, base, deb, base, base))
create_file(preserve, "debian/changelog",
"""wireshark-giop-%s (0.0.1-1) unstable; urgency=low
* Automatically created package.
-- %s <%s> %s
""" % (base, name, email, rfc))
create_file(preserve, "debian/copyright",
"""This package has been created automatically by idl2deb on
%s for Debian GNU/Linux.
Wireshark: http://www.wireshark.org/
Copyright:
GPL, as evidenced by existence of GPL license file \"COPYING\".
(the GNU GPL may be viewed on Debian systems in
/usr/share/common-licenses/GPL)
""" % (iso))
def get_wrs_version():
"""Detect version of wireshark-dev package."""
deb = os.popen(
"dpkg-query -W --showformat='${Version}' wireshark-dev").read()
debv = string.find(deb, "-")
if debv == -1: debv = len(deb)
version = deb[string.find(deb, ":")+1:debv]
return version, deb
def get_time():
"""Detect current time and return ISO and RFC time string."""
currenttime = time.gmtime()
return time.strftime("%Y-%m-%d %H:%M:%S +0000", currenttime), \
time.strftime("%a, %d %b %Y %H:%M:%S +0000", currenttime)
def main():
opts = process_opts(sys.argv)
iso, rfc = get_time()
version, deb = get_wrs_version()
create_files(version, deb,
opts.email, opts.idl, opts.name, opts.preserve,
iso, rfc)
bootstrap()
os.system("dpkg-buildpackage " + opts.dbopts)
def process_opts(argv):
"""Process command line options."""
parser = optparse.OptionParser(
version=scriptinfo,
description="""Example:
%prog -e me@foo.net -i bar.idl -n \"My Name\" -d \"-rfakeroot -uc -us\"""")
parser.add_option("-d", "--dbopts",
default="", metavar="opts",
help="options for dpkg-buildpackage")
parser.add_option("-e", "--email", metavar="address",
default="invalid@invalid.invalid",
help="use e-mail address")
parser.add_option("-i", "--idl", metavar="idlfile",
help="IDL file to use (mandatory)")
parser.add_option("-n", "--name", default="No Name",
help="use user name", metavar="name")
parser.add_option("-p", "--preserve", action="store_true",
help="do not overwrite files")
opts, args = parser.parse_args()
if not opts.idl:
print "mandatory IDL file parameter missing"
sys.exit(1)
if not os.access(opts.idl, os.R_OK):
print "IDL file not accessible"
sys.exit(1)
return opts
if __name__ == '__main__':
main()