Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
1
Konular (issue)
1
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
inary
Commits
5586b025
Kaydet (Commit)
5586b025
authored
Eki 02, 2006
tarafından
Faik Uygur
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
* use unused component.dependencies member to build a component tree
üst
ec2be6d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
22 deletions
+32
-22
component.py
pisi/component.py
+32
-22
No files found.
pisi/component.py
Dosyayı görüntüle @
5586b025
...
...
@@ -73,27 +73,9 @@ class Component(xmlfile.XmlFile):
t_Sources
=
[
[
autoxml
.
String
],
autoxml
.
optional
,
"Parts/Source"
]
# TODO: this is probably not necessary since we use fully qualified
# module names (like in Java)
#t_PartOf = [autoxml.Text, autoxml.mandatory]
#FIXME: recursive declarations do not work!
#class ComponentTree(xmlfile.XmlFile):
# "index representation for the component structure"
#
# __metaclass__ = autoxml.autoxml
#
# tag = "Component"
#
# t_Name = [autoxml.Text, autoxml.mandatory] # fully qualified name
# #t_Icon = [autoxml.Binary, autoxml.mandatory]
# t_Dependencies = [ [autoxml.Text], autoxml.optional, "Component"]
# #t_Parts = [ [pisi.component.ComponentTree], autoxml.optional, "Component"]
class
ComponentDB
(
object
):
"""a database of components"""
#FIXME: we might need a database per repo in the future
def
__init__
(
self
):
self
.
d
=
ItemByRepoDB
(
'component'
)
...
...
@@ -104,7 +86,6 @@ class ComponentDB(object):
self
.
d
.
destroy
()
def
has_component
(
self
,
name
,
repo
=
pisi
.
itembyrepodb
.
repos
,
txn
=
None
):
#name = shelve.LockedDBShelf.encodekey(name)
name
=
str
(
name
)
return
self
.
d
.
has_key
(
name
,
repo
,
txn
)
...
...
@@ -115,7 +96,6 @@ class ComponentDB(object):
raise
Error
(
_
(
'Component
%
s not found'
)
%
name
)
def
get_component_repo
(
self
,
name
,
repo
=
None
,
txn
=
None
):
#name = shelve.LockedDBShelf.encodekey(name)
try
:
return
self
.
d
.
get_item_repo
(
name
,
repo
,
txn
=
txn
)
except
pisi
.
itembyrepodb
.
NotfoundError
,
e
:
...
...
@@ -141,12 +121,41 @@ class ComponentDB(object):
def
list_components
(
self
,
repo
=
None
):
return
self
.
d
.
list
(
repo
)
def
get_packages
(
self
,
component_name
,
repo
=
None
,
txn
=
None
):
"""returns the given component's and underlying recursive components' packages"""
packages
=
[]
component
=
self
.
get_component
(
component_name
,
repo
,
txn
)
packages
.
extend
(
component
.
packages
)
for
dep
in
component
.
dependencies
:
packages
.
extend
(
self
.
get_packages
(
dep
))
return
packages
def
add_child
(
self
,
component
,
repo
,
txn
=
None
):
"""update component tree"""
parent_name
=
"."
.
join
(
component
.
name
.
split
(
"."
)[:
-
1
])
if
not
parent_name
:
# root component
return
if
self
.
has_component
(
parent_name
,
repo
,
txn
):
parent
=
self
.
get_component
(
parent_name
,
repo
,
txn
)
else
:
parent
=
Component
(
name
=
parent_name
)
if
component
.
name
not
in
parent
.
dependencies
:
parent
.
dependencies
.
append
(
component
.
name
)
self
.
d
.
add_item
(
parent_name
,
parent
,
repo
,
txn
)
def
update_component
(
self
,
component
,
repo
,
txn
=
None
):
def
proc
(
txn
):
if
self
.
has_component
(
component
.
name
,
repo
,
txn
):
# preserve the list of packages
component
.
packages
=
self
.
d
.
get_item
(
component
.
name
,
repo
,
txn
)
.
packages
# preserve list of packages and dependencies
current
=
self
.
d
.
get_item
(
component
.
name
,
repo
,
txn
)
component
.
packages
=
current
.
packages
component
.
dependencies
=
current
.
dependencies
self
.
d
.
add_item
(
component
.
name
,
component
,
repo
,
txn
)
self
.
add_child
(
component
,
repo
,
txn
)
self
.
d
.
txn_proc
(
proc
,
txn
)
def
add_package
(
self
,
component_name
,
package
,
repo
,
txn
=
None
):
...
...
@@ -159,6 +168,7 @@ class ComponentDB(object):
if
not
package
in
component
.
packages
:
component
.
packages
.
append
(
package
)
self
.
d
.
add_item
(
component_name
,
component
,
repo
,
txn
)
# update
self
.
add_child
(
component
,
repo
,
txn
)
self
.
d
.
txn_proc
(
proc
,
txn
)
def
remove_package
(
self
,
component_name
,
package
,
repo
=
None
,
txn
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment