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

UnitTestFrameworkPkg: Use TianoCore mirror of subhook submodule #6402

Conversation

mdkinney
Copy link
Member

@mdkinney mdkinney commented Nov 4, 2024

Description

Change subhook url from https://github.com/Zeex/subhook to https://github.com/tianocore/edk2-subhook because old url is no longer available.

Also align .gitmodules file to use consistent LF line endings.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Test with edk2 CI and local clone new edk2 env and verify subhook files and sha match 83d4e1e

Integration Instructions

N/A

Change subhook url from https://github.com/Zeex/subhook to
https://github.com/tianocore/edk2-subhook because old url is
no longer available.

Also align .gitmodules file to use consistent LF line endings.

Signed-off-by: Michael D Kinney <[email protected]>
@spbrogan
Copy link
Member

spbrogan commented Nov 4, 2024

Is the subhook project dead? I noticed here: https://github.com/tianocore/edk2-subhook that you mention it is a mirror of the defunct repo but does that mean the project is gone and our dependency is now fully unsupported?

@mdkinney
Copy link
Member Author

mdkinney commented Nov 4, 2024

The mirror is a short term fix to keep devs/CI working. Can discuss in Tools/CI for long term solution.

@mdkinney mdkinney added the push Auto push patch series in PR if all checks pass label Nov 4, 2024
@mergify mergify bot merged commit 95d8a1c into tianocore:master Nov 4, 2024
126 checks passed
@ajfish
Copy link
Member

ajfish commented Nov 4, 2024

These changes look good

fidencio added a commit to fidencio/kata-containers that referenced this pull request Nov 5, 2024
Let's just do a simple `sed` and **not** use the repo that became
private.

This is not a backport of tianocore/edk2#6402,
but it's a similar approach that allows us to proceed without the need
to pick up a newer version of edk2.

Signed-off-by: Fabiano Fidêncio <[email protected]>
fidencio added a commit to fidencio/kata-containers that referenced this pull request Nov 5, 2024
Let's just do a simple `sed` and **not** use the repo that became
private.

This is not a backport of tianocore/edk2#6402,
but it's a similar approach that allows us to proceed without the need
to pick up a newer version of edk2.

