~martijnbraam/public-inbox

mainlinestatus: Add support for downstream kernels v1 APPLIED

Add the ability to override various parts of the site to produce a
reference for downstream kernels. Being able to see how much code an
Android kernel carries on top of Linux compared to some of the mainline
kernels is a very useful comparison.

Caleb Connolly (4):
  add support for kernel types which can be filtered
  data: add oneplus 6 downstream kernel
  allow overriding title and description
  gen_downstream: override title and description for downstream page

 data/downstream-oneplus-sdm845.yaml | 32 +++++++++++++++++++++++++++++
 data/pine64-pinephone.yml           |  1 +
 data/purism.yml                     |  1 +
 data/qcom-msm8916.yml               |  1 +
 data/qcom-msm8974.yml               |  1 +
 data/qcom-msm8996.yml               |  3 ++-
 data/qcom-msm8998.yml               |  3 ++-
 data/qcom-sdm845.yml                |  1 +
 gen.sh                              |  2 +-
 gen_downstream.sh                   |  3 +++
 mainlinestatus/__main__.py          | 18 ++++++++++++----
 mainlinestatus/index.html           |  8 +++-----
 mainlinestatus/structs.py           |  1 +
 13 files changed, 63 insertions(+), 12 deletions(-)
 create mode 100644 data/downstream-oneplus-sdm845.yaml
 create mode 100755 gen_downstream.sh

-- 
2.32.0
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~martijnbraam/public-inbox/patches/27253/mbox | git am -3
Learn more about email & git

[PATCH mainlinestatus 1/4] add support for kernel types which can be filtered Export this patch

From: Caleb Connolly <caleb@connolly.tech>

All current kernel marked as "mainline", prepares for next patch to add
a "downstream" kernel.
---
 data/pine64-pinephone.yml  |  1 +
 data/purism.yml            |  1 +
 data/qcom-msm8916.yml      |  1 +
 data/qcom-msm8974.yml      |  1 +
 data/qcom-msm8996.yml      |  3 ++-
 data/qcom-msm8998.yml      |  3 ++-
 data/qcom-sdm845.yml       |  1 +
 gen.sh                     |  2 +-
 mainlinestatus/__main__.py | 11 ++++++++---
 mainlinestatus/structs.py  |  1 +
 10 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/data/pine64-pinephone.yml b/data/pine64-pinephone.yml
index 3352a42..c121d97 100644
--- a/data/pine64-pinephone.yml
+++ b/data/pine64-pinephone.yml
@@ -7,3 +7,4 @@ url: https://github.com/megous/linux
tag: orange-pi-\d\.\d.+
ignore:
  - drivers/gpu/drm/rockchip
