I have a script coming up that can remove virtual/libc dependencies from ebuilds automatically but can this be done safely for all ebuilds are are there ebuilds in system that really need this dep for stage building etc? Are there other deps to like this that could be removed? At least sys-libs/zlib could be one. Attached is a version that prints a unified diff for the changes my script would make.
Regards, Petteri
#!/usr/bin/python
from __future__ import with_statement
import portage
from fnmatch import filter
import os
import re
import sys
from contextlib import nested
from difflib import unified_diff
dep_start = re.compile('^R?DEPEND.*')
ws_re = re.compile('^\s*$')
dep_end = re.compile('.*"$')
for root, dirs, files in os.walk(portage.settings['PORTDIR']):
for ebuild in filter(files, '*.ebuild'):
path = os.path.join(root, ebuild)
print path
with nested(open(path), os.tmpfile()) as (f,tmp):
in_dep = False
lines = f.readlines()
new = []
for line in lines:
if dep_start.match(line):
in_dep = True
if in_dep:
if dep_end.match(line):
in_dep = False
if line.find('virtual/libc') is not -1:
line =
line.replace('virtual/libc','')
if not ws_re.match(line):
tmp.write(line)
new.append(line)
else:
tmp.write(line)
new.append(line)
else:
tmp.write(line)
new.append(line)
sys.stdout.writelines(unified_diff(lines, new))
signature.asc
Description: OpenPGP digital signature
