Update of /cvsroot/alsa/alsa-kernel/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv16927

Modified Files:
        ksync 
Log Message:
Improved lsync - it works now - see LKML

Index: ksync
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/scripts/ksync,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ksync       17 Sep 2002 11:15:50 -0000      1.12
+++ ksync       30 Sep 2002 16:49:44 -0000      1.13
@@ -47,6 +47,7 @@
 # define working directories
 CVSROOT = '~/alsa'
 BKROOT = '~/linux/official'
+PATCH_UPDATE = '~/alsa/alsa-kernel/scripts/kchanges/update'
 
 # exclude some files or directories
 ALSA_EXCLUDE = ['/include/version.h']
@@ -76,6 +77,7 @@
 
 # Global variables
 LAST_CVS_TIME = 0
+FATAL_LSYNC_ERROR = 0
 
 # Translation tables for CVS user IDs
 CVS_USER = {'perex':'Jaroslav Kysela <[EMAIL PROTECTED]>',
@@ -351,33 +353,44 @@
                        i = i + 1
        return result, dead
 
+def write_to_patch_update_file(lines):
+       global PATCH_UPDATE
+       fp = open(os.path.expanduser(PATCH_UPDATE), 'a+')
+       print_file(fp, lines)
+       fp.close()
+
 def do_alsa_kernel_diff(alsa, kernel, from_cvs_time, to_cvs_time):
+       global FATAL_LSYNC_ERROR
        ncvsflag = 0
        nbkflag = 0
        lsyncflag = 0
        if from_cvs_time or to_cvs_time:
                lsyncflag = 1
-               ncvsflag = 1
-               afile = '/tmp/ksync_kernel_diff'
-               params = get_cvs_date_param1(to_cvs_time)
-               update_cvs_file(alsa, afile, params)
-       else:
-               afile = get_cvs_root() + alsa;
+#              ncvsflag = 1
+#              afile = '/tmp/ksync_kernel_diff'
+#              params = get_cvs_date_param1(to_cvs_time)
+#              update_cvs_file(alsa, afile, params)
+#      else:
+       afile = get_cvs_root() + alsa;
+       if not os.path.exists(afile):
+               update_cvs_file(alsa)
                if not os.path.exists(afile):
-                       update_cvs_file(alsa)
-                       if not os.path.exists(afile):
-                               ncvsflag = 1
-                               os.system('touch %s' % afile)
+                       ncvsflag = 1
+                       os.system('touch %s' % afile)
        kfile = get_bk_root() + kernel;
        if not os.path.exists(kfile):
                update_bk_file(kfile)
                if not os.path.exists(kfile):
                        nbkflag = 1
                        os.system('touch %s' % kfile)
-       cmd = 'diff -uN %s %s' % (kfile, afile)
+       if lsyncflag > 0:
+               cmd = 'diff -uN %s %s' % (afile, kfile)
+       else:
+               cmd = 'diff -uN %s %s' % (kfile, afile)
        fp = os.popen(cmd)
        lines = fp.readlines()
        fp.close()
+       lines = change_diff_lines(lines, "linux" + kernel)
        if len(lines) > 1:
                if lsyncflag > 0:
                        collected_logs, dead = collect_cvs_logs(alsa, from_cvs_time, 
to_cvs_time)
@@ -402,13 +415,15 @@
                                        sys.exit(1)
                        tmpfile = '/tmp/ksyncABCD1234'
                        fp = open(tmpfile, 'w+')
+                       if alsa == '/include/version.h':
+                               collected_logs = 'Updated date/time/version from the 
+ALSA CVS tree'
                        fp.write(collected_logs)
                        fp.close()
                        if os.system('bk comments -Y%s %s' % (tmpfile, kfile)):
-                               sys.exit(1)
+                               write_to_patch_update_file(lines)
+                               FATAL_LSYNC_ERROR = 1
                        os.remove(tmpfile)
                else:
-                       lines = change_diff_lines(lines, "linux" + kernel)
                        print_file(sys.stdout, lines)
        if ncvsflag:
                os.remove(afile)
@@ -445,6 +460,9 @@
        print '#'
 
 def diffall(reverse, from_cvs_time = 0, to_cvs_time = 0):
+       lsyncflag = 0
+       if from_cvs_time or to_cvs_time:
+               lsyncflag = 1
        cdirs, cfiles = get_cvs_files(get_cvs_root(), '/')
        bdirs, bfiles = get_bk_files(get_bk_root(), '/')
        print 'BKROOT = %s' % BKROOT
@@ -593,7 +611,7 @@
        cs, kernel = get_last_changeset()
         print 'alsa-%s-%s-linux-%s-cs%s.patch' % (time.strftime("%Y-%m-%d", 
time.gmtime(time.time())), ver, kernel, cs)        
 
-def kdiffs(cs = '1.403.56.48'):
+def kdiffs(cs = '1.403.57.48'):
        os.chdir(get_bk_root())
        cmd = 'sh -c \'bk rset -hr%s.. | grep -E "^(sound/|include/sound/)" | grep -E 
-v "^sound/oss/" | bk gnupatch -du\'' % cs
        fp = os.popen(cmd)
@@ -613,7 +631,7 @@
        return t - time.timezone
 
 def main():
-       global CVSROOT, BKROOT, ALSA_MAP, KERNEL_MAP
+       global CVSROOT, BKROOT, PATCH_UPDATE, ALSA_MAP, KERNEL_MAP
        try:
                opts, args = getopt.getopt(sys.argv[1:], 'hB:C:',
                                           ['cvsroot=', 'bkroot=', 'help']);
@@ -659,27 +677,39 @@
                        to_cvs_time = parse_time(args[1])
                if len(args) > 2:
                        patch = os.path.abspath(os.path.expanduser(args[2]))
+               else:
+                       npatch = os.path.abspath('kchanges/%s' % 
+time.strftime("%Y-%m-%d", time.gmtime(to_cvs_time)))
+                       if os.path.exists(npatch):
+                               print 'Using kernel patch %s' % npatch
+                               patch = npatch
 
-               os.chdir(os.path.expanduser('~/bk/linux-sound'))
-               os.system('rm -rf work')
-               os.system('bk clone -l linux-sound work')
-               BKROOT = '~/bk/linux-sound/work'
-
-               os.chdir(os.path.expanduser('~/'))
                CVSROOT = '~/alsa.local'
+               os.chdir(os.path.expanduser('~/'))
                os.system('rm -rf alsa.local')
                os.system('mkdir alsa.local')
                os.chdir(os.path.expanduser('~/alsa.local'))
-               os.system('cvs -d/mnt/exthd/cvsroot/alsa co -P %s .' % 
get_cvs_date_param1(to_cvs_time))
+               os.system('cvs -d/home/src/alsa co -P %s alsa-driver alsa-kernel' % 
+get_cvs_date_param1(to_cvs_time))
                if os.path.exists(patch):
                        os.chdir(os.path.expanduser('~/alsa.local/alsa-kernel'))
                        os.system('patch -p2 < %s' % patch)
+                       print 'Is this ok? Press Ctrl-C to abort...'
+                       sys.stdin.readline()
+
+               BKROOT = '~/bk/linux-sound/work'
+               os.chdir(os.path.expanduser('~/bk/linux-sound'))
+               os.system('rm -rf work')
+               os.system('bk clone -l linux-sound work')
+
+               if os.path.exists(os.path.expanduser(PATCH_UPDATE)):
+                       os.remove(os.path.expanduser(PATCH_UPDATE))
 
                from_cvs_time = get_last_lsync_time()
                if to_cvs_time <= from_cvs_time:
                        print 'Time < last_lsync_time (%s)' % time.strftime('%Y/%m/%d 
%H:%M:%S', time.gmtime(from_cvs_time))
                        sys.exit(1)
                diffall(0, from_cvs_time, to_cvs_time)
+               if FATAL_LSYNC_ERROR > 0:
+                       print 'Error during merge, see %s file...' % PATCH_UPDATE
        elif args[0] == 'filename':
                ver = 1
                if len(args) > 1:



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to