Kaydet (Commit) bcef38ee authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Artistical Patch!!! Patched more-python3.patch

üst 5691cbcd
......@@ -55,7 +55,7 @@ def handle_exception(exception, value, tb):
ui.error(_("System error. Program terminated."))
if show_traceback:
ui.error("%s: %s" % (exception, str(value)))
ui.error("{}: {}".format(exception, str(value)))
else:
msg = str(value)
if msg:
......
......@@ -37,7 +37,7 @@ class ConfigureError(inary.actionsapi.Error):
self.value = value
ctx.ui.error(value)
if can_access_file('config.log'):
ctx.ui.error(_('Please attach the config.log to your bug report:\n%s/config.log') % os.getcwd())
ctx.ui.error(_('Please attach the config.log to your bug report:\n{}/config.log').format(os.getcwd()))
class MakeError(inary.actionsapi.Error):
def __init__(self, value=''):
......@@ -65,18 +65,16 @@ def configure(parameters = ''):
prefix = get.emul32prefixDIR() if get.buildTYPE() == "emul32" else get.defaultprefixDIR()
args = './configure \
--prefix=/%s \
--build=%s \
--mandir=/%s \
--infodir=/%s \
--datadir=/%s \
--sysconfdir=/%s \
--localstatedir=/%s \
--libexecdir=/%s \
%s%s' % (prefix, \
get.HOST(), get.manDIR(), \
get.infoDIR(), get.dataDIR(), \
get.confDIR(), get.localstateDIR(), get.libexecDIR(),
--prefix=/{0} \
--build={1.HOST()} \
--mandir=/{1.manDIR()} \
--infodir=/{1.infoDIR()} \
--datadir=/{1.dataDIR()} \
--sysconfdir=/{1.confDIR()} \
--localstatedir=/{1.localstateDIR()} \
--libexecdir=/{1.libexecDIR()} \
{2}{3}'.format(prefix, \
get,
"--libdir=/usr/lib32 " if get.buildTYPE() == "emul32" else "",
parameters)
......@@ -90,29 +88,29 @@ def rawConfigure(parameters = ''):
if can_access_file('configure'):
gnuconfig_update()
if system('./configure %s' % parameters):
if system('./configure {}'.format(parameters)):
raise ConfigureError(_('Configure failed.'))
else:
raise ConfigureError(_('No configure script found.'))
def compile(parameters = ''):
system('%s %s %s' % (get.CC(), get.CFLAGS(), parameters))
system('{0} {1} {2}'.format(get.CC(), get.CFLAGS(), parameters))
def make(parameters = ''):
'''make source with given parameters = "all" || "doc" etc.'''
if system('make %s %s' % (get.makeJOBS(), parameters)):
if system('make {0} {1}'.format(get.makeJOBS(), parameters)):
raise MakeError(_('Make failed.'))
def fixInfoDir():
infoDir = '%s/usr/share/info/dir' % get.installDIR()
infoDir = '{}/usr/share/info/dir'.format(get.installDIR())
if can_access_file(infoDir):
unlink(infoDir)
def fixpc():
''' fix .pc files in installDIR()/usr/lib32/pkgconfig'''
path = "%s/usr/lib32/pkgconfig" % get.installDIR()
path = "{}/usr/lib32/pkgconfig".format(get.installDIR())
if isDirectory(path):
for f in ls("%s/*.pc" % path):
for f in ls("{}/*.pc".format(path)):
dosed(f, get.emul32prefixDIR(), get.defaultprefixDIR())
def install(parameters = '', argument = 'install'):
......@@ -143,40 +141,40 @@ def install(parameters = '', argument = 'install'):
if get.buildTYPE() == "emul32":
fixpc()
if isDirectory("%s/emul32" % get.installDIR()): removeDir("/emul32")
if isDirectory("{}/emul32".format(get.installDIR())): removeDir("/emul32")
def rawInstall(parameters = '', argument = 'install'):
'''install source into install directory with given parameters = PREFIX=%s % get.installDIR()'''
if system('make %s %s' % (parameters, argument)):
if system('make {0} {1}'.format(parameters, argument)):
raise InstallError(_('Install failed.'))
else:
fixInfoDir()
if get.buildTYPE() == "emul32":
fixpc()
if isDirectory("%s/emul32" % get.installDIR()): removeDir("/emul32")
if isDirectory("{}/emul32".format(get.installDIR())): removeDir("/emul32")
def aclocal(parameters = ''):
'''generates an aclocal.m4 based on the contents of configure.in.'''
if system('aclocal %s' % parameters):
if system('aclocal {}'.format(parameters)):
raise RunTimeError(_('Running aclocal failed.'))
def autoconf(parameters = ''):
'''generates a configure script'''
if system('autoconf %s' % parameters):
if system('autoconf {}'.format(parameters)):
raise RunTimeError(_('Running autoconf failed.'))
def autoreconf(parameters = ''):
'''re-generates a configure script'''
if system('autoreconf %s' % parameters):
if system('autoreconf {}'.format(parameters)):
raise RunTimeError(_('Running autoreconf failed.'))
def automake(parameters = ''):
'''generates a makefile'''
if system('automake %s' % parameters):
if system('automake {}'.format(parameters)):
raise RunTimeError(_('Running automake failed.'))
def autoheader(parameters = ''):
'''generates templates for configure'''
if system('autoheader %s' % parameters):
if system('autoheader {}'.format(parameters)):
raise RunTimeError(_('Running autoheader failed.'))
......@@ -33,7 +33,7 @@ class ConfigureError(inary.actionsapi.Error):
self.value = value
ctx.ui.error(value)
if can_access_file('config.log'):
ctx.ui.error(_('Please attach the config.log to your bug report:\n%s/config.log') % os.getcwd())
ctx.ui.error(_('Please attach the config.log to your bug report:\n{}/config.log').format(os.getcwd()))
class MakeError(inary.actionsapi.Error):
def __init__(self, value=''):
......@@ -53,14 +53,14 @@ class RunTimeError(inary.actionsapi.Error):
self.value = value
ctx.ui.error(value)
def configure(parameters = '', installPrefix = '/%s' % get.defaultprefixDIR(), sourceDir = '.'):
def configure(parameters = '', installPrefix = '/{}'.format(get.defaultprefixDIR()), sourceDir = '.'):
'''configure source with given cmake parameters = "-DCMAKE_BUILD_TYPE -DCMAKE_CXX_FLAGS ... "'''
if can_access_file(join_path(sourceDir, 'CMakeLists.txt')):
args = 'cmake -DCMAKE_INSTALL_PREFIX=%s \
-DCMAKE_C_FLAGS="%s" \
-DCMAKE_CXX_FLAGS="%s" \
-DCMAKE_LD_FLAGS="%s" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo %s %s' % (installPrefix, get.CFLAGS(), get.CXXFLAGS(), get.LDFLAGS(), parameters, sourceDir)
args = 'cmake -DCMAKE_INSTALL_PREFIX={0} \
-DCMAKE_C_FLAGS="{1}" \
-DCMAKE_CXX_FLAGS="{2}" \
-DCMAKE_LD_FLAGS="{3}" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo {4} {5}'.format(installPrefix, get.CFLAGS(), get.CXXFLAGS(), get.LDFLAGS(), parameters, sourceDir)
if system(args):
raise ConfigureError(_('Configure failed.'))
......@@ -70,15 +70,15 @@ def configure(parameters = '', installPrefix = '/%s' % get.defaultprefixDIR(), s
def make(parameters = ''):
'''build source with given parameters'''
if ctx.config.get_option("verbose") and ctx.config.get_option("debug"):
command = 'make VERBOSE=1 %s %s' % (get.makeJOBS(), parameters)
command = 'make VERBOSE=1 {0} {1}'.format(get.makeJOBS(), parameters)
else:
command = 'make %s %s' % (get.makeJOBS(), parameters)
command = 'make {0} {1} '.format(get.makeJOBS(), parameters)
if system(command):
raise MakeError(_('Make failed.'))
def fixInfoDir():
infoDir = '%s/usr/share/info/dir' % get.installDIR()
infoDir = '{}/usr/share/info/dir'.format(get.installDIR())
if can_access_file(infoDir):
unlink(infoDir)
......@@ -102,7 +102,7 @@ def install(parameters = '', argument = 'install'):
def rawInstall(parameters = '', argument = 'install'):
'''install source into install directory with given parameters = PREFIX=%s % get.installDIR()'''
if can_access_file('makefile') or can_access_file('Makefile') or can_access_file('GNUmakefile'):
if system('make %s %s' % (parameters, argument)):
if system('make {} {} '.format(parameters, argument)):
raise InstallError(_('Install failed.'))
else:
fixInfoDir()
......
......@@ -46,7 +46,7 @@ def curKERNEL():
def curPYTHON():
''' returns currently used python's version'''
(a, b, c, x, y) = sys.version_info
return 'python%s.%s' % (a, b)
return 'python{0}.{1}'.format(a, b)
def curPERL():
''' returns currently used perl's version'''
......@@ -92,10 +92,10 @@ def srcRELEASE():
return env.src_release
def srcTAG():
return '%s-%s-%s' % (env.src_name, env.src_version, env.src_release)
return '{0}-{1}-{2}'.format(env.src_name, env.src_version, env.src_release)
def srcDIR():
return '%s-%s' % (env.src_name, env.src_version)
return '{0}-{1}'.format(env.src_name, env.src_version)
# Build Related Functions
......@@ -175,13 +175,12 @@ def existBinary(bin):
return False
def getBinutilsInfo(util):
cross_build_name = '%s-%s' % (HOST(), util)
cross_build_name = '{0}-{1}'.format(HOST(), util)
if not existBinary(cross_build_name):
if not existBinary(util):
raise BinutilsError(_('Util %s cannot be found') % util)
raise BinutilsError(_('Util {} cannot be found').format(util))
else:
ctx.ui.debug(_('Warning: %s does not exist, using plain name %s') \
% (cross_build_name, util))
ctx.ui.debug(_('Warning: {0} does not exist, using plain name {1}').format(cross_build_name, util))
return util
else:
return cross_build_name
......
......@@ -77,11 +77,11 @@ def dohtml(*sourceFiles, **kw):
for sourceFile in sourceFiles:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\"") % sourceFile)
raise FileError(_("No file matched pattern \"{}\"") % sourceFile)
for source in sourceFileGlob:
if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions:
system('install -m0644 "%s" %s' % (source, destionationDirectory))
system('install -m0644 "{0}" {1}'.format(source, destionationDirectory))
if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories:
eraser = os.path.split(source)[0]
for root, dirs, files in os.walk(source):
......@@ -89,7 +89,7 @@ def dohtml(*sourceFiles, **kw):
for sourcename in files:
if os.path.splitext(sourcename)[1] in allowed_extensions:
makedirs(join_path(destionationDirectory, newRoot))
system('install -m0644 %s %s' % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
system('install -m0644 {0} {1}'.format(join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
def doinfo(*sourceFiles):
'''inserts the into files in the list of files into /usr/share/info'''
......@@ -126,7 +126,7 @@ def dolib_so(sourceFile, destinationDirectory = '/usr/lib'):
def doman(*sourceFiles):
'''inserts the man pages in the list of files into /usr/share/man/'''
'''example call: inarytools.doman("man.1", "pardus.*")'''
'''example call: inarytools.doman("man.1", "sulin.*")'''
manDIR = join_path(get.installDIR(), get.manDIR())
if not can_access_directory(manDIR):
makedirs(manDIR)
......@@ -134,7 +134,7 @@ def doman(*sourceFiles):
for sourceFile in sourceFiles:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\"") % sourceFile)
raise FileError(_("No file matched pattern \"{}\"").format(sourceFile))
for source in sourceFileGlob:
compressed = source.endswith("gz") and source
......@@ -144,12 +144,12 @@ def doman(*sourceFiles):
pageName, pageDirectory = source[:source.rindex('.')], \
source[source.rindex('.')+1:]
except ValueError:
error(_('ActionsAPI [doman]: Wrong man page file: %s') % (source))
error(_('ActionsAPI [doman]: Wrong man page file: {}').format(source))
manPDIR = join_path(manDIR, '/man%s' % pageDirectory)
manPDIR = join_path(manDIR, '/man{}'.format(pageDirectory))
makedirs(manPDIR)
if not compressed:
system('install -m0644 %s %s' % (source, manPDIR))
system('install -m0644 {} {}'.format(source, manPDIR))
else:
uncompress(compressed, targetDir=manPDIR)
......@@ -158,9 +158,9 @@ def domo(sourceFile, locale, destinationFile, localeDirPrefix = '/usr/share/loca
'''example call: inarytools.domo("po/tr.po", "tr", "pam_login.mo")'''
system('msgfmt %s' % sourceFile)
makedirs('%s%s/%s/LC_MESSAGES/' % (get.installDIR(), localeDirPrefix, locale))
move('messages.mo', '%s%s/%s/LC_MESSAGES/%s' % (get.installDIR(), localeDirPrefix, locale, destinationFile))
system('msgfmt {}'.format(sourceFile))
makedirs('{0}{1}/{2}/LC_MESSAGES/'.format(get.installDIR(), localeDirPrefix, locale))
move('messages.mo', '{0}{1}/{2}/LC_MESSAGES/{3}'.format(get.installDIR(), localeDirPrefix, locale, destinationFile))
def domove(sourceFile, destination, destinationFile = ''):
'''moves sourceFile/Directory into destinationFile/Directory'''
......@@ -171,7 +171,7 @@ def domove(sourceFile, destination, destinationFile = ''):
sourceFileGlob = glob.glob(join_path(get.installDIR(), sourceFile))
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\". 'domove' operation failed.") % sourceFile)
raise FileError(_("No file matched pattern \"{}\". 'domove' operation failed.").format(sourceFile))
for filePath in sourceFileGlob:
if not destinationFile:
......@@ -190,7 +190,7 @@ def rename(sourceFile, destinationFile):
try:
os.rename(join_path(get.installDIR(), sourceFile), join_path(get.installDIR(), baseDir, destinationFile))
except OSError as e:
error(_('ActionsAPI [rename]: %s: %s') % (e, sourceFile))
error(_('ActionsAPI [rename]: {}: {}').format(e, sourceFile))
def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLine = False, level = -1):
'''replaces patterns in sources'''
......@@ -212,7 +212,7 @@ def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLin
if not level == -1 and currentLevel > level: continue
for f in files:
if re.search(pattern, f):
res.append("%s/%s" % (root, f))
res.append("{0}/{1}".format(root, f))
return res
backupExtension = ".inary-backup"
......@@ -227,11 +227,11 @@ def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLin
#if there is no match, raise exception
if len(sourceFiles) == 0:
raise FileError(_('No such file matching pattern: "%s". \'dosed\' operation failed.') % filePattern if filePattern else sources)
raise FileError(_('No such file matching pattern: "{}". \'dosed\' operation failed.').format(filePattern if filePattern else sources))
for sourceFile in sourceFiles:
if can_access_file(sourceFile):
backupFile = "%s%s" % (sourceFile, backupExtension)
backupFile = "{0}{1}".format(sourceFile, backupExtension)
for line in fileinput.input(sourceFile, inplace = 1, backup = backupExtension):
#FIXME: In-place filtering is disabled when standard input is read
if re.search(findPattern, line):
......@@ -241,11 +241,11 @@ def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLin
# By default, filecmp.cmp() compares two files by looking file sizes.
# shallow=False tells cmp() to look file content.
if filecmp.cmp(sourceFile, backupFile, shallow=False):
ctx.ui.warning(_('dosed method has not changed file \'%s\'.') % sourceFile)
else: ctx.ui.info("%s has been changed by dosed method." % sourceFile, verbose=True)
ctx.ui.warning(_('dosed method has not changed file \'{}\'.').format(sourceFile))
else: ctx.ui.info(_("{} has been changed by dosed method.").format(sourceFile), verbose=True)
os.unlink(backupFile)
else:
raise FileError(_('File does not exist or permission denied: %s') % sourceFile)
raise FileError(_('File does not exist or permission denied: {}').format(sourceFile))
def dosbin(sourceFile, destinationDirectory = '/usr/sbin'):
'''insert a executable file into /sbin or /usr/sbin'''
......@@ -262,7 +262,7 @@ def dosym(sourceFile, destinationFile):
try:
os.symlink(sourceFile, join_path(get.installDIR() ,destinationFile))
except OSError:
error(_('ActionsAPI [dosym]: File already exists: %s') % (destinationFile))
error(_('ActionsAPI [dosym]: File already exists: {}').format(destinationFile))
def insinto(destinationDirectory, sourceFile, destinationFile = '', sym = True):
'''insert a sourceFile into destinationDirectory as a destinationFile with same uid/guid/permissions'''
......@@ -271,7 +271,7 @@ def insinto(destinationDirectory, sourceFile, destinationFile = '', sym = True)
if not destinationFile:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\".") % sourceFile)
raise FileError(_("No file matched pattern \"{}\".").format(sourceFile))
for filePath in sourceFileGlob:
if can_access_file(filePath):
......@@ -298,7 +298,7 @@ def remove(sourceFile):
'''removes sourceFile'''
sourceFileGlob = glob.glob(join_path(get.installDIR(), sourceFile))
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\". Remove operation failed.") % sourceFile)
raise FileError(_("No file matched pattern \"{}\". Remove operation failed.").format(sourceFile))
for filePath in sourceFileGlob:
unlink(filePath)
......@@ -307,7 +307,7 @@ def removeDir(destinationDirectory):
'''removes destinationDirectory and its subtrees'''
destdirGlob = glob.glob(join_path(get.installDIR(), destinationDirectory))
if len(destdirGlob) == 0:
raise FileError(_("No directory matched pattern \"%s\". Remove directory operation failed.") % destinationDirectory)
raise FileError(_("No directory matched pattern \"{}\". Remove directory operation failed.").format(destinationDirectory))
for directory in destdirGlob:
unlinkDir(directory)
......
......@@ -50,11 +50,11 @@ def executable_insinto(destinationDirectory, *sourceFiles):
for sourceFile in sourceFiles:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No executable file matched pattern \"%s\".") % sourceFile)
raise FileError(_("No executable file matched pattern \"{}\".").format(sourceFile))
for source in sourceFileGlob:
# FIXME: use an internal install routine for these
system('install -m0755 -o root -g root %s %s' % (source, destinationDirectory))
system('install -m0755 -o root -g root {0} {1}'.format(source, destinationDirectory))
def readable_insinto(destinationDirectory, *sourceFiles):
'''inserts file list into destinationDirectory'''
......@@ -68,10 +68,10 @@ def readable_insinto(destinationDirectory, *sourceFiles):
for sourceFile in sourceFiles:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"%s\".") % sourceFile)
raise FileError(_("No file matched pattern \"{}\".").format(sourceFile))
for source in sourceFileGlob:
system('install -m0644 "%s" %s' % (source, destinationDirectory))
system('install -m0644 "{0}" {1}'.format(source, destinationDirectory))
def lib_insinto(sourceFile, destinationDirectory, permission = 0o644):
'''inserts a library fileinto destinationDirectory with given permission'''
......@@ -85,4 +85,4 @@ def lib_insinto(sourceFile, destinationDirectory, permission = 0o644):
if os.path.islink(sourceFile):
os.symlink(os.path.realpath(sourceFile), os.path.join(destinationDirectory, sourceFile))
else:
system('install -m0%o %s %s' % (permission, sourceFile, destinationDirectory))
system('install -m0{0} {1} {2}'.format(permission, sourceFile, destinationDirectory))
......@@ -31,7 +31,7 @@ class ConfigureError(inary.actionsapi.Error):
self.value = value
ctx.ui.error(value)
if can_access_file('config.log'):
ctx.ui.error(_('\n!!! Please attach the config.log to your bug report:\n%s/config.log') % os.getcwd())
ctx.ui.error(_('\n!!! Please attach the config.log to your bug report:\n{}/config.log').format(os.getcwd()))
class MakeError(inary.actionsapi.Error):
def __init__(self, value=''):
......@@ -49,17 +49,17 @@ def configure(parameters = ''):
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
if can_access_file('configure'):
args = './configure \
--prefix=%s \
--build=%s \
--prefix={0.kdeDIR()} \
--build={0.HOST()} \
--with-x \
--enable-mitshm \
--with-xinerama \
--with-qt-dir=%s \
--with-qt-dir={0.qtDIR()} \
--enable-mt \
--with-qt-libraries=%s/lib \
--with-qt-libraries={0.qtDIR}/lib \
--disable-dependency-tracking \
--disable-debug \
%s' % (get.kdeDIR(), get.HOST(), get.qtDIR(), get.qtDIR(), parameters)
{1}'.format(get, parameters)
if system(args):
raise ConfigureError(_('Configure failed.'))
......@@ -68,12 +68,12 @@ def configure(parameters = ''):
def make(parameters = ''):
'''make source with given parameters = "all" || "doc" etc.'''
if system('make %s %s' % (get.makeJOBS(), parameters)):
if system('make {0} {1}'.format(get.makeJOBS(), parameters)):
raise MakeError(_('Make failed.'))
def install(parameters = 'install'):
if can_access_file('Makefile'):
args = 'make DESTDIR=%s destdir=%s %s' % (get.installDIR(), get.installDIR(), parameters)
args = 'make DESTDIR={0} destdir={0} {1}'.format(get.installDIR(), parameters)
if system(args):
raise InstallError(_('Install failed.'))
......
......@@ -16,24 +16,24 @@ from inary.actionsapi import shelltools
basename = "kde4"
prefix = "/%s" % get.defaultprefixDIR()
libdir = "%s/lib" % prefix
bindir = "%s/bin" % prefix
modulesdir = "%s/%s" % (libdir, basename)
libexecdir = "%s/libexec" % modulesdir
iconsdir = "%s/share/icons" % prefix
applicationsdir = "%s/share/applications/%s" % (prefix, basename)
mandir = "/%s" % get.manDIR()
sharedir = "%s/share/%s" % (prefix, basename)
appsdir = "%s/apps" % sharedir
configdir = "%s/config" % sharedir
prefix = "/{}".format(get.defaultprefixDIR())
libdir = "{}/lib".format(prefix)
bindir = "{}/bin".format(prefix)
modulesdir = "{0}/{1}".format(libdir, basename)
libexecdir = "{}/libexec".format(modulesdir)
iconsdir = "{}/share/icons".format(prefix)
applicationsdir = "{0}/share/applications/{1}".format(prefix, basename)
mandir = "/{}" % get.manDIR()
sharedir = "{0}/share/{1}".format(prefix, basename)
appsdir = "{}/apps".format(sharedir)
configdir = "{}/config".format(sharedir)
sysconfdir= "/etc"
servicesdir = "%s/services" % sharedir
servicetypesdir = "%s/servicetypes" % sharedir
includedir = "%s/include/%s" % (prefix, basename)
docdir = "/%s/%s" % (get.docDIR(), basename)
htmldir = "%s/html" % docdir
wallpapersdir = "%s/share/wallpapers" % prefix
servicesdir = "{}/services".format(sharedir)
servicetypesdir = "{}/servicetypes".format(sharedir)
includedir = "{0}/include/{1}".format(prefix, basename)
docdir = "/{0}/{1}".format(get.docDIR(), basename)
htmldir = "{}/html".format(docdir)
wallpapersdir = "{}/share/wallpapers".format(prefix)
def configure(parameters = '', installPrefix = prefix, sourceDir = '..'):
''' parameters -DLIB_INSTALL_DIR="hede" -DSOMETHING_USEFUL=1'''
......@@ -41,20 +41,20 @@ def configure(parameters = '', installPrefix = prefix, sourceDir = '..'):
shelltools.makedirs("build")
shelltools.cd("build")
cmaketools.configure("-DDATA_INSTALL_DIR:PATH=%s \
-DINCLUDE_INSTALL_DIR:PATH=%s \
-DCONFIG_INSTALL_DIR:PATH=%s \
-DLIBEXEC_INSTALL_DIR:PATH=%s \
-DSYSCONF_INSTALL_DIR:PATH=%s \
-DHTML_INSTALL_DIR:PATH=%s \
-DMAN_INSTALL_DIR:PATH=%s \
cmaketools.configure("-DDATA_INSTALL_DIR:PATH={0} \
-DINCLUDE_INSTALL_DIR:PATH={1} \
-DCONFIG_INSTALL_DIR:PATH={2} \
-DLIBEXEC_INSTALL_DIR:PATH={3} \
-DSYSCONF_INSTALL_DIR:PATH={4} \
-DHTML_INSTALL_DIR:PATH={5} \
-DMAN_INSTALL_DIR:PATH={6} \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DLIB_INSTALL_DIR:PATH=%s %s" % (appsdir, includedir, configdir, libexecdir, sysconfdir, htmldir, mandir, libdir, parameters), installPrefix, sourceDir)
-DLIB_INSTALL_DIR:PATH={7} {8}".format(appsdir, includedir, configdir, libexecdir, sysconfdir, htmldir, mandir, libdir, parameters), installPrefix, sourceDir)
shelltools.cd("..")
def make(parameters = ''):
cmaketools.make('-C build %s' % parameters)
cmaketools.make('-C build {}'.format(parameters))
def install(parameters = '', argument = 'install'):
cmaketools.install('-C build %s' % parameters, argument)
cmaketools.install('-C build {}'.format(parameters), argument)
......@@ -73,7 +73,7 @@ def __getSuffix():
"""Read and return the value read from .suffix file."""
suffix = get.srcVERSION()
if __getFlavour():
suffix += "-%s" % __getFlavour()
suffix += "-{}".format(__getFlavour())
return suffix
def __getExtraVersion():
......@@ -89,7 +89,7 @@ def __getExtraVersion():
# Append pae, default, rt, etc. to the extraversion if available
if __getFlavour():
extraversion += "-%s" % __getFlavour()
extraversion += "-{}".format(__getFlavour())
return extraversion
......@@ -114,22 +114,22 @@ def getKernelVersion(flavour=None):
return open(kverfile, "r").read().strip()
else:
# Fail
raise ConfigureError(_("Can't find kernel version information file %s.") % kverfile)
raise ConfigureError(_("Can't find kernel version information file {}.").format(kverfile))
def configure():
# Copy the relevant configuration file
shutil.copy("configs/kernel-%s-config" % get.ARCH(), ".config")
shutil.copy("configs/kernel-{}-config".format(get.ARCH()), ".config")
# Set EXTRAVERSION
inarytools.dosed("Makefile", "EXTRAVERSION =.*", "EXTRAVERSION = %s" % __getExtraVersion())
inarytools.dosed("Makefile", "EXTRAVERSION =.*", "EXTRAVERSION = {}".format(__getExtraVersion()))
# Configure the kernel interactively if
# configuration contains new options
autotools.make("ARCH=%s oldconfig" % __getKernelARCH())
autotools.make("ARCH={} oldconfig".format(__getKernelARCH()))
# Check configuration with listnewconfig
try:
autotools.make("ARCH=%s listnewconfig" % __getKernelARCH())
autotools.make("ARCH={} listnewconfig".format(__getKernelARCH()))
except:
pass
......@@ -152,7 +152,7 @@ def build(debugSymbols=False):
# Enable debugging symbols (-g -gdwarf2)
extra_config.append("CONFIG_DEBUG_INFO=y")
autotools.make("ARCH=%s %s" % (__getKernelARCH(), " ".join(extra_config)))
autotools.make("ARCH={0} {1}".format(__getKernelARCH(), " ".join(extra_config)))
def install():
......@@ -162,26 +162,26 @@ def install():
dumpVersion()
# Install kernel image
inarytools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-%s" % suffix)
inarytools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-{}".formar(suffix))
# Install the modules
# mod-fw= avoids firmwares from installing
# Override DEPMOD= to not call depmod as it will be called
# during module-init-tools' package handler
autotools.rawInstall("INSTALL_MOD_PATH=%s/" % get.installDIR(),
autotools.rawInstall("INSTALL_MOD_PATH={}/".format(get.installDIR()),
"DEPMOD=/bin/true modules_install mod-fw=")
# Remove symlinks first
inarytools.remove("/lib/modules/%s/source" % suffix)
inarytools.remove("/lib/modules/%s/build" % suffix)
inarytools.remove("/lib/modules/{}/source".format(suffix))
inarytools.remove("/lib/modules/{}/build".format(suffix))
# Install Module.symvers and System.map here too
shutil.copy("Module.symvers", "%s/lib/modules/%s/" % (get.installDIR(), suffix))
shutil.copy("System.map", "%s/lib/modules/%s/" % (get.installDIR(), suffix))
shutil.copy("Module.symvers", "{0}/lib/modules/{1}/".format(get.installDIR(), suffix))
shutil.copy("System.map", "{0}/lib/modules/{1}/".format(get.installDIR(), suffix))
# Create extra/ and updates/ subdirectories
for _dir in ("extra", "updates"):
inarytools.dodir("/lib/modules/%s/%s" % (suffix, _dir))
inarytools.dodir("/lib/modules/{0}/{1}".format(suffix, _dir))
def installHeaders(extraHeaders=None):
......@@ -199,58 +199,57 @@ def installHeaders(extraHeaders=None):
wanted = ["Makefile*", "Kconfig*", "Kbuild*", "*.sh", "*.pl", "*.lds"]
suffix = __getSuffix()
headersDirectoryName = "usr/src/linux-headers-%s" % suffix
headersDirectoryName = "usr/src/linux-headers-{}".format(suffix)
# Get the destination directory for header installation
destination = os.path.join(get.installDIR(), headersDirectoryName)
shelltools.makedirs(destination)
# First create the skel