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

patchqueue symlink name incorrect in README.md #8

Open
srcshelton opened this issue Oct 29, 2024 · 4 comments
Open

patchqueue symlink name incorrect in README.md #8

srcshelton opened this issue Oct 29, 2024 · 4 comments
Assignees

Comments

@srcshelton
Copy link

guilt-0.36 seems to require a directory named patchequeue-$(date date '+%Y-%m-%d') - if only patchqueue exists then a dated directory is instead created and no patches are found.

@pietrushnic
Copy link
Contributor

Where can I read about that? I'm noob user of guilt.

I'm using 0.36-3 from Debian, which seems to work fine when using patchqueue. patchqueue is a link to the directory patches directory, which is a git a dasharo-pq repository, so I'm not sure how dated stuff could be used if nothing is changed in git repo.

There is no complaint from guilt, but maybe I'm misusing it, so a reference to correct usage would be appreciated.

Creating symbolic links when one exists is a problem. It will lead to a broken directory tree patches -> patches, but the expectation would be that one copies coreboot from scratch or, if dealing with a tree that already has .git/patches, then operates on the dasharo-pq repo instead of using different links.

OTOH, I see that Guilt names the branch after the directory, so if directory content changes without removing and reapplying patches, we can end up with old patches applied to the tree. If you know where I can read about best practices for managing patch queues using Guild, I would appreciate that. Right now, I recreate the build tree whenever I need it.

@pietrushnic pietrushnic self-assigned this Oct 29, 2024
@srcshelton
Copy link
Author

To be honest, I'd never heard of guilt until I tried to build this repo!

Following the README.md instructions, I got to running guilt init which silently created coreboot/.git/patches/patchqueue-2024-10-29 with empty files series and status inside, and then guilt push -a fails as it says (looking in this directory) that there is nothing to apply.

When I changed the symlink name from patchequeue to patchqueue-2024-10-29, everything worked.

@pietrushnic
Copy link
Contributor

Following the README.md instructions, I got to running guilt init which silently created coreboot/.git/patches/patchqueue-2024-10-29 with empty files series and status inside, and then guilt push -a fails as it says (looking in this directory) that there is nothing to apply.

If the step cloning dasharo-pq was executed, the coreboot/.git/patches should already exist, and the patchqueue link should be created manually. Then guilt init does nothing like creating another directory with the date. I wonder about the difference between our environments. Could you let me know if you follow the exact steps?

Since I cannot reproduce the issue based on your order of operations, it is difficult to fix or change the README. However, I can link to this issue to indicate that such a situation may happen in some configurations. Of course, the best would be to realize the difference between our systems.

@srcshelton
Copy link
Author

I ran a (very!) rough script to get to this situation, so hopefully this also works as a reproducer...

