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

New Fixes.

        * Fixed archiving problem. Added file compression level.
        * Fixed util module errors.
üst 26c8c68a
2018-12-07 Suleyman POyraz <zaryob.dev@gmail.com>
* inary.operations.operations isimli modül hem saçma hem gereksizdi. Silindi.
* clean command was a useless command. And it was deleted.
* Fixed archiving problem. Added file compression level.
* Fixed util module errors.
2018-12-03 Suleyman POyraz <zaryob.dev@gmail.com>
* Preprocess module added into inary/libraries until when I rewrite xmlfile
......
......@@ -121,12 +121,15 @@ class TarFile(tarfile.TarFile):
name=None,
mode="r",
fileobj=None,
compresslevel=9,
compresslevel = None,
**kwargs):
"""Open lzma/xz compressed tar archive name for reading or writing.
Appending is not allowed.
"""
if not compresslevel:
compresslevel = ctx.config.values.build.compressionlevel
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")
......@@ -136,11 +139,12 @@ class TarFile(tarfile.TarFile):
try:
from backports import lzma
except ImportError:
raise tarfile.CompressionError("lzma module is not available")
raise tarfile.CompressionError("Lzma module is not available")
if fileobj is not None:
fileobj = _LZMAProxy(fileobj, mode)
else:
fileobj = lzma.LZMAFile(name, mode, preset=compresslevel)
try:
......@@ -475,9 +479,11 @@ class ArchiveTar(ArchiveBase):
try:
if oldwd:
os.chdir(oldwd)
# Bug #6748
except OSError:
pass
self.close()
def add_to_archive(self, file_name, arc_name=None):
......@@ -491,10 +497,11 @@ class ArchiveTar(ArchiveBase):
wmode = 'w:bz2'
elif self.type in ('tarlzma', 'tarxz'):
format = "xz" if self.type == "tarxz" else "alone"
level = int(ctx.config.values.build.compressionlevel)
compresslevel = int(ctx.config.values.build.compressionlevel)
self.tar = TarFile.lzmaopen(self.file_path, "w",
fileobj=self.fileobj,
compressformat=format)
compresslevel=compresslevel
)
else:
raise UnknownArchiveType
......
......@@ -99,18 +99,13 @@ class Build(command.Command, metaclass=command.autocommand):
help=_("Use quilt patch management system "
"instead of GNU patch"))
group.add_option("--home-build",
action="store_true",
default=False,
help=_("Do not use root user when packaging, "
"make building under home folder"))
group.add_option("--ignore-sandbox",
action="store_true",
default=False,
help=_("Do not constrain build process inside "
"the build folder"))
self.parser.add_option_group(group)
group = optparse.OptionGroup(self.parser, _("build steps"))
group.add_option("--fetch",
......@@ -158,8 +153,7 @@ class Build(command.Command, metaclass=command.autocommand):
const="package",
help=_("Create INARY package"))
self.parser.add_option_group(group)
self.add_options(group)
self.parser.add_option_group(group)
def run(self):
......@@ -181,14 +175,6 @@ class Build(command.Command, metaclass=command.autocommand):
if not ctx.get_option('output_dir'):
ctx.config.options.output_dir = '.'
# IDEA: A little hack :)
if ctx.get_option('home_build'):
if os.environ['USER']== 'root': # For idiots
pass
else:
dest_dir = util.join_path(os.environ['HOME'], '.inary')
ctx.config.set_option('destdir', dest_dir)
for x in self.args or ["pspec.xml"]:
if ctx.get_option('until'):
inary.operations.build.build_until(x, ctx.get_option('until'))
......
......@@ -89,15 +89,15 @@ class GeneralDefaults:
class BuildDefaults:
"""Default values for [build] section"""
build_host = "localhost"
host = "x86_64-sulin-linux"
jobs = "-j3"
host = "x86_64-linux-gnu"
jobs = "-j1"
generateDebug = False
enableSandbox = True
cflags = "-mtune=generic -march=x86_64 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
cxxflags = "-mtune=generic -march=x86_64 -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
cflags = "-mtune=generic -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
cxxflags = "-mtune=generic -O2 -pipe -fomit-frame-pointer -fstack-protector -D_FORTIFY_SOURCE=2"
ldflags = "-Wl,-O1 -Wl,-z,relro -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--sort-common"
buildhelper = None
compressionlevel = 1
compressionlevel = 9
fallback = "http://www.sulin.com.tr/pub"
ignored_build_types = ""
......
......@@ -15,6 +15,7 @@
from .path_utils import join_path
from .process_utils import run_batch
from .type_utils import *
import gettext
__trans = gettext.translation('inary', fallback=True)
......@@ -28,6 +29,7 @@ import os
import time
import shutil
import hashlib
import fnmatch
class Error(inary.errors.Error):
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment