Gentoo Archives: gentoo-dev

From: "Justin (jlec)" <jlec@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: Indention in metadata.xml
Date: Tue, 09 Jun 2015 11:48:20
Message-Id: 5576D278.5060700@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: Indention in metadata.xml by Alec Warner
1 On 09/06/15 03:21, Alec Warner wrote:
2 > On Sat, Jun 6, 2015 at 12:26 AM, Justin Lecher (jlec) <jlec@g.o
3 > <mailto:jlec@g.o>> wrote:
4 >
5 > Hi everyone,
6 >
7 > Can we get an agreement on how we are indenting metadata.xml?
8 >
9 > I like to properly format and indent metadata.xml, but without having
10 > an agreement or policy on the indention, I make unhappy by choosing
11 > the wrong.
12 >
13 >
14 >> I was going to stay out of this, but I want to kind of circle back a bit. You
15 >> want to 'properly format' the documents. I guess part of my question is, what
16 >> would you do if the proper format was basically undefined?
17 >
18 >> "Properly formatted" XML files isn't really what I consider a goal. Do you have
19 >> other goals?
20 >
21 >> For instance:
22 >
23 >> "I would like to standardize on spaces or tabs so that we can better automate
24 >> the tooling around metadata."
25 >
26 >> Or perhaps more clearly:
27 >
28 >> "I am writing tools that manipulate metadata.xml; while I can easily ingest
29 >> metadata.xml, producing the correct output is difficult when spaces or tabs are
30 >> mixed, can we consistently use one or the other?"
31 >
32 >> Or another take:
33 >
34 >> "I am trying to write a tool that manipulates metadata.xml and I am having
35 >> difficulty parsing entries that mix spaces and tabs, please help me."
36 >
37 >> Some of these problems are solved by code (I'm pretty sure the latter problem
38 >> just requires a sane XML parser for instance.) I believe mgorny already provided
39 >> code that tried to solve problem 2.
40 >
41 >> Problem 1 is sufficiently generic that it is hard to solve with a code snippet I
42 >> think.
43 >
44 >> The point is these are all goals other than "I want to standardize on tabs or
45 >> spaces because I like starting tabs vs spaces flamewars on gentoo-dev." This is
46 >> not meant to be accusatory; merely that standardizing the format "because"
47 >> doesn't really solve anything (there is no problem statement.) Perhaps there is
48 >> an implied statement (consistency is generally better for all parties.) But even
49 >> that being clearly stated would be nice.
50 >
51 >> -A
52
53 Hi Alec,
54
55 you are absolutely right. Having stated the goal more clearly would have help to
56 decide what it should be.
57
58 Nevertheless, I think the flames are quite small this time, and we rather heard
59 two opinions with their arguments.
60
61 The two options and the arguments are
62
63 tabs:
64 * made for indention
65 * Gentoo uses tabs everywhere
66 ... and similar
67
68 2 spaces:
69 * save space (2 spaces) on the 80 char line width
70
71 As XML ignores whitespaces per specification, the only rational argument is,
72 that Gentoo uses tabs in ebuilds, eclass, basically everywhere so we should also
73 use it in metadata.xml.
74
75 Or simply leave it to the maintainer with tabs (=4 spaces) as default or 2
76 spaces if wished.
77
78 So that is what we should decide on.
79
80
81 Coming back to your original point, the why.
82
83 I really like proper indentions.
84
85 That is why I started some while ago doing
86
87 xmlstarlet fo metadata.xml
88
89 using tabs on every commit. As you can imaging that upset some people so I
90 switched to 2 spaces, which was also not good.
91
92 The acute reason to come up with now, is my effort to fill the remote-id tags in
93 metadata.xml. xmlstarlet uses 2 spaces on insert, so I need to reformat the file
94 afterwards for consistency reason. Instead of finding to used indention style
95 and use that, I thought it might be useful to have a common style which can be
96 always applied. That would ease my effort and also future ones.
97
98 We could even do the formatting directly via repoman on every commit.
99
100 I hope that brought some substance to my question,
101
102 Justin

Attachments

File name MIME type
signature.asc application/pgp-signature