<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>11484</bug_id>
          
          <creation_ts>2017-05-09 04:06:24 +0000</creation_ts>
          <short_desc>devtool: upgrade: Being able to check for specified source revision is on the specified branch</short_desc>
          <delta_ts>2017-11-08 03:00:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>Scripts and Tools</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.4 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Rebecca Chang">rebecca.swee.fun.chang</reporter>
          <assigned_to name="Rebecca Chang">rebecca.swee.fun.chang</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>ee.peng.yeoh</cc>
    
    <cc>rebecca.swee.fun.chang</cc>
    
    <cc>ross.burton</cc>
          
          <qa_contact name="yeoh ee peng">ee.peng.yeoh</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>73137</commentid>
    <comment_count>0</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-05-09 04:06:24 +0000</bug_when>
    <thetext>Current issue with devtool is it isn&apos;t error out when there is no specified branch during devtool upgrade. devtool is checking out the specified source rev directly regardless of the source branch. This has caused bitbake build issue once we do &quot;devtool finish&quot; the package. Bitbake will not be able to fetch the src revision if the branch is not specified in the SRCURI.

devtool should be checking if the specified revision is on the specified branch (either the one specified in -B/--srcbranch, or the one in the SRC_URI entry, or master if none specified) and if it isn&apos;t, we should probably error out of the upgrade and tell the user they need to specify the branch.

To reproduce:
Use devtool upgrade --srcrev 5c1c0da352fe67377d88bf62be8cf55aaa84b8e1 ifupdown to upgrade ifupdown package to v0.8.19.

The source rev was not found on master branch but it was tagged on stretch branch.
devtool was able to build the package while bitbake build will failed.

WARNING: ifupdown-0.8.19-r0 do_fetch: Failed to fetch URL git://anonscm.debian.org/git/collab-maint/ifupdown.git, attempting MIRRORS if available
ERROR: ifupdown-0.8.19-r0 do_fetch: Fetcher failure: Unable to find revision 5c1c0da352fe67377d88bf62be8cf55aaa84b8e1 in branch master even from upstream
ERROR: ifupdown-0.8.19-r0 do_fetch: Fetcher failure for URL: &apos;git://anonscm.debian.org/git/collab-maint/ifupdown.git&apos;. Unable to fetch URL from any source.
ERROR: ifupdown-0.8.19-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /media/rebeccas/yocto/devtool-ifupdown/tmp/work/corei7-64-poky-linux/ifupdown/0.8.19-r0/temp/log.do_fetch.163732
ERROR: Task (/media/rebeccas/yocto/poky/meta/recipes-core/ifupdown/ifupdown_0.8.19.bb:do_fetch) failed with exit code &apos;1&apos;
NOTE: Tasks Summary: Attempted 820 tasks of which 819 didn&apos;t need to be rerun and 1 failed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75941</commentid>
    <comment_count>1</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-17 05:36:00 +0000</bug_when>
    <thetext>Submitted patch to mailing list
http://lists.openembedded.org/pipermail/openembedded-core/2017-August/140931.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76073</commentid>
    <comment_count>2</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-08-23 08:00:59 +0000</bug_when>
    <thetext>Patch accepted in upstream.
OE-Core rev: 29ced7387a92aed17b7fe93b1654790a981734c1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77259</commentid>
    <comment_count>3</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2017-10-02 04:26:29 +0000</bug_when>
    <thetext>Verify the fixes (reproduce the issue before verified the fixes)

1) Reproduce the issue successfully using origin/pyro
Prepare the environment: 
First revert to origin/pyro branch in order to get the code base before Rebecca fixes. Then, prepared a github repo for the testing, where the dev1 branch contain commit f26a5d9e53524edc72b9f476a628c35eb82e497b which does not existing in master. 

Steps:
a) Perform devtool add bbexample https://github.com/epyeoh/bbexample.git
b) Perform devtool finish bbexample &lt;local_layer_as_destination&gt;
c) Perform devtool upgrade --srcrev f26a5d9e53524edc72b9f476a628c35eb82e497b bbexample 
d) Perform bitbake bbexample and receive the error
WARNING: bbexample-0.1+gitAUTOINC+f26a5d9e53-r0 do_fetch: Failed to fetch URL git://github.com/epyeoh/bbexample.git;protocol=https, attempting MIRRORS if available
ERROR: bbexample-0.1+gitAUTOINC+f26a5d9e53-r0 do_fetch: Fetcher failure: Unable to find revision f26a5d9e53524edc72b9f476a628c35eb82e497b in branch master even from upstream
ERROR: bbexample-0.1+gitAUTOINC+f26a5d9e53-r0 do_fetch: Fetcher failure for URL: &apos;git://github.com/epyeoh/bbexample.git;protocol=https&apos;. Unable to fetch URL from any source.
ERROR: bbexample-0.1+gitAUTOINC+f26a5d9e53-r0 do_fetch: Function failed: base_do_fetch
ERROR: Logfile of failure stored in: /workdir/devtool_poky/poky/build/tmp/work/i586-poky-linux/bbexample/0.1+gitAUTOINC+f26a5d9e53-r0/temp/log.do_fetch.94803
ERROR: Task (/workdir/devtool_poky/poky/meta-yocto-bsp/recipes-bbexample/bbexample/bbexample_git.bb:do_fetch) failed with exit code &apos;1&apos;
NOTE: Tasks Summary: Attempted 468 tasks of which 467 didn&apos;t need to be rerun and 1 failed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77260</commentid>
    <comment_count>4</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2017-10-02 04:33:58 +0000</bug_when>
    <thetext>Verify the fixes

2) Verify the fixes from origin/master can upgrade recipe with srcrev exist only in dev1 branch.

a) Checkout to origin/master branch to get the fixes from Rebecca
b) Perform devtool upgrade --srcrev f26a5d9e53524edc72b9f476a628c35eb82e497b bbexample 
c) Verify that the SRC_URI generated contain the branch information
SRC_URI = &quot;git://github.com/epyeoh/bbexample.git;protocol=https;branch=dev&quot;
d) Verify that bitbake bbexample can build successfully
Initialising tasks: 100% |###################################################################################################| Time: 0:00:00
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn&apos;t need to be rerun and all succeeded.
pokyuser@6b6751c55719:/workdir/devtool_poky/poky/build$ bitbake bbexample
Loading cache: 100% |########################################################################################################| Time: 0:00:00
Loaded 1301 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.34.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;universal&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.3.2&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta
meta-poky
meta-yocto-bsp    = &quot;pyro:717303e6fbcbbe181ad9645d762eb5a85d934523&quot;

Initialising tasks: 100% |###################################################################################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 481 tasks of which 480 didn&apos;t need to be rerun and all succeeded.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77261</commentid>
    <comment_count>5</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2017-10-02 04:38:33 +0000</bug_when>
    <thetext>Verify the fixes

2) Verify the fixes from origin/master can prompt user when try to upgrade recipe with srcrev exists on multiple branches (eg. dev2 &amp; dev3) and srcrev deoes not exist in master branch.

a) Verify that dev2 &amp; dev3 branch from https://github.com/epyeoh/bbexample.git
contain commit a1e995ea27eb2e800cee1fc7b37672116aee2305bbexample that does not exist in master.
b) Checkout to origin/master branch to get the fixes from Rebecca
c) Perform devtool upgrade --srcrev a1e995ea27eb2e800cee1fc7b37672116aee2305 bbexample 
d) Verify that devtool will prompt error message
Initialising tasks: 100% |#################################################################################################| Time: 0:00:00
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 3 tasks of which 0 didn&apos;t need to be rerun and all succeeded.
ERROR: Revision a1e995ea27eb2e800cee1fc7b37672116aee2305 was found on multiple branches:
  dev2
  dev3
Please provide the correct branch in the devtool command with &quot;--srcbranch&quot; or &quot;-B&quot; option.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77262</commentid>
    <comment_count>6</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2017-10-02 04:57:07 +0000</bug_when>
    <thetext>Verify the fixes

2) Verify the fixes from origin/master can upgrade recipe when provide the srcrev and srcbranch argument.

a) Checkout to origin/master branch to get the fixes from Rebecca
b) Perform devtool upgrade --srcrev a1e995ea27eb2e800cee1fc7b37672116aee2305 --srcbranch dev2 bbexample
c) Verify that the SRC_URI generated contain the branch information &amp; srcrev is correct

SRC_URI = &quot;git://github.com/epyeoh/bbexample.git;protocol=https;branch=dev2&quot;

# Modify these as desired
PV = &quot;0.1+git${SRCPV}&quot;
SRCREV = &quot;a1e995ea27eb2e800cee1fc7b37672116aee2305&quot;

d) Verify bitbake bbexample can build successfully
pokyuser@6b6751c55719:/workdir/devtool_poky/poky/build$ bitbake bbexample
Loading cache: 100% |########################################################################################################| Time: 0:00:00
Loaded 1301 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################| Time: 0:00:00
Parsing of 832 .bb files complete (831 cached, 1 parsed). 1301 targets, 48 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = &quot;1.34.0&quot;
BUILD_SYS         = &quot;x86_64-linux&quot;
NATIVELSBSTRING   = &quot;universal&quot;
TARGET_SYS        = &quot;i586-poky-linux&quot;
MACHINE           = &quot;qemux86&quot;
DISTRO            = &quot;poky&quot;
DISTRO_VERSION    = &quot;2.3.2&quot;
TUNE_FEATURES     = &quot;m32 i586&quot;
TARGET_FPU        = &quot;&quot;
meta
meta-poky
meta-yocto-bsp    = &quot;pyro:717303e6fbcbbe181ad9645d762eb5a85d934523&quot;

Initialising tasks: 100% |###################################################################################################| Time: 0:00:00
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 481 tasks of which 480 didn&apos;t need to be rerun and all succeeded.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78045</commentid>
    <comment_count>7</comment_count>
    <who name="yeoh ee peng">ee.peng.yeoh</who>
    <bug_when>2017-11-08 03:00:37 +0000</bug_when>
    <thetext>Verified that the fixes had resolved the issue. Please refer to above verification log.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>