Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-09 Thread Justin (jlec)
On 09/06/15 03:21, Alec Warner wrote:
> On Sat, Jun 6, 2015 at 12:26 AM, Justin Lecher (jlec)  > wrote:
> 
> Hi everyone,
> 
> Can we get an agreement on how we are indenting metadata.xml?
> 
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
> 
> 
>> I was going to stay out of this, but I want to kind of circle back a bit. You
>> want to 'properly format' the documents. I guess part of my question is, what
>> would you do if the proper format was basically undefined?
> 
>> "Properly formatted" XML files isn't really what I consider a goal. Do you 
>> have
>> other goals?
> 
>> For instance:
> 
>> "I would like to standardize on spaces or tabs so that we can better automate
>> the tooling around metadata."
> 
>> Or perhaps more clearly:
> 
>> "I am writing tools that manipulate metadata.xml; while I can easily ingest
>> metadata.xml, producing the correct output is difficult when spaces or tabs 
>> are
>> mixed, can we consistently use one or the other?"
> 
>> Or another take:
> 
>> "I am trying to write a tool that manipulates metadata.xml and I am having
>> difficulty parsing entries that mix spaces and tabs, please help me."
> 
>> Some of these problems are solved by code (I'm pretty sure the latter problem
>> just requires a sane XML parser for instance.) I believe mgorny already 
>> provided
>> code that tried to solve problem 2.
> 
>> Problem 1 is sufficiently generic that it is hard to solve with a code 
>> snippet I
>> think.
> 
>> The point is these are all goals other than "I want to standardize on tabs or
>> spaces because I like starting tabs vs spaces flamewars on gentoo-dev." This 
>> is
>> not meant to be accusatory; merely that standardizing the format "because"
>> doesn't really solve anything (there is no problem statement.) Perhaps there 
>> is
>> an implied statement (consistency is generally better for all parties.) But 
>> even
>> that being clearly stated would be nice.
> 
>> -A

Hi Alec,

you are absolutely right. Having stated the goal more clearly would have help to
decide what it should be.

Nevertheless, I think the flames are quite small this time, and we rather heard
two opinions with their arguments.

The two options and the arguments are

tabs:
* made for indention
* Gentoo uses tabs everywhere
... and similar

2 spaces:
* save space (2 spaces) on the 80 char line width

As XML ignores whitespaces per specification, the only rational argument is,
that Gentoo uses tabs in ebuilds, eclass, basically everywhere so we should also
use it in metadata.xml.

Or simply leave it to the maintainer with tabs (=4 spaces) as default or 2
spaces if wished.

So that is what we should decide on.


Coming back to your original point, the why.

I really like proper indentions.

That is why I started some while ago doing

xmlstarlet fo metadata.xml

using tabs on every commit. As you can imaging that upset some people so I
switched to 2 spaces, which was also not good.

The acute reason to come up with now, is my effort to fill the remote-id tags in
metadata.xml. xmlstarlet uses 2 spaces on insert, so I need to reformat the file
afterwards for consistency reason. Instead of finding to used indention style
and use that, I thought it might be useful to have a common style which can be
always applied. That would ease my effort and also future ones.

We could even do the formatting directly via repoman on every commit.

I hope that brought some substance to my question,

Justin





signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-08 Thread Jeroen Roovers
On Sun, 7 Jun 2015 17:28:03 -0400
Mike Gilbert  wrote:

> Sorry, I could I have sworn I saw something about "easier scripting"
> somewhere in the thread.

Now you have two problems. ;-)


 jer



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-08 Thread Alec Warner
On Sat, Jun 6, 2015 at 12:26 AM, Justin Lecher (jlec) 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> Hi everyone,
>
> Can we get an agreement on how we are indenting metadata.xml?
>
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
>

I was going to stay out of this, but I want to kind of circle back a bit.
You want to 'properly format' the documents. I guess part of my question
is, what would you do if the proper format was basically undefined?

