* [PATCH 0/4] fetch/git: a few cleanups and one minor fix
@ 2017-03-21 18:40 Christopher Larson
2017-03-21 18:41 ` [PATCH 1/4] fetch/git: use enumerate for ud.names Christopher Larson
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christopher Larson @ 2017-03-21 18:40 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
The following changes since commit 1ff9b3c669fa187f152de7b8b57d14c2468d926c:
tests/data: Add inactive remove override test (2017-03-16 12:54:59 +0000)
are available in the git repository at:
git@github.com:kergoth/bitbake bb-fetch-git-cleanup
for you to fetch changes up to 0f71517b5208e117133b67fe728d482e7a575f35:
fetch/git: fix FetchError reference (2017-03-17 14:32:25 -0700)
----------------------------------------------------------------
Christopher Larson (4):
fetch/git: use enumerate for ud.names
fetch/git: kill pointless quotes around single % args
fetch/git: drop pointless os.path.join, workdir=
fetch/git: fix FetchError reference
lib/bb/fetch2/git.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--
2.8.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] fetch/git: use enumerate for ud.names
2017-03-21 18:40 [PATCH 0/4] fetch/git: a few cleanups and one minor fix Christopher Larson
@ 2017-03-21 18:41 ` Christopher Larson
2017-03-21 18:41 ` [PATCH 2/4] fetch/git: kill pointless quotes around single % args Christopher Larson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christopher Larson @ 2017-03-21 18:41 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
list.index() isn't a particularly efficient operation, so keep track of our
position via enumerate() instead, which is more pythonic as well.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
lib/bb/fetch2/git.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 0779e80..bbd302e 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -173,8 +173,8 @@ class Git(FetchMethod):
if len(branches) != len(ud.names):
raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
ud.branches = {}
- for name in ud.names:
- branch = branches[ud.names.index(name)]
+ for pos, name in enumerate(ud.names):
+ branch = branches[pos]
ud.branches[name] = branch
ud.unresolvedrev[name] = branch
--
2.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] fetch/git: kill pointless quotes around single % args
2017-03-21 18:40 [PATCH 0/4] fetch/git: a few cleanups and one minor fix Christopher Larson
2017-03-21 18:41 ` [PATCH 1/4] fetch/git: use enumerate for ud.names Christopher Larson
@ 2017-03-21 18:41 ` Christopher Larson
2017-03-21 18:41 ` [PATCH 3/4] fetch/git: drop pointless os.path.join, workdir= Christopher Larson
2017-03-21 18:41 ` [PATCH 4/4] fetch/git: fix FetchError reference Christopher Larson
3 siblings, 0 replies; 5+ messages in thread
From: Christopher Larson @ 2017-03-21 18:41 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
lib/bb/fetch2/git.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index bbd302e..e1e8765 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -205,7 +205,7 @@ class Git(FetchMethod):
if ud.rebaseable:
for name in ud.names:
gitsrcname = gitsrcname + '_' + ud.revisions[name]
- ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname)
+ ud.mirrortarball = 'git2_%s.tar.gz' % gitsrcname
ud.fullmirror = os.path.join(d.getVar("DL_DIR"), ud.mirrortarball)
gitdir = d.getVar("GITDIR") or (d.getVar("DL_DIR") + "/git2/")
ud.clonedir = os.path.join(gitdir, gitsrcname)
@@ -240,7 +240,7 @@ class Git(FetchMethod):
# If the checkout doesn't exist and the mirror tarball does, extract it
if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror):
bb.utils.mkdirhier(ud.clonedir)
- runfetchcmd("tar -xzf %s" % (ud.fullmirror), d, workdir=ud.clonedir)
+ runfetchcmd("tar -xzf %s" % ud.fullmirror, d, workdir=ud.clonedir)
repourl = self._get_repo_url(ud)
@@ -292,14 +292,14 @@ class Git(FetchMethod):
logger.info("Creating tarball of git repository")
runfetchcmd("tar -czf %s %s" % (ud.fullmirror, os.path.join(".") ), d, workdir=ud.clonedir)
- runfetchcmd("touch %s.done" % (ud.fullmirror), d, workdir=ud.clonedir)
+ runfetchcmd("touch %s.done" % ud.fullmirror, d, workdir=ud.clonedir)
def unpack(self, ud, destdir, d):
""" unpack the downloaded src to destdir"""
subdir = ud.parm.get("subpath", "")
if subdir != "":
- readpathspec = ":%s" % (subdir)
+ readpathspec = ":%s" % subdir
def_destsuffix = "%s/" % os.path.basename(subdir.rstrip('/'))
else:
readpathspec = ""
@@ -469,7 +469,7 @@ class Git(FetchMethod):
if not os.path.exists(rev_file) or not os.path.getsize(rev_file):
from pipes import quote
commits = bb.fetch2.runfetchcmd(
- "git rev-list %s -- | wc -l" % (quote(rev)),
+ "git rev-list %s -- | wc -l" % quote(rev),
d, quiet=True).strip().lstrip('0')
if commits:
open(rev_file, "w").write("%d\n" % int(commits))
--
2.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] fetch/git: drop pointless os.path.join, workdir=
2017-03-21 18:40 [PATCH 0/4] fetch/git: a few cleanups and one minor fix Christopher Larson
2017-03-21 18:41 ` [PATCH 1/4] fetch/git: use enumerate for ud.names Christopher Larson
2017-03-21 18:41 ` [PATCH 2/4] fetch/git: kill pointless quotes around single % args Christopher Larson
@ 2017-03-21 18:41 ` Christopher Larson
2017-03-21 18:41 ` [PATCH 4/4] fetch/git: fix FetchError reference Christopher Larson
3 siblings, 0 replies; 5+ messages in thread
From: Christopher Larson @ 2017-03-21 18:41 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
The touch of .done explicitly specifies the path, so there's no need for
workdir=, and "os.path.join('.')" is identical to just '.'.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
lib/bb/fetch2/git.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index e1e8765..e420232 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -291,8 +291,8 @@ class Git(FetchMethod):
os.unlink(ud.fullmirror)
logger.info("Creating tarball of git repository")
- runfetchcmd("tar -czf %s %s" % (ud.fullmirror, os.path.join(".") ), d, workdir=ud.clonedir)
- runfetchcmd("touch %s.done" % ud.fullmirror, d, workdir=ud.clonedir)
+ runfetchcmd("tar -czf %s ." % ud.fullmirror, d, workdir=ud.clonedir)
+ runfetchcmd("touch %s.done" % ud.fullmirror, d)
def unpack(self, ud, destdir, d):
""" unpack the downloaded src to destdir"""
--
2.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] fetch/git: fix FetchError reference
2017-03-21 18:40 [PATCH 0/4] fetch/git: a few cleanups and one minor fix Christopher Larson
` (2 preceding siblings ...)
2017-03-21 18:41 ` [PATCH 3/4] fetch/git: drop pointless os.path.join, workdir= Christopher Larson
@ 2017-03-21 18:41 ` Christopher Larson
3 siblings, 0 replies; 5+ messages in thread
From: Christopher Larson @ 2017-03-21 18:41 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
FetchError isn't defined, use bb.fetch2.FetchError in this context.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
lib/bb/fetch2/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index e420232..a8be859 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -484,5 +484,5 @@ class Git(FetchMethod):
try:
self._lsremote(ud, d, "")
return True
- except FetchError:
+ except bb.fetch2.FetchError:
return False
--
2.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-21 18:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-21 18:40 [PATCH 0/4] fetch/git: a few cleanups and one minor fix Christopher Larson
2017-03-21 18:41 ` [PATCH 1/4] fetch/git: use enumerate for ud.names Christopher Larson
2017-03-21 18:41 ` [PATCH 2/4] fetch/git: kill pointless quotes around single % args Christopher Larson
2017-03-21 18:41 ` [PATCH 3/4] fetch/git: drop pointless os.path.join, workdir= Christopher Larson
2017-03-21 18:41 ` [PATCH 4/4] fetch/git: fix FetchError reference Christopher Larson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.