Commit Graph

101 Commits

Author SHA1 Message Date
Christopher Larson abba11daf9 bitbake: bb.fetch.git: remove leading '.' from gitsrcname
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.

(Bitbake rev: 8dce6964d56b36a77fb113f2ad496cc992a5ff36)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-04 16:23:59 +01:00
Aníbal Limón bd5167d154 bitbake: fetch2/git.py: latest_versionstring now returns (version, revision)
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]

(Bitbake rev: fd175dc90024c503134c11cbd83e77d88c406ac8)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22 08:23:49 +01:00
Aníbal Limón 4bbc5dd6e7 bitbake: fetch2/git.py: latest_versionstring search in all tags
Don't limit the tag search for only tags end with ^{}.

(Bitbake rev: 7006ab313766344cf33481228465082ed5977d28)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-22 08:23:49 +01:00
Robert Yang 518abb731c bitbake: git.py: create a branch when checkout
* Create a branch and named as upstream branch when checkout source
* Set the branch to track remote branch.

(Bitbake rev: 1ba20e4fe9c884515b200589fe379ad5eeda10bd)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-12 22:50:41 +01:00
Aníbal Limón f9ea480e6c bitbake: fetch2: Add fetch parameter to checkstatus
In order to pass connection cache object to checkstatus function
add fetch parameter.

(Bitbake rev: fbb9c6f5538084e125b58118a86968908e6f895b)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-09 18:00:21 +01:00
Mike Looijmans 5170177719 bitbake: fetch2/git.py: Add gitpkgv_revision alternative version information
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".

(Bitbake rev: 989c08f62aff7b707c25c692c23284f16506b7bc)

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-24 07:20:56 +01:00
Marcin Smoczyński 7310c3c925 bitbake: fetch/git: Fix uri in git checkstatus
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]

(Bitbake rev: efa44d04137977f883db4a643b0f774e91514722)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-19 22:09:36 +01:00
Mariano Lopez c41b5b6fc3 bitbake: bitbake: fetch2/git: Add URL when latest_revision generates an exception.
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]

(Bitbake rev: 9f2115b07a55cb14e4a74dc6fbd3707c28a234d0)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15 17:45:00 +01:00
Paul Eggleton f5a87b4707 bitbake: fetch2/git: ensure the unpacked origin remote points upstream
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].

