From 987d309b7466fe9b472fe78d0e83b13910f4ba74 Mon Sep 17 00:00:00 2001
From: M Hickford <mirth.hickford@gmail.com>
Date: Tue, 18 Mar 2025 23:03:36 +0000
Subject: [PATCH] debian: package git-credential-libsecret
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Package is named 'git-credential-libsecret' for consistency with
application name and package name in other distributions
https://pkgs.org/search/?q=git-credential-libsecret

Tested package build, install and application:

    dpkg-buildpackage --no-sign
    sudo apt install ~/git-credential-libsecret_2.51.0-1_all.deb
    cd t && GIT_TEST_INSTALLED=/usr/bin GIT_TEST_CREDENTIAL_HELPER=libsecret make t0303-credential-external.sh

Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
Co-authored-by: Vit Kabele <vit.kabele@sysgo.com>
Co-authored-by: M Hickford <mirth.hickford@gmail.com>
Tested-by: Vit Kabele <vit.kabele@sysgo.com>
Tested-by: M Hickford <mirth.hickford@gmail.com>
---
 debian/control                          | 21 +++++++++++++++++++++
 debian/git-credential-libsecret.install |  1 +
 debian/rules                            |  8 +++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 debian/git-credential-libsecret.install

diff --git a/debian/control b/debian/control
index da94479525..9613ad077a 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders: Anders Kaseorg <andersk@mit.edu>
 Build-Depends: libz-dev, gettext,
  libpcre2-dev | libpcre3-dev,
  libcurl4-gnutls-dev, libexpat1-dev,
+ libsecret-1-dev,
  subversion, libsvn-perl, libyaml-perl,
  tcl, python3,
  libhttp-date-perl | libtime-parsedate-perl,
@@ -33,6 +34,7 @@ Pre-Depends: ${misc:Pre-Depends}
 Recommends: ca-certificates, patch, less, ssh-client
 Suggests: gettext-base,
  git-doc, git-email, git-gui, gitk, gitweb,
+ git-credential-libsecret,
  git-cvs, git-svn
 Breaks: bash-completion (<< 1:1.90-1),
  dgit (<< 5.1~),
@@ -231,11 +233,30 @@ Description: fast, scalable, distributed revision control system (web interface)
  If libcgi-fast-perl is installed, gitweb can also be run over FastCGI
  (and served by nginx, for example).
 
+Package: git-credential-libsecret
+Architecture: all
+Multi-Arch: foreign
+Depends: ${misc:Depends}, git (>> ${source:Upstream-Version}), git (<< ${source:Upstream-Version}-.), libsecret-1-0
+Description: fast, scalable, distributed revision control system (libsecret credential helper)
+ Git is popular version control system designed to handle very large
+ projects with speed and efficiency; it is used for many high profile
+ open source projects, most notably the Linux kernel.
+ .
+ Git falls in the category of distributed source code management tools.
+ Every Git working directory is a full-fledged repository with full
+ revision tracking capabilities, not dependent on network access or a
+ central server.
+ .
+ This package provides a helper git-credential-libsecret. It stores Git
+ credentials in any secret storage supporting the D-Bus Secret Service
+ API.
+
 Package: git-all
 Architecture: all
 Multi-Arch: foreign
 Depends: ${misc:Depends}, git (>> ${source:Upstream-Version}), git (<< ${source:Upstream-Version}-.),
  git-doc, git-cvs, git-svn,
+ git-credential-libsecret,
  git-email, git-gui, gitk, gitweb
 Description: fast, scalable, distributed revision control system (all subpackages)
  Git is popular version control system designed to handle very large
diff --git a/debian/git-credential-libsecret.install b/debian/git-credential-libsecret.install
new file mode 100644
index 0000000000..d61ca822bc
--- /dev/null
+++ b/debian/git-credential-libsecret.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/git-core/git-credential-libsecret* usr/lib/git-core
diff --git a/debian/rules b/debian/rules
index a9c5bde389..3a952d3005 100755
--- a/debian/rules
+++ b/debian/rules
@@ -65,6 +65,8 @@ build-stamp:
 override_dh_auto_build-arch: build-stamp
 	$(MAKE) -C contrib/subtree all $(OPTS)
 	ln -s contrib/subtree/git-subtree
+	$(MAKE) -C contrib/credential/libsecret all $(OPTS)
+	ln -s contrib/credential/libsecret
 
 override_dh_auto_test-arch:
 	test -z '$(TEST)' || \
@@ -87,8 +89,9 @@ override_dh_auto_test-indep:
 
 override_dh_auto_clean:
 	$(MAKE) -C contrib/subtree clean $(OPTS)
+	$(MAKE) -C contrib/credential/libsecret clean $(OPTS)
 	$(MAKE) clean $(OPTS)
-	rm -f git-subtree
+	rm -f git-subtree libsecret
 
 override_dh_clean:
 	dh_clean -Xmailinfo.c.orig
@@ -97,6 +100,9 @@ override_dh_auto_install-arch:
 	# git
 	DESTDIR='$(GIT)' $(MAKE) install $(OPTS)
 	DESTDIR='$(GIT)' $(MAKE) -C contrib/subtree install $(OPTS)
+	install -d -m0755 '$(TMP)'/usr/lib/git-core/
+	install -m0755 contrib/credential/libsecret/git-credential-libsecret \
+	 '$(TMP)'/usr/lib/git-core/
 	install -d -m0755 '$(GIT)'/var/lib/git
 	rm -rf '$(GIT)'/usr/share/man
 	# don't include arch, cvs, p4, svn, email, gui tools, and gitk program
-- 
2.51.0.windows.1