"Properly formatted" XML files isn't really what I consider a goal. Do you
have other goals?

For instance:

"I would like to standardize on spaces or tabs so that we can better
automate the tooling around metadata."

Or perhaps more clearly:

"I am writing tools that manipulate metadata.xml; while I can easily ingest
metadata.xml, producing the correct output is difficult when spaces or tabs
are mixed, can we consistently use one or the other?"

Or another take:

"I am trying to write a tool that manipulates metadata.xml and I am having
difficulty parsing entries that mix spaces and tabs, please help me."

Some of these problems are solved by code (I'm pretty sure the latter
problem just requires a sane XML parser for instance.) I believe mgorny
already provided code that tried to solve problem 2.

Problem 1 is sufficiently generic that it is hard to solve with a code
snippet I think.

The point is these are all goals other than "I want to standardize on tabs
or spaces because I like starting tabs vs spaces flamewars on gentoo-dev."
This is not meant to be accusatory; merely that standardizing the format
"because" doesn't really solve anything (there is no problem statement.)
Perhaps there is an implied statement (consistency is generally better for
all parties.) But even that being clearly stated would be nice.

-A


>
> The two options which are already suggested are
>
> * 2 spaces
> * single tab
>
> So what should it be?


> Jusitn
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0
>
> iQJ8BAEBCgBmBQJVcqCPXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
> ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
> OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmivxIP/3Vdv8fLVThtEdjknncX8txq
> DSEj1m+pEqVw53noSQscbvjRkiAiGg50xtZFC5zcJVC7cRSIAADGUByakt7w+Lmk
> D2cHWfQLJr5ZqGMholHdHJC7G7PXDJZ4D90Rt8qL7I1aGjMzWtGXzkzx2+OD+j8F
> jy8XAa2I30/Rgof+fsUp1mgglv5c4Y94CbJcnkbERuyxA5miB2d1E3i3iiIcoLmB
> M2fs0DN3oOQT8Fhwp2fJhoRH+aXlayC8o5PbBEKc6xGU5nfvtfvqqGHa9eoqLgXv
> vpZXIwKm9vujXoPi7DDBMKAPPqDD1OSKBV0fvbwx0Q94H7XzmSmtFW45gPdAyrF2
> rwL3dlLcswDsblv46LHmj+m3/VFJagSccrKaH/I4uf4z2+RhjwNO2R+Z66/EYH3n
> hvoYWQTx0Y+YI2kKKpXymK5e9ZgO7x+dxBHwLpa13JcJP0sMESQbN4jmJ5Rob0xV
> bqtTsn+/O/rB1iMMC2V1fq3cQT9AQZT3OKnyiXM6nwLDgae30cY4gCUkOqc/ULxp
> Eakb5D82HlSWIo840BXNAoGOWI7vFrtaKndDukWn+kKk1SeKm3j2ocwzQ7Rzxsa8
> 60hfE2tsuo0wQBLxslxYyZnv/kPBS9PS8RtZrLpS5V6D4BGS/32zuBVhN1eP9dQ0
> dz0kj1uvehcz5/Dhgms4
> =e7QN
> -END PGP SIGNATURE-
>
>


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-08 Thread Daniel "zlg" Campbell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 06/08/2015 12:47 PM, William Hubbs wrote:
> On Sat, Jun 06, 2015 at 09:26:08AM +0200, Justin Lecher (jlec)
> wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA512
>> 
>> Hi everyone,
>> 
>> Can we get an agreement on how we are indenting metadata.xml?
>> 
>> I like to properly format and indent metadata.xml, but without
>> having an agreement or policy on the indention, I make unhappy by
>> choosing the wrong.
>> 
>> The two options which are already suggested are
>> 
>> * 2 spaces * single tab
>> 
>> So what should it be?
> 
> I want to throw in my support for the second option.
> 
> Thanks,
> 
> William
> 
I'm also in favor of tabs. Aside from being shorter (by a single byte,
in this case), they're less prone to off-by-one inconsistencies and
any good text editor allows the user to configure the tab width, so
everyone can be happy.