(Also, if I've completely misunderstood then please let me know! I also always seem to get arguments to the ln command the wrong way around, so added a check for that 😩)

#! /usr/bin/env bash

set -eu
set -o pipefail

VER='v24.05.00.01'
CB_VER="$(echo "${VER#v}" | cut -d'.' -f 1-2 )"

if ! command -v guilt >/dev/null 2>&1; then
        echo >&2 "FATAL: 'guilt' missing... :o"
        exit 1
fi

cd "$( dirname "$( readlink -e "${0}" )" )" || exit 1

set -o xtrace

[[ -d coreboot ]] || git clone https://review.coreboot.org/coreboot
[[ -d pce-fw-builder ]] || git clone https://github.com/pcengines/pce-fw-builder.git

# Latest is currently 24.08 - unclear whether Dasharo supports this?
git -C coreboot fetch --all
git -C coreboot checkout "tags/${CB_VER}" -b patchqueue || :

git -C coreboot clone https://github.com/Dasharo/dasharo-pq.git .git/patches || :

# Latest is currently v24.05.00.01
git -C coreboot/.git/patches checkout "tags/${VER#v}"

# > "Point the `patchqueue` Branch at the Patches Inside `.git/patches`:"
#
# It's not entirely clear to me from the Dasharo instructions above as to what
# operation on which branch and/or directory we're actually intending to carry
# out?
#
[[ -e coreboot/.git/patches/patchqueue ]] ||
        ln -s patches coreboot/.git/patches/patchqueue
if [[ -e coreboot/.git/patches/patches/patches ]]; then
        echo >&2 "ERROR: Bad 'ln' - 'coreboot/.git/patches/patches/patches' has been created"
        exit 1
fi

[[ -e "coreboot/.git/patches/patchqueue-$(date +'%Y-%m-%d')" ]] ||
        ln -s patches "coreboot/.git/patches/patchqueue-$(date +'%Y-%m-%d')"
if [[ -e coreboot/.git/patches/patches/patches ]]; then
        echo >&2 "ERROR: Bad 'ln' - 'coreboot/.git/patches/patches/patches' has been created"
        exit 1
fi

touch coreboot/.git/patches/patchqueue/status

pushd coreboot >/dev/null || exit 1

# Requires dev-vcs/guilt...
#
# In case of issues see https://github.com/Dasharo/dasharo-pq:
#
#   'guilt pop' until the breakage is at the top of the stack;
#   Update as necessary;
#   'guilt refresh';
#   'guilt push -a'
#
# ... alternatively, 'guilt push -f' will force patching, at which point '.rej'
# files can be manually merged.
#
guilt init || :
guilt push -a
guilt applied

echo "Annotating vesion $(git describe) as '${VER}'"
git tag | grep -qF -- "${VER}" ||
        git tag -a "${VER}" -m "Dasharo ${VER}"

popd >/dev/null

if ! [[ -d pce-fw-builder ]]; then
        echo "FATAL: Directory '${PWD}' doesn't contain a check-out of" \
                "'pce-fw-builder'"
        exit 1
fi

git -C pce-fw-builder fetch --all
#git -C pce-fw-builder checkout 2.0.1
git -C pce-fw-builder checkout master

pushd pce-fw-builder >/dev/null || exit 1

docker() {
        local -a args=() env=()
        local arg=''
        local action=''
        local TMPDIR=''

        TMPDIR="$( sed 's/#.*$//' /etc/containers/containers.conf |
                grep image_copy_tmp_dir |
                cut -d'"' -f 2
        )"

        for arg in "${@:-}"; do
                case "${arg:-}" in
                        run)
                                action='run'
                                env+=( --env TERM="${TERM:-}" )
                                ;;
                        build)
                                action='build'
                                env+=( --build-arg TERM="${TERM:-}" )
                                ;;
                        *)
                                args+=( "${arg}" )
                                ;;
                esac
        done
        args=( ${action:-} ${env[@]:-} ${args[@]:-} )

        sudo TMPDIR="${TMPDIR:-"/var/tmp"}" podman "${args[@]}"
}
export -f docker

docker build . -t "pcengines/pce-fw-builder:${VER}"
#docker build . -t "pcengines/pce-fw-builder:mainline" -f Dockerfile.ml  # Missing

export SDK_VER="${VER}"
if [[ -e build_apus.sh ]] && [[ "${1:-}" != 'efi' ]] ; then
        ./build.sh dev-build "$( readlink -e ../coreboot )" apu2 distclean &&
        ./build_apus.sh "$( readlink -e ../coreboot )" apu2
else
        ./build.sh dev-build "$( readlink -e ../coreboot )" apu2 distclean &&
        cp ../coreboot/configs/config.pcengines_seabios_apu2 ../coreboot/.config &&
        ./build.sh dev-build "$( readlink -e ../coreboot )" apu2 olddefconfig &&
        ./build.sh dev-build "$( readlink -e ../coreboot )" apu2 menuconfig &&
        ./build.sh dev-build "$( readlink -e ../coreboot )" apu2 CPUS=$(nproc)
fi

# vi: set colorcolumn=80:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants