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)
0
Konular (issue)
0
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
e4d191e5
Kaydet (Commit)
e4d191e5
authored
Ock 18, 2018
tarafından
Suleyman Poyraz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
write a urgent package analyzer(but not finished should fix errors) and firmwares system literal
üst
499f8463
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
0 deletions
+164
-0
urgent-packages.py
inary/analyzer/urgent-packages.py
+96
-0
firmwares.py
inary/system_literals/firmwares.py
+68
-0
No files found.
inary/analyzer/urgent-packages.py
0 → 100644
Dosyayı görüntüle @
e4d191e5
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018, Suleyman POYRAZ (Zaryob)
#
# 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
ciksemel
import
bz2
import
sys
import
os
def
loadFile
(
_file
):
try
:
f
=
open
(
_file
)
d
=
[
a
.
lstrip
()
.
rstrip
(
"
\n
"
)
for
a
in
f
]
d
=
[
x
for
x
in
d
if
not
(
x
.
startswith
(
"#"
)
or
x
==
""
)]
f
.
close
()
return
d
except
:
return
[]
def
getXmlData
(
_file
):
if
os
.
path
.
exists
(
_file
):
return
ciksemel
.
parse
(
_file
)
elif
os
.
path
.
exists
(
"
%
s.bz2"
%
_file
):
indexdata
=
bz2
.
decompress
(
file
(
"
%
s.bz2"
%
_file
)
.
read
())
return
ciksemel
.
parseString
(
indexdata
)
else
:
print
(
"
%
s not found"
%
indexfile
)
sys
.
exit
(
1
)
def
fillPackageDict
(
tag
,
_hasSpecFile
,
packageOf
):
PackagePartOf
=
tag
.
getTagData
(
"PartOf"
)
PackageName
=
tag
.
getTagData
(
"Name"
)
if
_hasSpecFile
:
PackagePackagerName
=
tag
.
getTag
(
"Packager"
)
.
getTagData
(
"Name"
)
else
:
PackagePackagerName
=
tag
.
getTag
(
"Source"
)
.
getTag
(
"Packager"
)
.
getTagData
(
"Name"
)
fullpath
=
"
%
s/
%
s"
%
(
PackagePartOf
.
replace
(
"."
,
"/"
),
PackageName
)
if
not
PackagePackagerName
in
packageOf
:
packageOf
[
PackagePackagerName
]
=
[]
packageOf
[
PackagePackagerName
]
.
append
(
fullpath
)
def
parseXmlData
(
_index
):
packageOf
=
{}
hasSpecFile
=
_index
.
getTag
(
"SpecFile"
)
if
hasSpecFile
:
for
i
in
_index
.
tags
(
"SpecFile"
):
parent
=
i
.
getTag
(
"Source"
)
fillPackageDict
(
parent
,
hasSpecFile
,
packageOf
)
else
:
for
parent
in
_index
.
tags
(
"Package"
):
fillPackageDict
(
parent
,
hasSpecFile
,
packageOf
)
return
packageOf
def
findRequiredPackages
(
packageList
,
packagersList
):
pkgdict
=
{}
for
pkg
in
packageList
:
for
packager
in
packagersList
:
for
sourcePackage
in
packagersList
[
packager
]:
if
sourcePackage
.
endswith
(
"/
%
s"
%
pkg
):
if
not
packager
in
pkgdict
:
pkgdict
[
packager
]
=
[]
pkgdict
[
packager
]
.
append
(
pkg
)
return
pkgdict
def
urgent_packages
(
index
,
packages
):
indexfile
=
"
%
s/
%
s"
%
(
index
,
"inary-index.xml"
)
packageList
=
loadFile
(
packages
)
xmldata
=
getXmlData
(
indexfile
)
packagers
=
parseXmlData
(
xmldata
)
requiredPackages
=
findRequiredPackages
(
packageList
,
packagers
)
tmp
=
list
(
requiredPackages
.
keys
())
tmp
.
sort
()
for
i
in
tmp
:
print
(
"->
%
s"
%
i
)
for
k
in
requiredPackages
[
i
]:
print
(
"
\t
%
s"
%
k
)
inary/system_literals/firmwares.py
0 → 100644
Dosyayı görüntüle @
e4d191e5
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018, Suleyman POYRAZ (Zaryob)
#
# 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
os
import
sys
import
inary
import
inary.context
as
ctx
import
inary.util
#Gettext
import
gettext
__trans
=
gettext
.
translation
(
'inary'
,
fallback
=
True
)
_
=
__trans
.
gettext
FW_PATH
=
"/lib/firmware"
INSTALDB
=
inary
.
db
.
installdb
.
InstallDB
()
COMPONENTDB
=
inary
.
db
.
componentdb
.
ComponentDB
()
class
Error
(
inary
.
Error
):
pass
def
get_firmwares
():
ctx
.
ui
.
info
(
inary
.
util
.
colorize
(
"Extracting firmware list for
%
s..."
%
os
.
uname
()[
2
],
"green"
))
d
=
{}
modules
=
[
os
.
path
.
basename
(
mod
.
replace
(
".ko"
,
""
))
for
mod
in
\
os
.
popen
(
"modprobe -l"
)
.
read
()
.
strip
()
.
split
(
"
\n
"
)]
for
mod
in
modules
:
fws
=
os
.
popen
(
"modinfo -F firmware
%
s"
%
mod
)
.
read
()
.
strip
()
if
fws
:
try
:
d
[
mod
]
.
extend
(
fws
.
split
(
"
\n
"
))
except
KeyError
:
d
[
mod
]
=
fws
.
split
(
"
\n
"
)
return
d
def
get_firmware_package
(
firmware
):
try
:
fw_packages
=
COMPONENTDB
.
get_packages
(
"hardware.firmware"
)
unavailable_fw_packages
=
set
(
fw_packages
)
.
difference
(
INSTALLDB
.
list_installed
())
if
unavailable_fw_packages
:
ctx
.
ui
.
info
(
inary
.
util
.
colorize
(
"The following firmwares are not installed:"
,
"yellow"
))
ctx
.
ui
.
info
(
"
\n
"
.
join
(
unavailable_fw_packages
))
for
module
,
firmwares
in
list
(
get_firmwares
()
.
items
()):
ctx
.
ui
.
info
(
"
\n
%
s requires the following firmwares:"
%
module
)
for
fw
in
firmwares
:
ctx
.
ui
.
info
(
" *
%
s"
%
fw
,
noln
=
True
)
try
:
firmware
=
inary
.
api
.
search_file
(
fw
)[
0
][
0
]
except
:
pass
ctx
.
ui
.
info
(
" (
%
s)"
%
(
inary
.
util
.
colorize
(
firmware
,
'green'
)
if
firmware
else
\
inary
.
util
.
colorize
(
"missing"
,
'red'
)))
except
:
raise
Error
()
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