Subject: [alpine-devel] RFC: Distribution variables for abuild

From: "A. Wilcox" <[email-masked]>
Date: Sun, 25 Jun 2017 01:36:37 -0500

===========================================================
 Proposal for addition of distribution variables to abuild
===========================================================

:Author:
  A. Wilcox (Adélie Linux)
:Date:
  2017-06-25
:Status:
  Request for Comment

Introduction
- ------------

This proposal outlines the addition of environment variables to
``abuild.conf`` for the purposes of identifying the distribution of
built packages.

Background
- ----------

Alpine Linux is a secure, solid foundation for creators and
organisations to build atop for their own forks or spins (derivative
distributions).  Some that exist are postmarketOS and Adélie.

Current Situation
- -----------------

Currently, forks and spins of Alpine are required to choose one of
only two options.  They can either use aports as is, which causes
packages to identify as being built for Alpine and causes most
autoconf-based packages to have their builder and bug report URLs
point to Alpine.  Alternatively, they can fork the Git repository,
requiring the need of manual merges when conflicts arise, and constant
monitoring of new packages to ensure they are branded correctly.

Deficiencies
- ------------

If a fork or spin of Alpine does not have the manpower or resources to
modify all packages that mention the Alpine name / bug URL (about
300-400 at my last count, with many more possible), then both
distributions suffer.  Users of the spin will file bugs with Alpine
that are not bugs in Alpine.  Developers of the spin will not know
about said bugs, and be unable to fix them.  Alpine developers will
have to waste time and resources testing bugs and finding out they are
not even Alpine bugs.

If they choose the alternative of forking the repository and changing
these parameters in the packages, then it makes upstreaming their
improvements much more difficult.

Solution Objectives
- -------------------

* Protect Alpine's name, trademark, and reputation by avoiding the
  appearance that derivative distributions are part of the Alpine
  Linux project.

* Lessen number of inappropriate bugs filed with Alpine due to forks
  and spins.

* Foster better collaboration and sharing of improvements between
  Alpine and its forks/spins.

* Future potential changes to the bug report URL, while unlikely,
  are additionally made easier if there is a move off of Redmine.

Solution Vision
- ---------------

I hereby propose adding the following four variables to abuild.conf,
with the default values in abuild being appropriate for Alpine.

:``${DISTRO_NAME}``:
  The name of the distribution, such as "Alpine Linux" or
  "Adélie Linux".

:``${DISTRO_SHORT_NAME}``:
  A single word describing the distribution, such as "Alpine" or
  "Adelie".

:``${DISTRO_URL}``:
  The home page of the distribution, i.e. "https://alpinelinux.org".

:``${DISTRO_BUG_URL}``:
  The URL to use to report bugs with software on the distribution.
  This would be set to "https://bugs.alpinelinux.org" by default.

By replacing references to 'Alpine Linux' passed to ./configure, make,
etc with ``${DISTRO}``, forks and spins will be able to notate their
name as the distributor on packages.  This will affect packages such
as LibreOffice, OpenRC, X.Org, coreutils, and more, which are all
compiled with the name of the distribution internally. They use this
for bug information, and having the proper distribution name will
allow for more proper bug handling and ensure less inappropriate blame
is assigned to Alpine.  This also ensures that the fork or spin's own
mailing lists, forums, and so on are searched and contacted before
Alpine's.

By replacing references to 'bugs.alpinelinux.org' passed to
./configure with ``${DISTRO_BUG_URL}``, the Alpine project will have a
significant reduction in wasted effort handling inappropriately filed
bugs when the issues are caused by changes by the forks and spins.

Roadmap
- -------

Since the shell environment is flexible, this change can be
implemented almost immediately; the defaults specified ensure that at
worst, nothing will change.  As forks and spins change the environment
variables in their ``abuild.conf`` files, all updated packages will
immediately reflect those changes.

If there is interest, I would be happy to work on the abuild code and
adding the variables in relevant APKBUILDs. There are a few packages
that don't specify bug report URLs where they could; I could
additionally add support there, if desired.

One alternative is sourcing this information from ``/etc/os-release``
instead of ``abuild.conf``, or using os-release when abuild.conf does
not have anything set.

Thank you for your time in reviewing this proposal. If you have any
questions or concerns or changes, I would love to discuss them. I'm
open to any comments the community has.

All the best to you and yours,
- --arw

- -- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Fri, 30 Jun 2017 07:52:33 +0200

On Sun, 25 Jun 2017 01:36:37 -0500
"A. Wilcox" <[email-masked]> wrote:

...

>   This would be set to "https://bugs.alpinelinux.org" by default.

I think this is a good idea. It is trivial to implement and does not
cause any maintenance burden.

...

> immediately reflect those changes.

How much code is needed in abuild? I think we could start with the APKBUILDs:

	${DISTRO_URL:-https://alpinelinux.org}

That way you can override the default and we are still backwards
compatible. No code changes in abuild required to get started.

This makes it also possible backport security and bug fixes to stable
branches if needed.

> additionally add support there, if desired.

Yes. This would be great!

> instead of ``abuild.conf``, or using os-release when abuild.conf does

Nah, I like your proposal better.
  
> open to any comments the community has.

Are you ok with using the style ${DISTRO_NAME:-Alpine Linux} in the
APKBUILDs?

Something like:
diff --git a/main/alpine-base/APKBUILD b/main/alpine-base/APKBUILD
index e5cfeba83f..58980b5273 100644
--- a/main/alpine-base/APKBUILD
+++ b/main/alpine-base/APKBUILD
@@ -26,7 +26,7 @@ package() {
 
        # create /etc/issue
        cat >"$pkgdir"/etc/issue<<EOF
-Welcome to Alpine Linux ${pkgver%.*}
+Welcome to ${DISTRO_NAME:-Alpine Linux} ${pkgver%.*}
 Kernel \\r on an \\m (\\l)
 
 EOF
@@ -34,11 +34,11 @@ EOF
        _ver="$(echo "$pkgver" | grep -E -o '^[0-9]+\.[0-9]+')"
        # create os-release
        cat >"$pkgdir"/etc/os-release<<EOF
-NAME="Alpine Linux"
-ID=alpine
+NAME="${DISTRO_NAME:-Alpine Linux}"
+ID=${DISTRO_SHORT_NAME:-alpine}
 VERSION_ID=$pkgver
-PRETTY_NAME="Alpine Linux v$_ver"
-HOME_URL="http://alpinelinux.org"
-BUG_REPORT_URL="http://bugs.alpinelinux.org"
+PRETTY_NAME="${DISTRO_NAME:-Alpine Linux} v$_ver"
+HOME_URL="${DISTRO_URL:-https://alpinelinux.org}"
+BUG_REPORT_URL="${DISTRO_BUG_URL:-https://bugs.alpinelinux.org}"
 EOF
 }

Thanks for working on this.

-nc

---

---

From: "A. Wilcox" <[email-masked]>
Date: Fri, 30 Jun 2017 14:30:47 -0500

On 30/06/17 00:52, Natanael Copa wrote:
> On Sun, 25 Jun 2017 01:36:37 -0500 "A. Wilcox"
> <[email-masked]> wrote:
>> Roadmap
>> 
> This makes it also possible backport security and bug fixes to
> stable branches if needed.

That is a good thought, it is fine I think.  It does erase one good
feature in that if bug URL changes, all the APKBUILDs still have to be
updated.  But probably would be doable with a single `sed` command, so
that should still be okay.

>> If there is interest, I would be happy to work on the abuild code
>> and adding the variables in relevant APKBUILDs. There are a few
>> packages that don't specify bug report URLs where they could; I
>> could additionally add support there, if desired.
> 

Great, I will start work on this.

>> Thank you for your time in reviewing this proposal. If you have
>> any questions or concerns or changes, I would love to discuss
>> them. I'm open to any comments the community has.
> 
> Are you ok with using the style ${DISTRO_NAME:-Alpine Linux} in
> the APKBUILDs?

Yes, this is fine.

> Something like: [diff showing good implementation of proposal]
> 

Always glad to contribute to a worthy cause :)

Best,
- --arw

- -- 
A. Wilcox (awilfox)

---