Merge pull request #424 from aydemir/master

pisi add emergeup
This commit is contained in:
yusuf
2016-06-07 12:35:27 +03:00
2 changed files with 105 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
diff -Nuar a/pisi/cli/emergeup.py b/pisi/cli/emergeup.py
--- a/pisi/cli/emergeup.py 1970-01-01 02:00:00.000000000 +0200
+++ b/pisi/cli/emergeup.py 2016-06-06 23:33:48.000000000 +0300
@@ -0,0 +1,82 @@
+# -*- coding:utf-8 -*-
+#
+# Copyright (C) 2005 - 2007, TUBITAK/UEKAE
+#
+# 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 2 of the License, or (at your option)
+# any later version.
+#
+# Please read the COPYING file.
+#
+
+import optparse
+
+import gettext
+__trans = gettext.translation('pisi', fallback=True)
+_ = __trans.ugettext
+
+import pisi.cli.command as command
+import pisi.cli.build as build
+import pisi.context as ctx
+import pisi.api
+
+class EmergeUp(build.Build):
+ __doc__ = _("""Build and install PiSi source packages from repository
+
+Usage: emergeup ...
+
+You should give the name of a source package to be
+downloaded from a repository containing sources.
+
+You can also give the name of a component.
+""")
+ __metaclass__ = command.autocommand
+
+ def __init__(self, args):
+ super(EmergeUp, self).__init__(args)
+ self.comar = True
+
+ name = ("emergeup", "emup")
+
+ def options(self):
+
+ group = optparse.OptionGroup(self.parser, _("emergeup options"))
+ super(EmergeUp, self).add_options(group)
+ group.add_option("-c", "--component", action="store",
+ default=None, help=_("Emerge available packages under given component"))
+ group.add_option("--ignore-file-conflicts", action="store_true",
+ default=False, help=_("Ignore file conflicts"))
+ group.add_option("--ignore-package-conflicts", action="store_true",
+ default=False, help=_("Ignore package conflicts"))
+ group.add_option("--ignore-comar", action="store_true",
+ default=False, help=_("Bypass comar configuration agent"))
+ self.parser.add_option_group(group)
+
+ def run(self):
+ self.init(database = True)
+
+ source = pisi.db.sourcedb.SourceDB()
+
+ imdb = pisi.db.installdb.InstallDB()
+
+ installed_emerge_packages = imdb.list_installed_with_build_host("localhost")
+
+ emerge_up_list = []
+
+ for package in installed_emerge_packages:
+ if source.has_spec(package):
+ spec = source.get_spec(package)
+ if spec.getSourceRelease() > imdb.get_version(package)[1]:
+ emerge_up_list.append(package)
+
+ if ctx.get_option('output_dir'):
+ ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir)
+ else:
+ ctx.ui.info(_('Outputting binary packages in the package cache.'))
+ ctx.config.options.output_dir = ctx.config.cached_packages_dir()
+
+ repos = pisi.api.list_repos()
+ pisi.api.update_repos(repos, ctx.get_option('force'))
+
+ pisi.api.emerge(emerge_up_list)
diff -Nuar a/pisi/cli/pisicli.py b/pisi/cli/pisicli.py
--- a/pisi/cli/pisicli.py 2011-05-26 20:17:29.000000000 +0300
+++ b/pisi/cli/pisicli.py 2016-06-07 12:10:25.448737817 +0300
@@ -29,6 +29,7 @@
import pisi.cli.deletecache
import pisi.cli.delta
import pisi.cli.emerge
+import pisi.cli.emergeup
import pisi.cli.fetch
import pisi.cli.graph
import pisi.cli.index
+8
View File
@@ -33,6 +33,7 @@
<Patch>improve_pisi_ix.patch</Patch>
<Patch>fix_emul32_flags.patch</Patch>
<Patch level="1">pisi-2.6-pisitools.dopixmaps-add.patch</Patch>
<Patch>emergeup.patch</Patch>
</Patches>
</Source>
@@ -85,6 +86,13 @@
</Package>
<History>
<Update release="3">
<Date>2016-06-07</Date>
<Version>2.6</Version>
<Comment>Release Bump</Comment>
<Name>PisiLinux Community</Name>
<Email>admin@pisilinux.org</Email>
</Update>
<Update release="2">
<Date>2016-04-27</Date>
<Version>2.6</Version>