Merge branch 'develop' into 'master'

Develop

See merge request sulinos/devel/inary!55
# -*- coding: utf-8 -*-
#
# Main fork Pisi: Copyright (C) 2005 - 2011, Tubitak/UEKAE
#
# Copyright (C) 2016 - 2020, Suleyman POYRAZ (Zaryob)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
# Inary Modules
import inary.context as ctx
from inary.util import colorize
from inary.util import join_path
# ActionsAPI Modules
from inary.actionsapi import error
# Standart Python Modules
import os
import grp
import pwd
import sys
import glob
import shutil
from inary.actionsapi.shelltools import can_access_file
import inary.actionsapi.autotools as autotools
import inary.actionsapi.cmaketools as cmaketools
import inary.actionsapi.mesontools as mesontools
# Gettext Library
import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
def configure(args=''):
"""Autobuilder setup"""
if can_access_file("autogen.sh"):
autotools.autogen(args)
if can_access_file("configure"):
autotools.configure(args)
if can_access_file("meson.build"):
mesontools.configure(args)
if can_access_file("CmakeLists.txt"):
cmaketools.configure(args)
def make(args=''):
"""Autobuilder build"""
if can_access_file("autogen.sh"):
autotools.make(args)
if can_access_file("Makefile"):
autotools.make(args)
if can_access_file("meson.build"):
mesontools.make(args)
if can_access_file("CmakeLists.txt"):
cmaketools.make(args)
def install(args=''):
"""Autobuilder install"""
if can_access_file("autogen.sh"):
autotools.install(args)
if can_access_file("Makefile"):
autotools.install(args)
if can_access_file("meson.build"):
mesontools.install(args)
if can_access_file("CmakeLists.txt"):
cmaketools.install(args)
setup=configure()
build=make()
......@@ -448,7 +448,8 @@ def remove(sourceFile):
_("No file matched pattern \"{}\". Remove operation failed.").format(sourceFile))
for filePath in sourceFileGlob:
unlink(filePath)
if os.path.exists(filePath):
unlink(filePath)
def removeDir(destinationDirectory):
......@@ -459,7 +460,8 @@ def removeDir(destinationDirectory):
_("No directory matched pattern \"{}\". Remove directory operation failed.").format(destinationDirectory))
for directory in destdirGlob:
unlinkDir(directory)
if os.path.isdir(directory):
unlinkDir(directory)
class Flags:
......
......@@ -274,6 +274,13 @@ def export(key, value):
"""export environ variable"""
os.environ[str(key)] = str(value)
def reset_env():
_env=os.environ.copy()
os.environ.clear()
for key in ["PATH","HOST","CC","CXX"]:
os.environ[key]=_env[key]
return _env
def isLink(filePath):
"""return True if filePath refers to a symbolic link"""
......
......@@ -164,6 +164,15 @@ class Install(AtomicOperation):
self.old_path = None
self.trigger = inary.trigger.Trigger()
self.ask_reinstall = False
self.old_files = None
self.old_pkginfo = None
self.old_path = None
if self.installdb.has_package(self.pkginfo.name):
self.old_files = self.installdb.get_files(self.pkginfo.name)
self.old_pkginfo = self.installdb.get_info(self.pkginfo.name)
(iversion_s, irelease_s) = self.installdb.get_version(self.pkginfo.name)[:2]
self.old_path = self.installdb.pkg_dir(
self.pkginfo.name, iversion_s, irelease_s)
def install(self, ask_reinstall=True):
......@@ -279,7 +288,7 @@ class Install(AtomicOperation):
(iversion_s, irelease_s) = self.installdb.get_version(pkg.name)[:2]
pkg_version = inary.version.make_version(pkg.version)
iversion = inary.version.make_version(iversion_s)
if pkg_version > iversion:
if pkg_version > iversion or pkg.distributionRelease > self.installdb.get_distro_release(pkg.name)[1]:
if ctx.config.get_option('store_lib_info'):
self.store_old_paths = os.path.join(
ctx.config.old_paths_cache_dir(), pkg.name)
......@@ -295,7 +304,10 @@ class Install(AtomicOperation):
# is this an upgrade?
# determine and report the kind of upgrade: version, release
if pkg_release > irelease:
if pkg.distributionRelease > self.installdb.get_distro_release(pkg.name)[1]:
ctx.ui.info(_('Upgrading to new distribution.'))
self.operation = UPGRADE
elif pkg_release > irelease:
ctx.ui.info(_('Upgrading to new release.'))
self.operation = UPGRADE
# is this a downgrade? confirm this action.
......@@ -312,10 +324,6 @@ class Install(AtomicOperation):
# schedule for reinstall
self.old_files = self.installdb.get_files(pkg.name)
self.old_pkginfo = self.installdb.get_info(pkg.name)
self.old_path = self.installdb.pkg_dir(
pkg.name, iversion_s, irelease_s)
def preinstall(self):
if 'postOps' in self.metadata.package.isA:
......@@ -355,6 +363,8 @@ class Install(AtomicOperation):
_('Post-install configuration of \"{}\" package failed.').format(self.pkginfo.name))
self.installdb.mark_pending(self.pkginfo.name)
return 0
if self.old_path != self.package.pkg_dir() and self.old_path != None :
util.clean_dir(self.old_path)
def extract_install(self):
"""unzip package in place"""
......
......@@ -77,8 +77,8 @@ class GeneralDefaults:
destinationdirectory = "/"
autoclean = False
distribution = "Sulin"
distribution_release = "2019"
distribution_id = "s19"
distribution_release = "2021"
distribution_id = "s21"
architecture = "x86_64"
allowrfp = False
http_proxy = os.getenv("HTTP_PROXY") or None
......@@ -115,7 +115,7 @@ class BuildDefaults:
"""Default values for [build] section"""
build_host = "localhost"
host = "x86_64-linux-gnu"
jobs = "-j1"
jobs = "-j5"
generateDebug = True
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"
......
......@@ -354,6 +354,8 @@ def index(dirs=None, output='inary-index.xml',
index.distribution = None
if not dirs:
dirs = ['.']
# TODO: replace this method with good one.
os.environ["FAKEROOTKEY"]=str(os.getpid())
for repo_dir in dirs:
repo_dir = str(repo_dir)
ctx.ui.info(
......
......@@ -483,6 +483,7 @@ class Builder:
"SRC_RELEASE": self.spec.getSourceRelease(),
"PATH": "/bin:/usr/bin:/sbin:/usr/sbin",
"PYTHONDONTWRITEBYTECODE": '1',
"JOBS": ctx.config.values.build.jobs,
"INARY_USE_FLAGS": "True"}
# FIXME: Get useflag status from pspec file (Source section)
os.environ.update(env)
......
......@@ -38,7 +38,11 @@ print(otag("Packager"))
print(write("Name",inary.source.packager.name))
print(write("Email",inary.source.packager.email))
print(ctag("Packager"))
print(write("License",inary.source.license))
if type(inary.source.license) == type(""):
inary.source.license = [inary.source.license]
for l in inary.source.license:
print(write("License",l))
# IsA kısmı zorunlu değil o yüzden önce varmı bakıyoz
if hasattr(inary.source,"isa"):
......@@ -63,7 +67,7 @@ if hasattr(inary.source,"additionalfiles"):
print(otag("AdditionalFiles"))
for i in inary.source.additionalfiles:
print(write("AdditionalFile",i[1],["target=\"{}\"".format(i[0])]))
print(ctag("AdditionalFile"))
print(ctag("AdditionalFiles"))
#BuildDependencies zorunlu (boş bile olsa)
print(otag("BuildDependencies"))
......@@ -100,12 +104,19 @@ for package in inary.source.packages:
print(write("Path",i[1],["fileType=\"{}\"".format(i[0])]))
print(ctag("Files"))
if hasattr(pkg,"buildtype"):
print(write("BuildType",pkg.buildtype))
if hasattr(pkg,"isa"):
for i in pkg.isa:
print(write("IsA",i))
#AdditionalFiles zorunlu değil
if hasattr(pkg,"additionalfiles"):
print(otag("AdditionalFiles"))
for i in pkg.additionalfiles:
print(write("AdditionalFile",i[0],["owner=\"{}\"".format(i[1]),"permission=\"{}\"".format(str(i[2])),"target=\"{}\"".format(i[3])]))
print(ctag("AdditionalFile"))
print(ctag("AdditionalFiles"))
#Package sonu
print(ctag("Package"))
......
......@@ -93,10 +93,10 @@ o("description","Source.Description")
print("archive = [",1)
archive = get_node("Source.Archive")
if type(archive) == type({}):
print("(\"{}\",\"{}\"),".format(archive["Archive"],archive["sha1sum"]))
print("(\"{}\",\"{}\"),".format(archive["sha1sum"],archive["Archive"]))
else:
for a in archive:
print("(\"{}\",\"{}\"),".format(a["Archive"],a["sha1sum"]))
print("(\"{}\",\"{}\"),".format(a["sha1sum"],a["Archive"]))
tab-=1
print("]")
o("builddependencies","Source.BuildDependencies.Dependency",True)
......
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