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.
This commit is contained in:
ZyX 2014-10-25 22:24:24 +04:00
parent 9b03ff6936
commit 1dd4269baf
1 changed files with 35 additions and 3 deletions

View File

@ -5,7 +5,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct
import argparse import argparse
import codecs import codecs
import os import os
import shutil import re
from subprocess import check_output, check_call from subprocess import check_output, check_call
from getpass import getpass from getpass import getpass
@ -107,9 +107,41 @@ def create_ebuilds(version_string, overlay, user, **kwargs):
('app-vim', 'powerline-vim'), ('app-vim', 'powerline-vim'),
): ):
pdir = os.path.join(overlay, category, pn) 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)) 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) new_files.append(vcur)
check_call(['ebuild', vcur, 'manifest']) check_call(['ebuild', vcur, 'manifest'])
new_files.append(os.path.join(pdir, 'Manifest')) new_files.append(os.path.join(pdir, 'Manifest'))