On Mon, May 14, 2012 at 12:16:07PM +0200, Daniel Dehennin wrote:
> Guido Günther <a...@sigxcpu.org> writes:
> 
> > Hi Daniel,
> >
> > sorry for the delay. Real life keeps interfering.
> 
> No problem, I hope it's in the good way.
> 
> 
> [...]
> 
> >> diff --git a/gbp/deb/changelog.py b/gbp/deb/changelog.py
> >> index b8c10b8..a410e86 100644
> >> --- a/gbp/deb/changelog.py
> >> +++ b/gbp/deb/changelog.py
> >> @@ -19,6 +19,7 @@
> >>  import email
> >>  import os
> >>  import subprocess
> >> +from gbp import scripts
> >
> > We don't want to import scripts itself (since these are the actual
> > scripts being run). If we need code from there we should move it out
> > (see below).
> 
> I think most of the "def" in the scripts/* could be moved somewhere else
> to be reusable.
> 
> 
> [...]
> 
> >> +        if package == None and os.path.isfile("debian/control"):
> >> +            try:
> >> +                control = open("debian/control", "r")
> >> +                for line in control:
> >> +                    if line.startswith("Source: "):
> >> +                        package = line.split()[1]
> >> +                        break
> >> +            except Exception, e:
> >> +                raise NoChangeLogError, "Error parsing debian/control: 
> >> %s" % e
> >
> > We should probably wrap this in either a Control(object) class or at
> > least defer this to another function in deb/__init__.py since the
> > ChangeLog class shouldn't access the control file directly.
> 
> I was first using locally python-debian, but it was too much for 10
> lines.
> 
> I think creating a Control class is a little to much, or maybe there
> will be uses of it.

I'd start of simple with a Control class that has some attributes to
query the name of the source and binary packages. We can extend that as
we move on as needed.

> >
> >> +
> >> +        if version == None:
> >> +            version = scripts.dch.guess_version_from_upstream(repo, 
> >> upstream_tag_format, None)
> >> +        if version == None:
> >> +            raise NoChangeLogError, "No suitable version found"
> >> +
> >> +        scripts.dch.spawn_dch(msg=["debian/changelog: generated by 
> >> git-dch."],
> >> +                              newversion=True, 
> >> version={'version':version},
> >> +                              dch_options="--create --package %s" % 
> >> package)
> >
> > spawn_dch could be moved into gbp/dch.py. It'd be nicer to have this the
> > ChangeLog class later on but I don't want you to having to do all the
> > cleanup work.
> 
> If you have some cleanup plans I could help.

I think movving spawn_dch as a static method to ChagenLog for now would
do the trick for now.

> I'll need this feature and #64668 to setup an autobuild system at work.
> 
> 
> [...]
> 
> >> diff --git a/tests/11_test_changelog_create.py 
> >> b/tests/11_test_changelog_create.py
> >> new file mode 100644
> >> index 0000000..51a8b04
> >> --- /dev/null
> >> +++ b/tests/11_test_changelog_create.py
> >> @@ -0,0 +1,86 @@
> >> +# vim: set fileencoding=utf-8 :
> >> +
> >> +"""Test L{Changelog}'s create"""
> >> +
> >> +import sys
> >> +sys.path.insert(0, "..")
> >> +sys.path.insert(0, ".")
> >
> > What is this needed for?
> 
> I use py.test like this:
> 
> me@home:~/src/gbp/tests$ py.test 11_11_test_changelog_create.py
> 
> This permit to use the code from my git repository, I should use a
> wrapper to set PYTHONPATH like in debian/rules.

Yes. I think that's better. You can also just invoke:

python setup.py nosetests

and it will do the right thing.
Cheers,
 -- Guido

> 
> 
> [...]
> 
> >> +        assert """test-package (1.0-1) UNRELEASED; urgency=low\n""" in 
> >> lines
> >> +        assert """  * debian/changelog: generated by git-dch.\n""" in 
> >> lines
> >
> > Since you derived from unittest (via DebianGitTestRepo) you can use
> > self.assertEqual and friends here. Which gives better failure
> > messages.
> 
> Thanks, I'll do that.
> 
> -- 
> Daniel Dehennin
> Récupérer ma clef GPG:
> gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF





--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to