diff --git a/development/cgit/cgit.SlackBuild b/development/cgit/cgit.SlackBuild index b55f3a5739..f3e5b77e20 100644 --- a/development/cgit/cgit.SlackBuild +++ b/development/cgit/cgit.SlackBuild @@ -1,7 +1,7 @@ #!/bin/sh # Slackware build script for cgit -# Copyright 2013-2017 Matteo Bernardini , Pisa, Italy +# Copyright 2013-2018 Matteo Bernardini , Pisa, Italy # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,8 +22,8 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=cgit -VERSION=${VERSION:-1.1} -BUILD=${BUILD:-3} +VERSION=${VERSION:-1.2} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} DOCROOT=${DOCROOT:-/var/www} @@ -55,8 +55,8 @@ else LIBDIRSUFFIX="" fi -CGIT_VERSION=${CGIT_VERSION:-v1.1} -GIT_VERSION=${GIT_VERSION:-2.10.4} +CGIT_VERSION=${CGIT_VERSION:-v1.2} +GIT_VERSION=${GIT_VERSION:-2.18.0} DOCS="cgitrc.5.txt COPYING README $CWD/config/cgitrc.sample \ $CWD/config/cgit-lighttpd.conf $CWD/config/cgit-httpd.conf \ @@ -78,23 +78,15 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# apply some upstream patches -patch -p1 < $CWD/patches/0004-syntax-highlighting-replace-invalid-unicode-with.patch -patch -p1 < $CWD/patches/0005-ui-patch-fix-crash-when-using-path-limit.patch -patch -p1 < $CWD/patches/0006-ui-repolist-properly-sort-by-age.patch -patch -p1 < $CWD/patches/0007-Remove-unused-variable-from-sort_section.patch -patch -p1 < $CWD/patches/0011-ui-atom-properly-escape-delimiter-in-page-link.patch -patch -p1 < $CWD/patches/0012-ui-shared-don-t-print-path-crumbs-without-a-repo.patch -patch -p1 < $CWD/patches/0013-parsing-clear-query-path-before-starting.patch -patch -p1 < $CWD/patches/0014-cgit-don-t-set-vpath-unless-repo-is-set.patch -patch -p1 < $CWD/patches/0015-ui-plain-print-symlink-content.patch +# apply patches from upstream +patch -p1 < $CWD/patches/0001-record.repo.snapshot-prefix.in.the.per-repo.config.patch # prepare sources sed -i Makefile \ -e "s|-g -Wall -Igit|-Wall ${SLKCFLAGS} -Igit|" \ -e "s|\/lib$|/lib${LIBDIRSUFFIX}|" \ -e "s|(libdir)|(prefix)/share|" \ - -e "s|/usr/local|/usr|" + -e "s|/usr/local|/usr|" || exit 1 sed -e "s|@DOCROOT@|$DOCROOT|g" $CWD/config/cgit.conf > cgit.conf echo "CGIT_VERSION = $CGIT_VERSION" >> cgit.conf @@ -109,7 +101,7 @@ make install DESTDIR=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# Install additionals lua scripts +# install additionals lua scripts install -m 0644 -D $CWD/config/email-libravatar-korg.lua \ $PKG/usr/share/cgit/filters/email-libravatar-korg.lua install -m 0644 -D $CWD/config/email-gravatar-sbo.lua \ diff --git a/development/cgit/cgit.info b/development/cgit/cgit.info index 585d6696eb..e76f5e0cc1 100644 --- a/development/cgit/cgit.info +++ b/development/cgit/cgit.info @@ -1,10 +1,10 @@ PRGNAM="cgit" -VERSION="1.1" +VERSION="1.2" HOMEPAGE="https://git.zx2c4.com/cgit/about/" -DOWNLOAD="https://git.zx2c4.com/cgit/snapshot/cgit-1.1.tar.xz \ - https://www.kernel.org/pub/software/scm/git/git-2.10.4.tar.xz" -MD5SUM="7cc92b94e4aaefed952b0e6b8fde0a3e \ - c357c27316b18678ca1b3c383920bb5a" +DOWNLOAD="https://git.zx2c4.com/cgit/snapshot/cgit-1.2.tar.xz \ + https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.xz" +MD5SUM="fa13e0e093b9e7e769bc98842e9e4a42 \ + 7a668403aa7807d0db37e8573299d471" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/development/cgit/patches/0001-record.repo.snapshot-prefix.in.the.per-repo.config.patch b/development/cgit/patches/0001-record.repo.snapshot-prefix.in.the.per-repo.config.patch new file mode 100644 index 0000000000..780684712f --- /dev/null +++ b/development/cgit/patches/0001-record.repo.snapshot-prefix.in.the.per-repo.config.patch @@ -0,0 +1,27 @@ +Konstantin Ryabitsev konstantin at linuxfoundation.org +Tue Jul 17 18:38:22 CEST 2018 + +Even if we find snapshot-prefix in the repo configuration, we are not +writing it out into the rc- file, so setting the value does not have any +effect. + +Signed-off-by: Konstantin Ryabitsev +--- + cgit.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/cgit.c b/cgit.c +index e2d7891..a39d83a 100644 +--- a/cgit.c ++++ b/cgit.c +@@ -830,6 +830,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) + fprintf(f, "repo.snapshots=%s\n", tmp ? tmp : ""); + free(tmp); + } ++ if (repo->snapshot_prefix) ++ fprintf(f, "repo.snapshot-prefix=%s\n", repo->snapshot_prefix); + if (repo->max_stats != ctx.cfg.max_stats) + fprintf(f, "repo.max-stats=%s\n", + cgit_find_stats_periodname(repo->max_stats)); +-- +2.17.1 diff --git a/development/cgit/patches/0004-syntax-highlighting-replace-invalid-unicode-with.patch b/development/cgit/patches/0004-syntax-highlighting-replace-invalid-unicode-with.patch deleted file mode 100644 index 47483837f4..0000000000 --- a/development/cgit/patches/0004-syntax-highlighting-replace-invalid-unicode-with.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 5564a5d06678b3f9b0725bc4b2383ea1b7eb5515 Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Sun, 22 Jan 2017 12:44:44 +0100 -Subject: [PATCH 04/15] syntax-highlighting: replace invalid unicode with ? - ---- - filters/syntax-highlighting.py | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py -index 1ca4108..5888b50 100755 ---- a/filters/syntax-highlighting.py -+++ b/filters/syntax-highlighting.py -@@ -30,8 +30,8 @@ from pygments.lexers import guess_lexer_for_filename - from pygments.formatters import HtmlFormatter - - --sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') --sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') -+sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace') -+sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') - data = sys.stdin.read() - filename = sys.argv[1] - formatter = HtmlFormatter(style='pastie') --- -2.14.1 - diff --git a/development/cgit/patches/0005-ui-patch-fix-crash-when-using-path-limit.patch b/development/cgit/patches/0005-ui-patch-fix-crash-when-using-path-limit.patch deleted file mode 100644 index 2339129069..0000000000 --- a/development/cgit/patches/0005-ui-patch-fix-crash-when-using-path-limit.patch +++ /dev/null @@ -1,43 +0,0 @@ -From be39d22328f841536b8e44e8aaeed80a74ebb353 Mon Sep 17 00:00:00 2001 -From: Lukas Fleischer -Date: Thu, 24 Nov 2016 20:14:54 +0100 -Subject: [PATCH 05/15] ui-patch: fix crash when using path limit - -The array passed to setup_revisions() must be NULL-terminated. Fixes a -regression introduced in 455b598 (ui-patch.c: Use log_tree_commit() to -generate diffs, 2013-08-20). - -Reported-by: Florian Pritz -Signed-off-by: Lukas Fleischer ---- - ui-patch.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/ui-patch.c b/ui-patch.c -index ec7f352..047e2f9 100644 ---- a/ui-patch.c -+++ b/ui-patch.c -@@ -18,8 +18,8 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, - struct commit *commit; - struct object_id new_rev_oid, old_rev_oid; - char rev_range[2 * 40 + 3]; -- const char *rev_argv[] = { NULL, "--reverse", "--format=email", rev_range, "--", prefix }; -- int rev_argc = ARRAY_SIZE(rev_argv); -+ const char *rev_argv[] = { NULL, "--reverse", "--format=email", rev_range, "--", prefix, NULL }; -+ int rev_argc = ARRAY_SIZE(rev_argv) - 1; - char *patchname; - - if (!prefix) -@@ -85,8 +85,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, - DIFF_FORMAT_PATCH | DIFF_FORMAT_SUMMARY; - if (prefix) - rev.diffopt.stat_sep = fmt("(limited to '%s')\n\n", prefix); -- setup_revisions(ARRAY_SIZE(rev_argv), rev_argv, &rev, -- NULL); -+ setup_revisions(rev_argc, rev_argv, &rev, NULL); - prepare_revision_walk(&rev); - - while ((commit = get_revision(&rev)) != NULL) { --- -2.14.1 - diff --git a/development/cgit/patches/0006-ui-repolist-properly-sort-by-age.patch b/development/cgit/patches/0006-ui-repolist-properly-sort-by-age.patch deleted file mode 100644 index e48d97f2db..0000000000 --- a/development/cgit/patches/0006-ui-repolist-properly-sort-by-age.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 87c47488d02fcace4da0d468cd9ddd1651b7949e Mon Sep 17 00:00:00 2001 -From: "Jason A. Donenfeld" -Date: Thu, 30 Mar 2017 13:19:50 +0200 -Subject: [PATCH 06/15] ui-repolist: properly sort by age - -When empty repos exist, comparing them against an existing repo with a -good mtime might, with particular qsort implementations, not sort -correctly, because of this brokenness: - - if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t)) - -However, sorting by the age column works as expected, so anyway, to tidy -things up, we simply reuse that function. - -Signed-off-by: Jason A. Donenfeld ---- - ui-repolist.c | 38 +++++++++++++++++--------------------- - 1 file changed, 17 insertions(+), 21 deletions(-) - -diff --git a/ui-repolist.c b/ui-repolist.c -index b57ea60..20a4f56 100644 ---- a/ui-repolist.c -+++ b/ui-repolist.c -@@ -184,27 +184,6 @@ static int cmp(const char *s1, const char *s2) - return 0; - } - --static int sort_section(const void *a, const void *b) --{ -- const struct cgit_repo *r1 = a; -- const struct cgit_repo *r2 = b; -- int result; -- time_t t; -- -- result = cmp(r1->section, r2->section); -- if (!result) { -- if (!strcmp(ctx.cfg.repository_sort, "age")) { -- // get_repo_modtime caches the value in r->mtime, so we don't -- // have to worry about inefficiencies here. -- if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t)) -- result = r2->mtime - r1->mtime; -- } -- if (!result) -- result = cmp(r1->name, r2->name); -- } -- return result; --} -- - static int sort_name(const void *a, const void *b) - { - const struct cgit_repo *r1 = a; -@@ -241,6 +220,23 @@ static int sort_idle(const void *a, const void *b) - return t2 - t1; - } - -+static int sort_section(const void *a, const void *b) -+{ -+ const struct cgit_repo *r1 = a; -+ const struct cgit_repo *r2 = b; -+ int result; -+ time_t t; -+ -+ result = cmp(r1->section, r2->section); -+ if (!result) { -+ if (!strcmp(ctx.cfg.repository_sort, "age")) -+ result = sort_idle(r1, r2); -+ if (!result) -+ result = cmp(r1->name, r2->name); -+ } -+ return result; -+} -+ - struct sortcolumn { - const char *name; - int (*fn)(const void *a, const void *b); --- -2.14.1 - diff --git a/development/cgit/patches/0007-Remove-unused-variable-from-sort_section.patch b/development/cgit/patches/0007-Remove-unused-variable-from-sort_section.patch deleted file mode 100644 index 13e7118e50..0000000000 --- a/development/cgit/patches/0007-Remove-unused-variable-from-sort_section.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7ebdb30fdf91d1f63b4fb07e54b089136de5507b Mon Sep 17 00:00:00 2001 -From: Lukas Fleischer -Date: Wed, 5 Apr 2017 06:38:27 +0200 -Subject: [PATCH 07/15] Remove unused variable from sort_section() - -Signed-off-by: Lukas Fleischer ---- - ui-repolist.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/ui-repolist.c b/ui-repolist.c -index 20a4f56..7272e87 100644 ---- a/ui-repolist.c -+++ b/ui-repolist.c -@@ -225,7 +225,6 @@ static int sort_section(const void *a, const void *b) - const struct cgit_repo *r1 = a; - const struct cgit_repo *r2 = b; - int result; -- time_t t; - - result = cmp(r1->section, r2->section); - if (!result) { --- -2.14.1 - diff --git a/development/cgit/patches/0011-ui-atom-properly-escape-delimiter-in-page-link.patch b/development/cgit/patches/0011-ui-atom-properly-escape-delimiter-in-page-link.patch deleted file mode 100644 index 2dbf661fc9..0000000000 --- a/development/cgit/patches/0011-ui-atom-properly-escape-delimiter-in-page-link.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6d3c8bc37f6124c2193d66587079975d381aa435 Mon Sep 17 00:00:00 2001 -From: John Keeping -Date: Sun, 15 Jan 2017 12:29:38 +0000 -Subject: [PATCH 11/15] ui-atom: properly escape delimiter in page link - -If the delimiter here is '&' then it needs to be escaped for inclusion -in an attribute. Use html_attrf() to ensure that this happens (we know -that hex won't need escaping, but this makes it clearer what's -happening. - -Signed-off-by: John Keeping ---- - ui-atom.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui-atom.c b/ui-atom.c -index 41838d3..3866823 100644 ---- a/ui-atom.c -+++ b/ui-atom.c -@@ -63,7 +63,7 @@ static void add_entry(struct commit *commit, const char *host) - html_attr(pageurl); - if (ctx.cfg.virtual_root) - delim = '?'; -- htmlf("%cid=%s", delim, hex); -+ html_attrf("%cid=%s", delim, hex); - html("'/>\n"); - free(pageurl); - } --- -2.14.1 - diff --git a/development/cgit/patches/0012-ui-shared-don-t-print-path-crumbs-without-a-repo.patch b/development/cgit/patches/0012-ui-shared-don-t-print-path-crumbs-without-a-repo.patch deleted file mode 100644 index 99af79c4ba..0000000000 --- a/development/cgit/patches/0012-ui-shared-don-t-print-path-crumbs-without-a-repo.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 1b4ef6783a71962f8b5da3a23f2830f0f0f55ea0 Mon Sep 17 00:00:00 2001 -From: John Keeping -Date: Sun, 19 Feb 2017 12:27:48 +0000 -Subject: [PATCH 12/15] ui-shared: don't print path crumbs without a repo - -cgit_print_path_crumbs() can call repolink() which assumes that ctx.repo -is non-null. Currently we don't have any commands that set want_vpath -without also setting want_repo so it shouldn't be possible to fail this -test, but the check in cgit.c is in the wrong order so it is possible to -specify a query string like "?p=log&path=foo/bar" to end up here without -a valid repository. - -This was found by American fuzzy lop [0]. - -[0] http://lcamtuf.coredump.cx/afl/ - -Signed-off-by: John Keeping ---- - ui-shared.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui-shared.c b/ui-shared.c -index 2e4fcd9..e5c9a02 100644 ---- a/ui-shared.c -+++ b/ui-shared.c -@@ -1039,7 +1039,7 @@ void cgit_print_pageheader(void) - free(currenturl); - } - html("\n"); -- if (ctx.env.authenticated && ctx.qry.vpath) { -+ if (ctx.env.authenticated && ctx.repo && ctx.qry.vpath) { - html("
"); - html("path: "); - cgit_print_path_crumbs(ctx.qry.vpath); --- -2.14.1 - diff --git a/development/cgit/patches/0013-parsing-clear-query-path-before-starting.patch b/development/cgit/patches/0013-parsing-clear-query-path-before-starting.patch deleted file mode 100644 index ca20044d93..0000000000 --- a/development/cgit/patches/0013-parsing-clear-query-path-before-starting.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c699866699411346c5dba406457581013f85a873 Mon Sep 17 00:00:00 2001 -From: John Keeping -Date: Sun, 19 Feb 2017 12:17:05 +0000 -Subject: [PATCH 13/15] parsing: clear query path before starting - -By specifying the "url" query parameter multiple times it is possible to -end up with ctx.qry.vpath set while ctx.repo is null, which triggers an -invalid code path from cgit_print_pageheader() while printing path -crumbs, resulting in a null dereference. - -The previous patch fixed this segfault, but it makes no sense for us to -clear ctx.repo while leaving ctx.qry.path set to the previous value, so -let's just clear it here so that the last "url" parameter given takes -full effect rather than partially overriding the effect of the previous -value. - -Signed-off-by: John Keeping ---- - parsing.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/parsing.c b/parsing.c -index 9dacb16..b8d7f10 100644 ---- a/parsing.c -+++ b/parsing.c -@@ -21,6 +21,7 @@ void cgit_parse_url(const char *url) - struct cgit_repo *repo; - - ctx.repo = NULL; -+ ctx.qry.page = NULL; - if (!url || url[0] == '\0') - return; - -@@ -53,7 +54,6 @@ void cgit_parse_url(const char *url) - } - if (cmd[1]) - ctx.qry.page = xstrdup(cmd + 1); -- return; - } - } - --- -2.14.1 - diff --git a/development/cgit/patches/0014-cgit-don-t-set-vpath-unless-repo-is-set.patch b/development/cgit/patches/0014-cgit-don-t-set-vpath-unless-repo-is-set.patch deleted file mode 100644 index 1038a44b8f..0000000000 --- a/development/cgit/patches/0014-cgit-don-t-set-vpath-unless-repo-is-set.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 113f4b85886bc5eb6b319fd048623b8d43b7bce0 Mon Sep 17 00:00:00 2001 -From: John Keeping -Date: Sun, 19 Feb 2017 12:02:37 +0000 -Subject: [PATCH 14/15] cgit: don't set vpath unless repo is set - -After the previous two patches, this can be classified as a tidy up -rather than a bug fix, but I think it makes sense to group all of the -tests together before setting up the environment for the command to -execute. - -Signed-off-by: John Keeping ---- - cgit.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/cgit.c b/cgit.c -index 1075753..1dae4b8 100644 ---- a/cgit.c -+++ b/cgit.c -@@ -726,18 +726,18 @@ static void process_request(void) - return; - } - -- /* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual" -- * in-project path limit to be made available at ctx.qry.vpath. -- * Otherwise, no path limit is in effect (ctx.qry.vpath = NULL). -- */ -- ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL; -- - if (cmd->want_repo && !ctx.repo) { - cgit_print_error_page(400, "Bad request", - "No repository selected"); - return; - } - -+ /* If cmd->want_vpath is set, assume ctx.qry.path contains a "virtual" -+ * in-project path limit to be made available at ctx.qry.vpath. -+ * Otherwise, no path limit is in effect (ctx.qry.vpath = NULL). -+ */ -+ ctx.qry.vpath = cmd->want_vpath ? ctx.qry.path : NULL; -+ - if (ctx.repo && prepare_repo_cmd()) - return; - --- -2.14.1 - diff --git a/development/cgit/patches/0015-ui-plain-print-symlink-content.patch b/development/cgit/patches/0015-ui-plain-print-symlink-content.patch deleted file mode 100644 index 736158bc3b..0000000000 --- a/development/cgit/patches/0015-ui-plain-print-symlink-content.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 51cc456b773a3bb7253fad2146c1a0d2b0fa98cb Mon Sep 17 00:00:00 2001 -From: John Keeping -Date: Mon, 6 Mar 2017 23:27:23 +0000 -Subject: [PATCH 15/15] ui-plain: print symlink content - -We currently ignore symlinks in ui-plain, leading to a 404. In ui-tree -we print the content of the blob (that is, the path to the target of the -link), so it makes sense to do the same here. - -Signed-off-by: John Keeping ---- - ui-plain.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ui-plain.c b/ui-plain.c -index e45d553..cfdbf73 100644 ---- a/ui-plain.c -+++ b/ui-plain.c -@@ -135,7 +135,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base, - struct walk_tree_context *walk_tree_ctx = cbdata; - - if (base->len == walk_tree_ctx->match_baselen) { -- if (S_ISREG(mode)) { -+ if (S_ISREG(mode) || S_ISLNK(mode)) { - if (print_object(sha1, pathname)) - walk_tree_ctx->match = 1; - } else if (S_ISDIR(mode)) { --- -2.14.1 -