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
=== modified file 'pkgme/info_elements.py'
--- pkgme/info_elements.py 2012-07-05 13:42:09 +0000
+++ pkgme/info_elements.py 2012-07-09 10:53:19 +0000
@@ -65,6 +65,12 @@
65 description = "The debhelper buildsystem to use to build the package."65 description = "The debhelper buildsystem to use to build the package."
6666
6767
68class ExtraTargets(InfoElement):
69
70 name = 'extra_targets'
71 description = "Extra targets for the 'rules' file."
72
73
68class PackageName(InfoElement):74class PackageName(InfoElement):
6975
70 name = "package_name"76 name = "package_name"
7177
=== modified file 'pkgme/package_files.py'
--- pkgme/package_files.py 2012-07-05 13:34:22 +0000
+++ pkgme/package_files.py 2012-07-09 10:53:19 +0000
@@ -19,6 +19,7 @@
19 Executable,19 Executable,
20 ExtraFiles,20 ExtraFiles,
21 ExtraFilesFromPaths,21 ExtraFilesFromPaths,
22 ExtraTargets,
22 Homepage,23 Homepage,
23 Icon,24 Icon,
24 License,25 License,
@@ -164,6 +165,7 @@
164 elements = [165 elements = [
165 Buildsystem,166 Buildsystem,
166 DebhelperAddons,167 DebhelperAddons,
168 ExtraTargets,
167 ]169 ]
168170
169 filename = "rules"171 filename = "rules"
170172
=== modified file 'pkgme/templates/rules'
--- pkgme/templates/rules 2011-07-04 02:49:19 +0000
+++ pkgme/templates/rules 2012-07-09 10:53:19 +0000
@@ -9,3 +9,6 @@
9--with=${debhelper_addons} #slurp9--with=${debhelper_addons} #slurp
10#end if10#end if
1111
12#if $extra_targets
13${extra_targets}
14#end if
1215
=== modified file 'pkgme/tests/test_package_files.py'
--- pkgme/tests/test_package_files.py 2012-07-05 14:16:12 +0000
+++ pkgme/tests/test_package_files.py 2012-07-09 10:53:19 +0000
@@ -18,6 +18,7 @@
18 Executable,18 Executable,
19 ExtraFiles,19 ExtraFiles,
20 ExtraFilesFromPaths,20 ExtraFilesFromPaths,
21 ExtraTargets,
21 Homepage,22 Homepage,
22 Icon,23 Icon,
23 InfoElement,24 InfoElement,
@@ -209,6 +210,20 @@
209 "%%:\n\tdh $@ --with=%s \n" % debhelper_addons,210 "%%:\n\tdh $@ --with=%s \n" % debhelper_addons,
210 package_file.get_contents())211 package_file.get_contents())
211212
213 def test_content_with_extra_targets(self):
214 extra_targets = """
215include /usr/share/cli-common/cli.make
216
217override_dh_auto_build:
218 xbuild $(CURDIR)/WideMargin.sln /p:Configuration=Release
219
220override_dh_auto_clean:
221 xbuild $(CURDIR)/WideMargin.sln /p:Configuration=Release /t:Clean
222"""
223 args = {ExtraTargets.name: extra_targets}
224 package_file = self.get_object(args)
225 self.assertIn(extra_targets, package_file.get_contents())
226
212 def test_overwrite(self):227 def test_overwrite(self):
213 package_file = self.get_object()228 package_file = self.get_object()
214 self.assertEqual(True, package_file.overwrite)229 self.assertEqual(True, package_file.overwrite)

Subscribers

People subscribed via source and target branches