Just my two cents.

~Daniel
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCAAGBQJVdiq3AAoJEAEkDpRQOeFwFnMQANYOy+A9D8wU8RQjXtUm5fEO
FcK+vXyigt+ENholJVl4NYkL6z7l8dTx5PbjZ4qYUgM0hqwraUI8h69gmXe2r4c+
3r3FSaLofQ8ePlmaBQOJMw6OTJu9P2VULVh90bByj+2NKzu07aVHkRevzerzvl5F
uhiRSQvPNNYCxSrYL+Q5SLKtdfpny+gg9npoNkeoQPSzu/GujicxBisTHb8jaBEs
gcP1iSTsvrf8nhYzgxwmKpyDbeBH2V8rUMFOv800m6lbbfXChDHUrOEX81Jxs72/
wfjbEpSFz0Dkhd/WFu4ApMvgaQesT7NudRg5q+YV35aDyx6gXkvdKPyWzNv5FmVd
dDmODWnV7oLm8BymhQaqNZOauh/7LlEjKIRTATGow+IWoqwTVgyVw0lp4DmA3n0L
Mz8+WgaNfEERYct+Pbrc3MkQsQ7DsyAp8GWQ8b+j2SsNXjsVD2bjB58mKv4udda/
Nj8f8mdu43+O9zRXl385r7U5Nbb3foI9fyvJsN1GyPE+8LDHvs5LDvFDY41Yz3Nk
IWaEbEiWGAo5zLOfgld2NOtq8VB7kIMLwF2xhsMfHzO0oQKisPBOH7Ab2x29DvL/
TreinTiDyLtKzlJ6+bprIqH6dTXflaNzHsVzoXQiu9XDdb3hIpXTXup5hlDUZxT6
TZ4zilhFAeYHUjzOOyli
=lB7e
-END PGP SIGNATURE-



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-08 Thread Michał Górny
Dnia 2015-06-08, o godz. 08:36:02
"Justin (jlec)"  napisał(a):

> On 07/06/15 22:22, Michał Górny wrote:
> > Dnia 2015-06-07, o godz. 22:16:18
> > "Justin Lecher (jlec)"  napisał(a):
> > 
> >> -BEGIN PGP SIGNED MESSAGE-
> >> Hash: SHA512
> >>
> >> On 07/06/15 14:48, Andrew Udvare wrote:
> >>> On 07/06/15 05:12, Alexis Ballier wrote:
>  On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
>   wrote:
> 
> > Compatibility with sed scripts is not something I care about.
> >> ...
> >>> However, I do not disagree an XML parser is better than sed for
> >>> the purpose. There are plenty of XML pretty printers.
> >>>
> >>
> >> So you guys think I am using sed for this? Really?
> >>
> >> Still you need to tell a XML formatter what indention style to use.
> > 
> > Not exactly. You can write a tool that tries hard to recognize
> > indentation style and repeat it. Like the one I wrote to replace
> >  with  elements. It was pretty good in figuring out
> > developer fancies, including multiple different indentation levels.
> > 
> 
> I am trying to detect what ever they already is for indention. How did you
> implement this?

Script attached. Pretty much it looks it tries to figure out what
indent is used for first- and second-level elements, and reproduces
that.


-- 
Best regards,
Michał Górny
#!/usr/bin/env python

from collections import namedtuple
import errno
import glob
from lxml.builder import E
import lxml.etree
import os
import os.path

