~alpine/devel

2 2

Line length for APKBUILD files

Duncan Bellamy
Details
Message ID
<D95C331C-B1A9-4F99-A14C-6DF82DB5ABBD@me.com>
DKIM signature
missing
Download raw message
Hi,
I read Linus Torvalds is going to stop enforcing line lengths in kernel patches to increase readability.

Is it something Alpine has considered doing?

I think lines like the blocks with:

install -dm 750 -o PKGUSER -g PKGGRP \
		var/lib/ $pkgname

Would be easier to read if they were on one line (per install)

Duncan
Rasmus Thomsen
Details
Message ID
<47b50ae0b2e30e316927c7b3b0e29ac5e900e867.camel@cogitri.dev>
In-Reply-To
<D95C331C-B1A9-4F99-A14C-6DF82DB5ABBD@me.com> (view parent)
DKIM signature
missing
Download raw message
Hello,

On Mon, 2020-06-01 at 11:23 +0100, Duncan Bellamy wrote:
> Hi,
> I read Linus Torvalds is going to stop enforcing line lengths in
> kernel patches to increase readability.

FWIW, I don't think that kernel QA will stop enforcing line lengths,
just that the maximum character count per line will be increased. Many
have suggested ~120 lines per line to be a good compromise between
readability and being too restrictive.

> Is it something Alpine has considered doing?
> 
> I think lines like the blocks with:
> 
> install -dm 750 -o PKGUSER -g PKGGRP \
> 		var/lib/ $pkgname
> 
> Would be easier to read if they were on one line (per install)

Hm, that depends on the situation. In some cases linebreaks can make
reading things easier, even if linebreaks are enabled in the editor.
For example in the rust APKBUILD we have the following construct:

./configure \
	--build="$_build" \
	--host="$_target" \
	--target="$_target" \
	--prefix="/usr" \
	--release-channel="stable" \
	--enable-local-rust \
	--local-rust-root="/usr" \
	--llvm-root="/usr/lib/llvm$_llvmver" \
	--disable-docs \
	--enable-extended \
	--tools="analysis,cargo,src" \
	--enable-llvm-link-shared \
	--enable-option-checking \
	--enable-locked-deps \
	--enable-vendor \
	--python="$_python" \
	--set="rust.musl-root=/usr" \
	--set="target.$_target.llvm-
config=/usr/lib/llvm$_llvmver/bin/llvm-config" \
	--set="target.$_build.musl-root=/usr" \
	--set="target.$_build.crt-static=false"

The indention makes it immediately obvious where each configuration
option begins and ends. Without it it's kind of a pain to read:

./configure --build="$_build" --host="$_target" --target="$_target" --
prefix="/usr" --release-channel="stable" --enable-local-rust --local-
rust-root="/usr" --llvm-root="/usr/lib/llvm$_llvmver" --disable-docs --
enable-extended --tools="analysis,cargo,src" --enable-llvm-link-shared
--enable-option-checking --enable-locked-deps --enable-vendor --
python="$_python" --set="rust.musl-root=/usr" --
set="target.$_target.llvm-config=/usr/lib/llvm$_llvmver/bin/llvm-
config" --set="target.$_build.musl-root=/usr" --
set="target.$_build.crt-static=false"

Even if your mail client has linebreaks enabled, this is nowhere as
nice to read as the previous version with linebreaks. As such I think
that linebreaks still make sense for command invocations, since they
can carry semantic meaning.

However, for things like makedepends, I think it'd be fine to stop
enforcing the character limit. The indention in that doesn't really
carry semantic meaning, nor does it make reading the list much easier
compared to your text editor doing automatic linebreaks. I'm not sure
if lifting that restriction makes sense though - maybe that
inconsistency would only confuse contributors.

Regards,

Rasmus

> Duncan
Duncan Bellamy
Details
Message ID
<487CCA80-4621-41A4-B9C2-08C05A139B3B@me.com>
In-Reply-To
<47b50ae0b2e30e316927c7b3b0e29ac5e900e867.camel@cogitri.dev> (view parent)
DKIM signature
missing
Download raw message
Hi

> On 1 Jun 2020, at 11:33, Rasmus Thomsen <oss@cogitri.dev> wrote:
> 
> ´╗┐Hello,
> 
>>>> On Mon, 2020-06-01 at 11:23 +0100, Duncan Bellamy wrote:
>> Hi,
>> I read Linus Torvalds is going to stop enforcing line lengths in
>> kernel patches to increase readability.
> 
> FWIW, I don't think that kernel QA will stop enforcing line lengths,
> just that the maximum character count per line will be increased. Many
> have suggested ~120 lines per line to be a good compromise between
> readability and being too restrictive.
> 
>> Is it something Alpine has considered doing?
>> I think lines like the blocks with:
>> install -dm 750 -o PKGUSER -g PKGGRP \
>>      var/lib/ $pkgname
>> Would be easier to read if they were on one line (per install)
> 
> Hm, that depends on the situation. In some cases linebreaks can make
> reading things easier, even if linebreaks are enabled in the editor.
> For example in the rust APKBUILD we have the following construct:
> 
> ./configure \
>  --build="$_build" \
>  --host="$_target" \
>  --target="$_target" \
>  --prefix="/usr" \
>  --release-channel="stable" \
>  --enable-local-rust \
>  --local-rust-root="/usr" \
>  --llvm-root="/usr/lib/llvm$_llvmver" \
>  --disable-docs \
>  --enable-extended \
>  --tools="analysis,cargo,src" \
>  --enable-llvm-link-shared \
>  --enable-option-checking \
>  --enable-locked-deps \
>  --enable-vendor \
>  --python="$_python" \
>  --set="rust.musl-root=/usr" \
>  --set="target.$_target.llvm-
> config=/usr/lib/llvm$_llvmver/bin/llvm-config" \
>  --set="target.$_build.musl-root=/usr" \
>  --set="target.$_build.crt-static=false"
> 
> The indention makes it immediately obvious where each configuration
> option begins and ends. Without it it's kind of a pain to read:
> 
> ./configure --build="$_build" --host="$_target" --target="$_target" --
> prefix="/usr" --release-channel="stable" --enable-local-rust --local-
> rust-root="/usr" --llvm-root="/usr/lib/llvm$_llvmver" --disable-docs --
> enable-extended --tools="analysis,cargo,src" --enable-llvm-link-shared
> --enable-option-checking --enable-locked-deps --enable-vendor --
> python="$_python" --set="rust.musl-root=/usr" --
> set="target.$_target.llvm-config=/usr/lib/llvm$_llvmver/bin/llvm-
> config" --set="target.$_build.musl-root=/usr" --
> set="target.$_build.crt-static=false"

Yes the configure is definitely more readable on separate lines

> 
> Even if your mail client has linebreaks enabled, this is nowhere as
> nice to read as the previous version with linebreaks. As such I think
> that linebreaks still make sense for command invocations, since they
> can carry semantic meaning.
> 
> However, for things like makedepends, I think it'd be fine to stop
> enforcing the character limit. The indention in that doesn't really
> carry semantic meaning, nor does it make reading the list much easier
> compared to your text editor doing automatic linebreaks. I'm not sure
> if lifting that restriction makes sense though - maybe that
> inconsistency would only confuse contributors.

Yes it could be more confusing if some files are formatted one way and others another.

> 
> Regards,
> 
> Rasmus
> 
>> Duncan

Regards,
Duncan