]> git.alsa-project.org Git - alsa.git/commitdiff
alsatool: alsa-driver merging changes, comments.py updated
authorJaroslav Kysela <perex@perex.cz>
Thu, 6 Sep 2012 07:57:55 +0000 (09:57 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 6 Sep 2012 07:57:55 +0000 (09:57 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsatool
comments.py
config.py
drivermerge.py
misc/scan.sh [new file with mode: 0755]
utils.py

index e8c3ef5b7eae1378cc3a350e04ad385683f4e76c..f8732e7debf0f4dbd157ee1e22aeb00f9f840144 100755 (executable)
--- a/alsatool
+++ b/alsatool
@@ -14,12 +14,13 @@ import sys
 import getopt
 import re
 import config
+from traceback import print_exc
 from shutil import rmtree, copyfile
 from rfc822 import parsedate_tz
 from utils import git_repo, git_system, git_popen, diff_compare, \
-                  git_read_commits, raw_subject, eprint, tmpdir, package
-from drivermerge import analyze_diff, driver_merge, compare_trees
-from comments import COMMENT_MAP
+                  git_read_commits, raw_subject, eprint, tmpdir, tmpfile, package, \
+                  to_kernel_file
+from drivermerge import analyze_diff, driver_merge, compare_trees, try_to_merge
 
 VERSION="2.0"
 
@@ -119,8 +120,17 @@ def version_sort(tags):
         if tag == "tip":
             continue
         try:
-            a, b, c = tag.split('.')
+            t = tag.split('.')
+            if len(t) == 3:
+                a, b, c = t
+                d = None
+            elif len(t) == 4:
+                a, b, c, d = t
+            else:
+                print 'Ignoring tag:', repr(tag), repr(t)
+                raise ValueError
             if a[0] != 'v':
+                print 'Ignoring tag:', repr(tag), repr(t)
                 raise ValueError
             a = int(a[1:])
             b = int(b)
@@ -130,7 +140,13 @@ def version_sort(tags):
             c1 = int(c[:idx])
             c2 = c[idx:]
             if c2 == '':
-                c2 = 'zzzzz'
+                c2 = '01'
+                if not d is None:
+                    c2 += d
+            elif c2.startswith('rc'):
+                c2 = '00' + c2
+            else:
+                c2 = '02' + c2
             str = "%08i.%08i.%08i.%s" % (a, b, c1, c2)
             tags1.append(str)
             tags2[str] = tag
@@ -218,16 +234,9 @@ def release1(repo, tag):
                 raise ValueError, "autoconf"
         if os.system("./configure --with-debug=full --with-isapnp=yes --with-sequencer=yes --with-kernel=%s" % (config.ROOT + '/alsa-kernel')):
                 raise ValueError, "configure"
-        if os.system("make include/sound/version.h"):
+        if os.system("make -C include/sound version.h"):
                 raise ValueError, "include/sound/version.h"
         files.append('configure.in')
-        os.chdir(config.ROOT + '/alsa-kmirror')
-        #if os.system("git add include/version.h"):
-        #      raise ValueError, "git add"
-        #if os.system('git commit -m "Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % tag):
-        #      raise ValueError, "git add"
-        if os.system('git tag %s -a -m "Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % (tag, tag)):
-                raise ValueError, "git tag"
     elif repo in ['alsa-lib', 'alsa-plugins', 'alsa-utils',
                   'alsa-firmware', 'alsa-oss']:
         lines = open(config.ROOT + '/' + repo + '/configure.in').readlines()
@@ -270,8 +279,12 @@ def release1(repo, tag):
             raise ValueError, "git add %s" % file
     if os.system('git commit -m "Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % tag):
         raise ValueError, "git commit"
-    if os.system('git tag %s -a -m "Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % (tag, tag)):
-        raise ValueError, "git tag"
+    if not repo in ['alsa-driver']:
+        if os.system('git tag %s -a -m "Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % (tag, tag)):
+            raise ValueError, "git tag"
+    else:
+        if os.system('git branch -l %s %s' % tag):
+            raise ValueError, "git new branch"
 
 def release(argv):
     if argv == None or argv[0][0] != 'v':
@@ -289,45 +302,53 @@ def release(argv):
             repos.remove('alsa')
     if 'alsa-kmirror' in repos:
             repos.remove('alsa-kmirror')
-    if 'alsa-driver' in repos:
-            print('Updating alsa-kernel.git/include/sound/version.h...')
-            os.chdir(config.ROOT + '/' + 'alsa-kernel')
-            if os.system('git checkout master'):
-                    raise ValueError, "git checkout master"
-            if os.system('git pull origin master'):
-                    raise ValueError, "git pull origin master"
-            version = open('include/sound/version.h').read(4096)
-            pos1 = version.find("CONFIG_SND_VERSION")
-            pos2 = version[pos1:].find('"')
-            pos3 = version[pos1+pos2+1:].find('"')
-            active = version[pos1+pos2+1:pos1+pos2+pos3+1]
-            if active != tag[1:]:
-                    version = version[:pos1+pos2] + '"' + tag[1:] + '"' + version[pos1+pos2+pos3+2:]
-                    open('include/sound/version.h', 'w+').write(version)
-                    if os.system('git add include/sound/version.h'):
-                            raise ValueError, "git add"
-                    if os.system('git commit -m "ALSA: Release %s\n\nSigned-off-by: Jaroslav Kysela <perex@perex.cz>\n"' % tag):
-                            raise ValueError, "git commit"
-                    if os.system('git push origin master:refs/heads/master'):
-                            raise ValueError, "git push"
-            else:
-                    print('Already updated...')
     print('Doing release for: %s' % ','.join(repos))
     for repo in repos:
             release1(repo, tag)
 
-def _merge_members(members, module='alsa-driver', nice=False):
+def _to_changes_log(str, file, module):
+  f = ''
+  log = ''
+  if module == 'alsa-driver':
+    f = config.ROOT + '/alsa-kmirror/' + file
+    if not os.path.exists(f):
+      f = ''
+  if not f:
+    f = config.ROOT + '/' + module + '/' + file
+  if os.path.exists(f):
+    if not os.path.isdir(f):
+      fp = open(f)
+      lines = fp.readlines()
+      while lines[0] in ['/*\n', ' *\n']:
+        del lines[0]
+      nlines = []
+      for line in lines:
+        if line.startswith('MODULE_DESCRIPTION'):
+          nlines.append(line)
+      lines = nlines + lines
+      log = '>>> ' + '>>> '.join(lines[:15])
+      fp.close()
+  fp = open("/tmp/changes-log.txt", "a+")
+  fp.write(str + "\n")
+  if log:
+    fp.write(log)
+  fp.close()
+
+def _merge_members(regex, members, module='alsa-driver', nice=False):
 
     def mgo(file, module):
-        global COMMENT_MAP
-        map = COMMENT_MAP[module]
-        if module == 'alsa-driver' and file[:6] == '/acore':
-                file = '/' + file[2:]
-        for i in map:
-                if re.compile("^" + i[0]).search(file):
-                        if i[1] == 'ERROR':
-                                break
-                        return i[1]
+        if module == 'alsa-driver':
+                if file.startswith('/acore'):
+                        file = '/' + file[2:]
+                elif file.startswith('/mirror/sound'):
+                        file = file[13:]
+                elif file.startswith('/mirror/include/sound'):
+                        file = '/include' + file[21:]
+                elif file.startswith('/mirror/Documentation/sound/alsa/'):
+                        file = '/Documentation' + file[32:]
+        res = regex.search(module, file)
+        if res != 'ERROR':
+                return res
         if file.endswith('/.cvsignore'):
                 return 'IGNORE'
         if file.endswith('/.hgignore'):
@@ -342,8 +363,6 @@ def _merge_members(members, module='alsa-driver', nice=False):
                 return file
         return 'ERROR'
 
-    global GERRORS
-
     changes = []
     result = []
     for file in members:
@@ -351,12 +370,14 @@ def _merge_members(members, module='alsa-driver', nice=False):
             while file != '':
                     result1 = mgo(file, module)
                     if result1 == 'ERROR':
-                            config.GERRORS += 1
-                            str = 'Cannot identify file "%s" from module %s' % (file, module)
-                            fp = open("/tmp/changes-log.txt", "a+")
-                            fp.write(str + "\n")
-                            fp.close()
-                            print(str, ' {see /tmp/changes-log.txt file}')
+                            found = False
+                            for a in config.GERRORSA:
+                                    if a[0] == module and a[1] == file:
+                                            found = True
+                                            break
+                            if not found:
+                                config.GERRORS += 1
+                                config.GERRORSA.append((module, file))
                             result1 = ''
                     if result1 != '':
                             file = ''
@@ -422,8 +443,6 @@ def changes(argv):
                     changes.append(a)
 
     def merge_members(changes):
-            global GERRORS
-
             res = {}
             try:
                     os.remove("/tmp/changes-log.txt")
@@ -433,7 +452,7 @@ def changes(argv):
                     module = change['module']
                     if not res.has_key(module):
                             res[module] = {}
-                    members = _merge_members(change['files'], module)
+                    members = _merge_members(regex, change['files'], module)
                     if len(members) == 0:
                             continue
                     members = members[0]
@@ -444,9 +463,14 @@ def changes(argv):
                             if not res[module].has_key(mem):
                                     res[module][mem] = []
                             res[module][mem].append(change)
-                    if config.GERRORS > 0:
-                            print('Bailing out...')
-                            sys.exit(1);
+            if config.GERRORS > 0:
+                    for a in config.GERRORSA:
+                            str = 'Cannot identify file "%s" from module %s' % (a[1], a[0])
+                            _to_changes_log(str, a[1], a[0])
+                            print(str)
+                    print('^^^ {see /tmp/changes-log.txt file}')
+                    print('Bailing out...')
+                    sys.exit(1);
             return res
 
     def get_items(allitems):
@@ -495,6 +519,26 @@ def changes(argv):
     def esc(str):
             return str.replace('>', '&gt;').replace('<', '&lt;').replace('&', '&amp;')
 
+    def mediawiki_header(fp, title):
+            fp.write("""\
+<mediawiki xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.3/ http://www.mediawiki.org/xml/export-0.3.xsd" version="0.3" xml:lang="en">
+<page>
+<title>%s</title>
+<revision>
+<id>1</id>
+<contributor><username>Perex</username><id>2</id></contributor>
+<text xml:space="preserve">
+{| align="right"\n| __TOC__\n|}
+""" % title)
+
+    def mediawiki_footer(fp):
+          fp.write("""\
+</text>
+</revision>
+</page>
+</mediawiki>
+""")
+
     try:
             rev1 = argv[0]
             rev2 = argv[1]
@@ -502,6 +546,8 @@ def changes(argv):
             sys.stderr.write('Please, specify oldtag and newtag\n')
             sys.exit(1)
 
+    from comments import CommentRegex
+    regex = CommentRegex()
     changes = []
     fullset = config.REPOSITORIES
 
@@ -517,12 +563,19 @@ def changes(argv):
             fp = os.popen("%s tag 2> /dev/null" % git(module))
             tags = fp.readlines()
             fp.close()
+            fp = os.popen("%s branch 2> /dev/null" % git(module))
+            branches = fp.readlines()
+            fp.close()
+            for b in branches:
+                tags.append(b[2:])
             if not check_tag(tags, rev2):
                     continue
             tags1 = []
-            base = rev2
-            while not check_tag(tags, xrev):
-                    if rev2[-3:-1] == "rc":
+            base = rev2 == 'HEAD' and 'v999.999.999' or rev2
+            if not check_tag(tags, xrev):
+                    if rev2[0] != 'v':
+                            base = 'v9.9.9'
+                    elif rev2[-3:-1] == "rc":
                             base = rev2[:-3]
                     elif rev2[-1:] >= "a":
                             base = rev2[:-1]
@@ -533,7 +586,9 @@ def changes(argv):
                             if tag.strip() != rev2:
                                     tags1.append(tag)
                     tags1 = version_sort(tags1)
-                    if len(tags1) != 0:
+                    if tags1 is None:
+                            tags1 = []
+                    elif len(tags1) != 0:
                             xrev = tags1[len(tags1)-1]
                             break
                     major, minor, subminor = base.split('.')
@@ -555,43 +610,50 @@ def changes(argv):
                     if not groups.has_key(rev):
                             groups[rev] = []
                     groups[rev].append(module)
-    print('<mediawiki xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.3/ http://www.mediawiki.org/xml/export-0.3.xsd" version="0.3" xml:lang="en">')
-    print('<page>')
-    print('<title>Changes %s %s</title>' % (rev1, rev2))
-    print('<revision>')
-    print('<id>1</id>')
-    print('<contributor><username>Perex</username><id>2</id></contributor>')
-    print('<text xml:space="preserve">')
-    print('{| align="right"\n| __TOC__\n|}')
+
+    short = ''
+    long = ''
+    long_hda = ''
+    long_soc = ''
+    rev = None
+
     for rev in groups:
-            str = '=Changelog between %s and %s releases=' % (rev_to_dot(rev), rev_to_dot(rev2))
-            print(str)
+            str = '=Changelog between %s and %s releases=\n' % (rev_to_dot(rev), rev_to_dot(rev2))
+            short += str
             for module in groups[rev]:
-                    print('==%s==' % module)
+                    short += '==%s==\n' % module
                     items = get_items(res[module].keys())
                     for items1 in items:
                             for b in items1:
                                     if not res[module].has_key(b):
                                             continue
-                                    print('===%s===' % esc(b))
+                                    short += '===%s===\n' % esc(b)
                                     for a in res[module][b]:
                                             log = a['comment'].splitlines()[0]
                                             if log[:9] == 'Summary: ':
                                                     log = log[9:]
                                             elif log[:8] == 'Summary:':
                                                     log = log[8:]
-                                            print(': %s' % esc(log))
+                                            short += ': %s\n' % esc(log)
     for rev in groups:
-            str = '=Detailed changelog between %s and %s releases=' % (rev_to_dot(rev), rev_to_dot(rev2))
-            print(str)
+            long += '=Detailed changelog between %s and %s releases=\n' % (rev_to_dot(rev), rev_to_dot(rev2))
+            long += str
             for module in groups[rev]:
-                    print('==%s==' % module)
+                    long += '==%s==\n' % module
                     items = get_items(res[module].keys())
                     for items1 in items:
                             for b in items1:
                                     if not res[module].has_key(b):
                                             continue
-                                    print('===%s===' % esc(b))
+                                    hdaflag = b.startswith('HDA ') and module == 'alsa-driver'
+                                    socflag = (b.startswith('SoC ') or b.startswith('Soc ')) and module == 'alsa-driver'
+                                    long += '===%s===\n' % esc(b)
+                                    if hdaflag:
+                                        long += ': see [[Detailed HDA changes %s %s]]\n' % (rev1, rev2)
+                                        long_hda += '===%s===\n' % esc(b)
+                                    if socflag:
+                                        long += ': see [[Detailed SoC changes %s %s]]\n' % (rev1, rev2)
+                                        long_soc += '===%s===\n' % esc(b)
                                     for a in res[module][b]:
                                             log = a['comment'].splitlines()
                                             first = "-"
@@ -608,12 +670,38 @@ def changes(argv):
                                                             continue
                                                     if l[:4].lower() == "cc: ":
                                                             continue
-                                                    print(': %s %s' % (first, esc(l)))
+                                                    if hdaflag:
+                                                      long_hda += ': %s %s\n' % (first, esc(l))
+                                                    elif socflag:
+                                                      long_soc += ': %s %s\n' % (first, esc(l))
+                                                    else:
+                                                      long += ': %s %s\n' % (first, esc(l))
                                                     first = " "
-    print('</text>')
-    print('</revision>')
-    print('</page>')
-    print('</mediawiki>')
+
+    print("Changes are in /tmp/alsa-changes.wiki")
+    fp = open('/tmp/alsa-changes.wiki', 'w+')
+    mediawiki_header(fp, 'Changes %s %s' % (rev1, rev2))
+    fp.write('[[Detailed changes %s %s]]\n' % (rev1, rev2))
+    fp.write(short)
+    mediawiki_footer(fp)
+
+    fp = open('/tmp/alsa-changes1.wiki', 'w+')
+    mediawiki_header(fp, 'Detailed changes %s %s' % (rev1, rev2))
+    fp.write(long)
+    mediawiki_footer(fp)
+
+    idx = 2
+    if rev:
+        for id in [('HDA', long_hda), ('SoC', long_soc)]:
+          fp = open('/tmp/alsa-changes%s.wiki' % idx, 'w+')
+          mediawiki_header(fp, 'Detailed %s changes %s %s' % (id[0], rev1, rev2))
+          str = '=Detailed %s changelog between %s and %s releases=\n' % (id[0], rev_to_dot(rev), rev_to_dot(rev2))
+          fp.write(str + '\n')
+          module = 'alsa-driver'
+          fp.write('==%s==\n' % module)
+          fp.write(id[1])
+          mediawiki_footer(fp)
+          idx += 1
 
 def usage(code=0, msg=''):
     print(__doc__ % globals())
@@ -818,12 +906,14 @@ def import_(argv):
     print('Already merged patches: %s' % skipcount)
     print('Patches to be merged: %s' % len(tomerge))
     for l1 in tomerge:
+        print l1['ref'], l1['comment'].splitlines()[0][:-1]
         oldrev = os.popen("git rev-parse HEAD").readline().strip()
         if extpick(['.', l1['ref']], sign=True, interactive=False):
             if os.system("git am -3 --abort") or \
                os.system("git reset --hard"):
                    raise ValueError
             sys.stderr.write('An error occured... Skipping...\n')
+            sys.stderr.write('Error ref: %s\n' % l1['ref'])
         rev = os.popen("git rev-parse HEAD").readline().strip()
         if oldrev == rev:
             sys.stdout.write('No change, do you want to black list this patch? (Y/ ) ')
@@ -848,7 +938,12 @@ def getgitfile(url, file, size=1024):
     return res
 
 def getorigin(repo = 'alsa-kernel'):
-    origin = getgitfile('http://git.alsa-project.org/http/%s.git' % repo, 'refs/heads/master')
+    origin = getgitfile('http://git.alsa-project.org/http/%s.git' % repo, 'info/refs', size=8192)
+    for line in origin.splitlines():
+        a = line.strip().split('\t')
+        if a[1] == 'refs/heads/master':
+            origin = a[0]
+            break
     origin = origin.strip()
     if len(origin) != 40:
         raise ValueError, "git.alsa-project.org is down?"
@@ -969,6 +1064,252 @@ def kimport(argv=None):
         if import_([repo]):
             raise ValueError, "import_ %s" % repo
 
+def one(argv=''):
+
+    def filecheck1(file):
+        return True
+        
+    def filecheck2(file):
+        return True
+
+    def fileconv1(file, prefix=''):
+        if file == '/dev/null':
+            return file
+        if prefix and file.startswith(prefix):
+            file = file[len(prefix):]
+        return file
+
+    def fileconv2(file, prefix=''):
+        if file == '/dev/null':
+            return file
+        if prefix and file.startswith(prefix):
+            file = file[len(prefix):]
+        if file.startswith('Documentation/DocBook/alsa-driver-api.tmpl'):
+            pass
+        elif file.startswith('Documentation/'):
+            file = 'Documentation/sound/alsa/' + file[14:]
+        elif file.startswith('include/'):
+            file = 'include/sound/' + file[8:]
+        elif file.startswith('scripts/'):
+            pass
+        elif file.startswith('.'):
+            pass
+        else:
+            file = 'sound/' + file
+        return 'mirror/' + file
+
+    dir = os.path.expanduser('~/alsa/')
+    repo1 = 'alsa-driver'
+    repo2 = 'alsa-kmirror'
+    repo3 = 'alsa-driver.new'
+    conv = {repo1:fileconv1, repo2:fileconv2}
+    check = {repo1:filecheck1, repo2:filecheck2}
+    if argv and 'clear' in argv and os.path.exists(dir + repo3):
+        rmtree(dir + repo3)
+    if not os.path.exists(dir + repo3):
+        os.mkdir(dir + repo3)
+        if git_system(repo3, "init"):
+            raise ValueError, "git init error"
+    tags1 = version_sort(os.popen("%s tag" % git(repo1)).readlines())
+    tags1.remove('v1.0.2')
+    tags1.remove('v1.0.2b')
+    tags2 = version_sort(os.popen("%s tag" % git(repo2)).readlines())
+    tags1.append('master')
+    tags2.append('master')
+    tags3 = version_sort(os.popen("%s tag" % git(repo3)).readlines())
+    init1 = os.popen("%s log master --pretty=format:%%H  --reverse" % git(repo1)).readline().strip()
+    init2 = os.popen("%s log master --pretty=format:%%H  --reverse" % git(repo2)).readline().strip()
+    if not tags1 or not tags2 or not init1 or not init2:
+        raise ValueError, "init"
+
+    if tags3:
+        for tag in tags3:
+            tags1.remove(tag)
+            tags2.remove(tag)
+
+    for tag in tags1:
+        if not tag in tags2:
+            raise ValueError, "tag %s is not in %s" % (tag, repo2)           
+    for tag in tags2:
+        if not tag in tags1:
+            raise ValueError, "tag %s is not in %s" % (tag, repo1)
+
+    ptag = None
+    if tags3:
+        ptag = tags3[-1]
+        if git_system(repo3, "reset --hard %s" % ptag):
+            raise ValueError, "git reset tag error"
+
+    for tag in tags1:
+        prev1 = prev2 = ptag
+        if ptag is None:
+            prev1 = init1
+            prev2 = init2
+        ptag = tag[:]
+
+        print prev1, prev2, tag
+        log1 = git_read_commits(dir + repo1, prev1, tag, reverse=True)
+        log2 = git_read_commits(dir + repo2, prev2, tag, reverse=True)
+        if prev1 == init1:
+            l1 = git_read_commits(dir + repo1, prev1, prev1)
+            l1[0]['root_flag'] = True
+            l2 = git_read_commits(dir + repo2, prev2, prev2)
+            l2[0]['root_flag'] = True
+            log1 = l1 + log1
+            log2 = l2 + log2
+
+        if not log1 and not log2:
+            continue
+
+        log = []
+        while log1 or log2:
+            if not log1:
+                log.append(log2[0])
+                log2.pop(0)
+                log[-1]['repo'] = repo2
+            elif not log2:
+                log.append(log1[0])
+                log1.pop(0)
+                log[-1]['repo'] = repo1
+            else:
+                if log1[0]['CommitDate'] <= log2[0]['CommitDate']:
+                    log.append(log1[0])
+                    log1.pop(0)
+                    log[-1]['repo'] = repo1
+                else:
+                    log.append(log2[0])
+                    log2.pop(0)
+                    log[-1]['repo'] = repo2
+
+        for l in log:
+            if l['repo'] == 'alsa-kmirror' and \
+               l['ref'] in ['8ef26bb6279a048d838063a4b740cb716b30c75a',
+                            '6ae95af9a82c9f80a80ddd41a5ca2964a380fb77',
+                            '3cd9d1b408f301cdbf42e94a5cd3c6eb7019b57c',
+                            '60b096ce86d24ae797813dbcc117ca9194f82cca',
+                            '73b89c7c2d4f6f194316bcbac3448ea6e146aeb4',
+                            '88b6b99716dfb5026305f0e9a11f99a650b3e12f']:
+                continue
+            if l['comment'].startswith('Merge branch '):
+                continue
+            ok = False
+            for a in ('alsatool-abort', 'alsatool-skip'):
+                if os.path.exists(tmpfile(a)):
+                    os.remove(tmpfile(a))
+            while not ok:
+                try:
+                    try_to_merge(repo3, 'master', l['repo'], l, fileconv=conv[l['repo']], filecheck=check[l['repo']], do_checkout=False)
+                    ok = True
+                except:
+                    print "Unexpected error:", sys.exc_info()[0]
+                    print "-"*60
+                    print print_exc(file=sys.stdout)
+                    print "-"*60
+                    print "Type 'touch %s; exit' to abort..." % tmpfile("alsatool-abort")
+                    print "Type 'touch %s; exit' to skip the patch..." % tmpfile("alsatool-skip")
+                    print "Or make changes and type 'exit' to restart..."
+                    os.chdir(dir + repo3)
+                    os.system("PS1='alsatool fix [\u@\h \W]\$ ' /bin/bash")
+                    if os.path.exists(tmpfile("alsatool-abort")):
+                        raise
+                    if os.path.exists(tmpfile("alsatool-skip")):
+                        print "Skipping..."
+                        ok = True
+                    
+        if git_system(repo3, "tag -a %s -m \"Release %s\"" % (tag, tag)):
+            raise ValueError
+
+def onecheck(argv=''):
+    from dircache import listdir
+
+    def do_diff(path1, path2):
+        lines = os.popen("LANG=C diff -ruNp \"%s\" \"%s\"" % (path1, path2)).read(65536)
+        sys.stdout.write(''.join(lines))
+
+    def do_driver(path1, path2, level=0):
+        for f in listdir(path1):
+            if f.endswith('.mod') or f.endswith('.cmd') or f.endswith('.o') or \
+               f.endswith('.mod.c') or f.endswith('.ko') or f == 'modules.order' or \
+               f.endswith('~') or f.endswith('.orig') or f.endswith('.rej') or \
+               f.endswith('.d') or f.startswith('out.txt'):
+                continue
+            elif level == 0:
+                if f in ['.git', 'alsa-kernel', 'sound', 'Makefile.conf', \
+                         'Module.symvers', 'acinclude.m4', 'aclocal.m4', \
+                         'configure', 'toplevel.config']:
+                    continue
+            elif level == 1:
+                if f in ['config.h', 'config1.h']:
+                    continue
+                elif f.startswith('modprobe.work') or f.startswith('alsa-delay'):
+                    continue
+                elif f.startswith('modprobe.test') or f.startswith('alsaloop.'):
+                    continue
+            f1 = path1 + '/' + f
+            f2 = path2 + '/' + f
+            if os.path.islink(f1):
+                continue
+            elif os.path.isdir(f1):
+                do_driver(f1, f2, level + 1)
+            else:
+                do_diff(f1, f2)
+
+    def do_mirror(path1, path2, level=0):
+        for f in listdir(path1):
+            if f.endswith('.mod') or f.endswith('.cmd') or f.endswith('.o') or \
+               f.endswith('.mod.c') or f.endswith('.ko') or f == 'modules.order' or \
+               f.endswith('~') or f.endswith('.orig') or f.endswith('.rej') or \
+               f.endswith('.d') or f.startswith('out.txt'):
+                continue
+            elif level == 0:
+                if f in ['.git', '.gitignore', '.kmirrorpick', '.editmsg']:
+                    continue
+            f1 = path1 + '/' + f
+            f2 = path2 and path2 + '/' + f or f
+            if os.path.islink(f1):
+                continue
+            elif os.path.isdir(f1):
+                do_mirror(f1, f2, level + 1)
+            elif f2.startswith('scripts/'):
+                do_diff(f1, dir + repo3 + '/mirror/' + f2)
+            else:
+                do_diff(f1, dir + repo3 + '/mirror/' + to_kernel_file(f2))
+
+    dir = os.path.expanduser('~/alsa/')
+    repo1 = 'alsa-driver'
+    repo2 = 'alsa-kmirror'
+    repo3 = 'alsa-driver.new'
+    #do_driver(dir + repo1, dir + repo3)
+    do_mirror(dir + repo2, '')
+
+def oneretag(argv=''):
+
+    dir = os.path.expanduser('~/alsa/')
+    repo1 = 'alsa-driver'
+    repo3 = 'alsa-driver.new'
+
+    tags1 = version_sort(os.popen("%s tag" % git(repo1)).readlines())
+    tags1.remove('v1.0.2')
+    tags1.remove('v1.0.2b')
+
+    log3 = git_read_commits(dir + repo3, 'v1.0.1~4', 'HEAD', reverse=True)
+
+    for tag in tags1:
+        log1 = git_read_commits(dir + repo3, tag + '~1', tag)
+        x = log1[0]
+        match = None
+        for l in log3:
+            if l['AuthorDate'] == x['AuthorDate']:
+                match = l
+        if not match:
+            print 'Tag: %s not found' % tag
+            raise ValueError
+        else:
+            if git_system(repo3, "tag -d %s" % (tag)):
+                raise ValueError
+            if git_system(repo3, "branch -l %s %s" % (tag, match['ref'])):
+                raise ValueError
+
 def compile0(repo):
     from dircache import listdir
     dir = tmpdir('compile')
@@ -993,6 +1334,7 @@ def compile0(repo):
         args = ''
         if repo == 'alsa-driver':
             args = ' --with-kernel=$HOME/alsa/alsa-kernel'
+        print "configure%s" % args
         if os.system("./configure%s" % args):
             raise ValueError, "configure"
     if not repo in ['alsa-python']:
@@ -1022,7 +1364,7 @@ def dimport(argv=''):
             raise ValueError, "repo syntax error"
         repo = a
         branch = b
-    return driver_merge('alsa-kmirror', 'master', repo, branch)
+    return driver_merge('alsa-driver', 'master', repo, branch)
 
 def ddiff(argv=''):
     repo = 'alsa-kernel'
@@ -1033,7 +1375,7 @@ def ddiff(argv=''):
             raise ValueError, "repo syntax error"
         repo = a
         branch = b
-    return compare_trees('alsa-kmirror', 'master', repo, branch)
+    return compare_trees('alsa-driver.new', 'master', repo, branch)
 
 def kmerge(argv=''):
     os.chdir(config.ROOT + '/alsa-kernel')
@@ -1099,7 +1441,10 @@ CMDS=[
     ['ddiff', ddiff, '[remote/branch]', 'Show diff between alsa-kmirror tree and specified repo/branch.'],
     ['tolinus', tolinus, 'branch', 'Send a merge request for given branch to linus'],
     ['compile', compile, '', 'Compile all ALSA packages from actual snapshot (compilation test)'],
-    ['kmerge', kmerge, '', 'Merge trees for all ALSA developers']
+    ['kmerge', kmerge, '', 'Merge trees for all ALSA developers'],
+    ['one', one, '', 'Merge alsa-kmirror and alsa-driver trees to one alsa-driver tree'],
+    ['onecheck', onecheck, '', 'Compare integrity of the one alsa-driver tree'],
+    ['oneretag', oneretag, '', 'Retag the one alsa-driver tree']
 ]
  
 def main():
index 19b5fd898db3ad12ce3bb55693110042b71895bd..d28a14b4afe5b3ced792a4eeb37858fd16282394 100644 (file)
@@ -1,5 +1,7 @@
 COMMENT_MAP = {
     "alsa-utils": [
+        ['/alsaloop/.*', 'alsaloop'],
+        ['/alsaucm/.*', 'alsaucm'],
         ['/amixer/.*', 'amixer'],
         ['/alsamixer/.*', 'alsamixer'],
         ['/aplay/.*', 'aplay/arecord'],
@@ -17,6 +19,7 @@ COMMENT_MAP = {
         ['/Makefile.am', 'Core'],
         ['/README', 'Core'],
         ['/INSTALL', 'Core'],
+        ['/COPYING', 'Core'],
         ['/include/gettext.h', 'IGNORE'],
         ['/include/gettext_curses.h', 'IGNORE'],
         ['/po/.*', 'IGNORE'],
@@ -92,6 +95,7 @@ COMMENT_MAP = {
         ['/isa/wavefront', 'Wavefront drivers'],
         ['/isa/als100.c', 'ALS100 driver'],
         ['/isa/azt2320.c', 'AZT2320 driver'],
+        ['/isa/cmi8328.c', 'CMI8328 driver'],
         ['/isa/cmi8330.c', 'CMI8330 driver'],
         ['/isa/dt019x.c', 'DT019x driver'],
         ['/isa/es18xx.c', 'ES18xx driver'],
@@ -100,6 +104,7 @@ COMMENT_MAP = {
         ['/include/sscape_ioctl.h', 'Sound Scape driver'],
         ['/isa/sscape.c', 'Sound Scape driver'],
         ['/isa/adlib.c', 'Adlib FM driver'],
+        ['/isa/galaxy/.*', 'Aztech AZT1605 (galaxy) driver'],
         ['/isa', 'ERROR'],
         ['/include/ak4531_codec.h', 'AK4531 codec'],
         ['/pci/ac97/ak4531_codec.c', 'AK4531 codec'],
@@ -175,6 +180,7 @@ COMMENT_MAP = {
         ['/pci/aw2/.*', 'Emagic Audiowerk 2'],
         ['/pci/lx6464es/.*', 'LX6464ES'],
         ['/pci/ctxfi/.*', 'Creative Sound Blaster X-Fi (20K1/20K2)'],
+        ['/pci/lola/.*', 'Digigram Lola PCI-e boards'],
         ['/pci', 'ERROR'],
         ['/ppc/Makefile', 'PPC'],
         ['/ppc/Kconfig', 'PPC'],
@@ -246,15 +252,34 @@ COMMENT_MAP = {
         ['/include/soc.h', 'SoC Layer'],
         ['/include/soc-of-simple.h', 'SoC Layer'],
         ['/include/soc-dapm.h', 'SoC Dynamic Audio Power Management'],
+        ['/include/soc-dpcm.h', 'SoC Dynamic PCM'],
         ['/include/l3.h', 'SoC L3 bus'],
         ['/include/uda134x.h', 'SoC Codec Philips UDA134x'],
         ['/include/s3c24xx_uda134x.h', 'SoC Audio for the Samsung S3C24XX chips'],
         ['/include/soc-dai.h', 'SoC Layer'],
+        ['/include/simple_card.h', 'SoC Layer'],
         ['/soc/codecs/Kconfig', 'SoC Layer'],
         ['/soc/codecs/l3.(c|h)', 'SoC L3 bus'],
         ['/soc/codecs/ac97.(c|h)', 'SoC Codec AC97'],
+        ['/soc/codecs/ab8500-codec.(c|h)', 'SoC Codec AB8500'],
+        ['/soc/codecs/arizona.(c|h)', 'SoC Codec Wolfson Arizona'],
+        ['/soc/codecs/wl1273.(c|h)', 'SoC Codec WL1273'],
+        ['/soc/codecs/dmic.(c|h)', 'SoC Codec General Digital MICs'],
+        ['/soc/codecs/88pm860x-codec.(c|h)', 'SoC Codec 88PM860x'],
+        ['/include/alc5623.h', 'SoC Codec alc5621/2/3'],
+        ['/soc/codecs/alc5623.(c|h)', 'SoC Codec alc5621/2/3'],
+        ['/soc/codecs/alc5632.(c|h)', 'SoC Codec alc5632'],
+        ['/include/wm1250-ev1.h', 'SoC Codec WM1250-EV1'],
+        ['/soc/codecs/wm1250-ev1.(c|h)', 'SoC Codec WM1250-EV1'],
         ['/include/wm2000.h', 'SoC Codec WM2000'],
         ['/soc/codecs/wm2000.(c|h)', 'SoC Codec WM2000'],
+        ['/include/wm2200.(c|h)', 'SoC Codec WM2200'],
+        ['/soc/codecs/wm2200.(c|h)', 'SoC Codec WM2200'],
+        ['/include/wm5100.h', 'SoC Codec WM5100'],
+        ['/soc/codecs/wm5100.(c|h)', 'SoC Codec WM5100'],
+        ['/soc/codecs/wm5100-tables.(c|h)', 'SoC Codec WM5100'],
+        ['/soc/codecs/wm5102.(c|h)', 'SoC Codec WM5102'],
+        ['/soc/codecs/wm5110.(c|h)', 'SoC Codec WM5110'],
         ['/soc/codecs/wm8350.(c|h)', 'SoC Codec WM8350'],
         ['/soc/codecs/wm8400.(c|h)', 'SoC Codec WM8400'],
         ['/soc/codecs/wm8510.(c|h)', 'SoC Codec WM8510'],
@@ -265,36 +290,60 @@ COMMENT_MAP = {
         ['/soc/codecs/wm8727.(c|h)', 'SoC Codec WM8727'],
         ['/soc/codecs/wm8728.(c|h)', 'SoC Codec WM8728'],
         ['/soc/codecs/wm8731.(c|h)', 'SoC Codec WM8731'],
+        ['/soc/codecs/wm8737.(c|h)', 'SoC Codec WM8737'],
+        ['/soc/codecs/wm8741.(c|h)', 'SoC Codec WM8741'],
         ['/soc/codecs/wm8750.(c|h)', 'SoC Codec WM8750'],
         ['/soc/codecs/wm8753.(c|h)', 'SoC Codec WM8753'],
+        ['/soc/codecs/wm8770.(c|h)', 'SoC Codec WM8770'],
         ['/soc/codecs/wm8776.(c|h)', 'SoC Codec WM8776'],
+        ['/soc/codecs/wm8782.(c|h)', 'SoC Codec WM8782'],
         ['/soc/codecs/wm8794.(c|h)', 'SoC Codec WM8794'],
+        ['/soc/codecs/wm8804.(c|h)', 'SoC Codec WM8804'],
         ['/soc/codecs/wm8900.(c|h)', 'SoC Codec WM8900'],
         ['/include/wm8903.h', 'SoC Codec WM8903'],
         ['/soc/codecs/wm8903.(c|h)', 'SoC Codec WM8903'],
         ['/include/wm8904.h', 'SoC Codec WM8904'],
         ['/soc/codecs/wm8904.(c|h)', 'SoC Codec WM8904'],
+        ['/include/wm8915.h', 'SoC Codec WM8915'],
+        ['/soc/codecs/wm8915.(c|h)', 'SoC Codec WM8915'],
         ['/soc/codecs/wm8940.(c|h)', 'SoC Codec WM8940'],
         ['/include/wm8955.h', 'SoC Codec WM8955'],
         ['/soc/codecs/wm8955.(c|h)', 'SoC Codec WM8955'],
+        ['/soc/codecs/wm8958-dsp2.(c|h)', 'SoC Codec WM8958'],
         ['/include/wm8960.h', 'SoC Codec WM8960'],
         ['/soc/codecs/wm8960.(c|h)', 'SoC Codec WM8960'],
         ['/soc/codecs/wm8961.(c|h)', 'SoC Codec WM8961'],
+        ['/include/wm8962.h', 'SoC Codec WM8962'],
+        ['/soc/codecs/wm8962.(c|h)', 'SoC Codec WM8962'],
+        ['/soc/codecs/wm8962-tables.(c|h)', 'SoC Codec WM8962'],
         ['/soc/codecs/wm8971.(c|h)', 'SoC Codec WM8971'],
         ['/soc/codecs/wm8974.(c|h)', 'SoC Codec WM8974'],
         ['/soc/codecs/wm8978.(c|h)', 'SoC Codec WM8978'],
+        ['/soc/codecs/wm8983.(c|h)', 'SoC Codec WM8983'],
+        ['/soc/codecs/wm8985.(c|h)', 'SoC Codec WM8985'],
         ['/soc/codecs/wm8988.(c|h)', 'SoC Codec WM8988'],
         ['/soc/codecs/wm8990.(c|h)', 'SoC Codec WM8990'],
+        ['/soc/codecs/wm8991.(c|h)', 'SoC Codec WM8991'],
         ['/soc/codecs/wm_hubs.(c|h)', 'SoC Codec WM8993/4'],
         ['/include/wm8993.h', 'SoC Codec WM8993/4'],
         ['/soc/codecs/wm8993.(c|h)', 'SoC Codec WM8993/4'],
         ['/soc/codecs/wm8994.(c|h)', 'SoC Codec WM8994'],
+        ['/soc/codecs/wm8994-tables.(c|h)', 'SoC Codec WM8994'],
+        ['/soc/codecs/wm8995.(c|h)', 'SoC Codec WM8995'],
+        ['/include/wm8996.h', 'SoC Codec WM8996'],
+        ['/soc/codecs/wm8996.(c|h)', 'SoC Codec WM8996'],
         ['/include/wm9081.h', 'SoC Codec WM9081'],
         ['/soc/codecs/wm9081.(c|h)', 'SoC Codec WM9081'],
+        ['/include/wm9090.h', 'SoC Codec WM9090'],
+        ['/soc/codecs/wm9090.(c|h)', 'SoC Codec WM9090'],
         ['/soc/codecs/wm9705.(c|h)', 'SoC Codec WM9705'],
         ['/soc/codecs/wm9712.(c|h)', 'SoC Codec WM9712'],
         ['/soc/codecs/wm9713.(c|h)', 'SoC Codec WM9713'],
         ['/soc/codecs/cs4270.(c|h)', 'SoC Codec CS4270'],
+        ['/soc/codecs/cs42l51.(c|h)', 'SoC Codec CS42L51'],
+        ['/include/cs42l52.(c|h)', 'SoC Codec CS42L52'],
+        ['/soc/codecs/cs42l52.(c|h)', 'SoC Codec CS42L52'],
+        ['/soc/codecs/cs42l73.(c|h)', 'SoC Codec CS42L73'],
         ['/soc/codecs/ad1836.(c|h)', 'SoC Codec AD1836'],
         ['/soc/codecs/ad1938.(c|h)', 'SoC Codec AD1938'],
         ['/soc/codecs/ad193x.(c|h)', 'SoC Codec AD193X'],
@@ -302,6 +351,7 @@ COMMENT_MAP = {
         ['/soc/codecs/ad1980.(c|h)', 'SoC Codec AD1980'],
         ['/soc/codecs/tlv320aic23.(c|h)', 'SoC Codec TLV320AIC23'],
         ['/soc/codecs/tlv320aic26.(c|h)', 'SoC Codec TLV320AIC26'],
+        ['/include/tlv320aic3x.h', 'SoC Codec TLV320AIC3X'],
         ['/soc/codecs/tlv320aic3x.(c|h)', 'SoC Codec TLV320AIC3X'],
         ['/include/tlv320dac33-plat.h', 'SoC Codec TLV320DAC33'],
         ['/soc/codecs/tlv320dac33.(c|h)', 'SoC Codec TLV320DAC33'],
@@ -309,6 +359,8 @@ COMMENT_MAP = {
         ['/soc/codecs/uda1380.(c|h)', 'SoC Codec Philips UDA1380'],
         ['/soc/codecs/ak4104.(c|h)', 'SoC Codec AK4104'],
         ['/soc/codecs/ak4535.(c|h)', 'SoC Codec AK4535'],
+        ['/include/ak4641.h', 'SoC Codec AK4641'],
+        ['/soc/codecs/ak4641.(c|h)', 'SoC Codec AK4641'],
         ['/soc/codecs/ak4642.(c|h)', 'SoC Codec AK4642'],
         ['/soc/codecs/ak4671.(c|h)', 'SoC Codec AK4671'],
         ['/soc/codecs/ssm2602.(c|h)', 'SoC Codec SSM2602'],
@@ -317,20 +369,54 @@ COMMENT_MAP = {
         ['/soc/codecs/twl6040.(c|h)', 'SoC Codec TWL6040'],
         ['/soc/codecs/pcm3008.(c|h)', 'SoC Codec PCM3008'],
         ['/soc/codecs/cx20442.(c|h)', 'SoC Codec CX20442'],
+        ['/include/max9768.h', 'SoC Codec MAX9768'],
+        ['/soc/codecs/max9768.(c|h)', 'SoC Codec MAX9768'],
         ['/soc/codecs/max9877.(c|h)', 'SoC Codec MAX9877'],
+        ['/include/max98088.h', 'SoC Codec MAX98088'],
+        ['/soc/codecs/max98088.(c|h)', 'SoC Codec MAX98088'],
+        ['/soc/codecs/mc13783.(c|h)', 'SoC Codec MC13783'],
         ['/soc/codecs/stac9766.(c|h)', 'SoC Codec STAC9766'],
         ['/soc/codecs/spdif_transciever.(c|h)', 'SoC Codec DIT SPDI/F'],
         ['/soc/codecs/ads117x.(c|h)', 'SoC Codec ads1174/8'],
         ['/soc/codecs/da7210.(c|h)', 'SoC Codec DA7210'],
+        ['/soc/codecs/da732x.*.(c|h)', 'SoC Codec DA732x'],
         ['/soc/codecs/cq93vc.(c|h)', 'SoC Codec CQ0093 Voice'],
         ['/include/tpa6130a2-plat.h', 'SoC Codec TPA6130A2'],
         ['/soc/codecs/tpa6130a2.(c|h)', 'SoC Codec TPA6130A2'],
+        ['/soc/codecs/sn95031.(c|h)', 'SoC Codec TI sn95031'],
+        ['/soc/codecs/jz4740.(c|h)', 'SoC Codec Ingenic JZ4740'],
+        ['/include/cs4271.h', 'SoC Codec Cirrus Logic CS4271'],
+        ['/soc/codecs/cs4271.(c|h)', 'SoC Codec Cirrus Logic CS4271'],
+        ['/soc/codecs/sgtl5000.(c|h)', 'SoC Codec Freescale SGTL5000'],
+        ['/include/sta32x.h', 'Soc Codec STA32X'],
+        ['/soc/codecs/sta32x.(c|h)', 'SoC Codec STA32X'],
+        ['/soc/codecs/sta529.(c|h)', 'SoC Codec STA529'],
+        ['/soc/codecs/rt5631.(c|h)', 'SoC Codec RT5631'],
+        ['/soc/codecs/max9850.(c|h)', 'SoC Codec MAX9850'],
+        ['/include/max98095.h', 'SoC Codec MAX98095'],
+        ['/soc/codecs/max98095.(c|h)', 'SoC Codec MAX98095'],
+        ['/include/tlv320aic32x4.h', 'SoC Codec tlv320aic32x4'],
+        ['/soc/codecs/tlv320aic32x4.(c|h)', 'SoC Codec tlv320aic32x4'],
+        ['/include/adau1373.h', 'SoC Codec ADAU1373'],
+        ['/soc/codecs/adau1373.(c|h)', 'SoC Codec ADAU1373'],
+        ['/soc/codecs/adau1701.(c|h)', 'SoC Codec ADAU1701'],
+        ['/soc/codecs/lm4857.(c|h)', 'SoC Codec LM4857'],
+        ['/soc/codecs/lm49453.(c|h)', 'SoC Codec LM49453'],
+        ['/soc/codecs/adav80x.(c|h)', 'SoC Codec ADAV80x'],
+        ['/soc/codecs/sigmadsp.(c|h)', 'SoC Codec SigmaDSP Firmare Loader'],
+        ['/soc/codecs/dfbmcs320.(c|h)', 'SoC Codec DFBM-CS320 bluethooth'],
+        ['/soc/codecs/isabelle.(c|h)', 'SoC Codec Isabelle'],
+        ['/soc/codecs/spdif_receiver.(c|h)', 'SoC Codec SPDIF Receiver Stub'],
+        ['/soc/codecs/ml26124.(c|h)', 'SoC Codec Lapis ML26124'],
+        ['/soc/codecs/omap-hdmi.(c|h)', 'SoC Codec OMAP HDMI'],
         ['/soc/codecs', 'ERROR'],
         ['/soc/atmel/.*', 'SoC Audio for the Atmel AT32/AT91 System-on-Chip'],
         ['/soc/at32/.*', 'SoC Audio for the Atmel AT32 System-on-Chip'],
         ['/soc/at91/.*', 'SoC Audio for the Atmel AT91 System-on-Chip'],
         ['/soc/imx/.*', 'SoC Audio for Freecale i.MX1x i.MX2x CPUs'],
         ['/soc/txx9/.*', 'SoC Audio for TXx9'],
+        ['/soc/pxa/tavorevb3.c', 'SoC PXA2xx 88PM860x Tavor EVB3'],
+        ['/soc/pxa/saarb.c', 'SoC PXA2xx saarb'],
         ['/soc/pxa/z2.c', 'SoC PXA2xx Aeronix Zipit Z2'],
         ['/soc/pxa/spitz.c', 'SoC PXA2xx Spitz'],
         ['/soc/pxa/corgi.c', 'SoC PXA2xx Corgi'],
@@ -347,8 +433,14 @@ COMMENT_MAP = {
         ['/soc/pxa/magician.c', 'Soc PXA2xx Magician'],
         ['/soc/pxa/imote2.c', 'Soc PXA2xx Imote 2'],
         ['/soc/pxa/raumfeld.c', 'Soc PXA2xx Raumfeld'],
+        ['/soc/pxa/hx4700.c', 'Soc iPAQ hx4700'],
+        ['/soc/pxa/ttc-dkb.c', 'Soc TTC DKB'],
+        ['/soc/pxa/brownstone.c', 'Soc Brownstone'],
+        ['/soc/pxa/mmp-sspa.(c|h)', 'Soc MMP'],
+        ['/soc/pxa/mmp-pcm.(c|h)', 'Soc MMP'],
         ['/soc/pxa/Kconfig', 'SoC PXA2xx Core'],
         ['/soc/s3c24xx/.*', 'SoC Audio for the Samsung S3C24XX chips'],
+        ['/soc/samsung/.*', 'SoC Audio for the Samsung chips'],
         ['/include/sh_fsi.h', 'SoC FSI SH7724'],
         ['/soc/sh/.*', 'SoC SH7760 AC97'],
         ['/soc/fsl/.*', 'SoC Freescale'],
@@ -356,20 +448,41 @@ COMMENT_MAP = {
         ['/soc/omap/.*', 'SoC Texas Instruments OMAP'],
         ['/soc/au1x/.*', 'Au12x0/Au1550 PSC ASoC'],
         ['/soc/blackfin/.*', 'SoC Blackfin'],
+        ['/soc/mid-x86/.*', 'SoC Intel Medfield MID platform'],
+        ['/soc/tegra/.*', 'SoC NVIDIA Tegra'],
+        ['/soc/jz4740/.*', 'SoC Ingenic JZ4740'],
         ['/soc/s6000/.*', 'SoC S6000'],
+        ['/soc/ep93xx/.*', 'SoC EP93XX'],
+        ['/soc/kirkwood/.*', 'SoC Marvell Kirkwood'],
+        ['/soc/nuc900/.*', 'SoC Nuvoton NUC900'],
+        ['/include/saif.h', 'SoC MXS'],
+        ['/soc/mxs/.*', 'SoC MXS'],
+        ['/soc/ux500/.*', 'SoC UX500'],
+        ['/include/designware.*.h', 'SoC Designware'],
+        ['/soc/dwc/.*', 'SoC Designware'],
+        ['/include/spear.*.h', 'SoC SPEAr'],
+        ['/soc/spear/.*', 'SoC SPEAr'],
+        ['/soc/generic/.*', 'SoC Generic'],
         ['/soc/soc-cache.*', 'SoC Layer'],
         ['/soc/soc-core.*', 'SoC Layer'],
         ['/soc/soc-jack.*', 'SoC Layer'],
         ['/soc/soc-utils.*', 'SoC Layer'],
-        ['/soc/Kconfig', 'SoC Layer'],
+        ['/soc/soc-io.*', 'SoC Layer'],
+        ['/soc/soc-pcm.*', 'SoC Layer'],
+        ['/include/dmaengine_pcm.*', 'SoC Layer'],
+        ['/soc/soc-dmaengine-pcm.*', 'SoC Layer'],
         ['/soc/soc-dapm.c', 'SoC Dynamic Audio Power Management'],
+        ['/soc/Kconfig', 'SoC Layer'],
         ['/soc', 'ERROR'],
+        ['/include/usb_wrapper.h', 'USB'],
         ['/usb/usx2y/.*', 'USB USX2Y'],
         ['/usb/caiaq/.*', 'USB caiaq'],
+        ['/usb/6fire/.*', 'USB TerraTec DMX 6Fire'],
         ['/usb/misc/ua101.(c|h)', 'USB Edirol UA101 driver'],
         ['/usb/Kconfig', 'USB'],
         ['/usb/Makefile', 'USB'],
         ['/usb/card.(c|h|inc|patch)', 'USB generic driver'],
+        ['/usb/clock.(c|h|inc|patch)', 'USB generic driver'],
         ['/usb/midi.(c|h|inc|patch)', 'USB generic driver'],
         ['/usb/usbmidi.(c|h|inc|patch)', 'USB generic driver'],
         ['/usb/mixer.(c|h|inc|patch)', 'USB generic driver'],
@@ -389,13 +502,17 @@ COMMENT_MAP = {
         ['/usb/proc.(c|h)', 'USB generic driver'],
         ['/usb/mixer_maps.c', 'USB generic driver'],
         ['/usb/usbcompat.(c|h)', 'USB generic driver'],
+        ['/usb/stream.(c|h|patch)', 'USB generic driver'],
+        ['/usb/power.(c|h|patch)', 'USB generic driver'],
         ['/usb/ua101.(c|h)', 'USB Edirol UA101 driver'],
         ['/usb', 'ERROR'],
+        ['/firewire/.*', 'Firewire driver'],
         ['/include/atmel-abdac.h', 'Atmel on-chip Audio Bitstream DAC (ABDAC)'],
         ['/include/atmel-ac97c.h', 'Atmel on-chip Audio Bitstream DAC (ABDAC)'],
         ['/atmel/.*', 'Atmel on-chip Audio Bitstream DAC (ABDAC)'],
         ['/include/hal2.h', 'HAL2 driver'],
         ['/hal2/.*', 'HAL2 driver'],
+        ['/include/snd-aoa-hack.h', 'SuperH DAC audio driver'],
         ['/aoa/.*', 'Apple Onboard Audio driver'],
         ['/include/sh_dac_audio.h', 'SuperH DAC audio driver'],
         ['/sh/sh_dac_audio.c', 'SuperH DAC audio driver'],
@@ -443,17 +560,23 @@ COMMENT_MAP = {
         ['/include/info.h', 'ALSA Core'],
         ['/include/core.h', 'ALSA Core'],
         ['/include/memalloc.h', 'ALSA Core'],
+        ['/include/kconfig.h', 'ALSA Core'],
         ['/include/config.h.in', 'ALSA Core'],
+        ['/include/config-top.h', 'ALSA Core'],
         ['/include/.*_compat.h', 'ALSA Core'],
         ['/include/compat_22.h', 'ALSA Core'],
         ['/include/linux/pci_ids.h', 'ALSA Core'],
         ['/include/autoconf.*', 'ALSA Core'],
         ['/include/alsa-autoconf.*', 'ALSA Core'],
         ['/include/platform_device_compat.h', 'ALSA Core'],
+        ['/include/tracepoint_workaround.h', 'ALSA Core'],
         ['/include/typedefs.h', 'ALSA Core'],
         ['/include/old/gf1.h', 'OLD GF1 header'],
         ['/include/old/.*.h', 'OLD headers'],
         ['/include/ppc-prom-hack.h', 'ALSA Core'],
+        ['/include/compress_driver.h', 'ALSA Core'],
+        ['/include/compress_offload.h', 'ALSA Core'],
+        ['/include/compress_params.h', 'ALSA Core'],
         ['/include/Kbuild', 'ALSA Core'],
         ['/core/info.*', 'ALSA Core'],
         ['/core/control.*', 'ALSA Core'],
@@ -463,6 +586,8 @@ COMMENT_MAP = {
         ['/core/memory.*', 'ALSA Core'],
         ['/core/misc.*', 'ALSA Core'],
         ['/core/wrappers.*', 'ALSA Core'],
+        ['/core/compress_offload.*', 'ALSA Core'],
+        ['/core/ctljack.*', 'ALSA Core'],
         ['/core/pci_compat_22.c', 'ALSA Core'],
         ['/core/Makefile', 'ALSA Core'],
         ['/core', 'ERROR'],
@@ -524,6 +649,8 @@ COMMENT_MAP = {
         ['/sscape_ctl/.*', 'sscape_ctl'],
         ['/usx2yloader/.*', 'usx2yloader'],
         ['/hwmixvolume/.*', 'hwmixvolume'],
+        ['/hda-verb/.*', 'hda-verb'],
+        ['/hdajackretask/.*', 'HDA Jack Retask'],
         ['/seq/sbiload/.*', 'sbiload'],
         ['/seq/cvscompile', 'Core'],
         ['/seq/hgcompile', 'Core'],
@@ -542,6 +669,7 @@ COMMENT_MAP = {
         ['/include/local.*', 'Core'],
         ['/include/global*', 'Core'],
         ['/include/conv.h', 'Core'],
+        ['/include/list.h', 'Core'],
         ['/include/error.h', 'Core'],
         ['/include/conf.h', 'Config API'],
         ['/include/control.h', 'Control API'],
@@ -565,6 +693,8 @@ COMMENT_MAP = {
         ['/include/pcm_rate.h', 'External Rate Converter Plugin SDK'],
         ['/include/alsa-symbols.h', 'Core'],
         ['/include/iatomic.h', 'Core'],
+        ['/include/use-case.h', 'Use Case Manager API'],
+        ['/src/use-case.c', 'Use Case Manager API'],
         ['/src/control/.*', 'Control API'],
         ['/src/mixer/.*', 'Mixer API'],
         ['/include/pcm.h', 'PCM API'],
@@ -575,6 +705,7 @@ COMMENT_MAP = {
         ['/src/seq/.*', 'Sequencer API'],
         ['/src/instr/.*', 'Instrument API'],
         ['/src/hwdep/.*', 'HWDEP API'],
+        ['/src/ucm/.*', 'Use Case Manager API'],
         ['/src/ordinary_mixer/.*', 'Mixer Ordinary API'],
         ['/src/ordinary_pcm/.*', 'PCM Ordinary API'],
         ['/src/input.*', 'I/O subsystem'],
@@ -688,4 +819,20 @@ COMMENT_MAP = {
         ['/gitcompile', 'Core'],
         ['/', 'ERROR'],
     ],
-}
\ No newline at end of file
+}
+
+class CommentRegex:
+
+    def __init__(self):
+        from re import compile
+        self.c = {}
+        for m in COMMENT_MAP:
+            self.c[m] = []
+            for l in COMMENT_MAP[m]:
+                self.c[m].append([compile('^' + l[0]), l[1]])
+    
+    def search(self, module, file):
+        for l in self.c[module]:
+            if l[0].search(file):
+                return l[1]
+        return 'ERROR'
index c6a7941e3821a2fb30b52d405e7cb4edb9aeba85..d732f06f712d4168a8a7b1b37b6e50f46ae86ef1 100644 (file)
--- a/config.py
+++ b/config.py
@@ -6,11 +6,13 @@ import os
 ROOT = os.path.abspath(os.getcwd())
 USER = os.getenv('USER')
 VERBOSE = False
+GIT_DEBUG = False
 GERRORS = 0
+GERRORSA = []
 TMPDIR = '/dev/shm/alsatool'
 SMTP_SERVER = 'localhost'
-GIT_KERNEL_MERGE = 'v2.6.33'
-GIT_DRIVER_MERGE = 'v1.0.22'
+GIT_KERNEL_MERGE = 'v3.3'
+GIT_DRIVER_MERGE = 'v1.0.24'
 GIT_MERGE_REPOS = [
         ('git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git', 'master', 'linux-2.6', 'http://www.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git'),
         ('git://git.alsa-project.org/alsa-kernel.git', 'fixes', 'perex-fixes', 'http://git.alsa-project.org/http/alsa-kernel.git'),
@@ -20,7 +22,7 @@ GIT_MERGE_REPOS = [
         ('git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git', 'topic/asoc', 'tiwai-topic-asoc', 'http://www.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git')
 ]
 REPOSITORIES = [
-        'alsa', 'alsa-driver', 'alsa-kmirror', 'alsa-lib', 'alsa-utils',
+        'alsa', 'alsa-driver', 'alsa-lib', 'alsa-utils',
         'alsa-tools', 'alsa-firmware', 'alsa-oss', 'alsa-plugins',
         'alsa-python'
 ]        
@@ -32,12 +34,12 @@ ALSA_FILES = (
 NOT_ALSA_FILES = (
        'sound/oss/',
 )
-ALSA_TRANSLATE = {
-        'Documentation/DocBook/alsa-driver-api.tmpl': 'Documentation/DocBook/alsa-driver-api.tmpl',
-        'Documentation/sound/alsa/':        'Documentation/',
-        'include/sound/':                   'include/',
-        'sound/':                           ''
-}
-ALSA_RTRANSLATE = {}
-for i in ALSA_TRANSLATE:
-  ALSA_RTRANSLATE[ALSA_TRANSLATE[i]] = i
+ALSA_TRANSLATE = [
+        ('Documentation/DocBook/alsa-driver-api.tmpl', 'Documentation/DocBook/alsa-driver-api.tmpl'),
+        ('Documentation/sound/alsa/', 'Documentation/'),
+        ('include/sound/', 'include/'),
+        ('sound/', '')
+]
+ALSA_RTRANSLATE = []
+for i in range(len(ALSA_TRANSLATE)):
+  ALSA_RTRANSLATE.append((ALSA_TRANSLATE[i][1], ALSA_TRANSLATE[i][0]))
index 4c4c626f82ed5f3604573ea15abc9ee481fa3cbb..996558d6042072f56b5726e49920665e1a1cde8c 100644 (file)
@@ -2,10 +2,10 @@
 
 import config
 from sys import exit, stdin, stderr, stdout
-from os import popen, mkdir, system, chdir, getcwd, remove
-from os.path import isdir, exists
+from os import popen, mkdir, system, chdir, getcwd, remove, listdir
+from os.path import isdir, exists, split
 from shutil import rmtree
-from utils import git_popen, git_system, git_repo, is_alsa_file, to_alsa_file, \
+from utils import git_popen, git_system, git_repo, is_alsa_file, to_alsa_file2, \
                   tmpfile, tmpdir, diff_compare2, to_kernel_file, \
                   git_read_commits, raw_subject
 import re
@@ -31,9 +31,27 @@ def check_email(lines, fullemail, commit = False):
         return True
     return True
 
-def analyze_diff(fp, full=False, filter_git=False):
+def analyze_diff(fp, full=False, filter_git=False,
+                 filecheck=is_alsa_file, fileconv=to_alsa_file2):
+
+    def afile(file, prefix):
+        if file.startswith('/dev/'):
+            return file
+        return prefix + file
+
+    def hdr(rlines, addfiles, rmfiles, afile1, afile2):
+      rlines.append('diff --git %s %s\n' % (afile(afile1, 'a/'), afile(afile2, 'b/')))
+      rlines += hlines
+      if hlines and (hlines[0].startswith('new file mode ') or \
+         hlines[0].startswith('old mode ')):
+        addfiles.append(afile2)
+      elif hlines and hlines[0].startswith('deleted file mode '):
+        rmfiles.append(afile1)
+
     rlines = []
+    hlines = []
     ok = False
+    header = False
     addfiles = []
     rmfiles = []
     start = True
@@ -41,32 +59,57 @@ def analyze_diff(fp, full=False, filter_git=False):
         line = fp.readline()
         if not line:
             break
-        if filter_git and line.startswith('index ') and line.find('..') > 0:
-            continue
+        if filter_git:
+            if line.startswith('index ') and line.find('..') > 0:
+                continue
+            if line.startswith('new file mode '):
+                continue
+            if line.startswith('old mode '):
+                continue
+            if line.startswith('new mode '):
+                continue
         if line.startswith('diff --git a/'):
+            if header and ok:
+                hdr(rlines, addfiles, rmfiles, afile1, afile2)
             start = False
+            header = True
+            hlines = []
             file1, file2 = line[11:].split(' ')
             file1 = file1.strip()
             file2 = file2.strip()
-            ok1 = is_alsa_file(file1[2:])
-            ok2 = is_alsa_file(file2[2:])
+            ok1 = filecheck(file1[2:])
+            ok2 = filecheck(file2[2:])
             ok = False
             if ok1 or ok2:
-                afile1 = to_alsa_file(file1, 'a/')
-                afile2 = to_alsa_file(file2, 'b/')
-                rlines.append('diff --git %s %s\n' % (afile1, afile2))
-                addfiles.append(to_alsa_file(file1, 'a/')[2:])
+                afile1 = fileconv(file1, 'a/')
+                afile2 = fileconv(file2, 'b/')
                 ok = True
-        elif ok and (line.startswith('--- a/') or line.startswith('+++ b/')):
-            rlines.append(line[:6] + to_alsa_file(line[6:].strip()) + '\n')
+        elif ok and line.startswith('--- /dev/null'):
+            afile1 = line[4:].strip()
+        elif ok and line.startswith('--- a/'):
+            afile1 = fileconv(line[6:].strip())
+        elif ok and line.startswith('+++ b/'):
+            afile2 = fileconv(line[6:].strip())
+            rlines.append('diff --git %s %s\n' % (afile1, afile2))
+            rlines += hlines
+            rlines.append('--- %s\n' % afile(afile1, 'a/'))
+            rlines.append('+++ %s\n' % afile(afile2, 'b/'))
+            addfiles.append(afile2)
+            header = False
         elif ok and line.startswith('+++ /dev/null'):
-            spec = to_alsa_file(file1, 'a/')[2:]
-            rmfiles.append(spec)
-            addfiles.remove(spec)
-            rlines.append(line)
+            rmfiles.append(afile1)
+            rlines.append('diff --git %s %s\n' % (afile1, '/dev/null'))
+            rlines += hlines
+            rlines.append('--- %s\n' % afile(afile1, 'a/'))
+            rlines.append('+++ /dev/null\n')
+            header = False
+        elif header:
+            hlines.append(line)
         elif ok or (full and start):
             rlines.append(line)
     fp.close()
+    if header and ok:
+        hdr(rlines, addfiles, rmfiles, afile1, afile2)
     return rlines, addfiles, rmfiles
 
 def commit_is_merged(commit, driver_commits):
@@ -83,29 +126,36 @@ def commit_is_merged_diff(driver_repo, kernel_repo, commit):
     for f in commit['files']:
         if not is_alsa_file(f):
             continue
-        a = to_alsa_file(f)
-        lines = popen("diff -u %s %s 2> /dev/null" % (git_repo(driver_repo) + '/' + a, git_repo(kernel_repo) + '/' + f)).readlines()
+        src = git_repo(driver_repo) + '/' + to_alsa_file2(f)
+        dst = git_repo(kernel_repo) + '/' + f
+        lines = popen("diff -uN %s %s 2> /dev/null" % (src, dst)).readlines()
         if lines:
             ok = False
             break
     return ok
 
-def try_to_merge(driver_repo, driver_branch, kernel_repo, commit):
+def try_to_merge(driver_repo, driver_branch, src_repo, commit,
+                 filecheck=is_alsa_file, fileconv=to_alsa_file2,
+                 do_checkout=True):
     comment = commit['comment'].splitlines()
     ref = commit['ref']
 
     print 'Merging %s %s' % (ref[:7], comment[0])
 
-    fp = git_popen(kernel_repo, "diff %s~1..%s" % (ref, ref))
-    rlines, addfiles, rmfiles = analyze_diff(fp)
+    #fp = git_popen(src_repo, "diff --binary %s~1..%s" % (ref, ref))
+    root = ''
+    if 'root_flag' in commit and commit['root_flag']:
+      root = '--root '
+    fp = git_popen(src_repo, "diff-tree -p --binary %s%s" % (root, ref))
+    rlines, addfiles, rmfiles = analyze_diff(fp, filecheck=filecheck, fileconv=fileconv)
     fp.close()
 
-    patchfile = tmpfile('alsa-kmirror-patch')
+    patchfile = tmpfile('alsa-merge-patch')
     fp = open(patchfile, 'w+')
     fp.write(''.join(rlines))
     fp.close()
 
-    commentfile = tmpfile('alsa-kmirror-comment')
+    commentfile = tmpfile('alsa-merge-comment')
     fp = open(commentfile, 'w+')
     fp.write(''.join(commit['comment']))
     fp.close()
@@ -123,10 +173,12 @@ def try_to_merge(driver_repo, driver_branch, kernel_repo, commit):
     exports += 'export GIT_COMMITTER_DATE="%s"' % commit['CommitDate']
 
     curdir = getcwd()
-    if git_system(driver_repo, "checkout -q %s" % driver_branch):
+    if do_checkout and git_system(driver_repo, "checkout -q %s" % driver_branch):
         raise ValueError, 'git checkout'
+
     chdir(git_repo(driver_repo))
-    lines = popen("LANG=C patch -f -p 1 --dry-run --global-reject-file=%s < %s" % (tmpfile("rejects"), patchfile)).readlines()
+    lines = popen("LANG=C patch -f -p 1 --dry-run --reject-file=%s < %s" % (tmpfile("rejects"), patchfile)).readlines()
+    print ''.join(lines)
     failed = fuzz = succeed = 0
     for line in lines:
       if line.find('FAILED') >= 0:
@@ -139,12 +191,22 @@ def try_to_merge(driver_repo, driver_branch, kernel_repo, commit):
     if failed:
        print 'Merge skipped %s %s (%s failed)' % (ref[:7], comment[0], failed)
         chdir(curdir)
+        if do_checkout and \
+           ref[:7] in ['bdb527e', 'fc5b15f', '82b1d73', \
+                       '02a237b', 'ef8d60f', 'c0fa6c8', \
+                       '1605282', '3946860', 'd70f363', \
+                       '6539799', '152a3a7', '79980d9']:
+          print '  It is probably OK...'
+          return False
+        raise ValueError
         return False
-    if git_system(driver_repo, "apply --check %s" % patchfile):
+    if git_system(driver_repo, "apply --check --binary --allow-binary-replacement %s" % patchfile):
        print 'Merge skipped %s %s (apply check)' % (ref[:7], comment[0])
         chdir(curdir)
+        if not do_checkout:
+          raise ValueError
         return False
-    if git_system(driver_repo, "apply %s" % patchfile):
+    if git_system(driver_repo, "apply --binary --allow-binary-replacement %s" % patchfile):
         chdir(curdir)
         raise ValueError, 'git apply'
     if addfiles and git_system(driver_repo, "add %s" % ' '.join(addfiles)):
@@ -240,66 +302,68 @@ def try_to_merge_hard(driver_repo, driver_branch, kernel_repo, kernel_branch, co
 
 def compare_trees(driver_repo, driver_branch, kernel_repo, kernel_branch):
     print 'comparing %s/%s (old) and %s/%s (new) repos' % (driver_repo, driver_branch, kernel_repo, kernel_branch)
-    worktree = tmpdir('alsa-kmirror-repo')
+    worktree = tmpdir('alsa-driver-repo')
     worktreek = tmpdir('alsa-kernel-repo')
     rmtree(worktree, ignore_errors=True)
     rmtree(worktreek, ignore_errors=True)
     mkdir(worktree)
     mkdir(worktreek)
-    if git_system(driver_repo, "archive --format=tar %s | tar xf - -C %s" % (driver_branch, worktree)):
-        raise ValueError, 'git export (kmirror)'
+    if git_system(driver_repo, "archive --format=tar %s mirror | tar xf - -C %s" % (driver_branch, worktree)):
+        raise ValueError, 'git export (alsa-driver)'
     if git_system(kernel_repo, "archive --format=tar %s sound include/sound Documentation/DocBook Documentation/sound/alsa | tar xf - -C %s" % (kernel_branch, worktreek)):
         raise ValueError, 'git export (kernel)'
     git_system(driver_repo, "checkout %s" % driver_branch)
     git_system(kernel_repo, "checkout %s" % kernel_branch)
     curdir = getcwd()
     chdir(tmpdir())
-    system("mv alsa-kernel-repo/sound/* alsa-kernel-repo")
-    rmtree("alsa-kernel-repo/sound")
-    system("mv alsa-kernel-repo/include/sound/* alsa-kernel-repo/include")
-    rmtree("alsa-kernel-repo/include/sound")
-    system("mv alsa-kernel-repo/Documentation/sound/alsa/* alsa-kernel-repo/Documentation")
-    system("mv alsa-kernel-repo/Documentation/DocBook/alsa-driver-api.tmpl alsa-kernel-repo/Documentation")
-    rmtree("alsa-kernel-repo/Documentation/sound")
-    rmtree("alsa-kernel-repo/Documentation/DocBook")
-    mkdir("alsa-kernel-repo/Documentation/DocBook")
-    system("mv alsa-kernel-repo/Documentation/alsa-driver-api.tmpl alsa-kernel-repo/Documentation/DocBook")
-    for i in ['.git-ok-commits', '.hgignore', '.hgtags', '.gitignore', 'kernel', 'scripts',
-              'oss', 'usb/usbmixer.h', 'usb/usbmixer_maps.c']:
-        if isdir("alsa-kmirror-repo/%s" % i):
-            rmtree("alsa-kmirror-repo/%s" % i)
-        elif exists("alsa-kmirror-repo/%s" % i):
-            remove("alsa-kmirror-repo/%s" % i)
-    for i in ['oss', 'pci/ac97/ak4531_codec.c', 'isa/sb/sb16_csp_codecs.h',
-             'pci/korg1212/korg1212-firmware.h', 'pci/ymfpci/ymfpci_image.h',
-             'pci/hda/hda_patch.h',
-             'isa/ad1848/ad1848_lib.c', 'isa/cs423x/cs4231_lib.c', 'isa/cs423x/cs4232.c',
-             'include/cs4231.h', 'soc/at91/eti_b1_wm8731.c',
-             'aoa/codecs/snd-aoa-codec-onyx.c', 'aoa/codecs/snd-aoa-codec-onyx.h',
-             'aoa/codecs/snd-aoa-codec-tas-basstreble.h', 'aoa/codecs/snd-aoa-codec-tas-gain-table.h',
-             'aoa/codecs/snd-aoa-codec-tas.c', 'sound/aoa/codecs/snd-aoa-codec-tas.h',
-             'aoa/codecs/snd-aoa-codec-toonie.c', 'aoa/core/snd-aoa-alsa.c',
-             'aoa/core/snd-aoa-alsa.h', 'aoa/core/snd-aoa-core.c',
-             'aoa/core/snd-aoa-gpio-feature.c', 'aoa/core/snd-aoa-gpio-pmf.c',
-             'aoa/fabrics/snd-aoa-fabric-layout.c', 'aoa/soundbus/i2sbus/i2sbus-control.c',
-             'aoa/soundbus/i2sbus/i2sbus-core.c', 'aoa/soundbus/i2sbus/i2sbus-interface.h',
-             'aoa/soundbus/i2sbus/i2sbus-pcm.c', 'aoa/codecs/snd-aoa-codec-tas.h',
-             'include/uda1341.h', 'i2c/l3/', 'arm/sa11xx-uda1341.c',
-             'soc/at91/', 'soc/at32/',
-             'usb/caiaq/caiaq-audio.c', 'usb/caiaq/caiaq-audio.h',
-             'usb/caiaq/caiaq-control.c', 'usb/caiaq/caiaq-control.h',
-             'usb/caiaq/caiaq-device.c', 'usb/caiaq/caiaq-device.h',
-             'usb/caiaq/caiaq-input.c', 'usb/caiaq/caiaq-input.h',
-             'usb/caiaq/caiaq-midi.c', 'usb/caiaq/caiaq-midi.h',
-             'usb/usbmixer.h',
-             'usb/usbmixer_maps.c',
-             'isa/wavefront/yss225.c'
-             ]:
-        if isdir("alsa-kernel-repo/%s" % i):
-            rmtree("alsa-kernel-repo/%s" % i)
-        elif exists("alsa-kernel-repo/%s" % i):
-            remove("alsa-kernel-repo/%s" % i)
-    fp = popen("diff -ruNp alsa-kmirror-repo alsa-kernel-repo")
+    for f in listdir("alsa-kernel-repo/Documentation/DocBook"):
+      if not f in ['.', '..', 'alsa-driver-api.tmpl']:
+        x = "alsa-kernel-repo/Documentation/DocBook/" + f
+        if isdir(x):
+          rmtree(x)
+        else:
+          remove(x)
+    remove("alsa-driver-repo/mirror/.gitignore")
+    rmtree("alsa-driver-repo/mirror/scripts")
+    rmtree("alsa-driver-repo/mirror/sound/oss")
+    rmtree("alsa-kernel-repo/sound/oss")
+    if 0:
+      for i in ['.git-ok-commits', '.hgignore', '.hgtags', '.gitignore', 'kernel', 'scripts',
+                'oss', 'usb/usbmixer.h', 'usb/usbmixer_maps.c']:
+          if isdir("alsa-kmirror-repo/%s" % i):
+              rmtree("alsa-kmirror-repo/%s" % i)
+          elif exists("alsa-kmirror-repo/%s" % i):
+              remove("alsa-kmirror-repo/%s" % i)
+      for i in ['oss', 'pci/ac97/ak4531_codec.c', 'isa/sb/sb16_csp_codecs.h',
+                'pci/korg1212/korg1212-firmware.h', 'pci/ymfpci/ymfpci_image.h',
+                'pci/hda/hda_patch.h',
+                'isa/ad1848/ad1848_lib.c', 'isa/cs423x/cs4231_lib.c', 'isa/cs423x/cs4232.c',
+                'include/cs4231.h', 'soc/at91/eti_b1_wm8731.c',
+                'aoa/codecs/snd-aoa-codec-onyx.c', 'aoa/codecs/snd-aoa-codec-onyx.h',
+                'aoa/codecs/snd-aoa-codec-tas-basstreble.h', 'aoa/codecs/snd-aoa-codec-tas-gain-table.h',
+                'aoa/codecs/snd-aoa-codec-tas.c', 'sound/aoa/codecs/snd-aoa-codec-tas.h',
+                'aoa/codecs/snd-aoa-codec-toonie.c', 'aoa/core/snd-aoa-alsa.c',
+                'aoa/core/snd-aoa-alsa.h', 'aoa/core/snd-aoa-core.c',
+                'aoa/core/snd-aoa-gpio-feature.c', 'aoa/core/snd-aoa-gpio-pmf.c',
+                'aoa/fabrics/snd-aoa-fabric-layout.c', 'aoa/soundbus/i2sbus/i2sbus-control.c',
+                'aoa/soundbus/i2sbus/i2sbus-core.c', 'aoa/soundbus/i2sbus/i2sbus-interface.h',
+                'aoa/soundbus/i2sbus/i2sbus-pcm.c', 'aoa/codecs/snd-aoa-codec-tas.h',
+                'include/uda1341.h', 'i2c/l3/', 'arm/sa11xx-uda1341.c',
+                'soc/at91/', 'soc/at32/', 'soc/s3c24xx/',
+                'usb/caiaq/caiaq-audio.c', 'usb/caiaq/caiaq-audio.h',
+                'usb/caiaq/caiaq-control.c', 'usb/caiaq/caiaq-control.h',
+                'usb/caiaq/caiaq-device.c', 'usb/caiaq/caiaq-device.h',
+                'usb/caiaq/caiaq-input.c', 'usb/caiaq/caiaq-input.h',
+                'usb/caiaq/caiaq-midi.c', 'usb/caiaq/caiaq-midi.h',
+                'usb/usbmixer.h',
+                'usb/usbmixer_maps.c',
+                'isa/wavefront/yss225.c'
+                ]:
+          if isdir("alsa-kernel-repo/%s" % i):
+              rmtree("alsa-kernel-repo/%s" % i)
+          elif exists("alsa-kernel-repo/%s" % i):
+              remove("alsa-kernel-repo/%s" % i)
+    fp = popen("diff -ruNp alsa-driver-repo/mirror alsa-kernel-repo")
     notempty = False
     while 1:
         line = fp.readline()
@@ -351,6 +415,7 @@ def driver_merge(driver_repo, driver_branch, kernel_repo, kernel_branch):
         raise ValueError, 'git checkout'
     driver_commits = git_read_commits(driver_repo, config.GIT_DRIVER_MERGE, driver_branch)
     kernel_commits = git_read_commits(kernel_repo, config.GIT_KERNEL_MERGE, kernel_branch, kernel_tree=True)
+    #kernel_commits = git_read_commits(kernel_repo, 'd80852223ecabd1ab433a9c71436d81b697ef1fc~1', 'd80852223ecabd1ab433a9c71436d81b697ef1fc', kernel_tree=True)
     if not driver_commits or not kernel_commits:
       print 'Nothing to do'
       return
diff --git a/misc/scan.sh b/misc/scan.sh
new file mode 100755 (executable)
index 0000000..5ed440e
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+cd /proc/asound || exit 1
+list=$(ls | grep -E "^card" | grep -v cards)
+firstcard=1
+for card in $list; do
+  cardno=$(echo $card | colrm 1 4)
+  if test -d /sys/class/sound/mixer$cardno; then
+    # RHEL 5
+    path=$(ls -l /sys/class/sound/mixer$cardno/device 2> /dev/null | awk '{ print $NF }')
+    if test -z "$path"; then
+      continue
+    fi
+    cd /sys/class/sound/mixer$cardno/$path || exit 1
+    path=$(pwd)
+    driver=$(ls -l $path/driver | awk '{ FS="/"; split($NF, a); print a[length(a)] }')
+    if test "$driver" != "snd_hda_intel" -a "$driver" != "snd-hda-intel"; then
+      continue
+    fi    
+  else
+    # RHEL 6
+    driver=$(ls -l /sys/class/sound/$card/device/driver/module | awk '{ FS="/"; split($NF, a); print a[length(a)] }')
+    if test "$driver" != "snd_hda_intel" -a "$driver" != "snd-hda-intel"; then
+      continue
+    fi
+    path=$(ls -l /sys/class/sound/$card/device/driver/*:*:* 2> /dev/null | awk '{ print $NF }')
+    if test -z "$path"; then
+      continue
+    fi
+    cd /sys/class/sound/$card/device/driver/$path || exit 1
+    path=$(pwd)
+  fi
+  vendor=$(cat $path/vendor)
+  device=$(cat $path/device)
+  svendor=$(cat $path/subsystem_vendor)
+  sdevice=$(cat $path/subsystem_device)
+  cd /proc/asound/$card || exit 1
+  if test -z "$firstcard"; then
+    echo "----"
+  fi
+  echo "ALSA Card: $card"
+  echo "Driver: $driver"
+  echo "Device path: $path"
+  echo "PCI Device ID: $vendor:$device"
+  echo "PCI Subsystem Device ID: $svendor:$sdevice"
+  codecs=$(ls | grep -E "^codec#")
+  for codec in $codecs; do
+    echo "  ----"
+    awk '/^Codec: / { print "  " $0 }
+         /^Address: / { print "  " $0 }
+         /Function Id:/ { print "  " $0 }
+         /^Vendor Id:/ { print "  " $0 }
+         /^Subsystem Id:/ { print "  " $0 }
+         /^Revision Id:/ { print "  " $0 }' \
+        /proc/asound/$card/$codec
+  done
+  firstcard=
+done
\ No newline at end of file
index ecfbcbb9ea5ef75d7260a1bf2377cbf8e3e6896b..e7df36b5d465d5241c77a70e9bb6e4a4563c216b 100644 (file)
--- a/utils.py
+++ b/utils.py
@@ -39,19 +39,22 @@ def to_alsa_file(gitfile, prefix=''):
         return '/dev/null'
     if prefix and gitfile.startswith(prefix):
         gitfile = gitfile[len(prefix):]
-    for i in config.ALSA_TRANSLATE:
-        if gitfile.startswith(i):
-            return prefix + config.ALSA_TRANSLATE[i] + gitfile[len(i):]
+    for t in config.ALSA_TRANSLATE:
+        if gitfile.startswith(t[0]):
+            return prefix + t[1] + gitfile[len(t[0]):]
     raise ValueError, repr(gitfile)
 
+def to_alsa_file2(gitfile, prefix=''):
+    return prefix + 'mirror/' + gitfile
+
 def to_kernel_file(gitfile, prefix=''):
     if gitfile == '/dev/null':
         return '/dev/null'
     if prefix and gitfile.startswith(prefix):
         gitfile = gitfile[len(prefix):]
-    for i in config.ALSA_RTRANSLATE:
-        if gitfile.startswith(i):
-            return prefix + config.ALSA_RTRANSLATE[i] + gitfile[len(i):]
+    for t in config.ALSA_RTRANSLATE:
+        if gitfile.startswith(t[0]):
+            return prefix + t[1] + gitfile[len(t[0]):]
     raise ValueError, repr(gitfile)
 
 def git_repo(repo):
@@ -66,6 +69,8 @@ def git(repo):
     return "LANG=C git --work-tree=%s --git-dir=%s" % (repo, repo + '/.git')
 
 def git_popen(repo, cmd):
+    if config.GIT_DEBUG:
+        print "%s %s" % (git(repo), cmd)
     return os.popen("%s %s" % (git(repo), cmd))
     
 def git_system(repo, cmd, exports=None):
@@ -73,6 +78,8 @@ def git_system(repo, cmd, exports=None):
         exports = ''
     else:
         exports += ' ; '
+    if config.GIT_DEBUG:
+        print "%s%s %s" % (exports, git(repo), cmd)
     return os.system("%s%s %s" % (exports, git(repo), cmd))
 
 def git_read_commits(repo, old, head, kernel_tree=False, reverse=False):
@@ -90,10 +97,16 @@ def git_read_commits(repo, old, head, kernel_tree=False, reverse=False):
     curdir = os.getcwd()
     os.chdir(git_repo(repo))
     if old.startswith('__'):
-      fp = git_popen(repo, "log --name-only --pretty=fuller --date=iso%s %s %s" % (reverse, old[2:], head))
+      a, b = old[2:], head
+      if a != b:
+          a += ' ' + b
+      fp = git_popen(repo, "log --name-only --pretty=fuller --date=iso%s %s" % (reverse, a))
     else:
-      print 'Analyzing %s %s..%s:' % (repo, old, head)
-      fp = git_popen(repo, "log --name-only --pretty=fuller --date=iso%s %s..%s" % (reverse, old, head))
+      a, b = old, head
+      if a != b:
+          a += '..' + b
+      print 'Analyzing %s %s:' % (repo, a)
+      fp = git_popen(repo, "log --name-only --pretty=fuller --date=iso%s %s" % (reverse, a))
     res = []
     commit = None
     while 1: