]> git.pld-linux.org Git - projects/git-slug.git/commitdiff
slug_watch: Separate cgit and gitweb projects_list
authorKacper Kornet <draenog@pld-linux.org>
Thu, 15 Aug 2013 13:56:44 +0000 (14:56 +0100)
committerKacper Kornet <draenog@pld-linux.org>
Thu, 15 Aug 2013 13:58:48 +0000 (14:58 +0100)
cgit projects_list is plain text while gitweb requires
the paths in the file to be URI encoded.

slug_watch

index 70a7b2bc25e510e9790df3be04194f44f7e3dc38..b077de91c67adde0238507accddfe3a3ecfbdc4d 100755 (executable)
@@ -23,6 +23,7 @@ LOCKFILE = 'slug_watch.lock'
 PROJECTS_LIST = 'projects.list'
 PROJECTS_LIST_NEW = PROJECTS_LIST + '.new'
 PROJECTS_LIST_HEAD = PROJECTS_LIST + '.head'
+PROJECTS_LIST_GITWEB = PROJECTS_LIST + ".gitweb"
 REFFILE_NEW = REFFILE + '.new'
 REFREPO_WDIR = 'Refs'
 
@@ -83,7 +84,7 @@ def process_file(pathname):
                 if sha1 != EMPTYSHA1:
                     print(sha1, ref, repo, file=headfile_new)
                     if repo != oldtuple[0]:
-                        print(quote_plus('packages/'+repo+'.git', safe='/'), file=projects)
+                        print('packages/'+repo+'.git', file=projects)
                 oldtuple = (repo, ref)
         except ValueError:
             logger.error("Problem with file: {}".format(pathname))
@@ -91,6 +92,10 @@ def process_file(pathname):
         process.wait()
 
     os.rename(PROJECTS_LIST_NEW, PROJECTS_LIST)
+    with open(PROJECTS_LIST, 'r') as projects, open(PROJECTS_LIST_GITWEB, 'w') as output:
+        for line in projects:
+            print(quote_plus(line, safe='/\n'), end='', file=output)
+
     headrepo = GitRepo(REFREPO_WDIR, REFREPO_GDIR)
     headrepo.commitfile(REFFILE, 'Changes by {}'.format(committer))
     os.remove(pathname)
This page took 0.24187 seconds and 4 git commands to generate.