Closed mnagy closed 8 years ago
And I forgot @rhcarvalho :)
If you want to get the idea of what this does, run hack/generate.sh from the root repository directory and take a look at differences of mold 5.5 5.6
and mold v5.5 v5.6
or mold 5.5 v5.5
and mold 5.6 v5.6
.
As we talked about on the meeting, ideally we'd have generate.sh be called from a make update
and write directly into 5.5 and 5.6 directories. Jenkins could then run make update as well and test whether that changes anything in order to make sure we keep consistency.
@mnagy thanks for kicking us off with this!
Using the sed approach, do you think we could double check that all lines in the *.sed files end up being used? I see a possible bug if we make a typo in the @@ZZZ@@ name and notice it too late :)
@rhcarvalho how about instead making sure there are no @@<anything>@@
left-over?
+1 to this, even though there would be more flexible approaches.
I'd much less be in favour of a macro-style conditional #ifdef construct,
We don't deal with C-preprocessor, with e.g. jinja people (can) read only generated source (not the preprocessor conditionals). So basically sed is equivalent to any other substitution method, macro, jinja, or whatever. IOW - having run-time if-conditionals in your approach is small -1 from me, if end-user opens the script in generated container, it just complicates reading.
I don't know why the double '@@' symbol. Everywhere (thousands of projects) using autotools use just '@wrapper@', so this looks like non-standard a bit.
More discussions for such trivial tasks are not worth, so I stop here :).
@praiskup I think I will actually change it to get rid of run-time if-conditionals. The #ifdef
was just an example, I didn't mean to use the exact same syntax. I'm still thinking about how to do it, but I have a general idea.
Hmm, I thought autotools used double @ :) But yeah, I don't think it matters much.
how about instead making sure there are no @@
@@ left-over?
might be enough to help us fight typos.
I'm still thinking about how to do it, but I have a general idea.
This sounds like reinventing something. Have a look how automake.git uses sed (together with 'make' variable expansion) to generate scripts in parallel (instead of doing find -exec .. sth which is ugly and not effective): https://www.gnu.org/software/automake/manual/html_node/Scripts.html
@ppisar wrote:
While this seems pretty improbable, it creates a minefield that can hurt you in the future. I still think a real template system is necessary.
I agree here 100%.
On the other hand, I bet we still don't try to find the best solution, but rather the quicker.. (that is why initially the C&P solution was chosen?) and sed is probably good enough.
About the templating system.. Yes, it would be better and safer, but it would require people that want to contribute to install that system. IIRC, we agreed that's the reason we do not want to go that path. For our purposes, I think the sed solution is pretty much enough and the risks we'll need something more is both low and easy to mitigate if we'll really need to.
I would rather avoid complications with #ifdef
and just stick with simple sed
s. Anyway, I like the proposed solution, and yes, the check for unexpanded @
s would be fine.
Works for me, that's why I'm +1, this is about philosophy.
Yes, it would be better and safer, but it would require people that want to contribute to install that system.
I don't buy this argument. We try to "protect" contributors who have problems to install template system (and also those problems can be removed), while we are making the project boring to hackers.
PR testing has started.
PR testing has started.
Can one of the admins verify this patch?
This is my first shot at an deduplication idea of using sed to generate trees. So far there is only one script in
hack/generate.sh
that, when run from the root directory will generate directories v5.5 and v5.6 from the directory origin, using the appropriate sed files to substitute correct versions and so on.One thing I don't like is the
if [ "@@REPLICATION@@" = "GTID" ]; then
approach that I'd taken so far. I'd much less be in favour of a macro-style conditional#ifdef
construct, I'd like to hear discussion on that.This PR still retains 5.5 and 5.6 directories and is just for initial discussion.
@mfojtik @bparees @hhorak @praiskup @ppisar @pkajaba PTAL