From 97554d98a4b630e3867d7f7dbeff5ea5356e2694 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <seblu@seblu.net>
Date: Thu, 10 Aug 2017 19:40:43 +0200
Subject: [PATCH] Change way of handle with various repo names

---
 PKGBUILD | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/PKGBUILD b/PKGBUILD
index 044eebd..559f6b6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,8 +3,6 @@
 
 pkgname=linux-seblu
 pkgver=4.12
-_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
-#_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
 pkgrel=1
 pkgdesc='The Linux Kernel cooked by Seblu'
 arch=('x86_64')
@@ -14,13 +12,20 @@ options=('!strip')
 makedepends=('kmod' 'git' 'make' 'gcc' 'bc' 'sed')
 depends=('linux-firmware' 'kernel-install-hook')
 install=linux-seblu.install
-_reponame=${_repourl##*/}
+_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
+#_repourl='git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
 source=("$_repourl#tag=v${pkgver/_/-}"
         "config.$CARCH")
 md5sums=('SKIP' 'SKIP')
 
 prepare() {
-  cd ${_reponame%.git}
+  # fake linux directory if necessary
+  if [[ ${_repourl##*/} != 'linux.git' ]]; then
+    local _reponame="${_repourl##*/}"
+    ln -sfT "${_reponame%.git}" linux
+  fi
+
+  cd linux
 
   # apply patches
   for _f in "${source[@]}"; do
@@ -51,7 +56,7 @@ prepare() {
 }
 
 build() {
-  cd ${_reponame%.git}
+  cd linux
 
   msg2 'Make prepare'
   make prepare
@@ -64,7 +69,7 @@ build() {
 }
 
 package() {
-  cd ${_reponame%.git}
+  cd linux
 
   # get real compiled kernel version
   kernrel=$(make kernelrelease)
@@ -106,7 +111,7 @@ install_sources() {
   ln -rs  "$kernsrc" "$pkgdir/usr/lib/modules/$kernrel"/build
 
   # Copy kernel config files
-  cd "$srcdir/${_reponame%.git}"
+  cd "$srcdir/linux"
   install -D -m644 Makefile "$kernsrc/Makefile"
   install -D -m644 kernel/Makefile "$kernsrc/kernel/Makefile"
   install -D -m644 .config "$kernsrc/.config"
-- 
GitLab