On 4/28/23 11:36, David Marchand wrote:
> Hello,
> 
> On Thu, Apr 27, 2023 at 2:45 PM Ilya Maximets <[email protected]> wrote:
>>> diff --git a/.ci/dpdk-build.sh b/.ci/dpdk-build.sh
>>> new file mode 100755
>>> index 0000000000..64dec87247
>>> --- /dev/null
>>> +++ b/.ci/dpdk-build.sh
>>> @@ -0,0 +1,65 @@
>>> +#!/bin/bash
>>> +
>>> +set -o errexit
>>> +set -x
>>> +
>>> +function build_dpdk()
>>> +{
>>> +    local VERSION_FILE="dpdk-dir/cached-version"
>>> +    local DPDK_VER=$1
>>> +    local DPDK_OPTS=""
>>> +
>>> +    if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
>>> +        # Avoid using cache for git tree build.
>>
>> Do we need this branch since you added a comit hash to the cache signature?
> 
> Getting the sources to build still depends on DPDK_VER.
> We need to distinguish the tarball case from a git "object" string.


Yeah, cloning below is still necessary.  I guess, the comment above
should be changed, it misled me a little here.  We're going to use
cache for git tree builds, and this script is not going to be executed
if we have a cache hit.

> 
>>
>>> +        rm -rf dpdk-dir
>>> +
>>> +        DPDK_GIT=${DPDK_GIT:-https://dpdk.org/git/dpdk}
>>> +        git clone --single-branch $DPDK_GIT dpdk-dir -b 
>>> "${DPDK_VER##refs/*/}"
>>> +        pushd dpdk-dir
>>> +        git log -1 --oneline
>>> +    else
>>> +        if [ -f "${VERSION_FILE}" ]; then
>>> +            VER=$(cat ${VERSION_FILE})
>>> +            if [ "${VER}" = "${DPDK_VER}" ]; then
>>> +                echo "Found already built DPDK ${VER} build in 
>>> $(pwd)/dpdk-dir"
>>
>> Version file ligic is probably redundant as well, since the script will
>> not be executed on a cache hit.
> 
> Yep.
> 
> [snip]
> 
>>> +    name: dpdk gcc
>>> +    runs-on: ubuntu-20.04
>>> +    timeout-minutes: 30
>>> +
>>> +    steps:
>>> +    - name: checkout
>>> +      uses: actions/checkout@v3
>>> +
>>> +    - name: update PATH
>>> +      run:  |
>>> +        echo "$HOME/bin"        >> $GITHUB_PATH
>>> +        echo "$HOME/.local/bin" >> $GITHUB_PATH
>>> +
>>> +    - name: create ci signature file for the dpdk cache key
>>> +      # This will collect most of DPDK related lines, so hash will be 
>>> different
>>> +      # if something changed in a way we're building DPDK including 
>>> DPDK_VER.
>>> +      # This also allows us to use cache from any branch as long as version
>>> +      # and a way we're building DPDK stays the same.
>>> +      run:  |
>>> +        grep -irE 'RTE_|DPDK|meson|ninja' .ci/dpdk-* > dpdk-ci-signature
>>> +        grep -rwE 'DPDK_GIT|DPDK_VER' .github/ >> dpdk-ci-signature
>>> +        if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
>>> +            git ls-remote --heads $DPDK_GIT $DPDK_VER >> dpdk-ci-signature
>>> +        fi
>>> +        cat dpdk-ci-signature
>>
>> Should we move this into a separate small script file?
>> It's duplicated in two places now and bacame a bit more complex.
> 
> Good idea.
> 
> 

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to