Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: check for git status in patches action #94

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
39 changes: 39 additions & 0 deletions .github/workflows/site-check-patches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
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 diff
run: git diff-files --quiet

- name: Patch status
run: test -z "$(git status --porcelain)"
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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
|:----------------:|:----------------------:|:------------------------------------------------------------------------:|:-----------------------------:|
| master | | master | nightly builds, manual builds |
| stable | mostly latest release | [See here](https://hannover.freifunk.net/wiki/Freifunk/FirmwareReleases) | manual builds, releases |
| master-wireguard | currently unused | master | nightly builds, manual builds |
| master-wireguard | | master | nightly builds, manual builds |
| stable-wireguard | mostly latest release | [See here](https://hannover.freifunk.net/wiki/Freifunk/FirmwareReleases) | manual builds, releases |
| next | currently not used yet | next | manual builds |

Expand Down
2 changes: 1 addition & 1 deletion modules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GLUON_SITE_FEEDS='hannover'
PACKAGES_HANNOVER_REPO=https://github.com/freifunkh/ffh-packages
PACKAGES_HANNOVER_COMMIT=04813d8c5b46077b27b6b99a92992ef994fb4e79
PACKAGES_HANNOVER_COMMIT=55f5cc4a1d9d2bd1c0c9f8071d0ccbb9e8b90539

PACKAGES_FFHO_REPO=https://git.ffho.net/FreifunkHochstift/ffho-packages.git
PACKAGES_FFHO_BRANCH=master
Expand Down
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