type: mainline
diff --git a/data/purism.yml b/data/purism.yml
index 44692e4..50b6bdb 100644
--- a/data/purism.yml
+++ b/data/purism.yml
@@ -6,3 +6,4 @@ base: stable/linux-5.15.y
kernel: https://source.puri.sm/Librem5/linux-next.git
url: https://source.puri.sm/Librem5/linux-next
branch: next/byzantium
type: mainline
diff --git a/data/qcom-msm8916.yml b/data/qcom-msm8916.yml
index 6600f9e..d44c333 100644
--- a/data/qcom-msm8916.yml
+++ b/data/qcom-msm8916.yml
@@ -4,3 +4,4 @@ codename: qcom-msm8916
kernel: https://github.com/msm8916-mainline/linux
url: https://github.com/msm8916-mainline/linux
tag: v\d\.\d+-msm8916
type: mainline
diff --git a/data/qcom-msm8974.yml b/data/qcom-msm8974.yml
index d501177..99648ca 100644
--- a/data/qcom-msm8974.yml
+++ b/data/qcom-msm8974.yml
@@ -4,3 +4,4 @@ codename: qcom-msm8974
kernel: https://gitlab.com/postmarketOS/linux-postmarketos.git
url: https://gitlab.com/postmarketOS/linux-postmarketos
branch: qcom-msm8974-next-stable
type: mainline
diff --git a/data/qcom-msm8996.yml b/data/qcom-msm8996.yml
index cd27676..5fdb495 100644
--- a/data/qcom-msm8996.yml
+++ b/data/qcom-msm8996.yml
@@ -3,4 +3,5 @@ name: Snapdragon 820
codename: qcom-msm8996
kernel: https://gitlab.com/msm8996-mainline/linux
url: https://gitlab.com/msm8996-mainline/linux
branch: msm8996-staging
\ No newline at end of file
branch: msm8996-staging
type: mainline
diff --git a/data/qcom-msm8998.yml b/data/qcom-msm8998.yml
index 0d05740..b735b08 100644
--- a/data/qcom-msm8998.yml
+++ b/data/qcom-msm8998.yml
@@ -3,4 +3,5 @@ name: Snapdragon 835
codename: qcom-msm8998
kernel: https://gitlab.com/msm8998-mainline/linux
url: https://gitlab.com/msm8998-mainline/linux
branch: op5/5.15
\ No newline at end of file
branch: op5/5.15
type: mainline
diff --git a/data/qcom-sdm845.yml b/data/qcom-sdm845.yml
index d8f046a..a02e1e2 100644
--- a/data/qcom-sdm845.yml
+++ b/data/qcom-sdm845.yml
@@ -4,3 +4,4 @@ codename: qcom-sdm845
kernel: https://gitlab.com/sdm845-mainline/linux.git
url: https://gitlab.com/sdm845-mainline/linux
branch: sdm845-stable
type: mainline
diff --git a/gen.sh b/gen.sh
index 37686e7..c2c1727 100755
--- a/gen.sh
+++ b/gen.sh
@@ -1,2 +1,2 @@
#!/bin/sh
python3 -m mainlinestatus data linux.git index.html
\ No newline at end of file
python3 -m mainlinestatus data linux.git index.html "$@"
diff --git a/mainlinestatus/__main__.py b/mainlinestatus/__main__.py
index 5e5e547..f6c4c8e 100644
--- a/mainlinestatus/__main__.py
+++ b/mainlinestatus/__main__.py
@@ -12,12 +12,13 @@ from mainlinestatus.structs import Device
devices = []


def read_config(filename):
def read_config(filename, select):
    global devices
    with open(filename) as handle:
        raw = handle.read()
    config = yaml.load(raw, Loader=yaml.Loader)
    devices.append(Device(config))
    if config["type"] in select:
        devices.append(Device(config))


if __name__ == '__main__':
@@ -25,15 +26,19 @@ if __name__ == '__main__':
    parser.add_argument('configdir')
    parser.add_argument('gitdir')
    parser.add_argument('output')
    # List of types of files to use, empty for all (e.g. "--select mainline", "--select downstream")
    parser.add_argument('--select')
    args = parser.parse_args()
    args.select = args.select.split(',') if args.select else []

    git._GITDIR = args.gitdir

    for file in glob.glob(os.path.join(args.configdir, '*')):
        read_config(file)
        read_config(file, args.select)

    remotes = []
    for device in devices:
        print(device.ignores)
        remotes.append((device.codename, device.kernel))
    git.pull(remotes)

diff --git a/mainlinestatus/structs.py b/mainlinestatus/structs.py
index 8604281..69e85f5 100644
--- a/mainlinestatus/structs.py
+++ b/mainlinestatus/structs.py
@@ -17,6 +17,7 @@ class Device:
        self.labels = config['labels'] if 'labels' in config else {}
        self.stats = {}
        self.total = [0, 0]
        self.type = config['type'] if 'type' in config else ""

    def __repr__(self):
        return f'<Device {self.manufacturer} {self.name} from {self.kernel}>'
-- 
2.32.0

[PATCH mainlinestatus 2/4] data: add oneplus 6 downstream kernel Export this patch

From: Caleb Connolly <caleb@connolly.tech>

---
 data/downstream-oneplus-sdm845.yaml | 32 +++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 data/downstream-oneplus-sdm845.yaml

