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
d1c4d1dc
Kaydet (Commit)
d1c4d1dc
authored
May 17, 2020
tarafından
Ali Rıza KESKİN
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
list-newest fixlenik vev hzlandrlq
üst
75cf5059
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
33 deletions
+43
-33
listnewest.py
inary/cli/listnewest.py
+5
-7
listupgrades.py
inary/cli/listupgrades.py
+6
-7
historydb.py
inary/db/historydb.py
+0
-2
packagedb.py
inary/db/packagedb.py
+23
-5
install.py
inary/operations/install.py
+3
-12
upgrade.py
inary/operations/upgrade.py
+6
-0
No files found.
inary/cli/listnewest.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -38,6 +38,7 @@ packages from all repositories.
super
(
ListNewest
,
self
)
.
__init__
(
args
)
self
.
componentdb
=
inary
.
db
.
componentdb
.
ComponentDB
()
self
.
packagedb
=
inary
.
db
.
packagedb
.
PackageDB
()
self
.
historydb
=
inary
.
db
.
historydb
.
HistoryDB
()
name
=
(
"list-newest"
,
"ln"
)
...
...
@@ -55,7 +56,6 @@ packages from all repositories.
def
run
(
self
):
self
.
init
(
database
=
True
,
write
=
False
)
if
self
.
args
:
for
arg
in
self
.
args
:
self
.
print_packages
(
arg
)
...
...
@@ -68,14 +68,12 @@ packages from all repositories.
if
ctx
.
config
.
get_option
(
'since'
):
since
=
ctx
.
config
.
get_option
(
'since'
)
elif
ctx
.
config
.
get_option
(
'last'
):
since
=
inary
.
db
.
historydb
.
HistoryDB
()
.
get_last_repo_update
(
int
(
ctx
.
config
.
get_option
(
'last'
)))
since
=
self
.
historydb
.
get_last_repo_update
(
int
(
ctx
.
config
.
get_option
(
'last'
)))
else
:
since
=
None
l
=
self
.
packagedb
.
list_newest
(
repo
,
since
)
l
=
self
.
packagedb
.
list_newest
(
repo
,
since
,
self
.
historydb
)
if
not
l
:
return
if
since
:
ctx
.
ui
.
info
(
_
(
"Packages added to
\'
{0}
\'
since
\"
{1}
\"
:
\n
"
)
.
format
(
repo
,
since
))
else
:
...
...
@@ -86,9 +84,9 @@ packages from all repositories.
l
.
sort
()
for
p
in
l
:
p
ackage
=
self
.
packagedb
.
get_package
(
p
,
repo
)
p
kgsum
=
self
.
packagedb
.
get_summary
(
p
)
lenp
=
len
(
p
)
p
+=
' '
*
max
(
0
,
maxlen
-
lenp
)
ctx
.
ui
.
info
(
'{0} - {1} '
.
format
(
p
,
str
(
p
ackage
.
summary
)))
ctx
.
ui
.
info
(
'{0} - {1} '
.
format
(
p
,
str
(
p
kgsum
)))
print
()
inary/cli/listupgrades.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -56,9 +56,9 @@ Lists the packages that will be upgraded.
import
inary.operations
as
operations
self
.
init
(
database
=
True
,
write
=
False
)
installdb
=
inary
.
db
.
installdb
.
InstallDB
()
is_upgradable
=
operations
.
upgrade
.
is_upgradable
packagedb
=
inary
.
db
.
packagedb
.
PackageDB
()
upgradable_pkgs
=
list
(
filter
(
is_upgradable
,
installdb
.
list_installed
())
)
upgradable_pkgs
=
operations
.
upgrade
.
list_upgradeable
(
installdb
,
packagedb
)
# replaced packages can not pass is_upgradable test, so we add them manually
# upgradable_pkgs.extend(list_replaces())
...
...
@@ -86,13 +86,12 @@ Lists the packages that will be upgraded.
sys
.
stdout
.
write
(
'==========================================================================='
)
for
pkg
in
upgradable_pkgs
:
package
=
self
.
installdb
.
get_package
(
pkg
)
inst_info
=
self
.
installdb
.
get_info
(
pkg
)
if
self
.
options
.
long
:
ctx
.
ui
.
info
(
p
ackage
)
ctx
.
ui
.
info
(
p
kg
)
sys
.
stdout
.
write
(
inst_info
)
elif
self
.
options
.
install_info
:
ctx
.
ui
.
info
(
'
%-20
s |
%
s '
%
(
p
ackage
.
name
,
inst_info
.
one_liner
()))
ctx
.
ui
.
info
(
'
%-20
s |
%
s '
%
(
p
kg
,
inst_info
.
one_liner
()))
else
:
package
.
name
+=
' '
*
max
(
0
,
maxlen
-
len
(
p
ackage
.
name
))
ctx
.
ui
.
info
(
'{0} - {1}'
.
format
(
p
ackage
.
name
,
str
(
package
.
summary
)))
package
.
name
+=
' '
*
max
(
0
,
maxlen
-
len
(
p
kg
))
ctx
.
ui
.
info
(
'{0} - {1}'
.
format
(
p
kg
,
str
(
packagedb
.
get_summary
(
pkg
)
)))
inary/db/historydb.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -123,8 +123,6 @@ class HistoryDB(lazydb.LazyDB):
def
get_last_repo_update
(
self
,
last
=
1
):
repoupdates
=
[
l
for
l
in
self
.
__logs
if
l
.
endswith
(
"repoupdate.xml"
)]
repoupdates
.
reverse
()
if
not
len
(
repoupdates
)
>=
2
:
return
None
if
last
!=
1
and
len
(
repoupdates
)
<=
last
:
return
None
...
...
inary/db/packagedb.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -165,6 +165,15 @@ class PackageDB(lazydb.LazyDB):
release
=
xmlext
.
getNodeAttribute
(
update
,
'release'
)
return
release
@staticmethod
def
__get_last_date
(
meta_doc
):
history
=
xmlext
.
getNode
(
meta_doc
,
'History'
)
update
=
xmlext
.
getNode
(
history
,
'Update'
)
date
=
xmlext
.
getNodeText
(
update
,
'Date'
)
return
date
@staticmethod
def
__get_summary
(
meta_doc
):
...
...
@@ -210,6 +219,14 @@ class PackageDB(lazydb.LazyDB):
pkg_doc
=
xmlext
.
parseString
(
self
.
pdb
.
get_item
(
name
,
repo
))
return
self
.
__get_release
(
pkg_doc
)
def
get_last_date
(
self
,
name
,
repo
):
if
not
self
.
has_package
(
name
,
repo
):
raise
Exception
(
_
(
'Package
\"
{}
\"
not found.'
)
.
format
(
name
))
pkg_doc
=
xmlext
.
parseString
(
self
.
pdb
.
get_item
(
name
,
repo
))
return
self
.
__get_last_date
(
pkg_doc
)
def
get_package_repo
(
self
,
name
,
repo
=
None
):
pkg
,
repo
=
self
.
pdb
.
get_item_repo
(
name
,
repo
)
...
...
@@ -283,9 +300,10 @@ class PackageDB(lazydb.LazyDB):
def
list_packages
(
self
,
repo
):
return
self
.
pdb
.
get_item_keys
(
repo
)
def
list_newest
(
self
,
repo
,
since
=
None
):
def
list_newest
(
self
,
repo
,
since
=
None
,
historydb
=
None
):
packages
=
[]
historydb
=
inary
.
db
.
historydb
.
HistoryDB
()
if
not
historydb
:
historydb
=
inary
.
db
.
historydb
.
HistoryDB
()
if
since
:
since_date
=
datetime
.
datetime
(
*
time
.
strptime
(
since
,
"
%
Y-
%
m-
%
d"
)[
0
:
6
])
else
:
...
...
@@ -294,16 +312,16 @@ class PackageDB(lazydb.LazyDB):
for
pkg
in
self
.
list_packages
(
repo
):
failed
=
False
try
:
enter_date
=
datetime
.
datetime
(
*
time
.
strptime
(
self
.
get_
package
(
pkg
)
.
history
[
-
1
]
.
date
,
"
%
m-
%
d-
%
Y"
)[
0
:
6
])
enter_date
=
datetime
.
datetime
(
*
time
.
strptime
(
self
.
get_
last_date
(
pkg
,
repo
)
,
"
%
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
])
*
time
.
strptime
(
self
.
get_
last_date
(
pkg
,
repo
)
,
"
%
Y-
%
m-
%
d"
)[
0
:
6
])
except
:
enter_date
=
datetime
.
datetime
(
*
time
.
strptime
(
self
.
get_
package
(
pkg
)
.
history
[
-
1
]
.
date
,
"
%
Y-
%
d-
%
m"
)[
0
:
6
])
*
time
.
strptime
(
self
.
get_
last_date
(
pkg
,
repo
)
,
"
%
Y-
%
d-
%
m"
)[
0
:
6
])
if
enter_date
>=
since_date
:
packages
.
append
(
pkg
)
...
...
inary/operations/install.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -304,7 +304,7 @@ def plan_install_pkg_names(A):
for
x
in
A
:
G_f
.
add_package
(
x
)
B
=
A
not_satisfied
=
dict
()
while
len
(
B
)
>
0
:
Bp
=
set
()
for
x
in
B
:
...
...
@@ -314,15 +314,10 @@ def plan_install_pkg_names(A):
# we don't deal with already *satisfied* dependencies
if
not
dep
.
satisfied_by_installed
():
if
not
dep
.
satisfied_by_repo
(
packagedb
=
packagedb
)
and
not
ctx
.
config
.
get_option
(
'ignore_satisfy'
):
if
dep
in
not_satisfied
:
not_satisfied
[
dep
]
+=
[
pkg
.
name
]
else
:
not_satisfied
[
dep
]
=
[
pkg
.
name
]
pass
raise
Exception
(
_
(
'
\"
{0}
\"
dependency of package
\"
{1}
\"
is not satisfied.'
)
.
format
(
dep
,
pkg
.
name
))
if
not
dep
.
package
in
G_f
.
vertices
():
Bp
.
add
(
str
(
dep
.
package
))
G_f
.
add_dep
(
x
,
dep
)
if
ctx
.
config
.
values
.
general
.
allow_docs
:
dep
=
x
+
ctx
.
const
.
doc_package_end
if
packagedb
.
has_package
(
dep
):
...
...
@@ -343,12 +338,8 @@ def plan_install_pkg_names(A):
if
packagedb
.
has_package
(
dep
):
Bp
.
add
(
dep
)
G_f
.
add_package
(
dep
)
B
=
Bp
if
not_satisfied
:
msg
=
_
(
"Following packages are not satisfied:
\n
"
)
for
ns
in
not_satisfied
:
msg
+=
(
_
(
' ->
\"
{0}
\"
dependency(s) of package
\"
{1}
\"
is not satisfied.
\n
'
)
.
format
(
not_satisfied
[
ns
],
ns
))
raise
Exception
(
msg
)
if
ctx
.
config
.
get_option
(
'debug'
):
G_f
.
write_graphviz
(
sys
.
stdout
)
order
=
G_f
.
topological_sort
()
...
...
inary/operations/upgrade.py
Dosyayı görüntüle @
d1c4d1dc
...
...
@@ -464,6 +464,12 @@ def is_upgradable(name,installdb,packagedb):
return
int
(
i_release
)
<
int
(
release
)
def
list_upgradeable
(
installdb
,
packagedb
):
listup
=
[]
for
pkg
in
installdb
.
list_installed
():
if
is_upgradable
(
pkg
,
installdb
,
packagedb
):
listup
.
append
(
pkg
)
return
listup
def
get_upgrade_order
(
packages
):
"""
...
...
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