Merge lp:~dobey/libubuntuone/srcdir-signing into lp:libubuntuone
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | dobey on 2011-01-05 | ||||
| Approved revision: | 113 | ||||
| Merged at revision: | 112 | ||||
| Proposed branch: | lp:~dobey/libubuntuone/srcdir-signing | ||||
| Merge into: | lp:libubuntuone | ||||
| Diff against target: |
92 lines (+25/-13) 4 files modified
.bzrignore (+1/-1) bindings/mono/AssemblyInfo.cs.in (+1/-1) bindings/mono/Makefile.am (+19/-11) configure.ac (+4/-0) |
||||
| To merge this branch: | bzr merge lp:~dobey/libubuntuone/srcdir-signing | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Alejandro J. Cura (community) | 2010-12-14 | Approve on 2011-01-05 | |
| Natalia Bidart | 2010-12-14 | Approve on 2010-12-14 | |
|
Review via email:
|
|||
Commit Message
Generate the AssemblyInfo.cs file by replacing @ASSEMBLY_KEYFILE@
Require the sn program and use it to check the signature on the built dll
| Loïc Minier (lool) wrote : | # |
| Natalia Bidart (nataliabidart) wrote : | # |
Code looks good, the branch builds correctly.
| Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
Voting does not meet specified criteria. Required: Approve >= 2, Disapprove == 0, Needs Fixing == 0, Needs Information == 0, Resubmit == 0. Got: 1 Approve.
| dobey (dobey) wrote : | # |
OK, not using $(srcdir)/ in the dependencies declarations seems to work, so I removed the instances where it was used. I also removed the |sed portion of the check rule, since we're not using it yet, but I figured it might be useful to perhaps use the key id in the future. It's easy to add back though and not calling sed saves us a microsecond of build time.
I made AssemblyInfo.cs depend on mono.snk because we're replacing a string with the path to it. If the source file doesn't exist, it should fail there, rather than wasting time generating the file and then trying to compile all the csharp files into the dll, only to have it fail later. Earlier failures are better.
As for depending on Makefile, anything which generates a file via automatic inclusion in another rule, like we do here, it should depend on Makefile so that the file gets rebuilt if Makefile changes. For instance, if any variables we're inserting into the file with sed like this, have changed, the file needs to be regenerated with the new values.
| dobey (dobey) wrote : | # |
I've also discovered the -vf option now, and decided to use it instead of trying to parse the output. This keeps it language independent and relies on the return value instead.

That seems fine; some minor comments:
* you might want to call sn under LC_ALL=C in case the output is localized at some point -- or test exit code if that's an option, not sure it reports this in the exit code though
* you might want to send errors to stderr
* instead of sn | sed + test, you could just grep? e.g.:
if LC_ALL=C $(MONO_SN) -T $< | grep -q '^Public Key Token: '; then \
echo "Assembly was not properly signed." >&2; \
exit 1; \
fi
* I guess it's a personal taste question, but I think sed s/[@]FOO[@]/bar/ is slightly more common in Makefile.am than s/\@FOO\@/bar/
* the Makefile dependency is weird: /AssemblyInfo. cs.in $(srcdir)/mono.snk Makefile
+AssemblyInfo.cs: $(srcdir)
I don't think any other generated file depends on Makefile
* I'm not actually sure why AssemblyInfo.cs depends on mono.snk; I think only the dll needs to do that
* thanks to VPATH, I think you can actually just depend on the plain simple filenames:
AssemblyInfo.cs: AssemblyInfo.cs.in