gnu: git-filter-repo: Update to 2.38.0.

* gnu/packages/patches/git-filter-repo-generate-doc.patch: New file.
* gnu/local.mk (dist_patch_DATA): Regisiter it.
* gnu/packages/version-control.scm (git-filter-repo): Update to 2.38.0.
[source]: Switch to git-fetch.
Use the patch.
[build-system]: Switch to gnu-build-system.
[native-inputs]: Add asciidoc, docbook-xsl, libxml2, xmlto.

Modified-by: Hilton Chain <hako@ultrarare.space>
Change-Id: I7b15975ea56c44ae580d19cfe5a9e3eb75c6db0d
Signed-off-by: Hilton Chain <hako@ultrarare.space>
This commit is contained in:
Josselin Poiret 2024-02-16 01:34:59 +08:00 committed by Hilton Chain
parent e3e64acdb8
commit 313458c58c
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
3 changed files with 144 additions and 14 deletions

View File

@ -1305,6 +1305,7 @@ dist_patch_DATA = \
%D%/packages/patches/ghostscript-no-header-id.patch \
%D%/packages/patches/ghostscript-no-header-uuid.patch \
%D%/packages/patches/ghostscript-no-header-creationdate.patch \
%D%/packages/patches/git-filter-repo-generate-doc.patch \
%D%/packages/patches/gitg-fix-positional-argument.patch \
%D%/packages/patches/gklib-suitesparse.patch \
%D%/packages/patches/glib-appinfo-watch.patch \

View File

@ -0,0 +1,88 @@
From 56e6857e71d2b2a2236625f3c8b112bd40a8b164 Mon Sep 17 00:00:00 2001
From: Josselin Poiret <dev@jpoiret.xyz>
Date: Fri, 16 Feb 2024 00:21:06 +0800
Subject: [PATCH] Add documentation generation.
This requires the manpage XSL and asciidoc config files from git 2.41.0.
Modified-by: Hilton Chain <hako@ultrarare.space>
---
Documentation/Makefile | 34 ++++++++++++++++++++++++++++++++++
Makefile | 17 +++--------------
2 files changed, 37 insertions(+), 14 deletions(-)
create mode 100644 Documentation/Makefile
diff --git a/Documentation/Makefile b/Documentation/Makefile
new file mode 100644
index 0000000..d81ffbe
--- /dev/null
+++ b/Documentation/Makefile
@@ -0,0 +1,34 @@
+MAN_BASE_URL := $(prefix)/share/doc/git-doc/
+VERSION := $(git log --pretty="%H" -n 1)
+
+ASCIIDOC := asciidoc
+ASCIIDOC_EXTRA :=
+ASCIIDOC_HTML := xhtml11
+ASCIIDOC_DOCBOOK := docbook
+ASCIIDOC_CONF := -f asciidoc.conf
+ASCIIDOC_COMMON := $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
+ -amanmanual='git-filter-repo Manual' -amansource='git-filter-repo $(VERSION)'
+ASCIIDOC_DEPS := asciidoc.conf
+TXT_TO_HTML := $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
+TXT_TO_XML := $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
+MANPAGE_XSL := manpage-normal.xsl
+XMLTO := xmlto
+XMLTO_EXTRA := -m manpage-bold-literal.xsl \
+ --stringparam man.base.url.for.relative.links='$(MAN_BASE_URL)'
+
+manpage-prereqs := $(wildcard manpage*.xsl)
+manpage-cmd := $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man
+
+%.xml : %.txt $(ASCIIDOC_DEPS)
+ $(TXT_TO_XML) -d manpage -o $@ $<
+
+man1/%.1 : %.xml $(manpage-prereqs)
+ mkdir -p man1
+ $(manpage-cmd) -o man1 $<
+
+html/%.html : %.txt $(ASCIIDOC_DEPS)
+ mkdir -p html
+ $(TXT_TO_HTML) -d manpage -o $@ $<
+
+man: man1/git-filter-repo.1
+html: html/git-filter-repo.html
diff --git a/Makefile b/Makefile
index a443450..d965ae5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,21 +20,10 @@ test:
fixup_locale:
sed -ie s%@@LOCALEDIR@@%$(localedir)% git-filter-repo
-# People installing from tarball will already have man1/git-filter-repo.1 and
-# html/git-filter-repo.html. But let's support people installing from a git
-# clone too; for them, just cheat and snag a copy of the built docs that I
-# record in a different branch.
-snag_docs: Documentation/man1/git-filter-repo.1 Documentation/html/git-filter-repo.html
+doc:
+ $(MAKE) -C Documentation man html
-Documentation/man1/git-filter-repo.1:
- mkdir -p Documentation/man1
- git show origin/docs:man1/git-filter-repo.1 >Documentation/man1/git-filter-repo.1
-
-Documentation/html/git-filter-repo.html:
- mkdir -p Documentation/html
- git show origin/docs:html/git-filter-repo.html >Documentation/html/git-filter-repo.html
-
-install: snag_docs #fixup_locale
+install: doc #fixup_locale
install -Dm0755 git-filter-repo "$(DESTDIR)/$(bindir)/git-filter-repo"
install -dm0755 "$(DESTDIR)/$(pythondir)"
ln -sf "$(bindir)/git-filter-repo" "$(DESTDIR)/$(pythondir)/git_filter_repo.py"
base-commit: cbc6535694380d3a3bf3e5c96410d4ce7e8de94f
--
2.41.0

