Bug 14337

Summary: [SOLVED]do_fetch at the repository whose default branch is "main" fails
Product: [Build System, Metadata & Runtime] BitBake Reporter: kouheiaoki
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED OBSOLETE QA Contact:
Severity: normal    
Priority: Undecided CC: akuster808, kouheiaoki, poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
do_fetch error log none

Description kouheiaoki 2021-04-05 06:41:50 UTC
Created attachment 4783 [details]
do_fetch error log

# Reproduced version

Yocto 2.4.2

# How to reproduce

1. Add meta-sca layer according to this(https://github.com/priv-kweihmann/meta-sca).
https://github.com/priv-kweihmann/meta-sca
2. checkout the tag `vrocko_1.21.0)` on meta-sca.
3. Execute `. oe-init-build-env` at poky directory.
4/. Execute `bitbake cppcheck-native`.
->do_fetch error occurred like below.

```
WARNING: cppcheck-native-1.90-r0 do_fetch: Failed to fetch URL git://github.com/danmar/cppcheck.git;protocol=https;tag=1.90, attempting MIRRORS if available
ERROR: cppcheck-native-1.90-r0 do_fetch: Fetcher failure: Unable to find revision 077e652de43ad962be0454d7be347816f7482739 in branch master even from upstream
ERROR: cppcheck-native-1.90-r0 do_fetch: Fetcher failure for URL: 'git://github.com/danmar/cppcheck.git;protocol=https;tag=1.90'. Unable to fetch URL from any source.
ERROR: cppcheck-native-1.90-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/temp/log.do_fetch.337
ERROR: Task (/work/poky/meta-sca/recipes-sca/cppcheck-native/cppcheck-native_1.90.bb:do_fetch) failed with exit code '1'
```

# Error log

See attached log file.

It seems `git branch --contains`` command was executed on only `master` branch.
Line 24 is quoted below.
```
DEBUG: Running export PSEUDO_DISABLED=1; export PATH="/work/poky/scripts/native-intercept:/work/poky/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/work/poky/scripts:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin/x86_64-linux:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/sbin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/sbin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/bin:/work/poky/bitbake/bin:/work/poky/build/tmp/hosttools"; export HOME="/home/panasonic"; git -c core.fsyncobjectfiles=0 branch --contains 077e652de43ad962be0454d7be347816f7482739 --list master 2> /dev/null | wc -l
```

and line 34 is quoted below.
```
DEBUG: Running export PSEUDO_DISABLED=1; export PATH="/work/poky/scripts/native-intercept:/work/poky/build/tmp/sysroots-uninative/x86_64-linux/usr/bin:/work/poky/scripts:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin/x86_64-linux:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/sbin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/usr/bin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/sbin:/work/poky/build/tmp/work/x86_64-linux/cppcheck-native/1.90-r0/recipe-sysroot-native/bin:/work/poky/bitbake/bin:/work/poky/build/tmp/hosttools"; export HOME="/home/panasonic"; git -c core.fsyncobjectfiles=0 branch --contains 077e652de43ad962be0454d7be347816f7482739 --list master 2> /dev/null | wc -l
```

# Expected behavior

do_fetch succeeds whether the repository's default branch is `main` or `master`.
Comment 1 kouheiaoki 2021-04-06 19:35:36 UTC
I overlooked the document below.
https://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#migration-1.6-matching-branch-requirement-for-git-fetching

According to this, use `branch=main` or `nobranch=1` worked,
so this was solved.
Comment 2 akuster 2021-04-08 14:25:03 UTC
The README.md has the infomatin required to log an issue with the owner of that layer.

https://github.com/priv-kweihmann/meta-sca#readme

Get involved

To get involved following things can be done

    create an issue
    fix an issue and create a pull request
    see the pinned issues in the bugtracker
I suggest following their steps. This layer is not supported by the Yocto Project.
Comment 3 Randy MacLeod 2021-04-08 14:37:06 UTC
meta-sca isn't covered in the YP bugzilla.
Comment 4 kouheiaoki 2021-04-16 11:19:49 UTC
I think this is the problem about not only meta-sca.
My way to describe how to reproduce is bad, so I misled you, sorry.

I've known Yocto doesn't cover meta-sca.
Comment 5 Randy MacLeod 2021-04-16 23:51:25 UTC
Oops sorry about that, we're sometime rushed when reviewing bugs in the bugboard meeting. I've re-opened the bug and we'll take a look.

If you want to help out, we'd love to see a patch sent to bitbake or oe-core.
  https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded
If not, that's cool and I expect this bug will get fixed in a month or so, hopefully sooner.
Comment 6 Richard Purdie 2021-04-18 10:45:50 UTC
It sounds like an upstream project has renamed their branch. The url in question is:

git://github.com/danmar/cppcheck.git;protocol=https;tag=1.90

The fetcher is documented to default to "master" as was the standard for git at the time and has now knowledge of "main". For officially supported layers, we have mirrors available and we have preserved "master" branch copies in our mirrors so these older builds work. For layers where no mirroring has been setup by the maintainer, there isn't much we can do.

I'd also note that rocko/2.4 is an older release outside our support window at this point.

You can probably fix things by adding ";branch=main" to the SRC_URI for the recipe in question, there isn't much we can do about it at the project core at this point.
Comment 7 Richard Purdie 2021-04-18 10:50:25 UTC
Marking as resolved/obsolete as the submitter has a solution and there is little we can do for old releases like rocko.