diff --git a/data/downstream-oneplus-sdm845.yaml b/data/downstream-oneplus-sdm845.yaml
new file mode 100644
index 0000000..0be2c53
--- /dev/null
+++ b/data/downstream-oneplus-sdm845.yaml
@@ -0,0 +1,32 @@
name: OnePlus 6 downstream
manufacturer: Qualcomm
codename: op6-sm845
kernel: https://github.com/LineageOS/android_kernel_oneplus_sdm845.git
url: https://github.com/LineageOS/android_kernel_oneplus_sdm845
branch: lineage-18.1
base: stable/linux-4.9.y
type: downstream
ignores:
 - arch/alpha
 - arch/arc
 - arch/arm
 - arch/csky
 - arch/h8300
 - arch/hexagon
 - arch/ia64
 - arch/Kconfig
 - arch/m68k
 - arch/microblaze
 - arch/mips
 - arch/nds32
 - arch/nios2
 - arch/openrisc
 - arch/parisc
 - arch/powerpc
 - arch/riscv
 - arch/s390
 - arch/sh
 - arch/sparc
 - arch/um
 - arch/x86
 - arch/xtensa
-- 
2.32.0

[PATCH mainlinestatus 3/4] allow overriding title and description Export this patch

From: Caleb Connolly <caleb@connolly.tech>

---
 mainlinestatus/__main__.py | 7 ++++++-
 mainlinestatus/index.html  | 8 +++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/mainlinestatus/__main__.py b/mainlinestatus/__main__.py
index f6c4c8e..d4e3a91 100644
--- a/mainlinestatus/__main__.py
+++ b/mainlinestatus/__main__.py
@@ -28,6 +28,10 @@ if __name__ == '__main__':
    parser.add_argument('output')
    # List of types of files to use, empty for all (e.g. "--select mainline", "--select downstream")
    parser.add_argument('--select')
    parser.add_argument('--title', default="Mainline Status")
    parser.add_argument('--description', default="""This is an overview of the amount of code in the repositories for Linux phones that are not upstreamed yet
            to the kernel.org repository. The changes for the latest version of the kernel are taken from each tree and
            grouped by categories.""")
    args = parser.parse_args()
    args.select = args.select.split(',') if args.select else []

@@ -66,6 +70,7 @@ if __name__ == '__main__':

    template = env.get_template("mainlinestatus/index.html")
    generated = datetime.now().isoformat()
    rendered = template.render(devices=devices, stats=rows, generated=generated)
    rendered = template.render(devices=devices, title=args.title,
        description=args.description, stats=rows, generated=generated)
    with open(args.output, 'w') as handle:
        handle.write(rendered)
diff --git a/mainlinestatus/index.html b/mainlinestatus/index.html
index 60789d5..57ccbb3 100644
--- a/mainlinestatus/index.html
+++ b/mainlinestatus/index.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
    <title>Mainline status</title>
    <title>{{title}}</title>
    <style>
        body, html {
            padding: 0;
@@ -83,11 +83,9 @@
        }
    </style>
    <main>
        <h1>Mainline status</h1>
        <h1>{{title}}</h1>
        <p>
            This is an overview of the amount of code in the repositories for Linux phones that are not upstreamed yet
            to the kernel.org repository. The changes for the latest version of the kernel are taken from each tree and
            grouped by categories.
            {{description}}
        </p>
        <p>
            The data in this table was generated on {{generated}}, ordering is random.
-- 
2.32.0

[PATCH mainlinestatus 4/4] gen_downstream: override title and description for downstream page Export this patch

From: Caleb Connolly <caleb@connolly.tech>

---
 gen_downstream.sh | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100755 gen_downstream.sh

diff --git a/gen_downstream.sh b/gen_downstream.sh
new file mode 100755
index 0000000..f87e972
--- /dev/null
+++ b/gen_downstream.sh
@@ -0,0 +1,3 @@
#!/bin/sh

./gen.sh --select downstream --title "Downstream Status" --description "This is an overview of the amount of code in the Linux derived Android kernels compared to the Linux stable branch they are based on. Android SoC and device vendors carry many many drivers and changes which are of too low quality to be upstreamed to enable support for their devices."
-- 
2.32.0