From 1dd4269baf4b17cffd1fe4f4d3bce897f177b955 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 25 Oct 2014 22:24:24 +0400 Subject: [PATCH] Update powerline-release script to use live ebuild as the base Reasoning: I am going to add man pages support to the live ebuild, but it does not make sense to add this to the 1.0 ebuild previously used as the base. Since new features will likely continue to appear in the live ebuild powerline-release script was modified to do the right thing under new circumstances. --- scripts/powerline-release.py | 38 +++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/scripts/powerline-release.py b/scripts/powerline-release.py index ecfc213f..3a4c821d 100755 --- a/scripts/powerline-release.py +++ b/scripts/powerline-release.py @@ -5,7 +5,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct import argparse import codecs import os -import shutil +import re from subprocess import check_output, check_call from getpass import getpass @@ -107,9 +107,41 @@ def create_ebuilds(version_string, overlay, user, **kwargs): ('app-vim', 'powerline-vim'), ): pdir = os.path.join(overlay, category, pn) - v1_0 = os.path.join(pdir, '{0}-1.0.ebuild'.format(pn)) + live_ebuild = None + for ebuild in os.listdir(pdir): + if ebuild.endswith('.ebuild') and '9999' in ebuild: + live_ebuild = os.path.join(pdir, ebuild) + break + assert(live_ebuild) vcur = os.path.join(pdir, '{0}-{1}.ebuild'.format(pn, version_string)) - shutil.copy2(v1_0, vcur) + with open(live_ebuild) as LEF: + with open(vcur, 'w') as F: + dropnext = False + for line in LEF: + if line.startswith('EGIT'): + # Drop all EGIT_… and the next empty line + dropnext = True + next_re = re.compile('^$') + continue + if dropnext: + assert(next_re.match(line)) + dropnext = False + continue + if line.startswith('# Note the lack of an assignment to ${S}'): + next_re = re.compile('^#') + dropnext = True + line = 'S="${WORKDIR}/${MY_P}"\n' + if line.startswith('inherit'): + line = line.replace(' git-r3', '') + line += '\n' + line += 'MY_PN="powerline-status"\n' + line += 'MY_P="${MY_PN}-${PV}"' + line += '\n' + elif line.startswith('HOMEPAGE'): + line += 'SRC_URI="mirror://pypi/p/${MY_PN}/${MY_P}.tar.gz"\n' + elif line.startswith('KEYWORDS'): + line = 'KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"\n' + F.write(line) new_files.append(vcur) check_call(['ebuild', vcur, 'manifest']) new_files.append(os.path.join(pdir, 'Manifest'))