(Bitbake rev: 80ecd1c54d4c748cee3a7ce0d64013a346e7671e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15 17:45:00 +01:00
Anders Darander 65e9859769 bitbake: fetch/git: Remove a possible trailing '/' in subpath
If the subpath parameter to the git fetcher ends with a trailing '/',
 bb.utils.prunedir() will be called on '/'...

Fixes [YOCTO #7620].

(Bitbake rev: 380a3fb372c8b0a53dd7528562e6e7a222dc76ef)

Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-17 11:52:18 +01:00
Richard Purdie 83a30dfd49 bitbake: fetch/git: Improve ls-remote handling for latest_revision
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]

(Bitbake rev: 07ad307065bb15a48f0015b9e4a643201abdc283)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-14 11:32:01 +00:00
Aníbal Limón 7587877e5d bitbake: fetch/git: Add latest_versionstring method
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>.

(Bitbake rev: f71c8c0354e87fed80bc845db6728e6e18ce9c4d)

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-12 15:25:17 +00:00
Fredrik Svensson bc6330cb7f bitbake: fetch2/git: Allow other namespaces than refs/heads to be searched.
This makes it possble to fetch Gerrit review references which are
normally stored under refs/changes.

Please disregard previous patch with the same topic.

(Bitbake rev: 268e9c0c6830e8e621c418f20c2ca12dc840e48b)

Signed-off-by: Fredrik Svensson <fredrik.svensson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-11-06 16:45:22 +00:00
Richard Purdie c7c58dbe42 bitbake: fetch2/git: Stop git from triggering fsync() calls
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.

(Bitbake rev: 0a26abaf3a1e34d556c9375068dd17c879568d0f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-27 01:27:55 +01:00
Richard Purdie 1aab9c797d bitbake: fetch/git: Separate out an ls-remote function
There is other code which can want to run ls-remote style commands with
different parameters so split out the function.

(Bitbake rev: 13f1138f5504feee0ee8e8f3a0675d0bea490351)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-02 17:25:29 +00:00
Richard Purdie c81d3ad1e3 bitbake: fetch2/git: Dereference unresolved tags with ls-remote
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.

(Bitbake rev: 8ef24f4c834298348172b96ec0b855bf09552b09)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-21 10:20:14 +00:00
Richard Purdie d21c1537b7 bitbake: fetch2/git: Anchor names when using ls-remote
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).

(Bitbake rev: df2e0972cd1db7abd5ec8b7cb295fb0c42e284a4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-21 10:20:13 +00:00
Zhenhua Luo c4bcaa3f7c bitbake: bitbake: fetch2/git: add description for nobranch
(Bitbake rev: b426740b2ae8245c8cf0f314bf4983b6fff7ecb7)

Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-08 12:49:08 +00:00
Zhenhua Luo 100c8831a5 bitbake: bitbake: fetch2/git: add nobranch option for SRC_URI to skip SHA validating 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.

(Bitbake rev: f594cb9f5a18dd0ab2342f96ffc6dba697b35f65)

Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-07 13:42:55 +00:00
Robert Yang d8d4b0edb1 bitbake: bitbake: fetcher2: git.py: clean(): remove the .tar.gz.done
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]

(Bitbake rev: fb2dc84875eb477661f421b21bc404d4805ce379)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-02 13:08:40 +00:00
Olof Johansson 52ef6c210c bitbake: bb.fetch2.git: reuse basecmd attribute
The basecmd is initialized in urldata_init; there's no need redoing that
work.

(Bitbake rev: f8df6f746fb2e27f029a5449cee6c891b1f36f4f)

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-18 17:08:08 +00:00
Richard Purdie 498de04737 bitbake: fetch2/git: Improve handling of unresolved names verses branches
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.

(Bitbake rev: e85f39fe9d1b224414b5da0780da514f75c5df92)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-18 17:08:08 +00:00
Richard Purdie 184038bedb bitbake: fetch2/git: Ensure check is made in the correct directory
(Bitbake rev: 73ddf1a3d1c516ad3bc785e0413483e616ce07a8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-06 14:10:15 +00:00
Richard Purdie f19546e02d bitbake: fetch2/git: Add sanity check to ensure we really did fetch the correct revisions
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.

(Bitbake rev: a9112a102a89049cda597dad449e922c9e957a5d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-05 16:27:13 +00:00
Florin Sarbu 64372fa027 bitbake: bitbake: fetch2: Remove the unused urldata from the git fetcher.
(Bitbake rev: e0a2e9699e9f338dd7ade8c9eef0a12c7639ec05)

Signed-off-by: Florin Sarbu <florin.sarbu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-25 13:00:18 +00:00
Richard Purdie 9d7f8e2a20 bitbake: fetch2: Stop passing around the pointless url parameter
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.

(Bitbake rev: 6a48474de9505a3700863f31839a7c53c5e18a8d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-22 12:03:02 +00:00
Richard Purdie 9ccfe66074 bitbake: git: Use git branch for ancestor checks
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.

(Bitbake rev: 31467c0afe0346502fcd18bd376f23ea76a27d61)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-19 13:22:47 +00:00
Richard Purdie 2354250a95 bitbake: git: Use merge-base instead of log for testing if a commit is present
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.

(Bitbake rev: 89abfbc1953e3711d6c90aff793ee622c22609b1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 17:19:11 +00:00
Martin Jansa d529c11fa5 bitbake: git: remove symling before updating mirror tarball
* 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

(Bitbake rev: 3627b02f77c78beedadadd77c619b9e5edaae076)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-09 14:15:10 +01:00
Richard Purdie a6c6a8ddb6 bitbake: bitbake/fetch: Add git submodules fetcher
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.

(Bitbake rev: 25e0b0bc50114f1fbf955de23cc0c96f5f7a41e3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-25 15:58:31 +00:00
Constantin Musca d0f35207f9 bitbake: fetch2: remove localcount and use AUTOINC instead
- 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

(Bitbake rev: 61cf01c5c236b4218f40cfae7c059c2b86765dbd)

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:42:19 +00:00
Robert P. J. Day ad29d14099 bitbake: git.py: A bit of tidying up regarding grammar and supported protocols.
Doc cleanup, no functional change.

(Bitbake rev: 5161a84f5dcfe748382a5073349bf10ed21641f9)

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-14 13:08:48 +00:00
Richard Purdie a8edf79fce bitbake: fetch2/git: Don't use deprecated API
(Bitbake rev: 8e650b3307b60cfe8e7439ea6891c3a85f785af9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-25 15:55:57 +01:00
Richard Purdie e1c1ee19e0 bitbake: fetch2/git: Add missing mkdir
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.

(Bitbake rev: 1270a07713e2a6c6e6fadcc61b785aebc99ae17b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-24 12:13:52 +01:00
Richard Purdie a86bd42264 bitbake: fetch2/git: Work around git confusion between foo.git and foo repositories
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.

(Bitbake rev: bbf1f6fe594c721a296ca09ee7c583d4a205c591)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-18 16:21:44 +01:00
Enrico Scholz 86aeee98cf bitbake: git: do not execute 'git remote prune'
'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.

(Bitbake rev: 2ba23df5fad4b94d38a6aed97f7822226d72eb89)

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-04 14:48:14 +01:00
Richard Purdie 72f04e760d bitbake: fetch2: Ensure star character doesn't end up in mirror tarball names
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.

(Bitbake rev: 1369bec2404d942acc3618a8d005ec6868dcfd41)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25 14:57:17 +01:00
Richard Purdie e05b423cc6 bitbake: git.py: Remove -l option, its not necessary
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.

(Bitbake rev: 3aeb268b2aaab4bb8b1cfff1450e0b76aa8ce855)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25 14:57:16 +01:00
Jason Wessel fa7c2b0743 bitbake: fetch2/git.py: Optimize clone fall back when it is local
A file:// url should use "clone -l" to greatly speed
up the clone in the case of a kernel when it is local.

(Bitbake rev: 2bab2cc3ffe67ee2a308074a6e4c2c7be5636d2f)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:21:23 +01:00
Richard Purdie b0b9ee29a2 bitbake/fetch: Spell out which fetcher backends support and recommend checksums
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.

(Bitbake rev: ef6d268f7b8527541a7fb044cf95a973be4097f4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-20 09:24:23 +01:00
Richard Purdie 36462d5927 bitbake/fetch2/git: Set a default for the GITDIR variable
(Bitbake rev: 1a0cdc65812f1f12bf4bbea6540a3aaf0f81b4f7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-13 20:09:53 +01:00
Richard Purdie 279d0afd6e bitbake/fetch2/git: Don't set the branch name to None, that makes no sense
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.

(Bitbake rev: 740c58d43cfb1445dd126e4827bb70ce988ca107)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-13 20:09:52 +01:00
Jeff Polk ca8e06e8a0 fetch2/git: Allow file:// URLs without checking for network access
Don't check for network access before grabbing the the current head,
cloning, or updating a clone when the protocol is 'file'.

(Bitbake rev: d5847bc5254b9d2f28a6b574f6157d1286add27c)

Signed-off-by: Jeff Polk <jeff.polk@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-04 16:44:57 +01:00
Richard Purdie 3d69d9462d bitbake/fetch2: Ensure mirror tarballs have .done stamps so we don't redownload and corrupt them
[YOCTO #2154]

(Bitbake rev: 521d6b14151d3bf934b9597557f7ae46e50a3d7a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-03-23 14:54:16 +00:00
Bruce Ashfield 408fd37529 fetch2/git: create bareclone option
For similar reasons as the nocheckout option, packages that need
enhanced control over the checkout and branch creation on a repository
may want a complete mirror/bareclone created of the repository when
performing the unpack.

This is useful/required when a local respository is being used, but
local tracking branches have not been created for all branches that
a given recipe needs to manipulate. The standard git clone operations
will create remote branches for the branches that are local to the
source repository, but branches that are remote do not translate to
the destination repository. Doing a mirror/bare clone of the source,
makes all branches available to the repository.

This is a particular use case, but the ability to do a bare clone
creates great flexibility in recipe space, with no impact to recipes
that don't need this functionality.

To implement this, a new option 'bareclone' is craeted which creates
a mirror copy of the repository and leaves it bare in the unpacking
phase. A recipe that uses this option must both checkout and debare
the repository itself.

(Bitbake rev: 82482aae6f311c994275fb0b6b32d954bbfc78c3)

Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-24 16:40:08 +00:00
Richard Purdie 64662290d3 fetch2/git: Add workaround for clone using alternates problem
To quote my report of this to the git mailing list:
"""

I have a problem with git clone commands using alternates failing by
mixing up different repositories. I have a situation where I could end
up with both:

/srv/mirrors/repo
/srv/mirrors/repo.git

as bare clones.

I then try cloning "repo" with alternates with the command:

$ git clone -s -n /srv/mirrors/repo /tmp/foo
Cloning into /tmp/foo...
done.

$ cat /tmp/foo/.git/objects/info/alternates
/srv/mirrors/repo.git/objects

Note how I'm now referencing repo.git, not repo. This doesn't work as
expected giving some very bizarre results when actually using the
repository.

I appreciate this is a rather bizarre corner case but its one that is
breaking the build system I work with. Ideally people would use a
consistent URL for the same repository but we have an example where they
haven't and this really shouldn't break like this.

Looking at the code, the cause seems to be

clone.c:get_repo_path():
        static char *suffix[] = { "/.git", ".git", "" };

since its looking in order for:
 repo/.git (fails)
 repo.git (suceeds, incorrect)
 repo (never looked at)

I'm not sure what would break if that order were to change, swapping the
last two options.

I can "force" the issue by running:

git clone -s -n /srv/mirrors/repo/ /tmp/foo

but this results in the slightly odd looking:

$ cat /tmp/foo/.git/objects/info/alternates

/srv/mirrors/repo//objects

which does at least work.
"""

This patch adds the trailing slash to ensure the correct repository is
referenced at the expense of some ugliness in the alternates file.

(Bitbake rev: d978e7b35550e3785c7c567ffe4c40a3c3947450)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-02-01 15:08:43 +00:00
Juraj Hercek 51d64452f6 fetch2/git: change colon to dot in ud.host
Local cloning of git repositories from DL_DIR into WORKDIR fails when
using ssh URL with port specification e.g.
"ssh://user@host:port/path/to/repo.git". Git fetcher clones such remote
repository into "${DL_DIR}/git2/host:port.path.to.repo.git". However,
when clonging from ${DL_DIR}/git2/host:port.path.to.repo.git into
${WORKDIR}, git fetcher fails with "ssh: Could not resolve hostname
${DLDIR}/git2/host: Name or service not known".

A solution is to replace ":" by "." in host component, similarly as it
is done when replacing "/" with "." in path component, so that local
clone directory in DL_DIR looks like this: "host.port.path.to.repo.git".

(Bitbake rev: 1f2867b79f1cd2bfbdc849ba5677a39db6fa3396)

Signed-off-by: Juraj Hercek <juraj.hercek@jhksoftware.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-04 16:04:07 +00:00
Richard Purdie 4cd9671078 bitbake: Update users of getVar/setVar to use the data store functions directly
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-11-27 10:35:30 +00:00
Matthew McClintock dd71f67db1 fetch2/git: Make git fetch run with -f so rebased branches don't fail
git fetches can fail (or at least return failed) when trying to
fetch and prune rebased branches. This patch simply adds a -f
to the git fetch command so these failure are ignore

Generally, if some SHA was rebased away it's not coming back so
there is no point in not doing this force

(Bitbake rev: a7b75e4db52445b30ec0fc0053dcf454f5f7d2db)

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-10-04 13:46:15 +01:00
Paul Eggleton 92015c7863 fetch2/git: fix subpath destination directory
Make the git fetcher's subpath (path within the git repo to fetch)
option set the destsuffix (destination directory) option by default.
This reverts the behaviour of subpath to the same as when it was
introduced.

Based on a patch by Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

(Bitbake rev: 3e7f8afeacf7c8c8de3e87778a3907e33d4a06b3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-09-20 22:24:10 +01:00