From ad0ee7b350791e62bd02d2255b1286274174d230 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sat, 18 Apr 2009 23:38:52 +0200 Subject: [PATCH] * pbuilder-dist: - Fallback to calling lsb_release if /etc/lsb-release doesn't exist; this makes it possible to run pbuilder-dist on Debian. --- debian/changelog | 6 ++++-- pbuilder-dist | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index af04a43..9c080d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ ubuntu-dev-tools (0.73) UNRELEASED; urgency=low - * + * pbuilder-dist: + - Fallback to calling lsb_release if /etc/lsb-release doesn't + exist; this makes it possible to run pbuilder-dist on Debian. - -- Scott Kitterman Wed, 15 Apr 2009 23:06:54 -0400 + -- Siegfried-Angel Gevatter Pujals Sat, 18 Apr 2009 23:37:55 +0200 ubuntu-dev-tools (0.72) jaunty; urgency=low diff --git a/pbuilder-dist b/pbuilder-dist index d653449..c9ff8d0 100755 --- a/pbuilder-dist +++ b/pbuilder-dist @@ -101,15 +101,20 @@ class pbuilder_dist: if not self.system_architecture or 'not found' in self.system_architecture: print 'Error: Not running on a Debian based system; could not detect its architecture.' - if not os.path.isfile('/etc/lsb-release'): - print 'Error: Not running on a Debian based system; could not find /etc/lsb-release.' - exit(1) - - for line in open('/etc/lsb-release'): - line = line.strip() - if line.startswith('DISTRIB_CODENAME'): - self.system_distro = line[17:] - break + if os.path.isfile('/etc/lsb-release'): + for line in open('/etc/lsb-release'): + line = line.strip() + if line.startswith('DISTRIB_CODENAME'): + self.system_distro = line[17:] + break + else: + import commands + output = commands.getoutput('lsb_release -c').split() + if len(output) == 2: + self.system_distro = output[1] + else: + print 'Error: Not running on a Debian based system; could not find lsb_release.' + exit(1) if not self.system_distro: print 'Error: Could not determine what distribution you are running.'