[rt] Fold convert-series into genpatch.py
In the process, stop stripping localversion.patch from an upstream patch series, which we already stopped doing when exporting patches from git. svn path=/dists/trunk/linux/; revision=20310
This commit is contained in:
parent
655014b03d
commit
326f255d1f
|
@ -5,6 +5,7 @@ linux (3.10~rc7-1~exp2) UNRELEASED; urgency=low
|
||||||
for most patches
|
for most patches
|
||||||
* aufs: Add DEP-5 headers to generated/copied patches
|
* aufs: Add DEP-5 headers to generated/copied patches
|
||||||
* [rt] Make genpatch.py work with upstream patch series as well as git
|
* [rt] Make genpatch.py work with upstream patch series as well as git
|
||||||
|
- Fold convert-series into genpatch.py
|
||||||
|
|
||||||
-- Ben Hutchings <ben@decadent.org.uk> Mon, 01 Jul 2013 00:58:08 +0100
|
-- Ben Hutchings <ben@decadent.org.uk> Mon, 01 Jul 2013 00:58:08 +0100
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Add directory prefix to all filenames, but leave comments and
|
|
||||||
# empty lines unchanged. Also comment out localversion.patch.
|
|
||||||
sed -r -e 's,^localversion.patch,#&,' -e 's,^[^# \t],features/all/rt/&,' "debian/patches/features/all/rt/series" > debian/patches/series-rt
|
|
|
@ -3,41 +3,53 @@
|
||||||
import os, os.path, re, shutil, subprocess, sys
|
import os, os.path, re, shutil, subprocess, sys
|
||||||
|
|
||||||
def main(source_dir, version=None):
|
def main(source_dir, version=None):
|
||||||
patch_dir = 'debian/patches/features/all/rt'
|
patch_dir = 'debian/patches'
|
||||||
|
rt_patch_dir = 'features/all/rt'
|
||||||
|
series_name = 'series-rt'
|
||||||
old_series = set()
|
old_series = set()
|
||||||
new_series = set()
|
new_series = set()
|
||||||
|
|
||||||
with open(os.path.join(patch_dir, 'series'), 'r') as series_fh:
|
with open(os.path.join(patch_dir, series_name), 'r') as series_fh:
|
||||||
for line in series_fh:
|
for line in series_fh:
|
||||||
name = line.strip()
|
name = line.strip()
|
||||||
if name != '' and name[0] != '#':
|
if name != '' and name[0] != '#':
|
||||||
old_series.add(name)
|
old_series.add(name)
|
||||||
|
|
||||||
if version:
|
with open(os.path.join(patch_dir, series_name), 'w') as series_fh:
|
||||||
# Export rebased branch from stable-rt git as patch series
|
# Add directory prefix to all filenames
|
||||||
up_ver = re.sub(r'-rt\d+$', '', version)
|
def add_patch(name):
|
||||||
with open(os.path.join(patch_dir, 'series'), 'w') as series_fh:
|
name = os.path.join(rt_patch_dir, name)
|
||||||
|
series_fh.write(name)
|
||||||
|
series_fh.write('\n')
|
||||||
|
new_series.add(name)
|
||||||
|
|
||||||
|
if version:
|
||||||
|
# Export rebased branch from stable-rt git as patch series
|
||||||
|
up_ver = re.sub(r'-rt\d+$', '', version)
|
||||||
args = ['git', 'format-patch', 'v%s..v%s-rebase' % (up_ver, version)]
|
args = ['git', 'format-patch', 'v%s..v%s-rebase' % (up_ver, version)]
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['GIT_DIR'] = os.path.join(source_dir, '.git')
|
env['GIT_DIR'] = os.path.join(source_dir, '.git')
|
||||||
child = subprocess.Popen(args, cwd=patch_dir, env=env,
|
child = subprocess.Popen(args,
|
||||||
stdout=subprocess.PIPE)
|
cwd=os.path.join(patch_dir, rt_patch_dir),
|
||||||
|
env=env, stdout=subprocess.PIPE)
|
||||||
with child.stdout as pipe:
|
with child.stdout as pipe:
|
||||||
for line in pipe:
|
for line in pipe:
|
||||||
series_fh.write(line)
|
|
||||||
name = line.strip('\n')
|
name = line.strip('\n')
|
||||||
new_series.add(name)
|
add_patch(name)
|
||||||
else:
|
else:
|
||||||
# Copy patch series
|
# Copy patch series
|
||||||
shutil.copyfile(os.path.join(source_dir, 'series'),
|
with open(os.path.join(source_dir, 'series'), 'r') as \
|
||||||
os.path.join(patch_dir, 'series'))
|
source_series_fh:
|
||||||
with open(os.path.join(patch_dir, 'series'), 'r') as series_fh:
|
for line in source_series_fh:
|
||||||
for line in series_fh:
|
name = line.strip()
|
||||||
name = line.strip()
|
if name != '' and name[0] != '#':
|
||||||
if name != '' and name[0] != '#':
|
shutil.copyfile(os.path.join(source_dir, name),
|
||||||
shutil.copyfile(os.path.join(source_dir, name),
|
os.path.join(patch_dir, rt_patch_dir,
|
||||||
os.path.join(patch_dir, name))
|
name))
|
||||||
new_series.add(name)
|
add_patch(name)
|
||||||
|
else:
|
||||||
|
# Leave comments and empty lines unchanged
|
||||||
|
series_fh.write(line)
|
||||||
|
|
||||||
for name in new_series:
|
for name in new_series:
|
||||||
if name in old_series:
|
if name in old_series:
|
||||||
|
@ -48,8 +60,6 @@ def main(source_dir, version=None):
|
||||||
for name in old_series:
|
for name in old_series:
|
||||||
print 'Obsoleted patch', os.path.join(patch_dir, name)
|
print 'Obsoleted patch', os.path.join(patch_dir, name)
|
||||||
|
|
||||||
subprocess.check_call([os.path.join(patch_dir, 'convert-series')])
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) not in [2, 3]:
|
if len(sys.argv) not in [2, 3]:
|
||||||
print >>sys.stderr, '''\
|
print >>sys.stderr, '''\
|
||||||
|
|
Loading…
Reference in New Issue