diff options
author | David Cohen | 2022-04-21 22:50:20 -0500 |
---|---|---|
committer | David Cohen | 2022-04-21 22:54:28 -0500 |
commit | 0822a19a7c17b2389499ef993ce298cf8f8f0e95 (patch) | |
tree | e64510321b56acaaef3dc691ab0f71586430908f | |
parent | 1529de92383b3a099b0360e18279599f69dfa8eb (diff) | |
download | aur-0822a19a7c17b2389499ef993ce298cf8f8f0e95.tar.gz |
add support for extra user configs
This patch adds support to select specific remote and commit (instead of
hardcoded to support only mainline master branch). It also adds support
to add custom patches to be applied on top of selected remote/commit.
Signed-off-by: David Cohen <dacohen@pm.me>
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 58 | ||||
-rw-r--r-- | patches | 12 | ||||
-rw-r--r-- | remote | 9 |
4 files changed, 81 insertions, 6 deletions
@@ -1,6 +1,6 @@ pkgbase = linux-mainline-git pkgdesc = Linus Torvalds' Mainline Linux - pkgver = v5.17.r11138.f022814633e1 + pkgver = v5.18.rc3.r74.b05a5683eba6 pkgrel = 1 url = https://www.kernel.org arch = x86_64 @@ -21,16 +21,22 @@ pkgbase = linux-mainline-git makedepends = git options = !strip backup = etc/linux-mainline-git/config + backup = etc/linux-mainline-git/remote + backup = etc/linux-mainline-git/patches/patches source = linux-torvalds::git+https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux source = config source = config.extra source = config.user + source = remote + source = patches validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E sha256sums = SKIP sha256sums = 05381b085c83737922a85fa6f42aa61b3d1400840a7952bf8524726e1d8f74f8 sha256sums = 6e41a729c2f2946d3606ca2c0cb3a058c9700b0f73110eed36dcba91a271e50f sha256sums = b5ced6ad1f03a5cfe6dccc0b2b31f91420cfe97823e5d15d5b94b7224362daa9 + sha256sums = 71c6047def065c291127cebd5878389ff1aa103e1a3c20ca4dd5b04cd9069705 + sha256sums = 986e39ee1cb41d342b19f1c5af8016d48afa1e182237dbdcc3f222ae4203ef2d pkgname = linux-mainline-git pkgdesc = The Linus Torvalds' Mainline Linux kernel and modules @@ -6,14 +6,20 @@ # will be on config.extra file. pkgbase=linux-mainline-git -pkgver=v5.17.r11138.f022814633e1 +pkgver=v5.18.rc3.r74.b05a5683eba6 pkgrel=1 pkgdesc="Linus Torvalds' Mainline Linux" url="https://www.kernel.org" arch=(x86_64) license=(GPL2) _userconfig="/etc/${pkgbase}/config" -backup=("${_userconfig##/}") +_userremote="/etc/${pkgbase}/remote" +_userpatches="/etc/${pkgbase}/patches/patches" +backup=( +"${_userconfig##/}" +"${_userremote##/}" +"${_userpatches##/}" +) makedepends=( bc kmod libelf pahole cpio perl tar xz xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick @@ -26,6 +32,8 @@ source=( config # the main kernel config file config.extra # additional configs config.user # user custom config + remote # custom remote config + patches # user patches config ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds @@ -34,7 +42,9 @@ validpgpkeys=( sha256sums=('SKIP' '05381b085c83737922a85fa6f42aa61b3d1400840a7952bf8524726e1d8f74f8' '6e41a729c2f2946d3606ca2c0cb3a058c9700b0f73110eed36dcba91a271e50f' - 'b5ced6ad1f03a5cfe6dccc0b2b31f91420cfe97823e5d15d5b94b7224362daa9') + 'b5ced6ad1f03a5cfe6dccc0b2b31f91420cfe97823e5d15d5b94b7224362daa9' + '71c6047def065c291127cebd5878389ff1aa103e1a3c20ca4dd5b04cd9069705' + '986e39ee1cb41d342b19f1c5af8016d48afa1e182237dbdcc3f222ae4203ef2d') export KBUILD_BUILD_HOST=archlinux @@ -43,12 +53,35 @@ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EP pkgver() { cd "$srcdir/$_srcname" - printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')" + if [[ -n "$REMOTE_URL" ]]; then + # if $REMOTE_URL was created, it's safe to use $REMOTE + printf "%s" "$(git describe --dirty=-patched --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g').${REMOTE/\//.}" + else + printf "%s" "$(git describe --dirty=-patched --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')" + fi } prepare() { cd $_srcname + [[ -f "$_userremote" ]] && source "$_userremote" + if [[ -n "$REMOTE" && -n "$COMMIT" ]]; then + REMOTE_PREFIX=${REMOTE_PREFIX##${_srcname}::git+} + REMOTE_PREFIX=${REMOTE_PREFIX%%torvalds/linux} + REMOTE_URL=${REMOTE_PREFIX}${REMOTE} + echo + echo "================================================================================" + echo "Build script detected custom variables \$REMOTE and \$COMMIT are being used:" + echo "REMOTE_PREFIX: $REMOTE_PREFIX" + echo "REMOTE_TIP : $REMOTE" + echo "COMMIT : $COMMIT" + echo "================================================================================" + echo + echo "Fetching ${REMOTE_PREFIX}${REMOTE} ${COMMIT}" + git fetch ${REMOTE_URL} ${COMMIT} + git checkout -f FETCH_HEAD + fi + echo "Setting version..." scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel @@ -63,6 +96,19 @@ prepare() { patch -Np1 < "../$src" done + [[ -f "$_userpatches" ]] && source "$_userpatches" + PATCHES_PREFIX=${_userpatches%%patches} + _USER_PATCHES="0" + for src in "${PATCHES}"; do + [[ $src = *.patch ]] || continue + echo "Applying user patch $src..." + patch -Np1 < "${PATCHES_PREFIX}$src" + _USER_PATCHES="1" + done + + # Let user see the patches were applied before proceed with the build + [[ ${_USER_PATCHES} = "1" ]] && sleep 2 + echo "Setting config..." cat ../config ../config.extra > .config if [[ -f "$_userconfig" ]]; then @@ -106,8 +152,10 @@ _package() { # remove build and source links rm "$modulesdir"/{source,build} - # install user config file + # install config files install -Dm644 $srcdir/config.user "${pkgdir}${_userconfig}" + install -Dm644 $srcdir/remote "${pkgdir}${_userremote}" + install -Dm644 $srcdir/patches "${pkgdir}${_userpatches}" } _package-headers() { diff --git a/patches b/patches new file mode 100644 index 000000000000..d562e0316aad --- /dev/null +++ b/patches @@ -0,0 +1,12 @@ +# List here the patches' filename to be applied in the correct order. +# All patches need to be placed in this directory and have the .patch name +# extension. +# +# PATCHES=( +# '0001-foo.patch' +# '0002-bar.patch' +# ... +# ) + +PATCHES=( +) diff --git a/remote b/remote new file mode 100644 index 000000000000..08590bbd42b4 --- /dev/null +++ b/remote @@ -0,0 +1,9 @@ +# Here you can customize the remote and commit in case you don't want Linus +# Torvalds' mainline. +# For security reasons, the remote's prefix is hardcoded and you can only +# select among the git.kernel.org's official development trees (although this +# package uses a faster mirror): +# https://kernel.googlesource.com/pub/scm/linux/kernel/git/${REMOTE} + +# REMOTE="torvalds/linux" +# COMMIT="master" |