summaryrefslogtreecommitdiff
blob: a60bb9c369b8b9c5ef43ddd988251e68d7b1889c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
From 7343f154ae6bc08bd2c3c051f039824af3d917e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
Date: Wed, 11 Oct 2017 21:56:53 +0200
Subject: [PATCH 12/16] [no patch] Gentoo: Add patch tarball generation script

(cherry picked from commit 90427abb2aac0cc4ebcb73397cc3ad574c6fec5d)
---
 scripts/gentoo/0000-Gentoo-Git-is-development |  12 ++
 scripts/gentoo/9999-Gentoo-We-make-a-release  |  12 ++
 scripts/gentoo/README.Gentoo.patches          |  31 +++++
 scripts/gentoo/make-tarball.sh                | 118 ++++++++++++++++++
 4 files changed, 173 insertions(+)
 create mode 100644 scripts/gentoo/0000-Gentoo-Git-is-development
 create mode 100644 scripts/gentoo/9999-Gentoo-We-make-a-release
 create mode 100644 scripts/gentoo/README.Gentoo.patches
 create mode 100755 scripts/gentoo/make-tarball.sh

diff --git a/scripts/gentoo/0000-Gentoo-Git-is-development b/scripts/gentoo/0000-Gentoo-Git-is-development
new file mode 100644
index 0000000000..2b9482d033
--- /dev/null
+++ b/scripts/gentoo/0000-Gentoo-Git-is-development
@@ -0,0 +1,12 @@
+Gentoo: Git is development
+
+--- a/bfd/development.sh
++++ b/bfd/development.sh
+@@ -16,5 +16,5 @@
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ # Controls whether to enable development-mode features by default.
+-development=false
++development=true
+ 
+
diff --git a/scripts/gentoo/9999-Gentoo-We-make-a-release b/scripts/gentoo/9999-Gentoo-We-make-a-release
new file mode 100644
index 0000000000..fea66d97b4
--- /dev/null
+++ b/scripts/gentoo/9999-Gentoo-We-make-a-release
@@ -0,0 +1,12 @@
+Gentoo: We make a release, so switch development flag off
+
+--- a/bfd/development.sh
++++ b/bfd/development.sh
+@@ -16,5 +16,5 @@
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ # Controls whether to enable development-mode features by default.
+-development=true
++development=false
+ 
+
diff --git a/scripts/gentoo/README.Gentoo.patches b/scripts/gentoo/README.Gentoo.patches
new file mode 100644
index 0000000000..504dc67127
--- /dev/null
+++ b/scripts/gentoo/README.Gentoo.patches
@@ -0,0 +1,31 @@
+ ============
+ === What ===
+ ============
+
+Gentoo patchsets for binutils are maintained as vendor branches of the upstream
+binutils-glb git repository. From there, we bundle all the commits into a tarball
+and distribute it via our public mirroring system.
+
+If you want specific info about a patch (like what it does or whose great idea 
+it was to change the code), read the patch!  We try to fill out the commit
+messages with useful info such as what it does, why it's needed, bug reports, 
+original creators, etc...  
+
+ =============
+ === Where ===
+ =============
+
+Currently, https://github.com/gentoo/binutils-gdb
+
+ ===========
+ === How ===
+ ===========
+ 
+The patch naming convention is precisely as generated by "git format-patch".
+
+All patches should apply with -p1 (so they can be used both with the legacy
+epatch function and the new, more strict eapply function).
+
+Commits where the commit message starts with "[no patch]" will not be included
+in the patch tarball. This is useful for changes to the tarball generation
+script, or for the addition of extra files that are not patches.
diff --git a/scripts/gentoo/make-tarball.sh b/scripts/gentoo/make-tarball.sh
new file mode 100755
index 0000000000..575f48bf6a
--- /dev/null
+++ b/scripts/gentoo/make-tarball.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+
+PN="binutils"
+PV=$1
+pver=$2
+
+if [[ -z ${PV} ]] ; then
+	echo "Usage: $0 binutils-version patchset-version-to-be-created"
+	echo "Please read the script before trying to use it :)"
+	exit 1
+fi
+
+# check that we're in the root of a binutils-gdb git repo
+
+if [[ ! -f COPYING.LIBGLOSS ]] || [[ ! -d .git ]] ; then
+	echo "Error: You need to call this script in the main directory of a Gentoo binutils-gdb git clone"
+	exit 1
+fi
+
+# check that we're on a branch gentoo/${PV}
+
+mybranchinfo=$(git status --porcelain -b|grep '^##')
+mybranch=$(echo ${mybranchinfo}|sed -e 's:^## ::' -e 's:\.\.\..*$::')
+if [[ ! "gentoo/binutils-${PV}" == "${mybranch}" ]] ; then
+	echo "Error: Your git repository is on the incorrect branch ${mybranch}; should be gentoo/binutils-${PV}"
+	exit 1
+fi
+
+# check that the working directory is clean
+
+mystatusinfo=$(git status --porcelain)
+if [[ ! -z "${mystatusinfo}" ]] ; then
+	echo "Error: Your working directory is not clean"
+	exit 1
+fi
+
+# check if the tag already exists
+
+mytaginfo=$(git tag -l|grep "gentoo/binutils-${PV}-${pver}")
+if [[ ! -z "${mytaginfo}" ]] ; then
+	echo "Error: A tag corresponding to this patch level already exists (gentoo/binutils-${PV}-${pver})"
+	exit 1
+fi
+
+# luckily binutils git has no /tmp dir and no tar.xz files, but let's better check and be pathologically careful
+
+if [[ -e tmp ]] || [[ -e ${PN}-${PV}-patches-${pver}.tar.xz ]] ; then
+	echo "Error: tmp or ${PN}-${PV}-patches-${pver}.tar.xz exists in git"
+	exit 1
+fi
+rm -rf tmp
+rm -f ${PN}-${PV}-*.tar.bz2
+
+for myname in 0*.patch ; do
+	if [[ -e "${myname}" ]]; then
+		echo "Error: ${myname} exists in git"
+		exit 1
+	fi
+done
+rm -f 0*.patch
+
+# check if we have to override the upstream tag
+
+mytaginfo=$(git tag -l|grep "gentoo/binutils-${PV}-upstream")
+if [[ ! -z "${mytaginfo}" ]] ; then
+	starttag="gentoo/binutils-${PV}-upstream"
+else
+	starttag="binutils-${PV//./_}"
+fi
+if [[ "${PV}" == "9999" ]]; then
+	starttag="master"
+fi
+echo "Starting from tag ${starttag}"
+
+mkdir -p tmp/patch
+
+# copy README.Gentoo.patches
+
+cp scripts/gentoo/README.Gentoo.patches tmp/ || exit 1
+
+# create and rename patches
+
+git format-patch ${starttag}..HEAD > /dev/null || exit 1
+
+# remove all patches where the summary line starts with:
+# - [no-tarball]: not related to upstream tarball
+# - [no-patch]: not related to upstream patches
+# - "Automatic date update in version.in": daily bumps
+rm -f 0???-no-tarball-*.patch
+rm -f 0???-no-patch-*.patch
+rm -f 0???-Automatic-date-update-in-version.in.patch
+
+for myname in 0*.patch ; do
+	mv ${myname} tmp/patch/ || exit 1
+done
+
+# add the extra patch if needed
+
+if [[ "${PV}" != "9999" ]]; then
+	cp scripts/gentoo/0000-Gentoo-Git-is-development tmp/patch/0000-Gentoo-Git-is-development.patch || exit 1
+	cp scripts/gentoo/9999-Gentoo-We-make-a-release tmp/patch/9999-Gentoo-We-make-a-release.patch || exit 1
+fi
+
+# add a history file
+
+git log --stat --decorate ${starttag}..HEAD > tmp/patch/README.history || exit 1
+
+# package everything up
+
+tar -Jcf ${PN}-${PV}-patches-${pver}.tar.xz \
+	-C tmp patch README.Gentoo.patches || exit 1
+rm -r tmp
+
+du -b *.tar.xz
+
+# tag the commit
+
+git tag -s -m "Gentoo patchset binutils-${PV}-${pver}" "gentoo/binutils-${PV}-${pver}"
-- 
2.26.2