Bug 11389 - devtool: add: automatically set branch for git URLs if not master
Summary: devtool: add: automatically set branch for git URLs if not master
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 2.4 M3
Assignee: Rebecca Chang
QA Contact: Shashwat Pandey
URL:
Whiteboard:
Depends on:
Blocks: 11393
  Show dependency tree
 
Reported: 2017-04-20 02:58 UTC by Paul Eggleton
Modified: 2017-10-09 03:05 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2017-04-20 02:58:10 UTC
If devtool add is run on a git URL and a revision is specified that is not on master, and branch= isn't already in the URL, then get the correct branch and add it to the URL. If the revision isn't on a branch, and it's not already there, add nobranch=1 to the URL.
Comment 1 Rebecca Chang 2017-05-25 09:37:36 UTC
Paul, certain repository has same source revision on multiple branches. How do we handle this kind of situation? It is not possible for devtool to get the correct branch in this situation. So, do we print out the branch that having the source revision and error out?
Comment 2 Paul Eggleton 2017-05-25 20:23:57 UTC
That's a good point. If the revision is on multiple branches, and we've already checked that one of them isn't master, then yes I don't think we have much choice but to error out telling the user they need to select one.
Comment 3 Rebecca Chang 2017-07-13 04:49:53 UTC
Submitted fix to mailing list.
http://lists.openembedded.org/pipermail/openembedded-core/2017-July/139574.html
Comment 4 Rebecca Chang 2017-08-01 02:29:36 UTC
Patches are now staging at mut branch. Moving this to M3 as it has already overdue for M2.
Comment 5 Rebecca Chang 2017-08-17 05:36:49 UTC
v2 patch series fixed comment from Chris:
http://lists.openembedded.org/pipermail/openembedded-core/2017-August/140860.html
Comment 6 Rebecca Chang 2017-08-23 08:02:07 UTC
OE-Core rev: ecca596b75cfda2f798a0bdde75f4f774e23a95b
Comment 7 Shashwat Pandey 2017-10-09 03:05:30 UTC
Verification logs:

a) 	Checkout to origin/master branch to get the fixes.

b) 	Scenario1: When Revision is not on master-
	Perform devtool add bbexample-custom 'https://github.com/epyeoh/bbexample.git;rev=f26a5d9e53524edc72b9f476a628c35eb82e497b'

c) 	Verify that the correct branch is added to the SRC_URI:

	SRC_URI = "git://github.com/epyeoh/bbexample.git;protocol=https;branch=dev1"

d) 	Scenario2: If the revision is on multiple branches, and none of them is master:
	Perform devtool add bbexample 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305'

e) 	Verify the error for multiple branch of same revision:

		ERROR: Revision a1e995ea27eb2e800cee1fc7b37672116aee2305 was found on multiple branches:
		dev2
		dev3
		Please provide the correct branch with -B/--srcbranch
		ERROR: Command 'script -e -q -c "recipetool --color=always create --devtool -o /tmp/devtoolvnmzcrd_ 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305'  -x /workdir/build/workspace/sources/devtoolsrcqsb05ogk -N bbexample" /dev/null' failed

f) 	Scenario3: If the revision is on multiple branch and branch is specified:
	Perform  devtool add bbexample 'https://github.com/epyeoh/bbexample.git;rev=a1e995ea27eb2e800cee1fc7b37672116aee2305;branch=dev3'

g) 	Verify that the correct branch is added to the SRC_URI:

	SRC_URI = "git://github.com/epyeoh/bbexample.git;branch=dev3;protocol=https"

h) 	Scenario4: If the revision is on multiple branch and one of them is master:
	Perform devtool add bbexample 'https://github.com/shashwatpandey221091/bbexample.git;rev=60cca6f8fe6b74a9fa2f670fcb885be2d3f9bcb9'

i) 	Verify that devtool should create the recipe without error and expected SRC_URI is : SRC_URI = “https://github.com/repo.git” without “branch=“:

	SRC_URI = "git://github.com/shashwatpandey221091/bbexample.git;protocol=https"