From 326f255d1f01d5b15b5ae06d1abe17b5cbbfa198 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 1 Jul 2013 03:29:39 +0000 Subject: [PATCH] [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 --- debian/changelog | 1 + debian/patches/features/all/rt/convert-series | 5 -- debian/patches/features/all/rt/genpatch.py | 56 +++++++++++-------- 3 files changed, 34 insertions(+), 28 deletions(-) delete mode 100755 debian/patches/features/all/rt/convert-series diff --git a/debian/changelog b/debian/changelog index 1f4dd0e25..976c33d11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ linux (3.10~rc7-1~exp2) UNRELEASED; urgency=low for most patches * aufs: Add DEP-5 headers to generated/copied patches * [rt] Make genpatch.py work with upstream patch series as well as git + - Fold convert-series into genpatch.py -- Ben Hutchings Mon, 01 Jul 2013 00:58:08 +0100 diff --git a/debian/patches/features/all/rt/convert-series b/debian/patches/features/all/rt/convert-series deleted file mode 100755 index 0c99ff4bd..000000000 --- a/debian/patches/features/all/rt/convert-series +++ /dev/null @@ -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 diff --git a/debian/patches/features/all/rt/genpatch.py b/debian/patches/features/all/rt/genpatch.py index ba3f0b278..2e3a9908d 100755 --- a/debian/patches/features/all/rt/genpatch.py +++ b/debian/patches/features/all/rt/genpatch.py @@ -3,41 +3,53 @@ import os, os.path, re, shutil, subprocess, sys 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() 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: name = line.strip() if name != '' and name[0] != '#': old_series.add(name) - if version: - # Export rebased branch from stable-rt git as patch series - up_ver = re.sub(r'-rt\d+$', '', version) - with open(os.path.join(patch_dir, 'series'), 'w') as series_fh: + with open(os.path.join(patch_dir, series_name), 'w') as series_fh: + # Add directory prefix to all filenames + def add_patch(name): + 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)] env = os.environ.copy() env['GIT_DIR'] = os.path.join(source_dir, '.git') - child = subprocess.Popen(args, cwd=patch_dir, env=env, - stdout=subprocess.PIPE) + child = subprocess.Popen(args, + cwd=os.path.join(patch_dir, rt_patch_dir), + env=env, stdout=subprocess.PIPE) with child.stdout as pipe: for line in pipe: - series_fh.write(line) name = line.strip('\n') - new_series.add(name) - else: - # Copy patch series - shutil.copyfile(os.path.join(source_dir, 'series'), - os.path.join(patch_dir, 'series')) - with open(os.path.join(patch_dir, 'series'), 'r') as series_fh: - for line in series_fh: - name = line.strip() - if name != '' and name[0] != '#': - shutil.copyfile(os.path.join(source_dir, name), - os.path.join(patch_dir, name)) - new_series.add(name) + add_patch(name) + else: + # Copy patch series + with open(os.path.join(source_dir, 'series'), 'r') as \ + source_series_fh: + for line in source_series_fh: + name = line.strip() + if name != '' and name[0] != '#': + shutil.copyfile(os.path.join(source_dir, name), + os.path.join(patch_dir, rt_patch_dir, + name)) + add_patch(name) + else: + # Leave comments and empty lines unchanged + series_fh.write(line) for name in new_series: if name in old_series: @@ -48,8 +60,6 @@ def main(source_dir, version=None): for name in old_series: print 'Obsoleted patch', os.path.join(patch_dir, name) - subprocess.check_call([os.path.join(patch_dir, 'convert-series')]) - if __name__ == '__main__': if len(sys.argv) not in [2, 3]: print >>sys.stderr, '''\