Signed-off-by: Fabiano Fidêncio <[email protected]>
mjoerg added a commit to mjoerg/nixpkgs that referenced this pull request Nov 5, 2024
Original submodule sources are no longer available, so the submodules are fetched manually,
with unavailable sources replaced by mirrors. (tianocore/edk2#6402)

fix NixOS#353769
mjoerg added a commit to mjoerg/nixpkgs that referenced this pull request Nov 6, 2024
Original submodule sources are no longer available, so the submodules are fetched manually,
with unavailable sources replaced by mirrors. (tianocore/edk2#6402)

fix NixOS#353769

submodules-202408.nix was generated using the following script.

    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p coreutils git jq nixfmt-rfc-style nix-prefetch-git

    set -eu -o pipefail

    version=202408
    git_remote=origin
    git_repo=https://github.com/tianocore/edk2
    git_rev=refs/tags/edk2-stable$version

    tmp=$(mktemp -d)
    trap 'rm -rf -- "$tmp"' EXIT

    git_dir=$tmp/git
    git init --bare "$git_dir"
    git -C "$git_dir" remote add "$git_remote" "$git_repo"
    git -C "$git_dir" fetch --depth 1 --filter=blob:none "$git_remote" "$git_rev:$git_rev"
    git -C "$git_dir" show "$git_rev:.gitmodules" > "$tmp/submodules"

    submodules="{}"

    for module in $(git config get -f "$tmp/submodules" --all \
                        --name-only --show-names --regexp '^submodule\.[^.]+\.path$'); do

        module=${module#submodule.}
        module=${module%.path}

        module_path=$(git config get -f "$tmp/submodules" "submodule.$module.path")
        module_url=$(git config get -f "$tmp/submodules" "submodule.$module.url")
        module_rev=$(git -C "$git_dir" ls-tree --object-only "$git_rev" "$module_path")

        # https://github.com/tianocore/edk2/pull/6402/files
        case $module_url in
            https://github.com/Zeex/subhook.git)
                module_url=https://github.com/tianocore/edk2-subhook.git;;
        esac

        module_repo=${module_url#https://github.com/}
        module_repo=${module_repo%.git}
        module_owner=${module_repo%/*}
        module_repo=${module_repo#*/}

        module_hash=$(nix-prefetch-git --fetch-submodules "$module_url" "$module_rev" | jq -r .hash)

        submodules=$(jq --argjson submodules "$submodules" \
                        --arg path "$module_path" \
                        --arg owner "$module_owner" \
                        --arg repo "$module_repo" \
                        --arg rev "$module_rev" \
                        --arg hash "$module_hash" \
                        -n '$submodules + {$path: {"owner": $owner, "repo": $repo, "rev": $rev, "hash": $hash}}')
    done

    echo "$submodules" > "$tmp/result.json"
    nix eval --impure --expr "builtins.fromJSON (builtins.readFile \"$tmp/result.json\")" | \
        nixfmt > submodules-$version.nix
mjoerg added a commit to mjoerg/nixpkgs that referenced this pull request Nov 6, 2024
Original submodule sources are no longer available, so the submodules are fetched manually,
with unavailable sources replaced by mirrors. (tianocore/edk2#6402)

fix NixOS#353769

submodules-202408.nix was generated using the following script.

    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p coreutils git jq nixfmt-rfc-style nix-prefetch-git

    set -eu -o pipefail

    version=202408
    git_remote=origin
    git_repo=https://github.com/tianocore/edk2
    git_rev=refs/tags/edk2-stable$version

    tmp=$(mktemp -d)
    trap 'rm -rf -- "$tmp"' EXIT

    git_dir=$tmp/git
    git init --bare "$git_dir"
    git -C "$git_dir" remote add "$git_remote" "$git_repo"
    git -C "$git_dir" fetch --depth 1 --filter=blob:none "$git_remote" "$git_rev:$git_rev"
    git -C "$git_dir" show "$git_rev:.gitmodules" > "$tmp/submodules"

    submodules="{}"

    for module in $(git config get -f "$tmp/submodules" --all \
                        --name-only --show-names --regexp '^submodule\.[^.]+\.path$'); do

        module=${module#submodule.}
        module=${module%.path}

        module_path=$(git config get -f "$tmp/submodules" "submodule.$module.path")
        module_url=$(git config get -f "$tmp/submodules" "submodule.$module.url")
        module_rev=$(git -C "$git_dir" ls-tree --object-only "$git_rev" "$module_path")

        # tianocore/edk2#6402
        case $module_url in
            https://github.com/Zeex/subhook.git)
                module_url=https://github.com/tianocore/edk2-subhook.git;;
        esac

        module_repo=${module_url#https://github.com/}
        module_repo=${module_repo%.git}
        module_owner=${module_repo%/*}
        module_repo=${module_repo#*/}

        module_hash=$(nix-prefetch-git --fetch-submodules "$module_url" "$module_rev" | jq -r .hash)

        submodules=$(jq --argjson submodules "$submodules" \
                        --arg path "$module_path" \
                        --arg owner "$module_owner" \
                        --arg repo "$module_repo" \
                        --arg rev "$module_rev" \
                        --arg hash "$module_hash" \
                        -n '$submodules + {$path: {"owner": $owner, "repo": $repo, "rev": $rev, "hash": $hash}}')
    done

    echo "$submodules" > "$tmp/result.json"
    nix eval --impure --expr "builtins.fromJSON (builtins.readFile \"$tmp/result.json\")" | \
        nixfmt > submodules-$version.nix
AjanZhong added a commit to AjanZhong/linuxboot-edk2 that referenced this pull request Dec 6, 2024
Porting from: tianocore#6402

Change subhook url from https://github.com/Zeex/subhook to
https://github.com/tianocore/edk2-subhook because old url is
no longer available.

Also align .gitmodules file to use consistent LF line endings.

Signed-off-by: Michael D Kinney <[email protected]>
Signed-off-by: Ajan Zhong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants