[projects/git-slug: 110/170] Generate projects.list file for gitweb
glen
glen at pld-linux.org
Mon Sep 21 21:48:03 CEST 2015
commit b7ffeb55e44bb46be4f859915c4533b51e42546a
Author: Kacper Kornet <draenog at pld-linux.org>
Date: Sun Apr 8 00:19:43 2012 +0100
Generate projects.list file for gitweb
slug_watch | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/slug_watch b/slug_watch
index 4646f0c..4d1bb7c 100755
--- a/slug_watch
+++ b/slug_watch
@@ -16,6 +16,8 @@ from git_slug.serverconst import WATCHDIR
from git_slug.gitrepo import GitRepo
LOCKFILE = 'slug_watch.lock'
+PROJECTS_LIST = 'projects.list'
+PROJECTS_LIST_NEW = PROJECTS_LIST + '.new'
REFFILE_NEW = REFFILE + '.new'
REFREPO_WDIR = 'Refs'
REFREPO_GDIR = os.path.join('repositories', REFREPO+'.git')
@@ -56,20 +58,24 @@ def process_file(pathname):
if not os.path.isfile(pathname):
print('{} is not an ordinary file'.format(pathname))
return
- with open(os.path.join(REFREPO_WDIR, REFFILE),'w') as headfile_new, open(pathname, 'r') as newfile:
+ with open(os.path.join(REFREPO_WDIR, REFFILE),'w') as headfile_new, open(pathname, 'r') as newfile, \
+ open(PROJECTS_LIST_NEW,'w') as projects:
committer = newfile.readline().strip()
- oldtuple = None
+ oldtuple = (None, None)
refrepo = GitRepo(git_dir=REFREPO_GDIR)
process = refrepo.showfile(REFFILE, 'master')
headfile = process.stdout
for (repo, ref, number, sha1) in heapq.merge(sorted(processnewfile(newfile)), convertstream(headfile)):
if (repo, ref) == oldtuple:
continue
- oldtuple = (repo, ref)
if sha1 != EMPTYSHA1:
print(sha1, ref, repo, file=headfile_new)
+ if repo != oldtuple[0]:
+ print('packages/'+repo+'.git', file=projects)
+ oldtuple = (repo, ref)
process.wait()
+ os.rename(PROJECTS_LIST_NEW, PROJECTS_LIST)
headrepo = GitRepo(REFREPO_WDIR, REFREPO_GDIR)
headrepo.commitfile(REFFILE, 'Changes by {}'.format(committer))
os.remove(pathname)
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5
More information about the pld-cvs-commit
mailing list