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

Some important fixes get from branch b1ce7

I tried to patch my package manager with eopkg pkgconfig patch but it causes a platform complexity, so I returned branch to 6b83af and i take some fixes from old developing fork.
üst af1472aa
...@@ -40,3 +40,11 @@ Diğer özellikleri: ...@@ -40,3 +40,11 @@ Diğer özellikleri:
- Basit düzey ve üst düzey tüm işlemleri aynı kararlılıkla yerine getirir - Basit düzey ve üst düzey tüm işlemleri aynı kararlılıkla yerine getirir
- Forend uygulamaları tasarlanmasına elverişli bir yapıdadır. - Forend uygulamaları tasarlanmasına elverişli bir yapıdadır.
- Terminal arayüzü oldukça anlaşılır ve kullanıcı dostudur. - Terminal arayüzü oldukça anlaşılır ve kullanıcı dostudur.
Kurulum bağımlılıkları:
python3-requests
iksemel (https://gitlab.com/Zaryob/iksemel)
intltool
intltool-debian
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<!ATTLIST Dependency releaseFrom CDATA #IMPLIED> <!ATTLIST Dependency releaseFrom CDATA #IMPLIED>
<!ATTLIST Dependency releaseTo CDATA #IMPLIED> <!ATTLIST Dependency releaseTo CDATA #IMPLIED>
<!ATTLIST Dependency release CDATA #IMPLIED> <!ATTLIST Dependency release CDATA #IMPLIED>
<!ATTLIST Dependency type CDATA #IMPLIED>
<!ELEMENT Patches (Patch*)> <!ELEMENT Patches (Patch*)>
...@@ -100,9 +101,9 @@ ...@@ -100,9 +101,9 @@
)*> )*>
<!ELEMENT Provides (COMAR)+> <!ELEMENT Provides (COMAR)+>
<!ELEMENT COMAR (#PCDATA)> <!ELEMENT SCOM (#PCDATA)>
<!ATTLIST COMAR script CDATA #IMPLIED> <!ATTLIST SCOM script CDATA #IMPLIED>
<!ATTLIST COMAR name CDATA #IMPLIED> <!ATTLIST SCOM name CDATA #IMPLIED>
<!ELEMENT Conflicts (Package)+> <!ELEMENT Conflicts (Package)+>
<!-- we have a problem here, this Package tag only contains a package name <!-- we have a problem here, this Package tag only contains a package name
......
...@@ -1463,20 +1463,20 @@ ...@@ -1463,20 +1463,20 @@
<define name="Provides"> <define name="Provides">
<element name="Provides"> <element name="Provides">
<oneOrMore> <oneOrMore>
<ref name="COMAR"/> <ref name="SCOM"/>
</oneOrMore> </oneOrMore>
</element> </element>
</define> </define>
<!-- COMAR --> <!-- SCOM -->
<define name="COMAR"> <define name="SCOM">
<element name="COMAR"> <element name="SCOM">
<ref name="attlist.COMAR"/> <ref name="attlist.SCOM"/>
<text/> <text/>
</element> </element>
</define> </define>
<!-- attlist.COMAR --> <!-- attlist.SCOM -->
<define name="attlist.COMAR"> <define name="attlist.SCOM">
<optional> <optional>
<attribute name="script"/> <attribute name="script"/>
</optional> </optional>
......
...@@ -23,7 +23,7 @@ import importlib ...@@ -23,7 +23,7 @@ import importlib
__version__ = "1.0" __version__ = "1.0"
__all__ = ['api', 'configfile', 'db', 'util'] __all__ = ['api', 'configfile', 'db', 'util', '_cleanup']
import inary.api import inary.api
import inary.config import inary.config
......
...@@ -27,11 +27,15 @@ import inary.actionsapi.get as get ...@@ -27,11 +27,15 @@ import inary.actionsapi.get as get
from inary.actionsapi.shelltools import system from inary.actionsapi.shelltools import system
from inary.actionsapi.shelltools import can_access_file from inary.actionsapi.shelltools import can_access_file
from inary.actionsapi.shelltools import unlink from inary.actionsapi.shelltools import unlink
from inary.actionsapi.shelltools import export
from inary.actionsapi.libtools import gnuconfig_update from inary.actionsapi.libtools import gnuconfig_update
from inary.actionsapi.shelltools import isDirectory from inary.actionsapi.shelltools import isDirectory
from inary.actionsapi.shelltools import ls from inary.actionsapi.shelltools import ls
from inary.actionsapi.inarytools import dosed from inary.actionsapi.inarytools import dosed
from inary.actionsapi.inarytools import removeDir from inary.actionsapi.inarytools import removeDir
from inary.actionsapi.shelltools import isDirectory
from inary.actionsapi.shelltools import ls
from inary.actionsapi.inarytools import removeDir
class ConfigureError(inary.actionsapi.Error): class ConfigureError(inary.actionsapi.Error):
def __init__(self, value=''): def __init__(self, value=''):
...@@ -81,6 +85,9 @@ def configure(parameters = ''): ...@@ -81,6 +85,9 @@ def configure(parameters = ''):
"--libdir=/usr/lib32 " if get.buildTYPE() == "emul32" else "", "--libdir=/usr/lib32 " if get.buildTYPE() == "emul32" else "",
parameters) parameters)
if get.buildTYPE() == "emul32":
args += " --libdir=/usr/lib32"
if system(args): if system(args):
raise ConfigureError(_('Configure failed.')) raise ConfigureError(_('Configure failed.'))
else: else:
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
# Standart Python Modules # Standart Python Modules
import os import os
import sys import sys
import multiprocessing
import gettext import gettext
__trans = gettext.translation('inary', fallback=True) __trans = gettext.translation('inary', fallback=True)
...@@ -122,6 +123,13 @@ def LDFLAGS(): ...@@ -122,6 +123,13 @@ def LDFLAGS():
return env.ldflags return env.ldflags
def makeJOBS(): def makeJOBS():
# Note: "auto" only works when /sys is mounted.
if env.jobs == "auto":
procs = 4
try:
procs = multiprocessing.cpu_count()
except Exception as e:
ctx.ui.warning("Unable to retrieve CPU count: %s" % e)
return env.jobs return env.jobs
def buildTYPE(): def buildTYPE():
......
...@@ -36,6 +36,8 @@ def exportFlags(): ...@@ -36,6 +36,8 @@ def exportFlags():
os.environ['USER_LDFLAGS'] = values.build.ldflags os.environ['USER_LDFLAGS'] = values.build.ldflags
os.environ['JOBS'] = values.build.jobs os.environ['JOBS'] = values.build.jobs
os.environ['LD_AS_NEEDED'] = "1"
# http://liste.pardus.org.tr/gelistirici/2009-January/016442.html # http://liste.pardus.org.tr/gelistirici/2009-January/016442.html
os.environ['CC'] = "{}-gcc".format(values.build.host) os.environ['CC'] = "{}-gcc".format(values.build.host)
os.environ['CXX'] = "{}-g++".format(values.build.host) os.environ['CXX'] = "{}-g++".format(values.build.host)
...@@ -83,7 +85,7 @@ class Dirs: ...@@ -83,7 +85,7 @@ class Dirs:
localstate = 'var' localstate = 'var'
libexec = 'usr/libexec' libexec = 'usr/libexec'
defaultprefix = 'usr' defaultprefix = 'usr'
emul32prefix = 'emul32' emul32prefix = 'emul32'
# These should be owned by object not the class. Or else Python # These should be owned by object not the class. Or else Python
# will bug us with NoneType errors because of uninitialized # will bug us with NoneType errors because of uninitialized
......
...@@ -20,9 +20,13 @@ _ = __trans.gettext ...@@ -20,9 +20,13 @@ _ = __trans.gettext
import inary.data.relation as relation import inary.data.relation as relation
from inary.db.packagedb import PackageDB from inary.db.packagedb import PackageDB
import inary.sxml.autoxml as autoxml
import os import os
class Dependency(relation.Relation): class Dependency(relation.Relation, metaclass = autoxml.autoxml):
a_type = [autoxml.String, autoxml.optional]
def __str__(self): def __str__(self):
s = self.package s = self.package
if self.versionFrom: if self.versionFrom:
...@@ -37,12 +41,15 @@ class Dependency(relation.Relation): ...@@ -37,12 +41,15 @@ class Dependency(relation.Relation):
s += _(" release <= ") + self.releaseTo s += _(" release <= ") + self.releaseTo
if self.release: if self.release:
s += _(" release ") + self.release s += _(" release ") + self.release
if self.type:
s += " (" + self.type + ")"
return s return s
def name(self): def name(self):
return self.package return self.package
def satisfied_by_dict_repo(self, dict_repo): def satisfied_by_dict_repo(self, dict_repo):
if self.package not in dict_repo: if self.package not in dict_repo:
return False return False
else: else:
......
...@@ -121,18 +121,13 @@ class TarFile(tarfile.TarFile): ...@@ -121,18 +121,13 @@ class TarFile(tarfile.TarFile):
name=None, name=None,
mode="r", mode="r",
fileobj=None, fileobj=None,
compressformat = None,
compresslevel = None, compresslevel = None,
**kwargs): **kwargs):
"""Open lzma/xz compressed tar archive name for reading or writing. """Open lzma/xz compressed tar archive name for reading or writing.
Appending is not allowed. 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'.")
try: try:
import lzma import lzma
except ImportError: except ImportError:
...@@ -141,11 +136,24 @@ class TarFile(tarfile.TarFile): ...@@ -141,11 +136,24 @@ class TarFile(tarfile.TarFile):
except ImportError: except ImportError:
raise tarfile.CompressionError("Lzma module is not available") raise tarfile.CompressionError("Lzma module is not available")
if fileobj is not None: if not compresslevel:
fileobj = _LZMAProxy(fileobj, mode) compresslevel = ctx.config.values.build.compressionlevel
else:
fileobj = lzma.LZMAFile(name, mode, preset=compresslevel)
if len(mode) > 1 or mode not in "rw":
raise ValueError("mode must be 'r' or 'w'.")
if 'w' in mode:
if fileobj is not None:
fileobj = _LZMAProxy(fileobj, mode)
else:
fileobj = lzma.LZMAFile(name, mode, preset=compresslevel)
else:
if fileobj is not None:
fileobj = _LZMAProxy(fileobj, mode)
else:
fileobj = lzma.LZMAFile(name, mode)
try: try:
t = cls.taropen(name, mode, fileobj, **kwargs) t = cls.taropen(name, mode, fileobj, **kwargs)
...@@ -290,6 +298,20 @@ class ArchiveTar(ArchiveBase): ...@@ -290,6 +298,20 @@ class ArchiveTar(ArchiveBase):
super(ArchiveTar, self).unpack(target_dir, clean_dir) super(ArchiveTar, self).unpack(target_dir, clean_dir)
self.unpack_dir(target_dir) self.unpack_dir(target_dir)
def maybe_nuke_pip(self, info):
if not info.name.endswith(".egg-info"):
return
if not "site-packages" in info.name:
return
if not "/python" in info.name:
return
if not info.isreg():
return
if not os.path.isdir(info.name):
return
print("Overwriting stale pip install: /{}".format(info.name))
shutil.rmtree(info.name)
def unpack_dir(self, target_dir, callback=None): def unpack_dir(self, target_dir, callback=None):
rmode = "" rmode = ""
self.tar = None self.tar = None
...@@ -431,7 +453,7 @@ class ArchiveTar(ArchiveBase): ...@@ -431,7 +453,7 @@ class ArchiveTar(ArchiveBase):
# Try to extract again. # Try to extract again.
self.tar.extract(tarinfo) self.tar.extract(tarinfo)
except OSError as e: except IOError as e:
# Handle the case where new path is file, but old path is directory # Handle the case where new path is file, but old path is directory
# due to not possible touch file c in /a/b if directory /a/b/c exists. # due to not possible touch file c in /a/b if directory /a/b/c exists.
if not e.errno == errno.EISDIR: if not e.errno == errno.EISDIR:
...@@ -500,7 +522,8 @@ class ArchiveTar(ArchiveBase): ...@@ -500,7 +522,8 @@ class ArchiveTar(ArchiveBase):
compresslevel = int(ctx.config.values.build.compressionlevel) compresslevel = int(ctx.config.values.build.compressionlevel)
self.tar = TarFile.lzmaopen(self.file_path, "w", self.tar = TarFile.lzmaopen(self.file_path, "w",
fileobj=self.fileobj, fileobj=self.fileobj,
compresslevel=compresslevel compresslevel=compresslevel,
compressformat=format
) )
else: else:
raise UnknownArchiveType raise UnknownArchiveType
......
...@@ -79,7 +79,7 @@ You can also give the name of a component. ...@@ -79,7 +79,7 @@ You can also give the name of a component.
ctx.ui.info(_('Outputting binary packages in the package cache.')) ctx.ui.info(_('Outputting binary packages in the package cache.'))
ctx.config.options.output_dir = ctx.config.cached_packages_dir() ctx.config.options.output_dir = ctx.config.cached_packages_dir()
repos = inary.db.repodb.RepoDB().list_repos(only_active) repos = inary.db.repodb.RepoDB().list_repos(only_active=True)
repository.update_repos(repos, ctx.get_option('force')) repository.update_repos(repos, ctx.get_option('force'))
emerge.emerge(emerge_up_list) emerge.emerge(emerge_up_list)
...@@ -63,7 +63,7 @@ all repositories. ...@@ -63,7 +63,7 @@ all repositories.
self.print_packages(arg) self.print_packages(arg)
else: else:
# print for all repos # print for all repos
for repo in inary.db.repodb.RepoDB().list_repos(only_active): for repo in inary.db.repodb.RepoDB().list_repos(only_active=True):
ctx.ui.info(_("\n Repository : {}\n").format(str(repo)), color="blue") ctx.ui.info(_("\n Repository : {}\n").format(str(repo)), color="blue")
self.print_packages(repo) self.print_packages(repo)
......
...@@ -18,6 +18,7 @@ import gettext ...@@ -18,6 +18,7 @@ import gettext
__trans = gettext.translation('inary', fallback=True) __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext _ = __trans.gettext
import inary.db
import inary.cli.command as command import inary.cli.command as command
import inary.context as ctx import inary.context as ctx
...@@ -55,6 +56,6 @@ If no repository is given, all repositories are updated. ...@@ -55,6 +56,6 @@ If no repository is given, all repositories are updated.
if self.args: if self.args:
repos = self.args repos = self.args
else: else:
repos = inary.db.repodb.RepoDB().list_repos(only_active) repos = inary.db.repodb.RepoDB().list_repos(only_active=True)
repository.update_repos(repos, ctx.get_option('force')) repository.update_repos(repos, ctx.get_option('force'))
...@@ -21,7 +21,7 @@ _ = __trans.gettext ...@@ -21,7 +21,7 @@ _ = __trans.gettext
import inary.cli.command as command import inary.cli.command as command
import inary.context as ctx import inary.context as ctx
import inary.db import inary.db
from inary.operations import operations, remove, upgrade from inary.operations import remove, upgrade
class Upgrade(command.PackageOp, metaclass=command.autocommand): class Upgrade(command.PackageOp, metaclass=command.autocommand):
__doc__ = _("""Upgrade INARY packages __doc__ = _("""Upgrade INARY packages
......
...@@ -71,6 +71,7 @@ class Constants(metaclass=Singleton): ...@@ -71,6 +71,7 @@ class Constants(metaclass=Singleton):
# suffix for auto generated debug packages # suffix for auto generated debug packages
self.__c.debug_name_suffix = "-dbginfo" self.__c.debug_name_suffix = "-dbginfo"
self.__c.debug_file_suffix = ".debug" self.__c.debug_file_suffix = ".debug"
self.__c.debug_file_buildid = ".build-id"
# suffix for auto generated ar packages # suffix for auto generated ar packages
self.__c.static_name_suffix = "-static" # an admissible use of constant self.__c.static_name_suffix = "-static" # an admissible use of constant
......
...@@ -17,6 +17,7 @@ import gettext ...@@ -17,6 +17,7 @@ import gettext
__trans = gettext.translation('inary', fallback=True) __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext _ = __trans.gettext
from . import *
def invalidate_caches(): def invalidate_caches():
# Invalidates inary caches in use and forces to re-fill caches from disk when needed # Invalidates inary caches in use and forces to re-fill caches from disk when needed
......
...@@ -33,7 +33,8 @@ class Singleton(object): ...@@ -33,7 +33,8 @@ class Singleton(object):
return self._the_instances[type(self).__name__] return self._the_instances[type(self).__name__]
def _delete(self): def _delete(self):
#FIXME: After invalidate, previously initialized db object becomes stale #FIXME: After invalidate, previously initialized db object becomes
ctx.ui.debug("LazyDB: {0} invalidated.".format(self.__class__.__name__))
del self._the_instances[type(self).__name__] del self._the_instances[type(self).__name__]
class LazyDB(Singleton): class LazyDB(Singleton):
...@@ -70,6 +71,8 @@ class LazyDB(Singleton): ...@@ -70,6 +71,8 @@ class LazyDB(Singleton):
pickle.dump(self._instance().__dict__, pickle.dump(self._instance().__dict__,
open(self.__cache_file(), 'wb'), 1) open(self.__cache_file(), 'wb'), 1)
ctx.ui.debug("LazyDB: {0} cached.".format(self.__class__.__name__))
def cache_valid(self): def cache_valid(self):
if not self.cachedir: if not self.cachedir:
return True return True
...@@ -96,6 +99,8 @@ class LazyDB(Singleton): ...@@ -96,6 +99,8 @@ class LazyDB(Singleton):
def cache_flush(self): def cache_flush(self):
if os.path.exists(self.__cache_file()): if os.path.exists(self.__cache_file()):
os.unlink(self.__cache_file()) os.unlink(self.__cache_file())
ctx.ui.debug("LazyDB: {0} cached.".format(self.__class__.__name__))
def invalidate(self): def invalidate(self):
self._delete() self._delete()
......
...@@ -257,7 +257,17 @@ class PackageDB(lazydb.LazyDB): ...@@ -257,7 +257,17 @@ class PackageDB(lazydb.LazyDB):
since_date = datetime.datetime(*time.strptime(historydb.get_last_repo_update(), "%Y-%m-%d")[0:6]) since_date = datetime.datetime(*time.strptime(historydb.get_last_repo_update(), "%Y-%m-%d")[0:6])
for pkg in self.list_packages(repo): for pkg in self.list_packages(repo):
enter_date = datetime.datetime(*time.strptime(self.get_package(pkg).history[-1].date, "%Y-%m-%d")[0:6]) failed = False
try:
enter_date = datetime.datetime(*time.strptime(self.get_package(pkg).history[-1].date, "%m-%d-%Y")[0:6])
except:
failed = True
if failed:
try:
enter_date = datetime.datetime(*time.strptime(self.get_package(pkg).history[-1].date, "%Y-%m-%d")[0:6])
except:
enter_date = datetime.datetime(*time.strptime(self.get_package(pkg).history[-1].date, "%Y-%d-%m")[0:6])
if enter_date >= since_date: if enter_date >= since_date:
packages.append(pkg) packages.append(pkg)
return packages return packages
...@@ -53,7 +53,6 @@ class Repo: ...@@ -53,7 +53,6 @@ class Repo:
medias = (cd, usb, remote, local) = list(range(4)) medias = (cd, usb, remote, local) = list(range(4))
class RepoOrder: class RepoOrder:
def __init__(self): def __init__(self):
self._doc = None self._doc = None
self.repos = self._get_repos() self.repos = self._get_repos()
...@@ -174,6 +173,7 @@ class RepoDB(lazydb.LazyDB): ...@@ -174,6 +173,7 @@ class RepoDB(lazydb.LazyDB):
def init(self): def init(self):
self.repoorder = RepoOrder() self.repoorder = RepoOrder()
def has_repo(self, name): def has_repo(self, name):
return name in self.list_repos(only_active=False) return name in self.list_repos(only_active=False)
...@@ -198,7 +198,6 @@ class RepoDB(lazydb.LazyDB): ...@@ -198,7 +198,6 @@ class RepoDB(lazydb.LazyDB):
ctx.ui.warning(_("{} repository needs to be updated").format(repo_name)) ctx.ui.warning(_("{} repository needs to be updated").format(repo_name))
return xmlext.newDocument("INARY") return xmlext.newDocument("INARY")
try: try:
return xmlext.parse(index_path) return xmlext.parse(index_path)
except Exception as e: except Exception as e:
......
File mode changed from 100644 to 100755
...@@ -21,6 +21,37 @@ import gettext ...@@ -21,6 +21,37 @@ import gettext
__trans = gettext.translation('inary', fallback=True) __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext _ = __trans.gettext
# These guys will change due to depmod calls.
_blessed_kernel_borks = [
"modules.alias",
"modules.alias.bin",
"modules.dep",
"modules.dep.bin",
"modules.symbols",
"modules.symbols.bin",
]
def ignorance_is_bliss(f):
""" Too many complaints about things that are missing. """
p = f
if not p.startswith("/"):
p = "/{}".format(f)
pbas = os.path.basename(p)
p = p.replace("/lib64/", "/lib/")
# Ignore kernel depmod changes?
if p.startswith("/lib/modules"):
if pbas in _blessed_kernel_borks:
return True
# Running eopkg as root will mutate .pyc files. Ignore them.
if p.endswith(".pyc"):
return True
def file_corrupted(pfile): def file_corrupted(pfile):
path = os.path.join(ctx.config.dest_dir(), pfile.path) path = os.path.join(ctx.config.dest_dir(), pfile.path)
if os.path.islink(path): if os.path.islink(path):
...@@ -47,6 +78,9 @@ def check_files(files, check_config=False): ...@@ -47,6 +78,9 @@ def check_files(files, check_config=False):
continue continue
if not f.hash: if not f.hash:
continue continue
if ignorance_is_bliss(f.path):
continue
is_file_corrupted = False is_file_corrupted = False
......
...@@ -54,6 +54,33 @@ def __listactions(actions): ...@@ -54,6 +54,33 @@ def __listactions(actions):
return beinstalled, beremoved, configs return beinstalled, beremoved, configs
def __getpackageurl_binman(package):
packagedb = inary.db.packagedb.PackageDB()
repodb = inary.db.repodb.RepoDB()
pkg, ver = inary.util.parse_package_name(package)
reponame = None
try:
reponame = packagedb.which_repo(pkg)
except Exception:
# Maybe this package is obsoluted from repository
for repo in repodb.get_binary_repos():
if pkg in packagedb.get_obsoletes(repo):
reponame = repo
if not reponame:
raise PackageNotFound
package_ = packagedb.get_package (pkg)
repourl = repodb.get_repo_url(reponame)
base_package = os.path.dirname (package_.packageURI)
repo_base = os.path.dirname (repourl)
possible_url = os.path.join (repo_base, base_package, package)
ctx.ui.info(_("Package %s found in repository %s") % (pkg, reponame))
#return _possible_ url for this package
return possible_url
def __getpackageurl(package): def __getpackageurl(package):
packagedb = inary.db.packagedb.PackageDB() packagedb = inary.db.packagedb.PackageDB()
repodb = inary.db.repodb.RepoDB() repodb = inary.db.repodb.RepoDB()
...@@ -80,8 +107,9 @@ def __getpackageurl(package): ...@@ -80,8 +107,9 @@ def __getpackageurl(package):
package) package)
def fetch_remote_file(package, errors): def fetch_remote_file(package, errors):
try: try:
uri = inary.file.File.make_uri(__getpackageurl(package)) uri = inary.file.File.make_uri(__getpackageurlbinman(package))
except PackageNotFound: except PackageNotFound:
errors.append(package) errors.append(package)
ctx.ui.info(_("{} could not be found").format(package), color="red") ctx.ui.info(_("{} could not be found").format(package), color="red")
...@@ -90,12 +118,22 @@ def fetch_remote_file(package, errors): ...@@ -90,12 +118,22 @@ def fetch_remote_file(package, errors):
dest = ctx.config.cached_packages_dir() dest = ctx.config.cached_packages_dir()
filepath = os.path.join(dest, uri.filename()) filepath = os.path.join(dest, uri.filename())
if not os.path.exists(filepath): if not os.path.exists(filepath):
failed = True
try: try:
inary.fetcher.fetch_url(uri, dest, ctx.ui.Progress) inary.fetcher.fetch_url(uri, dest, ctx.ui.Progress)
except inary.fetcher.FetchError: except inary.fetcher.FetchError:
errors.append(package) errors.append(package)
ctx.ui.info(_("{} could not be found").format(package), color="red") ctx.ui.info(_("{} could not be found").format(package), color="red")
return False failed = True
if failed:
try:
new_uri = inary.file.File.make_uri(__getpackageurl(package))
inary.fetcher.fetch_url(new_uri, dest, ctx.ui.Progress)
except:
errors.append(package)
ctx.ui.info(_("{} could not be found").format(package), "red")
return False
else: else:
ctx.ui.info(_('{} [cached]').format(uri.filename())) ctx.ui.info(_('{} [cached]').format(uri.filename()))
return True return True
......
...@@ -226,10 +226,13 @@ def upgrade(A=None, repo=None): ...@@ -226,10 +226,13 @@ def upgrade(A=None, repo=None):
operations.remove.remove_obsoleted_packages() operations.remove.remove_obsoleted_packages()
for path in paths: try:
ctx.ui.info(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), color="yellow") for path in paths:
install_op = atomicoperations.Install(path, ignore_file_conflicts = True) ctx.ui.info(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), color="yellow")
install_op.install(not ctx.get_option('compare_sha1sum')) install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
install_op.install(not ctx.get_option('compare_sha1sum'))
except Exception as e:
raise(e)
def plan_upgrade(A, force_replaced=True, replaces=None): def plan_upgrade(A, force_replaced=True, replaces=None):
# FIXME: remove force_replaced # FIXME: remove force_replaced
......
...@@ -42,6 +42,7 @@ class Package: ...@@ -42,6 +42,7 @@ class Package:
formats = ("1.0", "1.1", "1.2") formats = ("1.0", "1.1", "1.2")
default_format = "1.2" default_format = "1.2"
timestamp = None
@staticmethod @staticmethod
def archive_name_and_format(package_format): def archive_name_and_format(package_format):
...@@ -153,6 +154,9 @@ class Package: ...@@ -153,6 +154,9 @@ class Package:
self.install_archive.close() self.install_archive.close()
arcpath = self.install_archive_path arcpath = self.install_archive_path
arcname = os.path.basename(arcpath) arcname = os.path.basename(arcpath)
if self.timestamp is not None:
tstamp = self.timestamp
os.utime(arcpath, (tstamp, tstamp))
self.add_to_package(arcpath, arcname) self.add_to_package(arcpath, arcname)
self.impl.close() self.impl.close()
......
...@@ -42,7 +42,7 @@ def run_batch(cmd, ui_debug=True): ...@@ -42,7 +42,7 @@ def run_batch(cmd, ui_debug=True):
stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate() out, err = p.communicate()
if ui_debug: ctx.ui.debug(_('return value for "{0}" is {1}').format(cmd, p.returncode)) if ui_debug: ctx.ui.debug(_('return value for "{0}" is {1}').format(cmd, p.returncode))
return p.returncode, out, err return p.returncode, out.decode('utf-8'), err
# TODO: it might be worthwhile to try to remove the # TODO: it might be worthwhile to try to remove the
# use of ctx.stdout, and use run_batch()'s return # use of ctx.stdout, and use run_batch()'s return
......
...@@ -37,12 +37,12 @@ MIMEFILE_DIR = "usr/share/mime/packages" ...@@ -37,12 +37,12 @@ MIMEFILE_DIR = "usr/share/mime/packages"
class Build(build): class Build(build):
def run(self): def run(self):
#Preparing configure file #Preparing configure file
shutil.copy("config/inary.conf-{}".format(sys.arch), "config/inary.conf") shutil.copy("config/inary.conf-{}".format(os.uname().machine), "config/inary.conf")
build.run(self) build.run(self)
self.mkpath(self.build_base) self.mkpath(self.build_base)
for in_file in IN_FILES: for in_file in IN_FILES:
name, ext = os.path.splitext(in_file) name, ext = os.path.splitext(in_file)
self.spawn(["intltool-merge", "-x", "po", in_file, os.path.join(self.build_base, name)]) self.spawn(["intltool-merge", "-x", "po", in_file, os.path.join(self.build_base, name)])
...@@ -212,17 +212,11 @@ setup(name="inary", ...@@ -212,17 +212,11 @@ setup(name="inary",
'inary.cli', 'inary.cli',
'inary.data', 'inary.data',
'inary.db', 'inary.db',
'inary.libraries',
'inary.operations', 'inary.operations',
'inary.sxml', 'inary.sxml',
'inary.scenarioapi', 'inary.scenarioapi',
'inary.util'], 'inary.util'],
scripts = ['inary-cli',
'scripts/lsinary',
'scripts/uninary',
'scripts/check-newconfigs.py',
'scripts/inarysh',
'tools/pspec2po'],
# include_package_data=True,
cmdclass = {'build' : Build, cmdclass = {'build' : Build,
'build_po' : BuildPo, 'build_po' : BuildPo,
'install' : Install, 'install' : Install,
......
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