--- python-cddb-1.4.orig/CDDB.py +++ python-cddb-1.4/CDDB.py @@ -13,11 +13,13 @@ name = 'CDDB.py' version = 1.3 -if os.environ.has_key('EMAIL'): - (default_user, hostname) = string.split(os.environ['EMAIL'], '@') +if os.environ.has_key('CDDB_EMAIL'): + (default_user, hostname) = string.split(os.environ['CDDB_EMAIL'], '@') else: - default_user = os.geteuid() or os.environ['USER'] or 'user' - hostname = socket.gethostname() or 'host' + # default_user = os.geteuid() or os.environ['USER'] or 'user' + # hostname = socket.gethostname() or 'host' + default_user = 'unknown' + hostname = 'localhost' proto = 4 default_server = 'http://freedb.freedb.org/~cddb/cddb.cgi' --- python-cddb-1.4.orig/debian/Debian.README +++ python-cddb-1.4/debian/Debian.README @@ -0,0 +1,8 @@ +python-cddb for Debian +====================== + +By default, python-cddb submits 'unknown@localhost' when doing a query +for privacy reasons. If you want to transmit your real Email address +instead, set $CDDB_EMAIL to your address and python-cddb will use this. + + -- Michael Banck Sun, 31 Mar 2002 23:02:25 +0200 --- python-cddb-1.4.orig/debian/control +++ python-cddb-1.4/debian/control @@ -0,0 +1,19 @@ +Source: python-cddb +Section: python +Priority: optional +Maintainer: Michael Banck +Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.37.2), + python-all-dev (>= 2.3.5-11), python-support (>= 0.3) +Standards-Version: 3.7.2 + +Package: python-cddb +Architecture: any +Depends: ${shlibs:Depends}, ${python:Depends} +Provides: ${python:Provides} +XB-Python-Version: ${python:Versions} +Description: Python interface to CD-IDs and FreeDB + The dynamic duo of CDDB.py and DiscID.py, along with their side-kick + C module cdrommodule.so, provide an easy way for Python programs to + fetch information on audio CDs from CDDB (http://www.cddb.com/) -- a + very large online database of track listings and other information on + audio CDs. The default CDDB server is FreeDB (http://www.freedb.org) --- python-cddb-1.4.orig/debian/compat +++ python-cddb-1.4/debian/compat @@ -0,0 +1 @@ +4 --- python-cddb-1.4.orig/debian/rules +++ python-cddb-1.4/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +DEB_PYTHON_SYSTEM = pysupport + +include /usr/share/cdbs/1/rules/buildcore.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/python-distutils.mk --- python-cddb-1.4.orig/debian/examples +++ python-cddb-1.4/debian/examples @@ -0,0 +1 @@ +cddb-info.py --- python-cddb-1.4.orig/debian/pycompat +++ python-cddb-1.4/debian/pycompat @@ -0,0 +1 @@ +2 --- python-cddb-1.4.orig/debian/changelog +++ python-cddb-1.4/debian/changelog @@ -0,0 +1,149 @@ +python-cddb (1.4-5.1build3) lucid; urgency=low + + * Rebuild dropping the extension for python2.5. + + -- Matthias Klose Mon, 01 Feb 2010 22:04:50 +0000 + +python-cddb (1.4-5.1build2) jaunty; urgency=low + + * Rebuild for python2.6. + + -- Matthias Klose Mon, 23 Feb 2009 16:55:51 +0100 + +python-cddb (1.4-5.1build1) edgy; urgency=low + + * Rebuild to add support for python2.5. + + -- Matthias Klose Fri, 8 Sep 2006 13:33:03 +0000 + +python-cddb (1.4-5.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix old FSF address in debian/copyright. + * Update package to last python policy (Closes: #373518). + + -- Pierre Habouzit Thu, 29 Jun 2006 23:27:03 +0200 + +python-cddb (1.4-5) unstable; urgency=low + + * debian/patches/03_double_free_fix.diff: New patch, fixing a double + free error. + + -- Michael Banck Sat, 1 Apr 2006 13:25:44 +0200 + +python-cddb (1.4-4) unstable; urgency=low + + * debian/patches/02_kfreebsd.diff: New patch, fixing build on + GNU/kFreeBSD, thanks to Aurelien Jarno; closes: #332989. + + -- Michael Banck Mon, 10 Oct 2005 00:30:05 +0200 + +python-cddb (1.4-3) unstable; urgency=low + + * debian/patches/01_integer_python2.4_fix: New file, fixes a + FutureWarning for integer conversion, thanks to Thomas + Krennwallner ; closes: #234762. + + -- Michael Banck Wed, 25 Feb 2004 18:27:47 +0100 + +python-cddb (1.4-2) unstable; urgency=low + + * The 'Oops'-Relase. + * Due to a wrong link on the upstream homepage, 1.4-1 stil + contained upstream version 1.3. + * debian/patches/upstream-1.3-to-1.4.diff: New file, containing + the changes between 1.3 and 1.4; closes: #230114. + * debian/rules: include simple-patchsys.mk. + + -- Michael Banck Sat, 31 Jan 2004 12:03:55 +0100 + +python-cddb (1.4-1) unstable; urgency=low + + * New upstream release. + * Acknowledge NMU; closes: #205639. + + -- Michael Banck Thu, 8 Jan 2004 12:35:25 +0100 + +python-cddb (1.3-10.1) unstable; urgency=low + + * NMU. + * Rebuild against python 2.3 (closes: #205639). + * Use python:Depends and depend on debhelper 4.1.62. + + -- Josselin Mouette Tue, 19 Aug 2003 11:34:37 +0200 + +python-cddb (1.3-10) unstable; urgency=low + + * Added Build-Depends on cdbs; closes: #201889 + + -- Michael Banck Fri, 18 Jul 2003 15:38:11 +0200 + +python-cddb (1.3-9) unstable; urgency=low + + * Moved section from interpreters to python + * Switched to cdbs + * Bumped Standards-Version to 3.6.0 + + -- Michael Banck Fri, 18 Jul 2003 13:07:55 +0200 + +python-cddb (1.3-8) unstable; urgency=low + + * Switched to Python2.2 + * Removed local Emacs-variables from debian/changelog + * Changed Maintainers Email address + + -- Michael Banck Tue, 27 Aug 2002 23:04:28 +0200 + +python-cddb (1.3-7) unstable; urgency=low + + * Changed EMail-submission when querying. CDDB.py now looks for + $CDDB_EMAIL instead of $EMAIL. If this does not exist, it uses + 'unknown@localhost' instead, so real Email-addresses don't get + submitted by default; closes: #139685 + * Documented this change in Debian.README + + -- Michael Banck Mon, 1 Apr 2002 13:15:55 +0200 + +python-cddb (1.3-6) unstable; urgency=low + + * Cleaned up debian/rules + * Corrected error in Description; closes: #125280 + + -- Michael Banck Tue, 18 Dec 2001 00:33:27 +0100 + +python-cddb (1.3-5) unstable; urgency=low + + * Changed debian/rules to call /usr/bin/python2.1 instead of just + python as /usr/bin/python isn't around + * Changed description in debian/control slightly + + -- Michael Banck Fri, 9 Nov 2001 00:30:52 +0100 + +python-cddb (1.3-4) unstable; urgency=low + + * Changed control file to comply with Python Policy, ver 0.3.6 + + -- Michael Banck Wed, 7 Nov 2001 20:46:40 +0100 + +python-cddb (1.3-3) unstable; urgency=low + + * Moved all dh_* stuff to binary-arch, python-cddb has a small + C-module and is therefore arch-dependant. Oops. + + -- Michael Banck Sat, 13 Oct 2001 10:27:42 +0200 + +python-cddb (1.3-2) unstable; urgency=low + + * Changed Section: from sound to interpreters according to + override file + + -- Michael Banck Fri, 12 Oct 2001 20:03:41 +0000 + +python-cddb (1.3-1) unstable; urgency=low + + * Initial Release; closes: #114911 + * Made CDDB.py and DiscID.py executable as they start with + '#!/usr/bin/env python' + + -- Michael Banck Sat, 6 Oct 2001 22:49:41 +0000 + --- python-cddb-1.4.orig/debian/copyright +++ python-cddb-1.4/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Michael Banck on +Fri, 15 Jun 2001 23:19:17 +0000. + +It was downloaded from http://cddb-py.sourceforge.net + +Upstream Author: Ben Gertzfield + +Copyright: + + This package 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; version 2 dated June, 1991. + + This package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. + + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + --- python-cddb-1.4.orig/debian/docs +++ python-cddb-1.4/debian/docs @@ -0,0 +1 @@ +README --- python-cddb-1.4.orig/debian/patches/03_double_free_fix.diff +++ python-cddb-1.4/debian/patches/03_double_free_fix.diff @@ -0,0 +1,10 @@ +--- unix/cdrommodule.c.orig 2006-04-01 13:24:40.000000000 +0200 ++++ unix/cdrommodule.c 2006-04-01 13:24:52.000000000 +0200 +@@ -218,7 +218,6 @@ + + if (cdrom_file_object == NULL) { + PyErr_SetString(cdrom_error, "Internal conversion from file pointer to Python object failed"); +- fclose(cdrom_file); + return NULL; + } + --- python-cddb-1.4.orig/debian/patches/upstream-1.3-to-1.4.diff +++ python-cddb-1.4/debian/patches/upstream-1.3-to-1.4.diff @@ -0,0 +1,440 @@ +diff -Naur CDDB-1.3/CDDB.py CDDB-1.4/CDDB.py +--- CDDB-1.3/CDDB.py 2001-03-10 23:34:03.000000000 +0100 ++++ CDDB-1.4/CDDB.py 2003-09-01 01:18:43.000000000 +0200 +@@ -5,13 +5,13 @@ + # Written 17 Nov 1999 by Ben Gertzfield + # This work is released under the GNU GPL, version 2 or later. + +-# Release version 1.3 +-# CVS ID: $Id: CDDB.py,v 1.7 2001/03/10 22:34:03 che_fox Exp $ ++# Release version 1.4 ++# CVS ID: $Id: CDDB.py,v 1.8 2003/08/31 23:18:43 che_fox Exp $ + + import urllib, string, socket, os, struct, re + + name = 'CDDB.py' +-version = 1.3 ++version = 1.4 + + if os.environ.has_key('EMAIL'): + (default_user, hostname) = string.split(os.environ['EMAIL'], '@') +@@ -19,7 +19,8 @@ + default_user = os.geteuid() or os.environ['USER'] or 'user' + hostname = socket.gethostname() or 'host' + +-proto = 4 ++# Use protocol version 5 to get DYEAR and DGENRE fields. ++proto = 5 + default_server = 'http://freedb.freedb.org/~cddb/cddb.cgi' + + def query(track_info, server_url=default_server, +diff -Naur CDDB-1.3/CHANGES CDDB-1.4/CHANGES +--- CDDB-1.3/CHANGES 2001-03-10 23:34:03.000000000 +0100 ++++ CDDB-1.4/CHANGES 2003-09-01 01:19:45.000000000 +0200 +@@ -1,3 +1,14 @@ ++v1.4 ++---- ++ ++Updated FreeDB version field to 5; this allows us to get access to the ++DYEAR and DGENRE fields in disc info from CDDB.read(). ++ ++Added Mac OS X support to cdrommodule.c; thanks to Andre Beckedorf ++and Jeffrey C. Jacobs. ++ ++Changed default Solaris CD-ROM device to /dev/vol/aliases/cdrom0. ++ + v1.3 + ---- + +diff -Naur CDDB-1.3/DiscID.py CDDB-1.4/DiscID.py +--- CDDB-1.3/DiscID.py 2001-03-10 23:34:03.000000000 +0100 ++++ CDDB-1.4/DiscID.py 2003-09-01 01:19:45.000000000 +0200 +@@ -9,8 +9,8 @@ + # Written 17 Nov 1999 by Ben Gertzfield + # This work is released under the GNU GPL, version 2 or later. + +-# Release version 1.3 +-# CVS ID: $Id: DiscID.py,v 1.9 2001/03/10 22:34:03 che_fox Exp $ ++# Release version 1.4 ++# CVS ID: $Id: DiscID.py,v 1.10 2003/08/31 23:19:45 che_fox Exp $ + + import cdrom, sys + +diff -Naur CDDB-1.3/README CDDB-1.4/README +--- CDDB-1.3/README 2001-03-10 23:34:03.000000000 +0100 ++++ CDDB-1.4/README 2003-09-01 01:19:45.000000000 +0200 +@@ -1,7 +1,7 @@ +-README for CDDB.py and DiscID.py, version 1.3 ++README for CDDB.py and DiscID.py, version 1.4 + +-Copyright (C) 1999, 2000 Ben Gertzfield +--------------------------------------------------------- ++Copyright (C) 1999-2003 Ben Gertzfield ++------------------------------------------------------- + + The dynamic duo of CDDB.py and DiscID.py, along with their side-kick C + module cdrommodule.so, provide an easy way for Python programs to +@@ -27,8 +27,8 @@ + + ----- + +-If you are using Python 1.6 or 2.0 on Linux, FreeBSD, OpenBSD, or +-Solaris, installing is simple. As root, run: ++If you are using Python 1.6 or 2.0 or later on Linux, FreeBSD, ++OpenBSD, Mac OS X, or Solaris, installing is simple. As root, run: + + # python setup.py install + +@@ -39,7 +39,7 @@ + ----- + + If you have an older version of Python installed on Linux, FreeBSD, +-OpenBSD, or Solaris: ++OpenBSD, Mac OS X, or Solaris: + + % make -f Makefile.pre.in boot + % make +@@ -97,9 +97,9 @@ + + This is the default, cross-platform way to open the audio + CD-ROM device. The device defaults to /dev/cdrom on Linux and BSD, +- /dev/vol/alias/cdrom0 on Solaris, and cdaudio under Windows. You +- do not have to use this function to open the audio CD-ROM device, +- but it's a sane default. ++ /dev/disk1 on Mac OS X, /dev/vol/aliases/cdrom0 on Solaris, and ++ cdaudio under Windows. You do not have to use this function to open ++ the audio CD-ROM device, but it's a sane default. + + If you want to specify a different device name or flags for opening, + use the following: +@@ -218,8 +218,8 @@ + the keys of which follow the keywords returned by the CDDB read + command. + +- Dictionary entries that will be of inter +-est: ++ Dictionary entries that will be of interest (note: not all of ++ these keys will always be available for all discs): + + info['TTITLE#'] (where # ranges from 1 to the last track on the disc): + The title of track number #. Note that this is not padded on the +@@ -240,6 +240,12 @@ + info['revision'] + Optional; revision of this CDDB entry + ++ info['DYEAR'] ++ Optional; year this disc was released ++ ++ info['DGENRE'] ++ Optional; Genre string describing this disc ++ + Note that aside from TTITLE#, most of these fields will be empty + strings for most discs. Also, submitted_via and revision are + technically in the comments returned from the server, so may or +@@ -253,8 +259,8 @@ + + This is the platform-specific part of the trio. I have included + unix/cdrommodule.c, which implements the necessary functions under +- Linux, FreeBSD, OpenBSD, and Solaris, but the interface is intended to be +- easy enough to implement on any platform. ++ Linux, FreeBSD, OpenBSD, Mac OS X, and Solaris, but the interface is ++ intended to be easy enough to implement on any platform. + + If you want to write your own cdrommodule.so for your platform, + here are the functions you'll need to export: +@@ -320,3 +326,6 @@ + + And thanks to Alexander S . Guy for the OpenBSD + patch. ++ ++ Finally, thanks to Andre Beckedorf and Jeffrey C. Jacobs for the ++ Mac OS X cdrommodule.c port. +diff -Naur CDDB-1.3/cddb-info.py CDDB-1.4/cddb-info.py +--- CDDB-1.3/cddb-info.py 2001-03-10 23:34:03.000000000 +0100 ++++ CDDB-1.4/cddb-info.py 2003-09-01 01:19:45.000000000 +0200 +@@ -5,7 +5,7 @@ + # Written 17 Nov 1999 by Ben Gertzfield + * OpenBSD support added by Alexander Guy ++ * Darwin/MacOS X support added by Andre Beckedorf + * + * Thanks to Viktor Fougstedt for info + * on the include file to make this work on Solaris! + * +- * Release version 1.2 +- * CVS ID: $Id: cdrommodule.c,v 1.5 2001/03/10 22:34:03 che_fox Exp $ ++ * Release version 1.4 ++ * CVS ID: $Id: cdrommodule.c,v 1.8 2003/08/31 23:24:30 che_fox Exp $ + */ + + #include "Python.h" +@@ -32,6 +33,12 @@ + #include + #endif + ++#if defined(__APPLE__) ++#include ++#include ++#include ++#endif ++ + /* + * Since FreeBSD has identical support but different names for lots + * of these structs and constants, we'll just #define CDDB_WHATEVER +@@ -56,20 +63,29 @@ + + #elif defined(__OpenBSD__) + +-#define CDDB_TOC_HEADER_STRUCT ioc_toc_header +-#define CDDB_STARTING_TRACK_FIELD starting_track ++#define CDDB_TOC_HEADER_STRUCT ioc_toc_header ++#define CDDB_STARTING_TRACK_FIELD starting_track + #define CDDB_ENDING_TRACK_FIELD ending_track +-#define CDDB_READ_TOC_HEADER_FLAG CDIOREADTOCHEADER +-#define CDDB_TOC_ENTRY_STRUCT ioc_read_toc_entry +-#define CDDB_TRACK_FIELD starting_track +-#define CDDB_FORMAT_FIELD address_format +-#define CDDB_MSF_FORMAT CD_MSF_FORMAT +-#define CDDB_ADDR_FIELD data->addr ++#define CDDB_READ_TOC_HEADER_FLAG CDIOREADTOCHEADER ++#define CDDB_TOC_ENTRY_STRUCT ioc_read_toc_entry ++#define CDDB_TRACK_FIELD starting_track ++#define CDDB_FORMAT_FIELD address_format ++#define CDDB_MSF_FORMAT CD_MSF_FORMAT ++#define CDDB_ADDR_FIELD data->addr + #define CDDB_READ_TOC_ENTRY_FLAG CDIOREADTOCENTRIES +-#define CDDB_CDROM_LEADOUT 0xaa ++#define CDDB_CDROM_LEADOUT 0xaa + #define CDDB_DEFAULT_CDROM_DEVICE "/dev/cdrom" + #define CDDB_DEFAULT_CDROM_FLAGS 0 + ++#elif defined (__APPLE__) /* Darwin and MacOS X */ ++ ++#define CDDB_TOC_HEADER_STRUCT CDDiscInfo ++#define CDDB_STARTING_TRACK_FIELD numberOfFirstTrack ++#define CDDB_ENDING_TRACK_FIELD lastTrackNumberInLastSessionLSB ++#define CDDB_TOC_ENTRY_STRUCT CDTrackInfo ++#define CDDB_DEFAULT_CDROM_DEVICE "/dev/disk1" ++#define CDDB_DEFAULT_CDROM_FLAGS O_RDONLY | O_NONBLOCK ++ + #else /* Linux and Solaris */ + + #define CDDB_TOC_HEADER_STRUCT cdrom_tochdr +@@ -85,7 +101,7 @@ + #define CDDB_CDROM_LEADOUT CDROM_LEADOUT + + #ifdef sun +-#define CDDB_DEFAULT_CDROM_DEVICE "/dev/vol/alias/cdrom0" ++#define CDDB_DEFAULT_CDROM_DEVICE "/dev/vol/aliases/cdrom0" + #else + #define CDDB_DEFAULT_CDROM_DEVICE "/dev/cdrom" + #endif /* sun */ +@@ -99,6 +115,10 @@ + static PyObject *cdrom_toc_header(PyObject *self, PyObject *args) + { + struct CDDB_TOC_HEADER_STRUCT hdr; ++#if defined(__APPLE__) ++ dk_cd_read_disc_info_t discInfoParams; ++#endif ++ + PyObject *cdrom_fileobj; + int cdrom_fd; + +@@ -107,7 +127,15 @@ + + cdrom_fd = fileno(PyFile_AsFile(cdrom_fileobj)); + ++#if defined(__APPLE__) ++ memset(&discInfoParams, 0, sizeof(discInfoParams)); ++ discInfoParams.buffer = &hdr; ++ discInfoParams.bufferLength = sizeof(hdr); ++ ++ if (ioctl(cdrom_fd, DKIOCCDREADDISCINFO, &discInfoParams) < 0) { ++#else /* not defined(__APPLE__) */ + if (ioctl(cdrom_fd, CDDB_READ_TOC_HEADER_FLAG, &hdr) < 0) { ++#endif + PyErr_SetFromErrno(cdrom_error); + return NULL; + } +@@ -125,6 +153,9 @@ + + #if defined(__OpenBSD__) + struct cd_toc_entry data; ++#elif defined(__APPLE__) ++ dk_cd_read_track_info_t trackInfoParams; ++ CDMSF trackMSF; + #endif + + if (!PyArg_ParseTuple(args, "O!b", &PyFile_Type, &cdrom_fileobj, &track)) +@@ -132,14 +163,32 @@ + + cdrom_fd = fileno(PyFile_AsFile(cdrom_fileobj)); + ++#if defined(__APPLE__) ++ memset( &trackInfoParams, 0, sizeof(trackInfoParams)); ++ trackInfoParams.addressType = kCDTrackInfoAddressTypeTrackNumber; ++ trackInfoParams.address = track; ++ trackInfoParams.bufferLength = sizeof(entry); ++ trackInfoParams.buffer = &entry; ++ ++ if (ioctl(cdrom_fd, DKIOCCDREADTRACKINFO, &trackInfoParams) < 0) { ++ PyErr_SetFromErrno(cdrom_error); ++ return NULL; ++ } ++ ++ trackMSF = CDConvertLBAToMSF(entry.trackStartAddress); ++ ++ return Py_BuildValue("bbb", trackMSF.minute, ++ trackMSF.second, ++ trackMSF.frame); ++#else /* not defined(__APPLE__) */ + entry.CDDB_TRACK_FIELD = track; + entry.CDDB_FORMAT_FIELD = CDDB_MSF_FORMAT; +- ++ + #if defined(__OpenBSD__) + entry.data = &data; + entry.data_len = sizeof(data); + #endif +- ++ + if (ioctl(cdrom_fd, CDDB_READ_TOC_ENTRY_FLAG, &entry) < 0) { + PyErr_SetFromErrno(cdrom_error); + return NULL; +@@ -148,6 +197,7 @@ + return Py_BuildValue("bbb", entry.CDDB_ADDR_FIELD.msf.minute, + entry.CDDB_ADDR_FIELD.msf.second, + entry.CDDB_ADDR_FIELD.msf.frame); ++#endif + } + + static PyObject *cdrom_leadout(PyObject *self, PyObject *args) +@@ -158,6 +208,11 @@ + + #if defined(__OpenBSD__) + struct cd_toc_entry data; ++#elif defined(__APPLE__) ++ struct CDDB_TOC_HEADER_STRUCT hdr; ++ dk_cd_read_disc_info_t discInfoParams; ++ dk_cd_read_track_info_t trackInfoParams; ++ CDMSF trackMSF; + #endif + + if (!PyArg_ParseTuple(args, "O!", &PyFile_Type, &cdrom_fileobj)) +@@ -165,6 +220,33 @@ + + cdrom_fd = fileno(PyFile_AsFile(cdrom_fileobj)); + ++#if defined(__APPLE__) ++ memset(&discInfoParams, 0, sizeof(discInfoParams)); ++ discInfoParams.buffer = &hdr; ++ discInfoParams.bufferLength = sizeof(hdr); ++ ++ if (ioctl(cdrom_fd, DKIOCCDREADDISCINFO, &discInfoParams) < 0) { ++ PyErr_SetFromErrno(cdrom_error); ++ return NULL; ++ } ++ ++ memset(&trackInfoParams, 0, sizeof(trackInfoParams)); ++ trackInfoParams.addressType = kCDTrackInfoAddressTypeTrackNumber; ++ trackInfoParams.address = hdr.CDDB_ENDING_TRACK_FIELD; ++ trackInfoParams.bufferLength = sizeof(entry); ++ trackInfoParams.buffer = &entry; ++ ++ if (ioctl(cdrom_fd, DKIOCCDREADTRACKINFO, &trackInfoParams) < 0) { ++ PyErr_SetFromErrno(cdrom_error); ++ return NULL; ++ } ++ ++ trackMSF = CDConvertLBAToMSF(entry.trackStartAddress + entry.trackSize + 1); ++ ++ return Py_BuildValue("bbb", trackMSF.minute, ++ trackMSF.second, ++ trackMSF.frame); ++#else /* not defined(__APPLE__) */ + entry.CDDB_TRACK_FIELD = CDDB_CDROM_LEADOUT; + entry.CDDB_FORMAT_FIELD = CDDB_MSF_FORMAT; + +@@ -181,6 +263,7 @@ + return Py_BuildValue("bbb", entry.CDDB_ADDR_FIELD.msf.minute, + entry.CDDB_ADDR_FIELD.msf.second, + entry.CDDB_ADDR_FIELD.msf.frame); ++#endif + } + + int cdrom_close(FILE *cdrom_file) +@@ -206,7 +289,7 @@ + PyErr_SetFromErrno(cdrom_error); + return NULL; + } +- ++ + cdrom_file = fdopen(cdrom_fd, "r"); + + if (cdrom_file == NULL) { --- python-cddb-1.4.orig/debian/patches/02_kfreebsd.diff +++ python-cddb-1.4/debian/patches/02_kfreebsd.diff @@ -0,0 +1,29 @@ +--- python-cddb-1.4.orig/unix/cdrommodule.c ++++ python-cddb-1.4/unix/cdrommodule.c +@@ -28,7 +28,7 @@ + #include + #endif + +-#if defined(sun) || defined(__FreeBSD__) || defined(__OpenBSD__) ++#if defined(sun) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) + #include + #endif + +@@ -38,7 +38,7 @@ + * so that we don't have to repeat the code. + */ + +-#ifdef __FreeBSD__ ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + + #define CDDB_TOC_HEADER_STRUCT ioc_toc_header + #define CDDB_STARTING_TRACK_FIELD starting_track +@@ -92,7 +92,7 @@ + + #define CDDB_DEFAULT_CDROM_FLAGS O_RDONLY | O_NONBLOCK + +-#endif /* __FreeBSD__ */ ++#endif /* __FreeBSD__ || __FreeBSD_kernel__ */ + + static PyObject *cdrom_error; + --- python-cddb-1.4.orig/debian/patches/01_integer_python2.4_fix.diff +++ python-cddb-1.4/debian/patches/01_integer_python2.4_fix.diff @@ -0,0 +1,23 @@ +--- /usr/lib/python2.3/site-packages/CDDB.py 2004-01-31 12:04:32.000000000 +0100 ++++ CDDB.py 2004-02-25 17:21:40.000000000 +0100 +@@ -32,7 +32,7 @@ + disc_id = track_info[0] + num_tracks = track_info[1] + +- query_str = (('%08lx %d ') % (disc_id, num_tracks)) ++ query_str = (('%08lx %d ') % (long(disc_id), num_tracks)) + + for i in track_info[2:]: + query_str = query_str + ('%d ' % i) + +--- /usr/lib/python2.3/site-packages/DiscID.py 2004-01-31 12:04:32.000000000 +0100 ++++ DiscID.py 2004-02-25 17:38:04.000000000 +0100 +@@ -50,7 +50,7 @@ + + total_time = (track_frames[-1] / 75) - (track_frames[0] / 75) + +- discid = ((checksum % 0xff) << 24 | total_time << 8 | last) ++ discid = ((long(checksum) % 0xff) << 24 | total_time << 8 | last) + + return [discid, last] + track_frames[:-1] + [ track_frames[-1] / 75 ] +