|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
from itertools import chain
|
|
|
|
|
import random
|
|
|
|
|
import re
|
|
|
|
|
import sys
|
|
|
|
|
import time
|
|
|
|
|
import stat
|
|
|
|
@ -26,7 +27,7 @@ from calculate.lib.utils.files import (
|
|
|
|
|
pathJoin, PercentProgress, getProgPath, process, STDOUT, removeDir,
|
|
|
|
|
makeDirectory, writeFile, readLinesFile, chmod, chown, FilePermission,
|
|
|
|
|
find, FindFileType, removeFileWithEmptyDirectory,
|
|
|
|
|
copyWithPath, countFiles, listDirectory, getRunCommands, isMount)
|
|
|
|
|
copyWithPath, countFiles, listDirectory, getRunCommands, isMount, readFile)
|
|
|
|
|
from calculate.lib.utils.git import Git
|
|
|
|
|
from calculate.lib.utils.portage import Layman, EmergeLog, EmergeLogNamedTask, \
|
|
|
|
|
InstalledPackageInfo, EbuildInfoError, EbuildInfo, ChrootEix, \
|
|
|
|
@ -811,25 +812,21 @@ class Builder(Update):
|
|
|
|
|
|
|
|
|
|
def regenPackages(self, chrootPath, pkgDirPath):
|
|
|
|
|
"""Regenerate packages and clean SYNC param"""
|
|
|
|
|
|
|
|
|
|
def fixKeywords(s):
|
|
|
|
|
if s.startswith("KEYWORDS:"):
|
|
|
|
|
return "KEYWORDS: amd64 x86\n"
|
|
|
|
|
else:
|
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
pathPackages = pathJoin(chrootPath, pkgDirPath, "Packages")
|
|
|
|
|
# remove Packages if it recreated
|
|
|
|
|
if path.exists(pathPackages):
|
|
|
|
|
os.unlink(pathPackages)
|
|
|
|
|
self._update_binhost_packages()
|
|
|
|
|
if path.exists(pathPackages):
|
|
|
|
|
# remove SYNC param
|
|
|
|
|
filtredPackages = \
|
|
|
|
|
map(fixKeywords,
|
|
|
|
|
filter(lambda x: not x.startswith("SYNC:"),
|
|
|
|
|
open(pathPackages, 'r')))
|
|
|
|
|
open(pathPackages, 'w').writelines(filtredPackages)
|
|
|
|
|
re_keywords = re.compile(
|
|
|
|
|
'^(KEYWORDS|SYNC):.*$\n', re.M)
|
|
|
|
|
data = readFile(pathPackages)
|
|
|
|
|
data_blocks = data.split('\n\n')
|
|
|
|
|
modified_blocks = [
|
|
|
|
|
"%s\nKEYWORDS: amd64 x86" % re_keywords.sub('', x)
|
|
|
|
|
for x in data_blocks[1:] if x.strip()]
|
|
|
|
|
with writeFile(pathPackages) as f:
|
|
|
|
|
f.write("\n\n".join(data_blocks[:1]+modified_blocks))
|
|
|
|
|
|
|
|
|
|
def binaryCleaning(self):
|
|
|
|
|
"""Clean binary repository"""
|
|
|
|
|