From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/linux-patches:genpatches-misc commit in: scripts/
Date: Thu, 11 Sep 2014 00:50:30 +0000 (UTC) [thread overview]
Message-ID: <1410396773.d87b1ff6119cb184872b3e736a6d9a9a1334bb7f.blueness@gentoo> (raw)
commit: d87b1ff6119cb184872b3e736a6d9a9a1334bb7f
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 11 00:46:47 2014 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Sep 11 00:52:53 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=d87b1ff6
scripts: initial commit of get-patch
---
scripts/get-patch | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/scripts/get-patch b/scripts/get-patch
new file mode 100755
index 0000000..5d56874
--- /dev/null
+++ b/scripts/get-patch
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+GENPATCHES_URL="git://git.overlays.gentoo.org/proj/linux-patches.git"
+KERNEL_BASE_URL="https://www.kernel.org/pub/linux/kernel/v3.x"
+KERENL_INCR_URL="${KERNEL_BASE_URL}/incr"
+
+
+usage() {
+ echo "Usage: $0 n [m]."
+ echo
+ echo "When called from within a branch N of the linux-patches repo,"
+ echo "get-patch will download patch-N.n-(n+1).xz from kernel.org"
+ echo "and rename it to 100n_linux-N-(n+1).patch for inclusion in"
+ echo "the genpatches patchset."
+ echo
+ echo "If a range 'n m' is given, then that range of patches will"
+ echo "be downloaded. get-patch expects n < m."
+ echo
+ exit $1
+}
+
+error_branch() {
+ echo "Could not detect your branch. get-patch expects you to be"
+ echo "in a branch of $LINUX_PATCHES_URL"
+ echo
+ exit 4
+}
+
+error_download() {
+ echo "Couldn't download $1, bailing out!"
+ echo
+ rm -f $2
+ exit 5
+}
+
+warning_exists() {
+ echo "Warning, $1 alreay exists, not downloading."
+ echo "If you want to download it again, remove the current file."
+ echo
+}
+
+alert_downloaded() {
+ echo "Downloaded: $1"
+ echo
+}
+
+[[ "$1" == "-h" || "$1" == "--help" ]] && usage 0
+[[ -z "$1" ]] && usage 1
+[[ ! -z "$3" ]] && usage 2
+[[ ! -z "$2" && $1 -ge $2 ]] && usage 3
+
+version=$(git rev-parse --abbrev-ref HEAD)
+
+[[ -z "$version" ]] && error_branch
+
+[[ -z "$2" ]] && limit=$(expr $1 + 1) || limit=$2
+
+for i in $(seq $1 $(expr $limit - 1)) ; do
+ if [[ $i -eq 0 ]]; then
+ front=100
+ GET="${KERNEL_BASE_URL}/patch-${version}.1.xz"
+ else
+ if [[ $i -lt 10 ]] ; then
+ front=100
+ else
+ front=10
+ fi
+ GET="${KERENL_INCR_URL}/patch-${version}.$i-$(expr $i + 1).xz"
+ fi
+ SAVE="${front}${i}_linux-${version}.$(expr $i + 1).patch"
+ [[ -f "${SAVE}" ]] && warning_exists "${SAVE}" && continue
+ wget "${GET}" -O "${SAVE}.xz" >/dev/null 2>&1
+ [[ $? -ne 0 ]] && error_download "${GET}" "${SAVE}.xz" || alert_downloaded "${SAVE}"
+ xz -d "${SAVE}.xz"
+done
next reply other threads:[~2014-09-11 0:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 0:50 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-10 16:49 [gentoo-commits] proj/linux-patches:genpatches-misc commit in: scripts/ Mike Pagano
2022-07-24 17:18 Mike Pagano
2021-09-15 14:54 Mike Pagano
2021-09-08 11:52 Mike Pagano
2021-03-04 15:50 Mike Pagano
2019-10-29 18:02 Mike Pagano
2019-10-12 19:12 Mike Pagano
2019-10-07 22:12 Mike Pagano
2019-10-07 19:27 Mike Pagano
2018-12-14 23:13 Mike Pagano
2015-04-29 17:49 Mike Pagano
2014-10-06 12:09 Anthony G. Basile
2014-07-15 12:34 Mike Pagano
2014-06-26 23:50 Mike Pagano
2014-06-20 12:22 Mike Pagano
2014-06-20 0:46 Mike Pagano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410396773.d87b1ff6119cb184872b3e736a6d9a9a1334bb7f.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox