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
9ed6a21c
Kaydet (Commit)
9ed6a21c
authored
Mar 26, 2018
tarafından
Suleyman Poyraz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes
üst
0c3fe2a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
42 deletions
+48
-42
inarytools.py
inary/actionsapi/inarytools.py
+7
-30
kerneltools.py
inary/actionsapi/kerneltools.py
+4
-2
magic.py
inary/analyzer/magic.py
+34
-10
info.py
inary/operations/info.py
+3
-0
No files found.
inary/actionsapi/inarytools.py
Dosyayı görüntüle @
9ed6a21c
...
...
@@ -118,12 +118,6 @@ def dodoc(*sourceFiles, **kw):
destDir
=
kw
.
get
(
"destDir"
,
get
.
srcNAME
())
readable_insinto
(
join_path
(
get
.
installDIR
(),
get
.
docDIR
(),
destDir
),
*
sourceFiles
)
def
doexe
(
sourceFile
,
destinationDirectory
):
'''insert a executable file into destination directory'''
''' example call: inarytools.doexe("kde-3.4.sh", "/etc/X11/Sessions")'''
executable_insinto
(
join_path
(
get
.
installDIR
(),
destinationDirectory
),
sourceFile
)
def
dohtml
(
*
sourceFiles
,
**
kw
):
'''inserts the files in the list of files into /usr/share/doc/PACKAGE/html'''
...
...
@@ -158,33 +152,16 @@ def doinfo(*sourceFiles):
'''inserts the into files in the list of files into /usr/share/info'''
readable_insinto
(
join_path
(
get
.
installDIR
(),
get
.
infoDIR
()),
*
sourceFiles
)
def
dolib
(
sourceFile
,
destinationDirectory
=
'/usr/lib'
):
def
dolib
(
sourceFile
,
destinationDirectory
=
'/usr/lib'
,
mode
=
755
):
'''insert the library into /usr/lib'''
'''example call: inarytools.dolib("libz.a")'''
'''example call: inarytools.dolib("libz.so")'''
if
mode
==
755
and
sourceFile
.
endswith
(
'.a'
):
mode
=
644
sourceFile
=
join_path
(
os
.
getcwd
(),
sourceFile
)
destinationDirectory
=
join_path
(
get
.
installDIR
(),
destinationDirectory
)
lib_insinto
(
sourceFile
,
destinationDirectory
,
755
)
def
dolib_a
(
sourceFile
,
destinationDirectory
=
'/usr/lib'
):
'''insert the static library into /usr/lib with permission 0644'''
'''example call: inarytools.dolib_a("staticlib/libvga.a")'''
sourceFile
=
join_path
(
os
.
getcwd
(),
sourceFile
)
destinationDirectory
=
join_path
(
get
.
installDIR
(),
destinationDirectory
)
lib_insinto
(
sourceFile
,
destinationDirectory
,
644
)
def
dolib_so
(
sourceFile
,
destinationDirectory
=
'/usr/lib'
):
'''insert the dynamic library into /usr/lib with permission 0755'''
'''example call: inarytools.dolib_so("pppd/plugins/minconn.so")'''
sourceFile
=
join_path
(
os
.
getcwd
(),
sourceFile
)
destinationDirectory
=
join_path
(
get
.
installDIR
(),
destinationDirectory
)
lib_insinto
(
sourceFile
,
destinationDirectory
,
755
)
lib_insinto
(
sourceFile
,
destinationDirectory
,
mode
)
def
doman
(
*
sourceFiles
):
'''inserts the man pages in the list of files into /usr/share/man/'''
...
...
@@ -281,7 +258,7 @@ def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLin
backupExtension
=
".inary-backup"
sourceFiles
=
[]
sourcesGlob
=
glob
.
glob
(
sources
)
for
source
in
sourcesGlob
:
if
os
.
path
.
isdir
(
source
):
sourceFiles
.
extend
(
get_files
(
source
,
filePattern
,
level
))
...
...
@@ -298,7 +275,7 @@ def dosed(sources, findPattern, replacePattern = '', filePattern = '', deleteLin
for
line
in
fileinput
.
input
(
sourceFile
,
inplace
=
1
,
backup
=
backupExtension
):
#FIXME: In-place filtering is disabled when standard input is read
if
re
.
search
(
findPattern
,
line
):
line
=
""
if
deleteLine
else
re
.
sub
(
findPattern
,
replacePattern
,
line
)
line
=
""
if
deleteLine
else
re
.
sub
(
findPattern
,
replacePattern
,
line
)
sys
.
stdout
.
write
(
line
)
if
can_access_file
(
backupFile
):
# By default, filecmp.cmp() compares two files by looking file sizes.
...
...
@@ -381,7 +358,7 @@ class Flags:
def
add
(
self
,
*
flags
):
for
evar
in
self
.
evars
:
os
.
environ
[
evar
]
=
" "
.
join
(
os
.
environ
[
evar
]
.
split
()
+
[
f
.
strip
()
for
f
in
flags
])
os
.
environ
[
evar
]
=
" "
.
join
(
os
.
environ
[
evar
]
.
split
()
+
[
f
.
strip
()
for
f
in
flags
])
def
remove
(
self
,
*
flags
):
for
evar
in
self
.
evars
:
...
...
inary/actionsapi/kerneltools.py
Dosyayı görüntüle @
9ed6a21c
...
...
@@ -162,7 +162,7 @@ def install():
dumpVersion
()
# Install kernel image
inarytools
.
insinto
(
"/boot/"
,
"arch/x86/boot/bzImage"
,
"kernel-{}"
.
forma
r
(
suffix
))
inarytools
.
insinto
(
"/boot/"
,
"arch/x86/boot/bzImage"
,
"kernel-{}"
.
forma
t
(
suffix
))
# Install the modules
# mod-fw= avoids firmwares from installing
...
...
@@ -215,6 +215,8 @@ def installHeaders(extraHeaders=None):
# Install additional headers
for
headers
in
extras
:
if
not
os
.
path
.
exist
(
"{0}/{1}"
.
format
(
destination
,
headers
)):
shelltools
.
system
(
"mkdir {0}/{1}"
.
format
(
destination
,
headers
))
shelltools
.
system
(
"cp -a {0}/*.h {1}/{2}"
.
format
(
headers
,
destination
,
headers
))
# Install remaining headers
...
...
@@ -254,7 +256,7 @@ def installLibcHeaders(excludes=None):
# Create directories
shelltools
.
makedirs
(
headers_tmp
)
shelltools
.
makedirs
(
headers_dir
)
###################Workaround begins here ...
#Workaround information -- http://patches.openembedded.org/patch/33433/
cpy_src
=
"{}/linux-*/arch/x86/include/generated"
.
format
(
get
.
workDIR
())
...
...
inary/analyzer/magic.py
Dosyayı görüntüle @
9ed6a21c
...
...
@@ -15,10 +15,19 @@ import glob
import
os
import
threading
import
gettext
__trans
=
gettext
.
translation
(
"inary"
,
fallback
=
True
)
_
=
__trans
.
gettext
import
ctypes
from
ctypes
import
c_char_p
,
c_int
,
c_size_t
,
c_void_p
import
ctypes.util
class
MagicException
(
Exception
):
def
__init__
(
self
,
message
):
super
(
MagicException
,
self
)
.
__init__
(
message
)
self
.
message
=
message
libmagic
=
None
dll
=
ctypes
.
util
.
find_library
(
'magic'
)
or
ctypes
.
util
.
find_library
(
'magic1'
)
or
ctypes
.
util
.
find_library
(
'cygmagic-1'
)
...
...
@@ -26,15 +35,31 @@ if dll:
libmagic
=
ctypes
.
CDLL
(
dll
)
if
not
libmagic
or
not
libmagic
.
_name
:
raise
ImportError
(
'failed to find libmagic. Check your installation'
)
magic_dlls
=
{
'darwin'
:
[
'/opt/local/lib/libmagic.dylib'
,
'/usr/local/lib/libmagic.dylib'
,
glob
.
glob
(
'/usr/local/Cellar/libmagic/*/lib/libmagic.dylib'
)],
'win32'
:
'magic1.dll'
,
'cygmagic-1.dll'
,
'linux'
:
[
'libmagic.so.1'
],
}
if
sys
.
platform
.
startswith
(
'linux'
):
platform
=
'linux'
else
:
platform
=
sys
.
platform
for
dll
in
magic_dlls
.
get
(
platform
,
[]):
try
:
libmagic
=
ctypes
.
CDLL
(
dll
)
break
except
OSError
:
pass
#Magic Flags from libmagic.so
MAGIC_CONTINUE
=
0x000020
MAGIC_CONTINUE
=
0x000020
MAGIC_COMPRESS
=
0x000004
MAGIC_NONE
=
0x000000
MAGIC_NONE
=
0x000000
MAGIC_MIME
=
0x000010
MAGIC_MIME_ENCODING
=
0x000400
MAGIC_MIME_ENCODING
=
0x000400
_instances
=
{}
...
...
@@ -52,7 +77,7 @@ def errorcheck(result, func, args):
else
:
return
result
# Declarations
magic_file
=
libmagic
.
magic_file
magic_file
.
restype
=
c_char_p
magic_file
.
argtypes
=
[
magic_t
,
c_char_p
]
...
...
@@ -110,23 +135,22 @@ class Magic:
magic_load
(
self
.
cookie
,
magic_file
)
def
get_file_type
(
self
,
data
):
# If given argument is a file load with magic_file
# If given argument is a file load with magic_file
# If given argument is a buffer load with magic_buffer
try
:
if
os
.
path
.
isfile
(
data
):
if
os
.
path
.
isfile
(
data
):
open
(
data
)
with
self
.
lock
:
return
magic_file
(
self
.
cookie
,
data
)
else
:
else
:
with
self
.
lock
:
if
type
(
data
)
==
str
and
str
!=
bytes
:
buf
=
data
.
encode
(
'utf-8'
,
errors
=
'replace'
)
return
magic_buffer
(
self
.
cookie
,
data
,
len
(
data
))
except
Exception
as
err
:
except
Magic
Exception
as
err
:
raise
(
_
(
"Can Not load file or buffer {}"
)
.
format
(
err
))
def
__del__
(
self
):
if
self
.
cookie
and
magic_close
:
magic_close
(
self
.
cookie
)
self
.
cookie
=
None
inary/operations/info.py
Dosyayı görüntüle @
9ed6a21c
...
...
@@ -10,7 +10,10 @@
# Please read the COPYING file.
#
import
os
import
inary
import
inary.context
as
ctx
import
inary.db
import
inary.data
...
...
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