summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/git.py
AgeCommit message (Collapse)Author
2017-11-07Replace deprecated git branch parameter "--set-upstream"Andre Rosa
Since 2017-08-17 (git version 2.14.1.473.g3ec7d702a) using deprecated git branch parameter "--set-upstream" causes a fetcher error. Replace it by "--set-upstream-to". https://git.kernel.org/pub/scm/git/git.git/commit/?id=52668846ea2d41ffbd87cda7cb8e492dea9f2c4d says, it's deprecated since 2012-08-30 so hopefully all still supported host distributions have new enough git to support "--set-upstream-to". ERROR: PACKAGE do_unpack: Fetcher failure: ...; git -c core.fsyncobjectfiles=0 branch --set-upstream master origin/master failed with exit code 128, output: fatal: the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead. ERROR: PACKAGE do_unpack: Function failed: base_do_unpack Signed-off-by: Andre Rosa <andre.rosa@lge.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2ab50074c1a6c56a8a178755de108447d7b7acaf) Signed-off-by: Javier Viguera <javier.viguera@digi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-05fetch2/git.py: remove .indirectiondir workaroundRobert Yang
It was used for workaround git 1.7.9.2 which was released in 2012 which should not be existed on nowadays host, so remove it to avoid confusions. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-15Revert "fetch/git: Change to use clearer ssh url syntax for broken servers"Richard Purdie
This reverts commit 4193e99adce8e88f12ac88d7578ad39575f7e346. It seems the underlying issue was caused by ":" in the url which isn't supported. The patch was therefore incorrect.
2016-01-11fetch2/git.py: Add missing "errno" module import.Kristian Amlie
This goes undetected most of the time, but when updating a repository, if the ud.fullmirror file is not present, you end up getting an exception instead of carrying on because the errno module is not loaded (specifically "if exc.errno != errno.ENOENT"). Signed-off-by: Kristian Amlie <kristian.amlie@mender.io> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-07fetch/git: Change to use clearer ssh url syntax for broken serversRichard Purdie
Some servers, e.g. bitbucket.org can't cope with ssh:// as part of the git url syntax. git itself is happy enough with this but you get server side errors when using it. This changes the git fetcher to use the more common ssh url format which also means we need a : before the path. Seems a shame to have to do this due to broken servers however it should be safe enough since this other form is the one most people use on the commandline so it should be safe enough. [YOCTO #8864] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-08bitbake: rename REGEX, REGEX_URI, and GITTAGREGEX.Alexander Kanavin
Rename REGEX to UPSTREAM_CHECK_REGEX, REGEX_URI to UPSTREAM_CHECK_URI, and GITTAGREGEX to UPSTREAM_CHECK_GITTAGREGEX to better reflect their purpose and to reflect a common namespace. Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-19bitbake: bb.fetch2.git: Import errno moduleRomain Perier
Currently this module is dereferencing errno.ENOENT but the python module "errno" is not imported, which causes a crash when fetching from a git repository. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18bb.fetch2.{git, hg}: remove tarball if it needs updatingChristopher Larson
We were maintaining state in the form of ud.repochanged to determine whether we need to write the tarball in the case where the tarball already exists, but this state is maintained only in memory. If we need to update the git repo, set ud.repochanged to True, and then are interrupted or killed, the tarball will then be out of date. Rather than maintaining this state, simply remove the out of date tarball when we update the git repo, and it will be re-created with updated content in build_mirror_data. [YOCTO #6366] Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03bb.fetch.git: remove leading '.' from gitsrcnameChristopher Larson
When using an absolute file URI, there's no host, and the path starts with '/', the dir under ${DL_DIR}/git2/ ends up starting with '.', so is hidden. Remove any leading '.' to fix this. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22fetch2/git.py: latest_versionstring now returns (version, revision)Aníbal Limón
We need to know the revision associated with the upstream version in SCM like git, this change broke return convention, oe-core recipeutils get_recipe_upstream_version need to be updated. tests/fetch.py: Updated git latest_versionstring test for comply new convention. [YOCTO #7605] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22fetch2/git.py: latest_versionstring search in all tagsAníbal Limón
Don't limit the tag search for only tags end with ^{}. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-12git.py: create a branch when checkoutRobert Yang
* Create a branch and named as upstream branch when checkout source * Set the branch to track remote branch. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-09fetch2: Add fetch parameter to checkstatusAníbal Limón
In order to pass connection cache object to checkstatus function add fetch parameter. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-23fetch2/git.py: Add gitpkgv_revision alternative version informationMike Looijmans
gitpkgv_revision returns a sortable revision number that can be used in the PKGV variable for example. To mimic meta-openembedded gitpkgv behaviour to provide a sortable revision numner, one could set the following: PKGV = "1.0+${@bb.fetch2.get_srcrev(d, 'gitpkgv_revision')}" This would yield a package version like "1.0+69+fb5eb80". Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-19fetch/git: Fix uri in git checkstatusMarcin Smoczyński
Pass proper repository url without arguments after a semicolon. Executing checkuri on a rule with git repository in SRC_URI does not report errors when working offline because wrong repository url is passed to the ls-remote command. For example "bitbake -c checkuri glibc" command executes: "git -c core.fsyncobjectfiles=0 ls-remote git://sourceware.org/git/glibc.git;branch=release/2.21/master" command in a shell subprocess to determine if url is valid. Shell subprocess executes in fact 2 commands: "git -c core.fsyncobjectfiles=0 ls-remote git://sourceware.org/git/glibc.git" and "branch=release/2.21/master" First one returns 127 or 128 depending on error but second one returns 0 because it is just env variable setup. Therefore we're not catching connection error. [YOCTO #7558] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-14bitbake: fetch2/git: Add URL when latest_revision generates an exception.Mariano Lopez
The URL is not sent when _latest_revision generates and exception. When performing the sanity checks it is not possible to know the URI that failed. This add the URL when latest_revision generates an exception. [YOCTO: #7592] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-14fetch2/git: ensure the unpacked origin remote points upstreamPaul Eggleton
If you're interested in using the checked out repository for development (e.g. in OE with devtool) then you ideally want the origin remote to point to the repository it was fetched from, so just set that after cloning. (As part of this I did a minor refactor so we have one function to generate the repository URL, which was already in two places.) Fixes [YOCTO #7756]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-17fetch/git: Remove a possible trailing '/' in subpathAnders Darander
If the subpath parameter to the git fetcher ends with a trailing '/', bb.utils.prunedir() will be called on '/'... Fixes [YOCTO #7620]. Signed-off-by: Anders Darander <anders@chargestorm.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-08fetch/git: Improve ls-remote handling for latest_revisionRichard Purdie
Currently the code ignores lightweight tags which has caused some user complaints. We can't put the right search list in place easily since the results don't come back in a good order, head happens to sort before tags. In the end I refactored the function so we get the complete list of remotes and then we can filter it ourselves in the order we chose, including checking for light weight tags, preferring the proper ones. Hopefully this resolves the issues people have been seeing. [YOCTO #6881] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-11-08fetch/git: Add latest_versionstring methodAníbal Limón
Being able to generate a version string representing the most recent git commit given git is useful, not least for the package reporting system. This adds in a latest_versionstring method to the git fetcher which allows users to query the latest version using ls-remote and filtering the responses. The patch also adds unittests for this function so that if improvements are made, the original test urls can be used to evaulate the those changes. This is based on code from Irina Patru <irina.patru@intel.com>. Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-11-04fetch2/git: Allow other namespaces than refs/heads to be searched.Fredrik Svensson
This makes it possble to fetch Gerrit review references which are normally stored under refs/changes. Please disregard previous patch with the same topic. Signed-off-by: Fredrik Svensson <fredrik.svensson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-27fetch2/git: Stop git from triggering fsync() callsRichard Purdie
We only ever clone other repositories, if there were a problem such as power failure, we'd blow away data and rebuild. As such we don't need fsync(). With filesystems like ext*, the fsync pushes nearly all the data out to disk which impacts all running processes. We therefore set a configuration parameter to disable the fsync() calls. Also fixup a case where basecmd wasn't being used for no good reason. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-02fetch/git: Separate out an ls-remote functionRichard Purdie
There is other code which can want to run ls-remote style commands with different parameters so split out the function. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-20fetch2/git: Dereference unresolved tags with ls-remoteRichard Purdie
We need to deference tags when trying to map them to commit IDs with ls-remote. If we don't do this, a given commit might not show up later in a specific branch. There appears to be no good reason not to do this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-20fetch2/git: Anchor names when using ls-remoteRichard Purdie
When specifying tags, they're searched for unanchored so foo/bar could match: refs/heads/abc/foo/bar refs/heads/xyz/foo/bar refs/heads/foo/bar This change anchors the expressions so they are based against heads or tags (or any other base level tree that has been created). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-08bitbake: fetch2/git: add description for nobranchZhenhua Luo
Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-07bitbake: fetch2/git: add nobranch option for SRC_URI to skip SHA validating ↵Zhenhua Luo
for branch For rebased git tree, some commits doesn't exist in any branch, and such commits are valid in tag, the change is useful for such case. Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-02bitbake: fetcher2: git.py: clean(): remove the .tar.gz.doneRobert Yang
There was a problem: $ bitbake xf86-video-omapfb -cfetch && bitbake xf86-video-omapfb -ccleanall The git2_git.pingu.fi.xf86-video-omapfb.tar.gz has been removed from the DL_DIR, but the git2_git.pingu.fi.xf86-video-omapfb.tar.gz.done still exists, this is because the "open(ud.donestamp, 'w').close()" in try_mirror_url() will create the git2_git.xxx.tar.gz.done, but no one removes it (the clean() in fetch2/__init__.py removes the DL_DIR/git2/pkg.done) This only happens on the git fetcher AFAIK. [YOCTO #5688] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-18bb.fetch2.git: reuse basecmd attributeOlof Johansson
The basecmd is initialized in urldata_init; there's no need redoing that work. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-18fetch2/git: Improve handling of unresolved names verses branchesRichard Purdie
Currently the fetcher doesn't distinguish between names that the fetcher needs to resolve verses branch names that the user specified. This meant that if you specify a tag and a branch, the fetcher broke. This separates the two so that the branch name is preserved and can be used in appropriate places. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-06fetch2/git: Ensure check is made in the correct directoryRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-05fetch2/git: Add sanity check to ensure we really did fetch the correct revisionsRichard Purdie
The fetcher made the rather bold assumption that if it fetched from the upstream, the revisions were present and correct. These checks are fast and ensure that really is the case. The avoids accidental network accessed and missing branch configuration problems. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-25bitbake: fetch2: Remove the unused urldata from the git fetcher.Florin Sarbu
Signed-off-by: Florin Sarbu <florin.sarbu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-21fetch2: Stop passing around the pointless url parameterRichard Purdie
There is no good reason to keep passing around the url parameter when its contained within urldata (ud). This is left around due to legacy reasons, some functions take it, some don't and its time to cleanup. This is fetcher internal API, there are a tiny number of external users of the internal API (buildhistory and distrodata) which can be fixed up after this change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-19git: Use git branch for ancestor checksRichard Purdie
Using git merge-base for checking for ancestors is nice but required git 1.8.0 which is not in many distrbutions yet. We therefore revert to a more ugly check using git branch --contains until such times as we can upgrade. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18git: Use merge-base instead of log for testing if a commit is presentRichard Purdie
The current use of git log to check if a given revision is present can be a little fragile. For example if revision X was on branch A, and then later added to branch B, the update checks would not notice this since they just check for X being in the repository. We also had some autobuilder corruption where an older packed-refs file was copied over a new repository containing newer pack files. There was no update to the refs file since the revision was present but not accessible in any branch. The correct fix is to check that the required revisions are present on the specific branches. This patch does this using merge-base. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09git: remove symling before updating mirror tarballMartin Jansa
* with read-only PREMIRROR (e.g. mounted over NFS or CIFS and referenced as file:///mnt/premirror) we cannot use BB_GENERATE_MIRROR_TARBALLS because all git2_abc.git.tar.gz files later became just symlinks to read-only location in PREMIRROR (it works fine on first build and for new components, because at that time there isn't tarball on PREMIRROR yet). ERROR: Fetcher failure: Fetch command failed with exit code 141, output: tar (child): /build/downloads/git2_abc.git.tar.gz: Cannot open: Read-only file system tar (child): Error is not recoverable: exiting now Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-25bitbake/fetch: Add git submodules fetcherRichard Purdie
This adds very basic git submodule support to the fetcher. It can be used by replacing a git:// url prefix with a gitsm:// prefix, otherwise behaviour is the same as the git fetcher. Whilst this code should be functional, its not as efficient as the usual git fetcher due to the need to checkout the tree to fetch/update the submodule information. git doesn't support submodule operations on the bare clones the standard git fetcher uses which is also problematic. This code does however give a starting point to people wanting to use submodules. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17fetch2: remove localcount and use AUTOINC insteadConstantin Musca
- do not use the BB_URI_LOCALCOUNT database for computing revision incremental numbers anymore - sortable_revision now generates "AUTOINC+${latest_rev}" - use one incrementing value rather than several - PV becomes 0.1+gitAUTOINC+deadbeefdecafbad_decafbaddeadbeef - remove all localcount code and simplify the fetcher - this patch addresses the following proposal: http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-November/003878.html Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-14git.py: A bit of tidying up regarding grammar and supported protocols.Robert P. J. Day
Doc cleanup, no functional change. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-25fetch2/git: Don't use deprecated APIRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-24fetch2/git: Add missing mkdirRichard Purdie
bitbake-selftest is failing due to directories not being created. This adds in an appropriate mkdir so the tests can complete. Presumably in general OE use, something else is ensuring the parent directory is created. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-18fetch2/git: Work around git confusion between foo.git and foo repositoriesRichard Purdie
If you have foo and foo.git in GITDIR, the two can end up being confused by git with some horrible union of the two being cloned. This adds a workaround to avoid this happening until git 1.7.9.2 onwards is common enough for this to be removed. We use a symlink to hide the directories we don't want git to know about. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-04git: do not execute 'git remote prune'Enrico Scholz
'git remote prune' at this location does not make much sense because the following 'git remote rm' will prune stale and non-stale branches. The 'prune' can cause trouble because it will access the network bypassing the no-network code in bitbake. When this operation fails and throws an exception, the next command (--> 'git remote rm') will be skipped. This in turn, will make all the following operations fail, because they assume that the remote does not exist yet. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25fetch2: Ensure star character doesn't end up in mirror tarball namesRichard Purdie
If '*' does end up in mirror urls accidently, some strange things can break since supports_checksum() looks for this, ud.localpath can then get ignored and this can lead to empty directories being downloaded "successfully". '*' is a special case for file urls only at this point so remove any entries that accidentlly make it in through url mapping. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25git.py: Remove -l option, its not necessaryRichard Purdie
If -l is specified and the source and destination are not on a common filesystem an error occurs. The -l option is however the default for git for local paths which the fetcher already now ensures in the file:// case. We can therefore safely drop the -l option. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21fetch2/git.py: Optimize clone fall back when it is localJason Wessel
A file:// url should use "clone -l" to greatly speed up the clone in the case of a kernel when it is local. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-20bitbake/fetch: Spell out which fetcher backends support and recommend checksumsRichard Purdie
There were some hardcoded behaviours in the system for which backends support checksums verses which backends recommend them verses which don't recommend them. This moves the functionality into specific fetchers and then makes the general code generic. This cleans up the codebase and fixes some corner cases such as trying to checksum directories returned by the git fetcher. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-13bitbake/fetch2/git: Set a default for the GITDIR variableRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-13bitbake/fetch2/git: Don't set the branch name to None, that makes no senseRichard Purdie
With floating revisions and no specified branch, the fetcher could fail with some obtuse errors. This was due to the branch name being set to None which makes no sense. This patch reworks some conditions to avoid this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>