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

Merge branch 'develop' into feature/documentation

......@@ -108,3 +108,8 @@ CMakeFiles/
*.cmake
config/inary.conf
*.py___jb_tmp___
# inary files
*.inary
......@@ -1110,6 +1110,7 @@
<value>data</value>
<value>data:doc</value>
<value>data:font</value>
<value>header</value>
<value>kernel</value>
<value>driver</value>
<value>locale</value>
......
......@@ -17,6 +17,11 @@ import inary.context as ctx
from inary.actionsapi import get
from inary.actionsapi.shelltools import can_access_file
from inary.actionsapi.shelltools import system
from inary.actionsapi.shelltools import ls
from inary.actionsapi.shelltools import copy
from inary.actionsapi.inarytools import dosed
from inary.actionsapi.shelltools import isDirectory
from inary.actionsapi.inarytools import removeDir
import gettext
......@@ -42,6 +47,12 @@ class NinjaBuildError(inary.actionsapi.Error):
self.value = value
ctx.ui.error("[MesonTools]: " + value)
def fixpc():
""" fix .pc files in installDIR()/usr/lib32/pkgconfig"""
path = "{}/usr/lib32/pkgconfig".format(get.installDIR())
if isDirectory(path):
for f in ls("{}/*.pc".format(path)):
dosed(f, get.emul32prefixDIR(), get.defaultprefixDIR())
def meson_configure(parameters=""):
if can_access_file('meson.build'):
......@@ -50,9 +61,9 @@ def meson_configure(parameters=""):
--prefix=/{0} \
--buildtype=plain \
--libdir=/{0}/lib{1} \
--libexecdir={2} \
--sysconfdir={3} \
--localstatedir={4} \
--libexecdir=/{2} \
--sysconfdir=/{3} \
--localstatedir=/{4} \
{5} inaryPackageBuild".format(
prefix,
"32 " if get.buildTYPE() == "emul32" else "",
......@@ -70,12 +81,22 @@ def meson_configure(parameters=""):
def ninja_build(parameters=""):
if system("ninja {} {} -C inaryPackageBuild".format(get.makeJOBS(), parameters)):
raise NinjaBuildError(_("Build failed."))
if get.buildTYPE() == "emul32":
fixpc()
if isDirectory("{}/emul32".format(get.installDIR())): removeDir("/emul32")
def ninja_install(parameters=""):
insdir = util.join_path(get.installDIR(), "emul32") if get.buildTYPE() == "emul32" else get.installDIR()
if system('DESTDIR="{}" ninja install {} -C inaryPackageBuild'.format(insdir, get.makeJOBS())):
raise NinjaBuildError(_("Install failed."))
if isDirectory("{}/emul32".format(get.installDIR())):
if isDirectory("{}/emul32/lib32".format(get.installDIR())):
copy("{}/emul32/lib32".format(get.installDIR()), "{}/".format(get.installDIR()))
if isDirectory("{}/emul32/usr/lib32".format(get.installDIR())):
copy("{}/emul32/usr/lib32".format(get.installDIR()), "{}/usr/".format(get.installDIR()))
removeDir("/emul32")
def ninja_check():
......
......@@ -59,7 +59,7 @@ def configure(parameters=''):
if can_access_file('Build.PL'):
if system('perl{0} Build.PL installdirs=vendor destdir={1}'.format(get.curPERL(), get.installDIR())):
raise ConfigureError(_('Configure failed.'))
elif can_access_file('Build.PL'):
elif can_access_file('Makefile.PL'):
if system('perl{0} Makefile.PL {1} PREFIX=/usr INSTALLDIRS=vendor DESTDIR={2}'.format(get.curPERL(), parameters,
get.installDIR())):
raise ConfigureError(_('Configure failed.'))
......
......@@ -35,7 +35,6 @@ import inary.util as util
import inary.context as ctx
import inary.uri
import inary.fetcher
import inary.mirrors
class SourceArchiveError(inary.errors.Error):
......@@ -887,38 +886,13 @@ class SourceArchive:
ctx.ui.info(_("\nSource archive is stored: \"{0}/{1}\"").format(ctx.config.archives_dir(), self.url.filename()))
def fetch_from_fallback(self):
archive = os.path.basename(self.url.get_uri())
src = os.path.join(ctx.config.values.build.fallback, archive)
ctx.ui.warning(_('Trying fallback address: \"{}\"').format(src))
inary.fetcher.fetch_url(src, ctx.config.archives_dir(), self.progress)
inary.fetcher.fetch_url(self.url.get_uri(), ctx.config.archives_dir(), self.progress)
def fetch_from_locale(self):
url = self.url.uri
if not os.access(url[7:], os.F_OK):
raise SourceArchiveError(_('No such file or no permission to read.'))
shutil.copy(url[7:], self.archiveFile)
inary.fetcher.fetch_from_locale(self.url.get_uri(), ctx.config.archives_dir(), destfile=self.uri.filename())
def fetch_from_mirror(self):
uri = self.url.get_uri()
sep = uri[len("mirrors://"):].split("/")
name = sep.pop(0)
archive = "/".join(sep)
mirrors = inary.mirrors.Mirrors().get_mirrors(name)
if not mirrors:
raise SourceArchiveError(_("\"{}\" mirrors are not defined.").format(name))
for mirror in mirrors:
try:
url = os.path.join(mirror, archive)
ctx.ui.warning(_('Fetching source from mirror: \"{}\"').format(url))
inary.fetcher.fetch_url(url, ctx.config.archives_dir(), self.progress)
return
except inary.fetcher.FetchError:
pass
raise inary.fetcher.FetchError(_('Could not fetch source from \"{}\" mirrors.').format(name))
inary.fetcher.fetch_from_mirror(self.url.get_uri(), ctx.config.archives_dir(), self.progress)
def is_cached(self, interactive=True):
if not os.access(self.archiveFile, os.R_OK):
......
......@@ -222,7 +222,7 @@ class CLI(inary.ui.UI):
msg = _('Configured \"{}\"').format(keywords['package'].name)
color = 'brightgreen'
elif event == inary.ui.configuring:
msg = _('Configuring \"{}\"').format(keywords['package'].name)
msg = _('Configuring \"{}\" package.').format(keywords['package'].name)
color = 'faintyellow'
elif event == inary.ui.extracting:
msg = _('Extracting the files of \"{}\"').format(keywords['package'].name)
......
......@@ -23,7 +23,7 @@ import inary.cli.command as command
import inary.context as ctx
from inary.operations import install, helper
import inary.db
import inary.util as util
class Install(command.PackageOp, metaclass=command.autocommand):
__doc__ = _("""Install INARY packages
......@@ -110,7 +110,8 @@ expanded to package names.
reinstall = bool(packages) and packages[0].endswith(ctx.const.package_suffix)
install.install(packages, ctx.get_option('reinstall') or reinstall)
config_changes = helper.check_config_changes(order=packages)
config_changes = helper.check_config_changes([util.parse_package_name_legacy(i.split("/")[-1])[0] for i in packages])
if config_changes:
if ctx.ui.confirm(_("[!] Some config files have been changed. Would you like to see and apply them?")):
......
......@@ -31,6 +31,7 @@ _ = __trans.gettext
import inary
import inary.db
import inary.errors
import inary.mirrors
import inary.util as util
import inary.context as ctx
import inary.uri
......@@ -151,10 +152,6 @@ class Fetcher:
def fetch(self, timeout=10):
"""Return value: Fetched file's full path.."""
if not ctx.config.values.general.ssl_verify:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
if not self.url.filename():
raise FetchError(_('Filename error'))
......@@ -177,6 +174,16 @@ class Fetcher:
c.setopt(pycurl.FOLLOWLOCATION, True)
c.setopt(pycurl.MAXREDIRS, 10)
c.setopt(pycurl.NOSIGNAL, True)
if not ctx.config.values.general.ssl_verify:
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(pycurl.SSL_VERIFYHOST, 0)
else:
c.setopt(pycurl.SSL_VERIFYPEER, 1)
c.setopt(pycurl.SSL_VERIFYHOST, True)
# To block man-in-middle attack
# curl.setopt(pycurl.SSL_VERIFYHOST, 2)
# curl.setopt(pycurl.CAINFO, "/etc/inary/certificates/sourceforge.crt")
# Header
# c.setopt(pycurl.HTTPHEADER, ["%s: %s" % header for header in self._get_http_headers().items()])
......@@ -257,13 +264,51 @@ class Fetcher:
else:
return 0
# helper function
def fetch_url(url, destdir, progress=None, destfile=None):
def fetch_url(url, destdir=None, progress=None, destfile=None):
if not destdir:
destdir=ctx.config.archives_dir()
if not progress:
progress=ctx.ui.Progress
fetch = Fetcher(url, destdir, destfile)
fetch.progress = progress
fetch.fetch()
def fetch_from_fallback(url, destdir=None, progress=None, destfile=None):
archive = os.path.basename(url)
src = os.path.join(ctx.config.values.build.fallback, archive)
ctx.ui.warning(_('Trying fallback address: \"{}\"').format(src))
fetch_url(src, destdir=destdir, progress=progress, destfile=destfile)
def fetch_from_locale(url, destdir=None, progress=None, destfile=None):
if not destdir:
destdir=ctx.config.archives_dir()
if url.startswith("file://"):
url = url[7:]
if not os.access(url, os.F_OK):
raise FetchError(_('No such file or no permission to read for {}.').format(url))
shutil.copy(url, os.path.join(destdir, destfile or url.split("/")[-1]))
def fetch_from_mirror(url, destdir=None, progress=None, destfile=None):
sep = url[len("mirrors://"):].split("/")
name = sep.pop(0)
archive = "/".join(sep)
mirrors = inary.mirrors.Mirrors().get_mirrors(name)
if not mirrors:
raise inary.mirrors.MirrorError(_("\"{}\" mirrors are not defined.").format(name))
for mirror in mirrors:
try:
mirror_url = os.path.join(mirror, archive)
ctx.ui.warning(_('Fetching source from mirror: \"{}\"').format(mirror))
fetch_url(mirror_url, destdir=destdir, progress=progress, destfile=destfile)
return
except FetchError:
pass
raise FetchError(_('Could not fetch source from \"{}\" mirrors.').format(name))
# Operation function
def fetch(packages=None, path=os.path.curdir):
......
......@@ -20,6 +20,8 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
class MirrorError(inary.errors.Error):
pass
class Mirrors:
def __init__(self, config=ctx.const.mirrors_conf):
......
......@@ -1065,7 +1065,12 @@ package might be a good solution."))
for fn in files:
filepath = util.join_path(root, fn)
if witcher:
fileinfo=witcher(filepath).name
try:
fileinfo=witcher(filepath).name
except ValueError:
ctx.ui.warning(_("File \"{}\" might be a broken symlink. Check it before publishing package.".format(filepath)))
fileinfo="broken symlink"
ctx.ui.info(_("\'magic\' return of \"{0}\" is \"{1}\"").format(filepath, fileinfo), verbose=True)
else:
ret, out, err = util.run_batch("file {}".format(filepath), ui_debug=False)
......@@ -1170,8 +1175,7 @@ package might be a good solution."))
ctx.ui.warning(_("Ignoring empty package: \"{}\"").format(package.name))
continue
ctx.ui.action(_("Building package: \"{}\"").format(package.name))
ctx.ui.status(_("Building package: \"{}\"").format(package.name), push_screen=True)
self.gen_metadata_xml(package)
name = self.package_filename(self.metadata.package)
......
......@@ -97,7 +97,7 @@ def update_repo(repo, force=False):
def __update_repo(repo, force=False):
ctx.ui.status(_('Updating package repository: \"{}\"').format(repo), push_screen=True)
ctx.ui.status(_('Updating package repository: \"{}\"').format(repo), push_screen=False)
ctx.ui.notify(inary.ui.updatingrepo, name=repo)
repodb = inary.db.repodb.RepoDB()
index = inary.data.index.Index()
......
......@@ -106,7 +106,6 @@ def post_install(package_name, provided_scripts,
fromVersion, fromRelease, toVersion, toRelease):
"""Do package's post install operations"""
ctx.ui.info(_("Configuring \"{}\" package.").format(package_name))
self_post = False
package_name = safe_script_name(package_name)
......
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