build process fixes

This commit is contained in:
guinux 2013-11-15 15:44:52 +01:00
parent 7bbe3a50ba
commit ce45f67336
3 changed files with 29 additions and 23 deletions

View File

@ -496,8 +496,8 @@ class PamacDBusService(dbus.service.Object):
def Add(self, pkgname): def Add(self, pkgname):
error = '' error = ''
try: try:
for repo in self.syncdbs: for db in self.syncdbs:
pkg = repo.get_pkg(pkgname) pkg = db.get_pkg(pkgname)
if pkg: if pkg:
self.t.add_pkg(pkg) self.t.add_pkg(pkg)
break break

View File

@ -892,10 +892,6 @@ else:
size_column.set_cell_data_func(size_renderertext, size_column_display_func) size_column.set_cell_data_func(size_renderertext, size_column_display_func)
transaction.get_handle() transaction.get_handle()
transaction.update_dbs() transaction.update_dbs()
# now localdb is defined, populate make_depends
for name in transaction.base_devel:
if not pyalpm.find_satisfier(transaction.localdb.pkgcache, name):
transaction.make_depends.add(name)
update_lists() update_lists()
ManagerWindow.show_all() ManagerWindow.show_all()
ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))

View File

@ -16,7 +16,7 @@ from pamac import config, common, aur
to_remove = set() to_remove = set()
to_add = set() to_add = set()
to_add_as_dep = set() to_mark_as_dep = set()
to_update = set() to_update = set()
to_load = set() to_load = set()
available_updates = (False, []) available_updates = (False, [])
@ -246,9 +246,16 @@ def init_transaction(**options):
def check_to_build(): def check_to_build():
global to_build global to_build
global to_add_as_dep global to_add
global to_mark_as_dep
global make_depends global make_depends
global build_depends global build_depends
make_depends = []
builds_depends = []
# check if base_devel packages are installed
for name in base_devel:
if not pyalpm.find_satisfier(localdb.pkgcache, name):
make_depends.add(name)
already_checked = set() already_checked = set()
build_order = [] build_order = []
i = 0 i = 0
@ -302,7 +309,7 @@ def check_to_build():
build_order.insert(index, raw_makedepend) build_order.insert(index, raw_makedepend)
# add it in already_checked and to_add_as_as_dep # add it in already_checked and to_add_as_as_dep
already_checked.add(raw_makedepend) already_checked.add(raw_makedepend)
to_add_as_dep.add(raw_makedepend) to_mark_as_dep.add(raw_makedepend)
else: else:
if error: if error:
error += '\n' error += '\n'
@ -341,7 +348,7 @@ def check_to_build():
build_order.insert(index, raw_depend) build_order.insert(index, raw_depend)
# add it in already_checked and to_add_as_as_dep # add it in already_checked and to_add_as_as_dep
already_checked.add(raw_depend) already_checked.add(raw_depend)
to_add_as_dep.add(raw_depend) to_mark_as_dep.add(raw_depend)
else: else:
if error: if error:
error += '\n' error += '\n'
@ -353,11 +360,13 @@ def check_to_build():
i += 1 i += 1
if error: if error:
return error return error
# add pkgname in make_depends and build_depends in to_add_as_dep # add pkgname in make_depends and build_depends in to_add and to_mark_as_dep
for name in make_depends: for name in make_depends:
to_add_as_dep.add(name) to_add.add(name)
to_mark_as_dep.add(name)
for name in build_depends: for name in build_depends:
to_add_as_dep.add(name) to_add.add(name)
to_mark_as_dep.add(name)
# reorder to_build following build_order # reorder to_build following build_order
to_build.sort(key = lambda pkg: build_order.index(pkg.name)) to_build.sort(key = lambda pkg: build_order.index(pkg.name))
print('order:', build_order) print('order:', build_order)
@ -387,11 +396,11 @@ def run():
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
if not error: if not error:
if to_add or to_remove or to_load or to_add_as_dep: if to_add or to_remove or to_load:
trans_flags = {'cascade' : True} trans_flags = {'cascade' : True}
error += init_transaction(**trans_flags) error += init_transaction(**trans_flags)
if not error: if not error:
for name in to_add | to_add_as_dep: for name in to_add:
error += Add(name) error += Add(name)
for name in to_remove: for name in to_remove:
error += Remove(name) error += Remove(name)
@ -422,7 +431,7 @@ def prepare(**trans_flags):
choose_provides(item) choose_provides(item)
error += init_transaction(**trans_flags) error += init_transaction(**trans_flags)
if not error: if not error:
for name in to_add | to_add_as_dep: for name in to_add:
error += Add(name) error += Add(name)
for name in to_remove: for name in to_remove:
error += Remove(name) error += Remove(name)
@ -602,13 +611,14 @@ def finalize():
build_next() build_next()
def mark_needed_pkgs_as_dep(): def mark_needed_pkgs_as_dep():
global to_add_as_dep global to_mark_as_dep
for name in to_add_as_dep.copy(): for name in to_mark_as_dep.copy():
error = SetPkgReason(name, pyalpm.PKG_REASON_DEPEND) if get_localpkg(name):
if error: error = SetPkgReason(name, pyalpm.PKG_REASON_DEPEND)
print(error) if error:
else: print(error)
to_add_as_dep.discard(name) else:
to_mark_as_dep.discard(name)
def get_updates(): def get_updates():
while Gtk.events_pending(): while Gtk.events_pending():