Merge lp:~jml/pkgme/rules-extra-targets into lp:pkgme

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 118
Merged at revision: 119
Proposed branch: lp:~jml/pkgme/rules-extra-targets
Merge into: lp:pkgme
Diff against target: 80 lines (+26/-0)
4 files modified
pkgme/info_elements.py (+6/-0)
pkgme/package_files.py (+2/-0)
pkgme/templates/rules (+3/-0)
pkgme/tests/test_package_files.py (+15/-0)
To merge this branch: bzr merge lp:~jml/pkgme/rules-extra-targets
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+113951@code.launchpad.net

Commit message

Allow extra targets to be specified in rules.

Description of the change

This is a very simplistic attempt at adding support for customizing the
'rules' file generated by pkgme. It is my own poor attempt at accommodating
directhex's needs, described below in a slightly edited version of their own
words.

For my part, I'm worried that this is too unstructured, and have vague fears
that it will allow pkgme to become yet another broken packaging system. As
such, I defer to the expert while trying to unblock directhex in their work.

...

directhex has been working on adding support to pkgme for handling building
of mono projects with xbuild, a command-line tool which can build visual
studio project and solution files (which monodevelop uses as its native
project format).

It should give far greater coverage than relying on mono developers to create
automake projects.

A mono source tree can contain multiple solution (.sln) and project (.csproj)
files, without any guarantees as to which is the "correct" one to build.
This is especially common for multi-platform projects where they might ship a
different .sln with different defaults for windows, osx, linux, silverlight,
etc

The usual strategy is to specify which project to build in 'rules', much like
passing a -f value to "make" which is typically done by overriding
dh_auto_build and dh_auto_clean. However, pkgme doesn't seem to have any
support for overrides, since the template format assumes a pristine dh $@ is
enough for anybody in all situations.

...

Thanks,
jml

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Let's give this a go and see what happens...

Thanks,

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pkgme/info_elements.py'
2--- pkgme/info_elements.py 2012-07-05 13:42:09 +0000
3+++ pkgme/info_elements.py 2012-07-09 10:53:19 +0000
4@@ -65,6 +65,12 @@
5 description = "The debhelper buildsystem to use to build the package."
6
7
8+class ExtraTargets(InfoElement):
9+
10+ name = 'extra_targets'
11+ description = "Extra targets for the 'rules' file."
12+
13+
14 class PackageName(InfoElement):
15
16 name = "package_name"
17
18=== modified file 'pkgme/package_files.py'
19--- pkgme/package_files.py 2012-07-05 13:34:22 +0000
20+++ pkgme/package_files.py 2012-07-09 10:53:19 +0000
21@@ -19,6 +19,7 @@
22 Executable,
23 ExtraFiles,
24 ExtraFilesFromPaths,
25+ ExtraTargets,
26 Homepage,
27 Icon,
28 License,
29@@ -164,6 +165,7 @@
30 elements = [
31 Buildsystem,
32 DebhelperAddons,
33+ ExtraTargets,
34 ]
35
36 filename = "rules"
37
38=== modified file 'pkgme/templates/rules'
39--- pkgme/templates/rules 2011-07-04 02:49:19 +0000
40+++ pkgme/templates/rules 2012-07-09 10:53:19 +0000
41@@ -9,3 +9,6 @@
42 --with=${debhelper_addons} #slurp
43 #end if
44
45+#if $extra_targets
46+${extra_targets}
47+#end if
48
49=== modified file 'pkgme/tests/test_package_files.py'
50--- pkgme/tests/test_package_files.py 2012-07-05 14:16:12 +0000
51+++ pkgme/tests/test_package_files.py 2012-07-09 10:53:19 +0000
52@@ -18,6 +18,7 @@
53 Executable,
54 ExtraFiles,
55 ExtraFilesFromPaths,
56+ ExtraTargets,
57 Homepage,
58 Icon,
59 InfoElement,
60@@ -209,6 +210,20 @@
61 "%%:\n\tdh $@ --with=%s \n" % debhelper_addons,
62 package_file.get_contents())
63
64+ def test_content_with_extra_targets(self):
65+ extra_targets = """
66+include /usr/share/cli-common/cli.make
67+
68+override_dh_auto_build:
69+ xbuild $(CURDIR)/WideMargin.sln /p:Configuration=Release
70+
71+override_dh_auto_clean:
72+ xbuild $(CURDIR)/WideMargin.sln /p:Configuration=Release /t:Clean
73+"""
74+ args = {ExtraTargets.name: extra_targets}
75+ package_file = self.get_object(args)
76+ self.assertIn(extra_targets, package_file.get_contents())
77+
78 def test_overwrite(self):
79 package_file = self.get_object()
80 self.assertEqual(True, package_file.overwrite)

Subscribers

People subscribed via source and target branches