- OS.chmod(OS.path.join('repos', f), mode)
-
- ## Build the configuration file
- v = {'HK-MASTER': hexhyphens(fingerprint('repos/master.pub',
- 'tripe-keys-master'))}
- fin = file('tripe-keys.master')
- fout = file(conf_subst('${conf-file}.new'), 'w')
- for line in fin:
- fout.write(subst(line, r_atsubst, v))
- fin.close(); fout.close()
-
- ## Make and sign the repository archive
- run('tar chozf ${repos-file}.new repos')
- run('''catsign -kmaster sign -abdC -ktripe-keys-master
- -o${sig-file}.new ${repos-file}.new''')
-
- ## Commit the changes
- for i in ['conf-file', 'repos-file', 'sig-file']:
- base = conf[i]
- new = '%s.new' % base
- OS.rename(new, base)
+ OS.chmod(ff, mode)
+
+ rmtree('tmp')
+ OS.mkdir('tmp')
+ OS.symlink('../repos', 'tmp/repos')
+ cwd = OS.getcwd()
+ try:
+
+ ## Build the configuration file
+ seq = max_master_sequence()
+ v = {'MASTER-SEQUENCE': str(seq),
+ 'HK-MASTER': hexhyphens(fingerprint('repos/master.pub',
+ 'master-%d' % seq))}
+ fin = file('tripe-keys.master')
+ fout = file('tmp/tripe-keys.conf', 'w')
+ for line in fin:
+ fout.write(subst(line, rx_atsubst, v))
+ fin.close(); fout.close()
+ SH.copyfile('tmp/tripe-keys.conf', conf_subst('${conf-file}.new'))
+ commit = [conf['repos-file'], conf['conf-file']]
+
+ ## Make and sign the repository archive
+ OS.chdir('tmp')
+ run('tar chozf ${repos-file}.new .')
+ OS.chdir(cwd)
+ for k in master_keys():
+ seq = master_sequence(k)
+ sigfile = seqsubst('sig-file', seq)
+ run('''catsign -kmaster sign -abdC -kmaster-%d
+ -o%s.new ${repos-file}.new''' % (seq, sigfile))
+ commit.append(sigfile)
+
+ ## Commit the changes
+ for base in commit:
+ new = '%s.new' % base
+ OS.rename(new, base)
+ finally:
+ OS.chdir(cwd)
+ rmtree('tmp')