def main():
	herdtuple = namedtuple('herdtuple', ('email', 'name'))
	herddb = {}
	portdir = '/var/db/repos/gentoo'
	herdsfile = os.path.join(portdir, 'metadata/herds.xml')
	herdsxml = lxml.etree.parse(herdsfile)
	for h in herdsxml.getroot():
		k = h.find('name').text
		e = h.find('email').text
		d = h.find('description').text
		herddb[k] = herdtuple(e, d)

	intree = portdir
	outtree = '/tmp/1'

	# LAZINESS!
	for f in glob.glob(os.path.join(intree, '*/*/metadata.xml')):
		subpath = os.path.relpath(f, intree)
		print(subpath)
		outf = os.path.join(outtree, subpath)

		xml = lxml.etree.parse(f)
		herds = xml.getroot().findall('herd')
		if not herds: # yay, one file less to care about
			continue
		r = xml.getroot()
		maints = r.findall('maintainer')
		if maints:
			insertpoint = maints[-1]
		else:
			insertpoint = herds[-1]

		# try to guess indentation
		def all_texts(node):
			first = True
			for e in node:
if first:
	yield node.text
	first = False
yield e.tail
		def all_indents(node):
			for t in all_texts(node):
if t is None:
	yield ''
	return
spl = t.split('\n')
# go to last line without text
for l in spl:
	if l.lstrip(' \t') != '':
		break
# go to the last line
t = l[:len(l) - len(l.lstrip(' \t'))]
yield t
		def sub_indents(node):
			for e in node:
for x in all_indents(e):
	yield x


		# some random defaults
		indent = '\t'
		try:
			indent = max(all_indents(r), key=len)
		except ValueError:
			pass

		inner_indent = indent*2 if indent else '\t'
		try:
			inner_indent = max(sub_indents(r), key=len)
		except ValueError:
			pass

		# start adding new herds after maintainers
		for h in herds:
			he = herddb[h.text.strip()]

			# look for duplicate  entries
			for m in maints:
if m.find('email').text.strip() == he.email:
	m.set('type', 'herd')
	r.remove(h)
	break
			else:
attrs = dict(h.items())
attrs['type'] = 'team'
nm = E.maintainer('\n',
	inner_indent, E.email(he.email), '\n',
	indent,
	**attrs
)
nextinsert = insertpoint.getnext()
nm.tail = insertpoint.tail
if nextinsert is not None:
	r.insert(r.index(nextinsert), nm)
else:
	# avoid extra indent
	nm.tail = '\n'
	r.append(nm)
insertpoint = nm

# now we can remove it safely
r.remove(h)

# now fix pre-indent
prev = nm.getprevious()
if prev is not None:
	prev.tail = '\n' + indent
else:
	nm.getparent().text = '\n' + indent

		try:
			os.makedirs(os.path.dirname(outf))
		except OSError as e:
			if e.errno != errno.EEXIST:
raise
		try:
			os.unlink(outf)
		except OSError as e:
			if e.errno != errno.ENOENT:
raise
		xml.write(outf, encoding='UTF-8', xml_declaration='1.0')
		# yay, add trailing newline because lxml is dumb
		with open(outf, 'ab') as f:
			f.write(b'\n')

if __name__ == '__main__':
	main()


pgpAIt2DTGsDT.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-08 Thread William Hubbs
On Sat, Jun 06, 2015 at 09:26:08AM +0200, Justin Lecher (jlec) wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
> 
> Hi everyone,
> 
> Can we get an agreement on how we are indenting metadata.xml?
> 
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
> 
> The two options which are already suggested are
> 
> * 2 spaces
> * single tab
> 
> So what should it be?

I want to throw in my support for the second option.

Thanks,

William



signature.asc
Description: Digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Justin (jlec)
On 07/06/15 22:22, Michał Górny wrote:
> Dnia 2015-06-07, o godz. 22:16:18
> "Justin Lecher (jlec)"  napisał(a):
> 
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA512
>>
>> On 07/06/15 14:48, Andrew Udvare wrote:
>>> On 07/06/15 05:12, Alexis Ballier wrote:
 On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
  wrote:

> Compatibility with sed scripts is not something I care about.
>> ...
>>> However, I do not disagree an XML parser is better than sed for
>>> the purpose. There are plenty of XML pretty printers.
>>>
>>
>> So you guys think I am using sed for this? Really?
>>
>> Still you need to tell a XML formatter what indention style to use.
> 
> Not exactly. You can write a tool that tries hard to recognize
> indentation style and repeat it. Like the one I wrote to replace
>  with  elements. It was pretty good in figuring out
> developer fancies, including multiple different indentation levels.
> 

I am trying to detect what ever they already is for indention. How did you
implement this?

Justin



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Mike Gilbert
On Sun, Jun 7, 2015 at 4:16 PM, Justin Lecher (jlec)  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> On 07/06/15 14:48, Andrew Udvare wrote:
>> On 07/06/15 05:12, Alexis Ballier wrote:
>>> On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
>>>  wrote:
>>>
 Compatibility with sed scripts is not something I care about.
> ...
>> However, I do not disagree an XML parser is better than sed for
>> the purpose. There are plenty of XML pretty printers.
>>
>
> So you guys think I am using sed for this? Really?
>
> Still you need to tell a XML formatter what indention style to use.
>

Sorry, I could I have sworn I saw something about "easier scripting"
somewhere in the thread.



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Michał Górny
Dnia 2015-06-07, o godz. 22:16:18
"Justin Lecher (jlec)"  napisał(a):

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
> 
> On 07/06/15 14:48, Andrew Udvare wrote:
> > On 07/06/15 05:12, Alexis Ballier wrote:
> >> On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
> >>  wrote:
> >> 
> >>> Compatibility with sed scripts is not something I care about.
> ...
> > However, I do not disagree an XML parser is better than sed for
> > the purpose. There are plenty of XML pretty printers.
> > 
> 
> So you guys think I am using sed for this? Really?
> 
> Still you need to tell a XML formatter what indention style to use.

Not exactly. You can write a tool that tries hard to recognize
indentation style and repeat it. Like the one I wrote to replace
 with  elements. It was pretty good in figuring out
developer fancies, including multiple different indentation levels.

-- 
Best regards,
Michał Górny


pgpedie7aceeD.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Justin Lecher (jlec)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 07/06/15 14:48, Andrew Udvare wrote:
> On 07/06/15 05:12, Alexis Ballier wrote:
>> On Sat, 6 Jun 2015 22:00:14 -0400 Mike Gilbert
>>  wrote:
>> 
>>> Compatibility with sed scripts is not something I care about.
...
> However, I do not disagree an XML parser is better than sed for
> the purpose. There are plenty of XML pretty printers.
> 

So you guys think I am using sed for this? Really?

Still you need to tell a XML formatter what indention style to use.

Justin
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0

iQJ8BAEBCgBmBQJVdKaSXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiepMP/j+/jp2yP0Jqj8UKzbTkWbND
2cD2fJdn5op9rfbAt4NuVFofU3/MbnaloITsadHNV1j3Nz9fX2sTB4sr5GPrRNfj
K+nqdLA7TCsCY0OVMGerCEmkCQ/pfzmcHjm4G3Ktx8GDmOPD7dkt5abMez2phz+A
uXJwKrLyQxk/o5OxuryMU1VFLw7oyDRgbo4tJi8Rp4ZCeeT2UpHmr6T1wgrhgfk3
K59kN3NPz86t7u/9sRSD4RteGZrLrisAXFzwMkiRvmy7ZtPRgbao5zWronqOPe7Z
N6yhCUXqaWi3aRS0Rx+Bfn6QHwVat4xTYVcNV2DIN5FWAiwe1PS4zKSi1cSts7rU
6ARAOkwz3DZ6v9PFT+y2QawGvN6Ve1TEvKsl5gmFrhOHaejiNYE4EyF7sYt3aqmk
hv2Wh+E+q6qjYy6ghOUuMgiCNHhAw1966nRPMJF8H1baLrTZSZU1E+MGYdx0EcFu
EmsnHGqAjbFFVtesTf+FN6KDf/YOeppt8ReKJ88SY8zy0z5AwQ4tUC+DcnGukFDt
n1yz+innTSgVce0oKdB8dheaBliTu6aNXlee+9jya1gevijb8axM9Q9xK281Fa8j
rewFaQHqxmXVKkACTavcskDMrW3OQMs5to60yTTXnRxyja0riJ8a1xlG0DwAl45h
COAKrMqMqsH93qw1TD1w
=a8iK
-END PGP SIGNATURE-



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Mike Frysinger
On 06 Jun 2015 12:17, Ulrich Mueller wrote:
> > On Sat, 6 Jun 2015, Michał Górny wrote:
> 
> > Visual space is what you set in your editor. Which also gives tab
> > the advantage that you can set it to something good for you, like
> > 'more than 2 spaces so that it is readable'.
> 
> *If* we should agree on using tabs, then we should also standardise
> the tab width. Using the same rules for indenting and whitespace as
> for ebuilds (i.e., tab stops every four positions) suggests itself:
> https://devmanual.gentoo.org/ebuild-writing/file-format/index.html#indenting-and-whitespace