View File

@ -50,6 +50,8 @@
;;; Copyright © 2023 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2023 Kjartan Oli Agustsson <kjartanoli@disroot.org>
;;; Copyright © 2023 Steve George <steve@futurile.net>
;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
;;; Copyright © 2024 Hilton Chain <hako@ultrarare.space>
;;;
;;; This file is part of GNU Guix.
;;;
@ -3846,25 +3848,64 @@ TkDiff is included for browsing and merging your changes.")
(define-public git-filter-repo
(package
(name "git-filter-repo")
(version "2.29.0")
(version "2.38.0")
(source
(origin
;; Use a release tarball instead of 'git-fetch' because it contains
;; pre-compiled man-pages which are too hard to build in this context
;; as it depends on Git's Makefile.
(method url-fetch)
(uri (string-append "https://github.com/newren/git-filter-repo/releases/"
"download/v" version
"/git-filter-repo-" version ".tar.xz"))
(method git-fetch)
(uri (git-reference
(url "https://github.com/newren/git-filter-repo")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"00nn7k9jqrybb762486fmigsnbcn9lbvimgpfvvarz4ikdp9y9pb"))))
(build-system copy-build-system)
"1al43zpw1mdfy9i05w4xw178abypjwnkk52lqvmbl19lr1l47r4i"))
;; Modified from <https://github.com/newren/git-filter-repo/pull/477>.
;; Used with 'unpack-git-source phase.
(patches (search-patches "git-filter-repo-generate-doc.patch"))))
(build-system gnu-build-system)
(arguments
`(#:install-plan
'(("git-filter-repo" "libexec/git-core/")
("Documentation/man1/" "share/man/man1")
("/" "" #:include ()))))
(list
#:tests? #f ;No tests.
#:imported-modules
`(,@%gnu-build-system-modules
(guix build python-build-system))
#:modules
'((guix build gnu-build-system)
((guix build python-build-system) #:select (site-packages))
(guix build utils)
(srfi srfi-26))
#:make-flags
#~(list (string-append "prefix=" #$output)
(string-append "VERSION=" #$(package-version this-package)))
#:phases
#~(modify-phases %standard-phases
(delete 'configure)
(add-after 'unpack 'unpack-git-source
(lambda _
(let* ((old-path (getcwd))
(doc-source (string-append old-path "/Documentation")))
(mkdir-p "git-source")
(chdir "git-source")
((assoc-ref %standard-phases 'unpack)
#:source #+(package-source git))
(for-each
(cut install-file <> doc-source)
(find-files "." "asciidoc\\.conf$|manpage.*\\.xsl$"))
(chdir old-path)
(delete-file-recursively "git-source"))))
(add-before 'build 'set-pythondir
(lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* "Makefile"
(("(pythondir = ).*" _ pre)
(string-append pre (site-packages inputs outputs))))))
(replace 'build
(lambda* (#:key make-flags #:allow-other-keys)
(apply invoke "make" "doc" make-flags))))))
(native-inputs
(list asciidoc
docbook-xsl
libxml2 ;for XML_CATALOG_FILES
xmlto))
(inputs (list python)) ;for the shebang
(home-page "https://github.com/newren/git-filter-repo")
(synopsis "Quickly rewrite Git repository history")