From 261210fe09b7b6189b78c8393abac6d051348402 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:21:52 +0200 Subject: [PATCH 1/6] github: Gentoo is a proper name --- .../.github/workflows/update-packages-from-list.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index 6ed0dd9b24..bd37908886 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -13,7 +13,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} path: ./portage-stable - - name: Checkout gentoo + - name: Checkout Gentoo uses: actions/checkout@v2 with: repository: gentoo/gentoo From 1d8feba460c6aec6d2d46173835766ed825808d5 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:22:34 +0200 Subject: [PATCH 2/6] github: Silence the warning about node 12 deprecation The workflow was inconsistent with usage of actions/checkout. The first checkout used v3, whereas the next two - v2. These are the same, but v3 runs on currently supported node 16. Using v2 emits warnings. To avoid them, update the action versions to v3. --- .../.github/workflows/update-packages-from-list.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index bd37908886..043cd59bf8 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -14,13 +14,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} path: ./portage-stable - name: Checkout Gentoo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: gentoo/gentoo path: gentoo fetch-depth: 0 - name: Checkout build scripts - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: flatcar/flatcar-build-scripts ref: krnowak/stuff From c68b399d8928e62bb4b78c92b59aa970f3cdf0b8 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:25:06 +0200 Subject: [PATCH 3/6] github: Fix package check Packages in the list are not necessarily packages only, which are represented as directories (like sys-apps/systemd), but also, in case of eclasses, plain files. The check was checking for the path to be a directory and emitted the warning if it was not, which resulted in eclasses being kept not updated. Just check if the path exists. --- .../.github/workflows/update-packages-from-list.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index 043cd59bf8..b1ac7a2caa 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -33,7 +33,7 @@ jobs: old_head=$(git -C portage-stable rev-parse HEAD) cd portage-stable while read -r package; do - if [[ ! -d "${package}" ]]; then + if [[ ! -e "${package}" ]]; then # If this happens, it means that the package was moved to overlay # or dropped, the list ought to be updated. echo "::warning title=${package}::Nonexistent package" From e07dc35011cefb062dea657eda204108b81e142e Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:27:50 +0200 Subject: [PATCH 4/6] github: Add a warning about moved or obsoleted packages Packages (and eclasses) in Gentoo are sometimes moved around or completely removed. It's good to know about this when it happens, because such package won't be updated any more, so print a warning. --- .../.github/workflows/update-packages-from-list.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index b1ac7a2caa..1b6a717f2c 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -39,6 +39,16 @@ jobs: echo "::warning title=${package}::Nonexistent package" continue fi + if [[ ! -e "../gentoo/${package}" ]]; then + # If this happens, it means that the package was obsoleted or moved + # in Gentoo. The obsoletion needs to be handled in the case-by-case + # manner, while move should be handled by doing the same move + # in portage-stable. The build should not break because of the move, + # because most likely it's already reflected in the profiles/updates + # directory. + echo "::warning title=${package}::Obsolete or moved package" + continue + fi GENTOO_REPO=../gentoo ../flatcar-build-scripts/sync-with-gentoo "${package}" done < <(grep '^[^#]' .github/workflows/packages-list) cd .. From ba9d159004bb480bece0a517d23dfc90f26643f7 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:51:47 +0200 Subject: [PATCH 5/6] github: Limit the depth of Gentoo checkout It is quite a bit of data to download for no real reason. We are trying to update packages here, so we will be grabbing them from the most recent commit that made the changes to the package. With the advancement the package updates effort, we possibly can later lower the number of the fetched commits even further. --- .../.github/workflows/update-packages-from-list.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index 1b6a717f2c..ba8e29dd12 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -18,7 +18,10 @@ jobs: with: repository: gentoo/gentoo path: gentoo - fetch-depth: 0 + # Gentoo is quite a large repo, so limit ourselves to last + # quarter milion of commits. It is about two years worth of changes. + fetch-depth: 250000 + ref: master - name: Checkout build scripts uses: actions/checkout@v3 with: From 8b2f0732076feceeb78ae6eac44c820f069469dd Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Mon, 17 Oct 2022 17:55:19 +0200 Subject: [PATCH 6/6] github: Use non-deprecated way of setting output The warnings are currently emitted if the `::set_output` stuff is used. --- .../.github/workflows/update-packages-from-list.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml index ba8e29dd12..abf3f6720d 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/update-packages-from-list.yml @@ -62,8 +62,8 @@ jobs: updated=1 count=$(git -C portage-stable rev-list --count "${old_head}..${new_head}") fi - echo ::set-output "name=UPDATED::${updated}" - echo ::set-output "name=COUNT::${count}" + echo "UPDATED=${updated}" >>"${GITHUB_OUTPUT}" + echo "COUNT=${count}" >>"${GITHUB_OUTPUT}" - name: Create pull request for main branch uses: peter-evans/create-pull-request@v4 if: steps.update-listed-packages.outputs.UPDATED == 1