if there's any standard at all for metadata.xml, it should be the same as 
ebuilds.  there's no reason to deviate.
-mike


signature.asc
Description: Digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Andrew Udvare
On 07/06/15 05:12, Alexis Ballier wrote:
> On Sat, 6 Jun 2015 22:00:14 -0400
> Mike Gilbert  wrote:
> 
>> Compatibility with sed scripts is not something I care about.
> 
> and is something nobody should care about: xml is not a regular
> language :)
> 

If you are enforcing split lines on every single tag except ones that
can be shortened like , then it does not matter if you use 4
spaces or tabs. Both would be compatible with sed assuming the indenting
is correct in either case. With regard to white space within tags is
another story. The rule should still apply there and so compatibility
would remain.

However, I do not disagree an XML parser is better than sed for the
purpose. There are plenty of XML pretty printers.



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-07 Thread Alexis Ballier
On Sat, 6 Jun 2015 22:00:14 -0400
Mike Gilbert  wrote:

> Compatibility with sed scripts is not something I care about.

and is something nobody should care about: xml is not a regular
language :)



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Mike Gilbert
On Sat, Jun 6, 2015 at 3:26 AM, Justin Lecher (jlec)  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> Hi everyone,
>
> Can we get an agreement on how we are indenting metadata.xml?
>
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
>
> The two options which are already suggested are
>
> * 2 spaces
> * single tab
>
> So what should it be?

My 2 cents: So long as it is a well-formed XML document and doesn't
look horribly ugly in an editor, it really doesn't matter what we use,
and I don't think we need a policy for it.

For scripting, I would recommend using an XML parser/emitter.
Compatibility with sed scripts is not something I care about.



Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Andreas K. Huettel
Am Samstag, 6. Juni 2015, 09:26:08 schrieb Justin Lecher (jlec):
> Hi everyone,
> 
> Can we get an agreement on how we are indenting metadata.xml?
> 
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
> 
> The two options which are already suggested are
> 
> * 2 spaces
> * single tab
> 
> So what should it be?

How about the unicode character for a right-aligned tab, together with the 
nonbreaking half-width space?



  

-- 

Andreas K. Huettel
Gentoo Linux developer 
dilfri...@gentoo.org
http://www.akhuettel.de/




Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Allan Wegan
> The two options which are already suggested are
> * 2 spaces
> * single tab
> So what should it be?

Two spaces per indention with a maximum line width of 80 single-width
Unicode grapheme clusters (equals the with of 80 ASCII characters).



-- 
Allan Wegan
Jabber: allanwe...@jabber.ccc.de
 OTR-Fingerprint: A1AAA1B9C067F9884A424D339834346929164587
ICQ: 209459114
 OTR-Fingerprint: 71DE5B5E67D6D758A93BF1CE7DA06625205AC6EC




signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread James Le Cuirot
On Sat, 06 Jun 2015 09:25:33 +0200
Patrick Lauer  wrote:

