Skip to contentSkip to conversation

combo-layer fixes

PATCH In review Paul Eggleton 2 participants 5 messages Mar 22, 2012

lore
Share & tools
lore
#0 lore raw

cover combo-layer fixes

A couple of fixes for combo-layer. Thanks to Otavio Salvador for testing the second patch.

The following changes since commit d036265de1d9931bedb660e01a763d3d1d9e4097:

xserver-kdrive: Fix packaging warnings (2012-03-21 23:17:26 +0000)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/combo-layer-fixes4
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/combo-layer-fixes4

Paul Eggleton (2):
scripts/combo-layer: limit component repo dirty check scripts/combo-layer: handle diffs in commit messages

 scripts/combo-layer |   56 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 scripts/combo-layer: limit component repo dirty check

If one or more components are specified for update, only check if their repository/repositories are dirty rather than checking all of the configured repositories.

---
 scripts/combo-layer |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
scripts/combo-layer +9 -9
index 7457ba2..3612323 100755
@@ -150,15 +150,6 @@ def action_update(conf, args):
         generate the patch list
         apply the generated patches
     """
-    # make sure all repos are clean
-    for name in conf.repos:
-        check_repo_clean(conf.repos[name]['local_repo_dir'])
-    check_repo_clean(os.getcwd())
-
-    import uuid
-    patch_dir = "patch-%s" % uuid.uuid4()
-    os.mkdir(patch_dir)
-
     repos = []
     if len(args) > 1:
         for arg in args[1:]:
@@ -174,6 +165,15 @@ def action_update(conf, args):
     if not repos:
         repos = conf.repos
 
+    # make sure all repos are clean
+    for name in repos:
+        check_repo_clean(conf.repos[name]['local_repo_dir'])
+    check_repo_clean(os.getcwd())
+
+    import uuid
+    patch_dir = "patch-%s" % uuid.uuid4()
+    os.mkdir(patch_dir)
+
     for name in repos:
         repo = conf.repos[name]
         ldir = repo['local_repo_dir']
Signature · 1 line
1.7.5.4
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] scripts/combo-layer: limit component repo dirty check

Quoted 53 lines · Paul Eggleton

If one or more components are specified for update, only check if their repository/repositories are dirty rather than checking all of the configured repositories.

---
 scripts/combo-layer |   18 +++++++++---------

 1 files changed, 9 insertions(+), 9 deletions(-)
scripts/combo-layer +0 -0
index 7457ba2..3612323 100755
@@ -150,15 +150,6 @@ def action_update(conf, args):

        generate the patch list
        apply the generated patches
    """
-    # make sure all repos are clean
-    for name in conf.repos:
-        check_repo_clean(conf.repos[name]['local_repo_dir'])
-    check_repo_clean(os.getcwd())

scripts/combo-layer +0 -5
-
-    import uuid
-    patch_dir = "patch-%s" % uuid.uuid4()
-    os.mkdir(patch_dir)
-

    repos = []
    if len(args) > 1:
        for arg in args[1:]:

scripts/combo-layer +0 -0
@@ -174,6 +165,15 @@ def action_update(conf, args):

    if not repos:
        repos = conf.repos

+    # make sure all repos are clean
+    for name in repos:
+        check_repo_clean(conf.repos[name]['local_repo_dir'])
+    check_repo_clean(os.getcwd())

scripts/combo-layer +5 -0
+
+    import uuid
+    patch_dir = "patch-%s" % uuid.uuid4()
+    os.mkdir(patch_dir)
+

    for name in repos:
        repo = conf.repos[name]
        ldir = repo['local_repo_dir']
--
1.7.5.4

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#3 lore raw

PATCH 2/2 scripts/combo-layer: handle diffs in commit messages

In reply to Paul Eggleton

A few recent commits in the OE-Core repository contain diffs in their commit messages, which totally confuses git-am when applying them to the combo repository during update. Add some code to detect and indent any diff text in the commit message so that this does not happen (and show a warning).

---
 scripts/combo-layer |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
scripts/combo-layer +38 -0
index 3612323..73d61cc 100755
@@ -144,6 +144,43 @@ def check_repo_clean(repodir):
         logger.error("git repo %s is dirty, please fix it first", repodir)
         sys.exit(1)
 
+def check_patch(patchfile):
+    f = open(patchfile)
+    ln = f.readline()
+    of = None
+    in_patch = False
+    beyond_msg = False
+    pre_buf = ''
+    while ln:
+        if not beyond_msg:
+            if ln == '---\n':
+                if not of:
+                    break
+                in_patch = False
+                beyond_msg = True
+            elif ln.startswith('--- '):
+                # We have a diff in the commit message
+                in_patch = True
+                if not of:
+                    print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile)
+                    of = open(patchfile + '.tmp', 'w')
+                    of.write(pre_buf)
+                    pre_buf = ''
+            elif in_patch and not ln[0] in '+-@ \n\r':
+                in_patch = False
+        if of:
+            if in_patch:
+                of.write(' ' + ln)
+            else:
+                of.write(ln)
+        else:
+            pre_buf += ln
+        ln = f.readline()
+    f.close()
+    if of:
+        of.close()
+        os.rename(patchfile + '.tmp', patchfile)
+
 def action_update(conf, args):
     """
         update the component repos
@@ -227,6 +264,7 @@ def action_update(conf, args):
         count=len(revlist)-1
         for patch in patchlist:
             f.write("%s %s\n" % (patch, revlist[count]))
+            check_patch(os.path.join(patch_dir, patch))
             count=count-1
         f.close()
 
Signature · 1 line
1.7.5.4
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] scripts/combo-layer: handle diffs in commit messages

Quoted 75 lines · Paul Eggleton

A few recent commits in the OE-Core repository contain diffs in their commit messages, which totally confuses git-am when applying them to the combo repository during update. Add some code to detect and indent any diff text in the commit message so that this does not happen (and show a warning).

---
 scripts/combo-layer |   38 ++++++++++++++++++++++++++++++++++++++

 1 files changed, 38 insertions(+), 0 deletions(-)
scripts/combo-layer +37 -0
index 3612323..73d61cc 100755
@@ -144,6 +144,43 @@ def check_repo_clean(repodir):
         logger.error("git repo %s is dirty, please fix it first", repodir)
         sys.exit(1)
 
+def check_patch(patchfile):
+    f = open(patchfile)
+    ln = f.readline()
+    of = None
+    in_patch = False
+    beyond_msg = False
+    pre_buf = ''
+    while ln:
+        if not beyond_msg:
+            if ln == '---\n':
+                if not of:
+                    break
+                in_patch = False
+                beyond_msg = True
+            elif ln.startswith('--- '):
+                # We have a diff in the commit message
+                in_patch = True
+                if not of:
+                    print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile)
+                    of = open(patchfile + '.tmp', 'w')
+                    of.write(pre_buf)
+                    pre_buf = ''
+            elif in_patch and not ln[0] in '+-@ \n\r':
+                in_patch = False
+        if of:
+            if in_patch:
+                of.write(' ' + ln)
+            else:
+                of.write(ln)
+        else:
+            pre_buf += ln
+        ln = f.readline()
+    f.close()
+    if of:
+        of.close()
+        os.rename(patchfile + '.tmp', patchfile)
+

 def action_update(conf, args):
    """
        update the component repos

scripts/combo-layer +0 -0
@@ -227,6 +264,7 @@ def action_update(conf, args):

        count=len(revlist)-1
        for patch in patchlist:
            f.write("%s %s\n" % (patch, revlist[count]))
+            check_patch(os.path.join(patch_dir, patch)) count=count-1
        f.close()

--
1.7.5.4

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br