From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 155371396D0 for ; Sat, 9 Sep 2017 15:06:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 03F6FE0DA6; Sat, 9 Sep 2017 15:06:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A0F71E0D88 for ; Sat, 9 Sep 2017 15:06:48 +0000 (UTC) Received: from katipo2.lan (unknown [203.86.205.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kentnl) by smtp.gentoo.org (Postfix) with ESMTPSA id 30649341755 for ; Sat, 9 Sep 2017 15:06:47 +0000 (UTC) Date: Sun, 10 Sep 2017 03:05:56 +1200 From: Kent Fredric To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] eapi7-ver.eclass: 'Early adopter' version of EAPI 7 version manip Message-ID: <20170910030556.666c392b@katipo2.lan> In-Reply-To: <20170908111923.8809-1-mgorny@gentoo.org> References: <20170908111923.8809-1-mgorny@gentoo.org> Organization: Gentoo X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/qtbVIqre8roK0vn+2gUeSqi"; protocol="application/pgp-signature" X-Archives-Salt: 994f1746-4919-4b7e-90a0-a6e0c3e96264 X-Archives-Hash: a128310d266c4c5910a7ec875b4be01a --Sig_/qtbVIqre8roK0vn+2gUeSqi Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 8 Sep 2017 13:19:23 +0200 Micha=C5=82 G=C3=B3rny wrote: > a. getting wider review and some real-life testing before > the specification is set in stone, and Any thoughts on a function that would represent a dotted-decimal style vers= ion as a floating point string? eg:=20 ver_float 0.1.0 -> 0.001 ver_float 0.10.0 -> 0.010 ver_float 0.100.0 -> 0.100 That's of course *the most* generic example I can offer, but seeing this sort of transformation is commonly needed in the world of perl, I thought maybe now is a good time to mention something. Sadly, its just the sort of idea that if done wrong, would be no use. For instance, sometimes you want: ver_float 0.1.0 -> 0.0010 Or ver_float 0.1.1 -> 0.001001 The two key things here is to know:=20 1. How many digits each position represents 2. The maximum number of digits to represent So, some ideas in that regard are: ver_float ${INPUT} ${PRECISION} =20 Where the values per position are fixed, so: ver_float 0.1 3 -> 0.001 ver_float 0.1 2 -> INVALD # fidelity loss by truncation ver_float 0.10 2 -> 0.01 # permitted because there's no fidelity lo= ss by truncation ver_float 0.100 1 -> 0.1 # permitted because there's no fidelity lo= ss by truncation ver_float 0.100 2 -> 0.10 ver_float 0.100 3 -> 0.100 ver_float 0.101 1 -> INVALID # fidelity loss by truncation ver_float 0.1 5 -> 0.00100 ver_float 0.1.1 5 -> INVALID, need 6 digits to represent 0.1.1=20 ver_float 0.1.1 6 -> 0.001001 Or say,=20 ver_float ${INPUT} ${PATTERN} Where "pattern" is a string like 3-3-3 indicating how to map digits to numb= ers ver_float 0.1 3 -> 0.001 ver_float 0.1 2 -> 0.01=20 ver_float 0.1 1 -> 0.1 ver_float 0.1.1 3 -> # INVALID, no map for '.1' ver_float 0.1.1 3-3 -> 0.001001 ver_float 0.1.10 3-3 -> 0.001010 =20 ver_float 0.1.10 2-2 -> 0.0110 ver_float 0.10.10 2-2 -> 0.1010 ver_float 0.100.10 2-2 -> # INVALID, can't map "100" into 2 characters Though I suspect you'd want both features ... ver_float ${INPUT} ${PATTERN} ${TRUNCATION_LENGTH} Because we do need packages where=20 0.123.10 means 0.1231=20 Either way, much of this is probably a time wasting bad idea. But I thought I'd just=20 ( =E2=80=A2_=E2=80=A2) ( =E2=80=A2_=E2=80=A2)>=E2=8C=90=E2=96=A0-=E2=96=A0 (=E2=8C=90=E2=96=A0_=E2=96=A0) Float it by you. --Sig_/qtbVIqre8roK0vn+2gUeSqi Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEPZazbI/qrFT1o9rn6FQySxNmqCAFAlm0A3QACgkQ6FQySxNm qCCLNhAA0lPnhpeQgLJbE8m3uIPkDrFMCmWMIRhLv3amBA49rEfD9PleuqIiz+75 lVetMkaIBbPFnqsMkjzT2Ksx5ky7hhSkyz/fIz3/GIosPL3gTWPjJ2ZZzoeRl+Ws eZEOOLgu5ifrFFxa9MF4zqGAxO5kZ+6Ht43ohhgIcfSlFnVacfNjnAGFp9eiF89J Mqu8xo7VITZCWTubo/vS06Y/e+tHknPfWWR++B/oepljtfTjPCcGotAFLMfXdivt xxlAeEShmdz5tPrjgTEpg7+OL2FjJtldmGy6bxk/k/Lisn8e5LpFSKs3AndsZEGs PFMyNW7f9xrzA/Af0UH8a2Zl5D4gMOy3KcyvWGeeNkhBZxI4yWuqSc6x488aHrTO PzBJA9RzQmMgHXKe2B2cRzhWy86Vy7NGwd8JloEbTMMKRf/t0epvLKsezyWXIvgV eqZgpgnPZJOh+fugDYHyH4T3mLSAQgLm43XL1AjUyji3E3lNsM+v412G4dTv5VTu V2CukhmYFuixjdqU5kB9GnwMUzOwCq6A9NusqUWDVVgYnj7YMuxwvuSkYoR9Jahp W0MlMdswFEuvqCY0Wd29XlSv1GWvB3guxL0TaB0F8/0kp+CisiwuZIAi1fjR3gXN cnB6Zj1S5Jrq/PJyocelpKKRi5yvFHwfDSKXkN7+ZSil6KzrpWc= =4zrX -----END PGP SIGNATURE----- --Sig_/qtbVIqre8roK0vn+2gUeSqi--