> On 06/06/15 09:26, Justin Lecher (jlec) wrote:
> > Hi everyone,
> > 
> > Can we get an agreement on how we are indenting metadata.xml?
> > 
> > I like to properly format and indent metadata.xml, but without
> > having an agreement or policy on the indention, I make unhappy by
> > choosing the wrong.
> > 
> > The two options which are already suggested are
> > 
> > * 2 spaces
> > * single tab
> > 
> > So what should it be?
> 
> Obviously a tab, as tabs were made for indentation.

Tabs for me too, please. It's worth noting that metagen uses tabs.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer


pgpyACVhcMix7.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Ulrich Mueller
> On Sat, 6 Jun 2015, Michał Górny wrote:

> Visual space is what you set in your editor. Which also gives tab
> the advantage that you can set it to something good for you, like
> 'more than 2 spaces so that it is readable'.

*If* we should agree on using tabs, then we should also standardise
the tab width. Using the same rules for indenting and whitespace as
for ebuilds (i.e., tab stops every four positions) suggests itself:
https://devmanual.gentoo.org/ebuild-writing/file-format/index.html#indenting-and-whitespace

Ulrich


pgp5Mostf7sUW.pgp
Description: PGP signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Michał Górny
Dnia 2015-06-06, o godz. 10:02:53
Ulrich Mueller  napisał(a):

> > On Sat, 6 Jun 2015, Michał Górny wrote:
> 
> >> Tabs are too wasteful on space. Therefore, two spaces, and no
> >> indentation of the top-level elements.
> 
> > That's nonsense. Tab = 1 byte. Two spaces = 2 bytes.
> 
> Visual space.

Visual space is what you set in your editor. Which also gives tab
the advantage that you can set it to something good for you, like
'more than 2 spaces so that it is readable'.

-- 
Best regards,
Michał Górny


pgpxKNdviVGPZ.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Jason Zaman
On Sat, Jun 06, 2015 at 10:02:53AM +0200, Ulrich Mueller wrote:
> > On Sat, 6 Jun 2015, Michał Górny wrote:
> 
> >> Tabs are too wasteful on space. Therefore, two spaces, and no
> >> indentation of the top-level elements.
> 
> > That's nonsense. Tab = 1 byte. Two spaces = 2 bytes.
> 
> Visual space.

:set ts=2
done :)
> 
> Ulrich





Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Jason Zaman
On Sat, Jun 06, 2015 at 09:34:41AM +0200, Michał Górny wrote:
> Dnia 2015-06-06, o godz. 09:26:08
> "Justin Lecher (jlec)"  napisał(a):
> 
> > Can we get an agreement on how we are indenting metadata.xml?
> > 
> > I like to properly format and indent metadata.xml, but without having
> > an agreement or policy on the indention, I make unhappy by choosing
> > the wrong.
> > 
> > The two options which are already suggested are
> > 
> > * 2 spaces
> > * single tab
> > 
> > So what should it be?
> 
> A tab. With one-line element contents being inline, while multi-line in
> deeper indented block, i.e.:
> 
> ...>
> ...>...>Foo Bar
> ...>...>b...@example.com
> ...>
> ...>
> ...>...>Some random text. Possibly spanning multiple lines.
> ...>...>Like this.
> ...>

This one definitely. Tabs let people set the tabstop themselves and its
all easy. Can we get repoman to autoformat the xml files during a commit
too?

-- Jason




Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Ulrich Mueller
> On Sat, 6 Jun 2015, Michał Górny wrote:

>> Tabs are too wasteful on space. Therefore, two spaces, and no
>> indentation of the top-level elements.

> That's nonsense. Tab = 1 byte. Two spaces = 2 bytes.

Visual space.

Ulrich


pgpYsZj5GseK_.pgp
Description: PGP signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Michał Górny
Dnia 2015-06-06, o godz. 09:46:27
Ulrich Mueller  napisał(a):

> > On Sat, 06 Jun 2015, Justin Lecher (jlec) wrote:
> 
> > * 2 spaces
> > * single tab
> 
> > So what should it be?
> 
> Tabs are too wasteful on space. Therefore, two spaces, and no
> indentation of the top-level elements.

