Skip to content

Commit

Permalink
Merge pull request #93 from AiyionPrime/wg-variant-patch-actions
Browse files Browse the repository at this point in the history
WG variant patch actions
  • Loading branch information
AiyionPrime authored Apr 27, 2023
2 parents 16d13a5 + bbb67ca commit 1facfc0
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 160 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/gluon-check-patches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Gluon check patches
on:
push:
paths:
- 'patches/**'
- '.github/workflows/gluon-check-patches.yml'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'patches/**'
- '.github/workflows/gluon-check-patches.yml'
schedule:
- cron: '16 * * * *'
permissions:
contents: read

jobs:
gluon-check-patches:
name: Gluon check patches
runs-on: ubuntu-latest
steps:
- name: Clone gluon repo
uses: actions/checkout@v3
with:
repository: freifunk-gluon/gluon

- name: Clone site repo
uses: actions/checkout@v3
with:
path: gluon/site

- name: apply site patches
working-directory: ./gluon
run: git -c user.name='freifunkh Patch Manager' -c user.email='freifunkh@void.example.com' -c commit.gpgsign=false am --whitespace=nowarn --committer-date-is-author-date site/patches/*


# The following should match the last steps in gluons check-patches.yml
- name: Refresh patches
run: make refresh-patches GLUON_SITEDIR="contrib/ci/minimal-site"

- name: Show diff
run: git status; git diff

- name: Patch status
run: git diff-files --quiet
36 changes: 36 additions & 0 deletions .github/workflows/site-check-patches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Site check patches
on:
push:
paths:
- 'patches/**'
- '.github/workflows/site-check-patches.yml'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'patches/**'
- '.github/workflows/site-check-patches.yml'
schedule:
- cron: '16 * * * *'
permissions:
contents: read

jobs:
site-check-patches:
name: site check patches
runs-on: ubuntu-latest
steps:
- name: Clone site repo
uses: actions/checkout@v3

- name: Run refresh_ffh_patches.sh
working-directory: ./
run: ./refresh_ffh_patches.sh

# The following should match the last steps from gluons check-patches.yml

- name: Show diff
run: git status; git diff

- name: Patch status
run: git diff-files --quiet
61 changes: 61 additions & 0 deletions PATCHES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Patches

As gluon, this repo is upstream-first.
Which means, if a patch can be upstreamed to gluon, it should be.


## Patches in Gluons repo

Whenever Gluon implements changes that cannot be upstreamed to OpenWrt or related repos (yet),
Patchfiles are created and tracked in a subdir of the `patches`-folder in the gluon repo.

Patches in that repo have to be structured in a specific way.
There's a helper in the gluon repo, which reformats them accordingly,
available by calling `make refresh-patches`.

After calling it, the file is in the desired format, but uncommitted.
Commit them (if necessary using `--amend`, if the commit that created italready exists).

## Patches in this repo

Our patches are similar:

Whenever we implement changes that cannot be upstreamed to Gluon (yet),
Patchfiles are created and tracked in the `patches`-folder in this repo.

We structure these patches the very same way gluon does.
There's again a helper in this repo, which formats them as intended.
available by calling `refresh_ffh_patches.sh`.

Calling it does change the files in the patch folder if necessary, but does not commit them.
That's your task again.


## Careful

Working with these helpers is a fast and powerful workflow;
which means you can break things fast.

Make sure you have **no uncommited changes** in the respective repo, before calling either of them.
That way recovering and assessing the situation is easy using git.


## A clean patch

If the folder contains only clean patches, calling either helper does not change anything.
So calling them before pushing is a good way to make sure the GitHub actions will run through.


# Use-cases

## Updating a patch

If we want to change an exiting patch of ours, we apply the *existing* patches to the proper gluon-branch can then alter the commits appropriately.
After commiting the gluon changes using `--amend` we can then create a patch of it using `git format-patch`, and replace the old patch version with it.
Now comes the new part: call `refresh_ffh_patches.sh` to have the script reformat it appropriately.
This will minimize the differences to previous versions of the patches, regardless which OS we use to create them.

## Gluon added a patch itself

The action will fail, if tat breaks the order of existing patches.
renaming the numbers manually and then fixing the script again will do the trick.
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
From 57756bf8ff39784639fd5299a118af17cbdf5d36 Mon Sep 17 00:00:00 2001
From: lemoer <git@irrelefant.net>
Date: Mon, 23 Apr 2018 02:55:52 +0200
Subject: [PATCH] batman-adv: fix when vlan crc == 0x00000000

---
.../routing/0005-batman-adv-add-patch.patch | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 patches/packages/routing/0005-batman-adv-add-patch.patch
Subject: batman-adv: fix when vlan crc == 0x00000000

diff --git a/patches/packages/routing/0005-batman-adv-add-patch.patch b/patches/packages/routing/0005-batman-adv-add-patch.patch
new file mode 100644
index 00000000..7d92a1c2
index 0000000000000000000000000000000000000000..7d92a1c2ca4a3fb0daed6b42482c1860b7de1733
--- /dev/null
+++ b/patches/packages/routing/0005-batman-adv-add-patch.patch
@@ -0,0 +1,41 @@
Expand Down Expand Up @@ -55,6 +49,3 @@ index 00000000..7d92a1c2
++--
++2.11.0
++
--
2.16.2

Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
From 86d188616d7a03e6e7ce8312a3968d7c54687acb Mon Sep 17 00:00:00 2001
From: lemoer <git@irrelefant.net>
Date: Thu, 31 May 2018 23:52:48 +0200
Subject: [PATCH] patches: uradvd: change ip lifetimes to 150/300 seconds

---
...vd-change-ip-lifetimes-to-150-300-seconds.patch | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 patches/packages/gluon/0001-uradvd-change-ip-lifetimes-to-150-300-seconds.patch
Subject: patches: uradvd: change ip lifetimes to 150/300 seconds

diff --git a/patches/packages/gluon/0001-uradvd-change-ip-lifetimes-to-150-300-seconds.patch b/patches/packages/gluon/0001-uradvd-change-ip-lifetimes-to-150-300-seconds.patch
new file mode 100644
index 00000000..b6bf1cdb
index 0000000000000000000000000000000000000000..b6bf1cdb1b89ba4fb3c13108aa6c56342bc42100
--- /dev/null
+++ b/patches/packages/gluon/0001-uradvd-change-ip-lifetimes-to-150-300-seconds.patch
@@ -0,0 +1,27 @@
Expand Down Expand Up @@ -41,6 +35,3 @@ index 00000000..b6bf1cdb
+
+ /* And these in milliseconds */
+ #define MAX_RA_DELAY_TIME 500u
--
2.11.0

Loading

0 comments on commit 1facfc0

Please sign in to comment.