Package: git-buildpackage
Version: 0.6.0~git20120419
Severity: wishlist
Tags: patch

Dear Maintainer,

I include a patch to provide a minimalist debian/control object in
preparation to #669171.

Based on experimental.

Regards.

The following changes since commit 7fc0d8c974921d1ef280d5178d03839e0d074b88:

  Fix typo in doctest that made epydoc fail. (2012-05-15 21:04:23 +0200)

are available in the git repository at:

  git://git.baby-gnu.net/git-buildpackage 
tags/dad/add-minimalist-control-object/1

for you to fetch changes up to 33796f8278e4b7e81674fa7e7f90cfb076804147:

  Add minimalist debian/control object. (2012-05-18 23:35:18 +0200)

----------------------------------------------------------------
For now it only provides the "name" property which return the package source 
name.

----------------------------------------------------------------
Daniel Dehennin (1):
      Add minimalist debian/control object.

 gbp/deb/control.py |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 gbp/deb/control.py


From 33796f8278e4b7e81674fa7e7f90cfb076804147 Mon Sep 17 00:00:00 2001
From: Daniel Dehennin <[email protected]>
Date: Fri, 18 May 2012 19:42:16 +0200
Subject: [PATCH] Add minimalist debian/control object.

* gbp/deb/control.py: New class Control with "name" property to get
  package source name.
---
 gbp/deb/control.py |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 gbp/deb/control.py

diff --git a/gbp/deb/control.py b/gbp/deb/control.py
new file mode 100644
index 0000000..f048f33
--- /dev/null
+++ b/gbp/deb/control.py
@@ -0,0 +1,63 @@
+# vim: set fileencoding=utf-8 :
+#
+# (C) 2012 Daniel Dehennin <[email protected]>
+#    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
+"""A Debian Control"""
+
+import email
+import os
+
+class NoControlError(Exception):
+    """No control found"""
+    pass
+
+class ParseControlError(Exception):
+    """Problem parsing control"""
+    pass
+
+class Control(object):
+    """A Debian control"""
+
+    def __init__(self, filename="debian/control"):
+        """
+        Parse an existing control file.
+
+        @param filename: name of the control file
+        @type filename: C{str}
+        @return: Control object
+        @rtype: C{gbp.deb.conrol.Control} object
+        """
+        if not os.access(filename, os.F_OK):
+            raise NoControlError("Control file %s does not exist" % filename)
+
+        self.filename = filename
+        with file(filename) as f:
+            control = email.message_from_file(f)
+
+        if not control.items():
+            raise ParseControlError("Empty control file")
+
+        self._control = control
+
+    # def __getitem__(self, item):
+    #     return self._control[item]
+
+    # def __setitem__(self, item, value):
+    #     self._control[item] = value
+
+    @property
+    def name(self):
+        """The packges name"""
+        return self._control['Source']
-- 
1.7.10



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (90, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.4+hati.1+ (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages git-buildpackage depends on:
ii  devscripts       2.11.6
ii  git              1:1.7.10-1
ii  python           2.7.2-10
ii  python-dateutil  1.5-1
ii  python2.6        2.6.7-4
ii  python2.7        2.7.3~rc2-2.1

Versions of packages git-buildpackage recommends:
ii  cowbuilder    <none>
ii  pristine-tar  1.24

Versions of packages git-buildpackage suggests:
ii  python-notify  0.1.1-3
ii  unzip          6.0-6

-- no debconf information

-- debsums errors found:
debsums: changed file /usr/share/pyshared/gbp/deb/changelog.py (from 
git-buildpackage package)
debsums: changed file /usr/share/pyshared/gbp/scripts/dch.py (from 
git-buildpackage package)

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF

Attachment: pgp1LaJOXD9mi.pgp
Description: PGP signature

Reply via email to