That's nonsense. Tab = 1 byte. Two spaces = 2 bytes.


-- 
Best regards,
Michał Górny


pgpKFtYOKtUPV.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Ulrich Mueller
> On Sat, 06 Jun 2015, Justin Lecher (jlec) wrote:

> * 2 spaces
> * single tab

> So what should it be?

Tabs are too wasteful on space. Therefore, two spaces, and no
indentation of the top-level elements.

Ulrich


pgpmxfmE7_yBp.pgp
Description: PGP signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Michał Górny
Dnia 2015-06-06, o godz. 09:26:08
"Justin Lecher (jlec)"  napisał(a):

> Can we get an agreement on how we are indenting metadata.xml?
> 
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
> 
> The two options which are already suggested are
> 
> * 2 spaces
> * single tab
> 
> So what should it be?

A tab. With one-line element contents being inline, while multi-line in
deeper indented block, i.e.:

...>
...>...>Foo Bar
...>...>b...@example.com
...>
...>
...>...>Some random text. Possibly spanning multiple lines.
...>...>Like this.
...>


-- 
Best regards,
Michał Górny


pgp9WMbSMZ8xb.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Patrick Lauer
On 06/06/15 09:26, Justin Lecher (jlec) wrote:
> Hi everyone,
> 
> Can we get an agreement on how we are indenting metadata.xml?
> 
> I like to properly format and indent metadata.xml, but without having
> an agreement or policy on the indention, I make unhappy by choosing
> the wrong.
> 
> The two options which are already suggested are
> 
> * 2 spaces
> * single tab
> 
> So what should it be?

Obviously a tab, as tabs were made for indentation.



[gentoo-dev] RFC: Indention in metadata.xml

2015-06-06 Thread Justin Lecher (jlec)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi everyone,

Can we get an agreement on how we are indenting metadata.xml?

I like to properly format and indent metadata.xml, but without having
an agreement or policy on the indention, I make unhappy by choosing
the wrong.

The two options which are already suggested are

* 2 spaces
* single tab

So what should it be?

Jusitn
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0

iQJ8BAEBCgBmBQJVcqCPXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmivxIP/3Vdv8fLVThtEdjknncX8txq
DSEj1m+pEqVw53noSQscbvjRkiAiGg50xtZFC5zcJVC7cRSIAADGUByakt7w+Lmk
D2cHWfQLJr5ZqGMholHdHJC7G7PXDJZ4D90Rt8qL7I1aGjMzWtGXzkzx2+OD+j8F
jy8XAa2I30/Rgof+fsUp1mgglv5c4Y94CbJcnkbERuyxA5miB2d1E3i3iiIcoLmB
M2fs0DN3oOQT8Fhwp2fJhoRH+aXlayC8o5PbBEKc6xGU5nfvtfvqqGHa9eoqLgXv
vpZXIwKm9vujXoPi7DDBMKAPPqDD1OSKBV0fvbwx0Q94H7XzmSmtFW45gPdAyrF2
rwL3dlLcswDsblv46LHmj+m3/VFJagSccrKaH/I4uf4z2+RhjwNO2R+Z66/EYH3n
hvoYWQTx0Y+YI2kKKpXymK5e9ZgO7x+dxBHwLpa13JcJP0sMESQbN4jmJ5Rob0xV
bqtTsn+/O/rB1iMMC2V1fq3cQT9AQZT3OKnyiXM6nwLDgae30cY4gCUkOqc/ULxp
Eakb5D82HlSWIo840BXNAoGOWI7vFrtaKndDukWn+kKk1SeKm3j2ocwzQ7Rzxsa8
60hfE2tsuo0wQBLxslxYyZnv/kPBS9PS8RtZrLpS5V6D4BGS/32zuBVhN1eP9dQ0
dz0kj1uvehcz5/Dhgms4
=e7QN
-END PGP SIGNATURE-