Date: Monday, March 7, 2022 @ 14:16:30
  Author: eworm
Revision: 1144371

upgpkg: gitolite 3.6.12-2: do not depend on inetutils (FS#74043)

... and use `hostname()` from perl instead.

Added:
  gitolite/trunk/0001-perl-sys-hostname.patch
Modified:
  gitolite/trunk/PKGBUILD

------------------------------+
 0001-perl-sys-hostname.patch |   65 +++++++++++++++++++++++++++++++++++++++++
 PKGBUILD                     |   19 +++++++----
 2 files changed, 77 insertions(+), 7 deletions(-)

Added: 0001-perl-sys-hostname.patch
===================================================================
--- 0001-perl-sys-hostname.patch                                (rev 0)
+++ 0001-perl-sys-hostname.patch        2022-03-07 14:16:30 UTC (rev 1144371)
@@ -0,0 +1,65 @@
+diff --git a/src/commands/sskm b/src/commands/sskm
+index eb51f69..3692f37 100755
+--- a/src/commands/sskm
++++ b/src/commands/sskm
+@@ -3,6 +3,7 @@ use strict;
+ use warnings;
+ 
+ use lib $ENV{GL_LIBDIR};
++use Sys::Hostname;
+ use Gitolite::Rc;
+ use Gitolite::Common;
+ 
+@@ -131,7 +132,7 @@ sub cd_temp_clone {
+     chomp($TEMPDIR);
+     hushed_git( "clone", "$rb/gitolite-admin.git", "$TEMPDIR" );
+     chdir($TEMPDIR);
+-    my $hostname = `hostname`; chomp($hostname);
++    my $hostname = hostname();
+     hushed_git( "config", "--get", "user.email" ) and hushed_git( "config", 
"user.email", $ENV{USER} . "@" . $hostname );
+     hushed_git( "config", "--get", "user.name" )  and hushed_git( "config", 
"user.name",  "$ENV{USER} on $hostname" );
+ }
+diff --git a/src/lib/Gitolite/Rc.pm b/src/lib/Gitolite/Rc.pm
+index 41996fb..4e683ac 100644
+--- a/src/lib/Gitolite/Rc.pm
++++ b/src/lib/Gitolite/Rc.pm
+@@ -21,6 +21,7 @@ package Gitolite::Rc;
+ );
+ 
+ use Exporter 'import';
++use Sys::Hostname;
+ 
+ use Gitolite::Common;
+ 
+@@ -284,7 +285,7 @@ sub version {
+ sub greeting {
+     my $json = shift;
+ 
+-    chomp( my $hn = `hostname -s 2>/dev/null || hostname` );
++    my $hn = (split /\./, hostname())[0];
+     my $gv = substr( `git --version`, 12 );
+     my $gl_user = $ENV{GL_USER} || '';
+     $gl_user = " $gl_user" if $gl_user;
+diff --git a/src/lib/Gitolite/Setup.pm b/src/lib/Gitolite/Setup.pm
+index 8ad5d34..77f97ac 100644
+--- a/src/lib/Gitolite/Setup.pm
++++ b/src/lib/Gitolite/Setup.pm
+@@ -43,6 +43,7 @@ Subsequent runs:
+ );
+ 
+ use Exporter 'import';
++use Sys::Hostname;
+ 
+ use Gitolite::Rc;
+ use Gitolite::Common;
+@@ -157,8 +158,8 @@ sub setup_gladmin {
+     _chdir("$rc{GL_REPO_BASE}/gitolite-admin.git");
+     _system("git add conf/gitolite.conf");
+     _system("git add keydir") if $pubkey;
+-    tsh_try("git config --get user.email") or tsh_run( "git config user.email 
$ENV{USER}\@" . `hostname` );
+-    tsh_try("git config --get user.name")  or tsh_run( "git config user.name 
'$ENV{USER} on '" . `hostname` );
++    tsh_try("git config --get user.email") or tsh_run( "git config user.email 
$ENV{USER}\@" . hostname() );
++    tsh_try("git config --get user.name")  or tsh_run( "git config user.name 
'$ENV{USER} on '" . hostname() );
+     tsh_try("git diff --cached --quiet")
+       or tsh_try("git commit -am '$message'")
+       or _die "setup failed to commit to the admin repo";

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2022-03-07 13:49:20 UTC (rev 1144370)
+++ PKGBUILD    2022-03-07 14:16:30 UTC (rev 1144371)
@@ -4,7 +4,7 @@
 
 pkgname=gitolite
 pkgver=3.6.12
-pkgrel=1
+pkgrel=2
 pkgdesc='An access control layer on top of git'
 url='https://github.com/sitaramc/gitolite'
 arch=('any')
@@ -11,25 +11,30 @@
 license=('GPL2')
 depends=('git' 'perl' 'openssh')
 optdepends=('perl-json: json output')
-source=("$pkgname-$pkgver.tar.gz::$url/archive/v${pkgver}.tar.gz"
+source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz"
+        '0001-perl-sys-hostname.patch'
         'gitolite-sysusers.conf'
         'gitolite-tmpfiles.conf')
 sha256sums=('8c55976ed561b8eabf39097b7fcb9c6e8741c2ceea85ef4529a06b1adff850b6'
+            '60775fcf967599ba2d48cdb21591a3150c7314f74e50579b040fc6bc05f0325f'
             '5e4f3aaa406c25fcd88fffaee74ea4878cecf1dd8c777456e4416caf35292dbf'
             '5682190c639618cd4744d3ae193425df1044dde4fb36acf03fc4d20423eeb10c')
 
 prepare() {
-  cd $pkgname-$pkgver/src
-  echo "$pkgver" > VERSION
+  cd "${pkgname}-${pkgver}"
+
+  echo "${pkgver}" > src/VERSION
+
+  patch -Np1 < ../0001-perl-sys-hostname.patch
 }
 
 package() {
   # create directories
-  install -d "$pkgdir"/usr/{bin,lib/gitolite}
+  install -d "${pkgdir}"/usr/{bin,lib/gitolite}
 
   # install files and create symlink
-  cp -a $pkgname-$pkgver/src/* "$pkgdir"/usr/lib/gitolite
-  ln -s /usr/lib/gitolite/gitolite "$pkgdir"/usr/bin/
+  cp -a "${pkgname}-${pkgver}"/src/* "${pkgdir}"/usr/lib/gitolite
+  ln -s /usr/lib/gitolite/gitolite "${pkgdir}"/usr/bin/
 
   # sysusers and tmpfiles files
   install -D -m 0644 "${srcdir}"/gitolite-sysusers.conf 
"${pkgdir}"/usr/lib/sysusers.d/gitolite.conf

Reply via email to