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
3c722d3a
Kaydet (Commit)
3c722d3a
authored
Eki 06, 2019
tarafından
Suleyman Poyraz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Appearance arrangements.
üst
4ad43614
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
30 deletions
+39
-30
index.py
inary/cli/index.py
+3
-0
index.py
inary/data/index.py
+36
-30
No files found.
inary/cli/index.py
Dosyayı görüntüle @
3c722d3a
...
...
@@ -22,6 +22,7 @@ _ = __trans.gettext
import
inary.cli.command
as
command
import
inary.context
as
ctx
import
inary.data.index
as
index
import
inary.util
as
util
usage
=
_
(
"""Index INARY files in a given directory
...
...
@@ -87,7 +88,9 @@ class Index(command.Command, metaclass=command.autocommand):
for
type_str
in
ctx
.
get_option
(
"compression_types"
)
.
split
(
","
):
compression
|=
ctypes
.
get
(
type_str
,
0
)
util
.
xterm_title
(
_
(
"Taking inary repo index."
))
index
.
index
(
self
.
args
or
[
"."
],
ctx
.
get_option
(
'output'
),
skip_sources
=
ctx
.
get_option
(
'skip_sources'
),
skip_signing
=
ctx
.
get_option
(
'skip_signing'
),
compression
=
compression
)
util
.
xterm_title_reset
()
inary/data/index.py
Dosyayı görüntüle @
3c722d3a
...
...
@@ -91,19 +91,21 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
specs
=
[]
deltas
=
{}
ctx
.
ui
.
info
(
_
(
"* Generating index tree...
\n
"
),
color
=
"cyan"
)
pkgs_sorted
=
False
for
fn
in
os
.
walk
(
repo_uri
)
.
__next__
()[
2
]:
if
fn
.
endswith
(
ctx
.
const
.
delta_package_suffix
)
or
fn
.
endswith
(
ctx
.
const
.
package_suffix
):
pkgpath
=
os
.
path
.
join
(
repo_uri
,
util
.
parse_package_dir_path
(
fn
))
if
not
os
.
path
.
isdir
(
pkgpath
):
os
.
makedirs
(
pkgpath
)
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
(
_
(
'
Sorting:
\"
{}
\"
'
)
.
format
(
fn
)),
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
_
(
' ->
Sorting:
\"
{}
\"
'
)
.
format
(
fn
)),
noln
=
False
if
ctx
.
config
.
get_option
(
"verbose"
)
else
True
)
shutil
.
copy2
(
os
.
path
.
join
(
repo_uri
,
fn
),
pkgpath
)
os
.
remove
(
os
.
path
.
join
(
repo_uri
,
fn
))
pkgs_sorted
=
True
if
pkgs_sorted
:
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
''
)
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
util
.
colorize
(
_
(
' * Sorted:
\"
{}
\"
'
)
.
format
(
fn
),
color
=
"green"
))
)
for
root
,
dirs
,
files
in
os
.
walk
(
repo_uri
):
# Filter hidden directories
...
...
@@ -132,13 +134,22 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
# Create a process pool, as many processes as the number of CPUs we
# have
try
:
obsoletes_list
=
list
(
map
(
str
,
self
.
distribution
.
obsoletes
))
except
AttributeError
:
obsoletes_list
=
[]
if
obsoletes_list
:
ctx
.
ui
.
info
(
_
(
" * Added obsoleted packages: [ {} ]"
.
format
(
obsoletes_list
)),
color
=
"blue"
,
noln
=
False
)
pool
=
multiprocessing
.
Pool
()
# Before calling pool.map check if list is empty or not: python#12157
if
specs
:
ctx
.
ui
.
info
(
_
(
" * Adding source packages: "
),
color
=
"blue"
,
noln
=
False
)
try
:
# Add source packages to index using a process pool
self
.
specs
=
pool
.
map
(
add_spec
,
specs
)
ctx
.
ui
.
info
(
"
\n
"
)
except
:
# If an exception occurs (like a keyboard interrupt),
# immediately terminate worker processes and propagate
...
...
@@ -149,11 +160,6 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
ctx
.
ui
.
info
(
""
)
raise
try
:
obsoletes_list
=
list
(
map
(
str
,
self
.
distribution
.
obsoletes
))
except
AttributeError
:
obsoletes_list
=
[]
latest_packages
=
[]
for
pkg
in
util
.
filter_latest_packages
(
packages
):
...
...
@@ -179,8 +185,9 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
except
KeyError
:
sorted_pkgs
[
key
]
=
[
pkg
]
self
.
packages
=
[]
ctx
.
ui
.
info
(
_
(
" * Adding binary packages: "
),
color
=
"blue"
,
noln
=
False
)
for
key
,
pkgs
in
sorted
(
sorted_pkgs
.
items
()):
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
(
_
(
"
Adding packages from directory
\"
{}
\"
... "
.
format
(
key
))),
noln
=
True
)
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
_
(
" ->
Adding packages from directory
\"
{}
\"
... "
.
format
(
key
))),
noln
=
True
)
try
:
# Add binary packages to index using a process pool
self
.
packages
.
extend
(
pool
.
map
(
add_package
,
pkgs
))
...
...
@@ -189,10 +196,9 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
pool
.
join
()
ctx
.
ui
.
info
(
""
)
raise
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
(
_
(
"Adding packages from directory
\"
{}
\"
... done."
.
format
(
key
))),
noln
=
False
)
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
_
(
" * Adding packages from directory
\"
{}
\"
... done."
.
format
(
key
))),
color
=
"green"
,
noln
=
False
)
ctx
.
ui
.
info
(
_
(
"* Writing index file."
),
color
=
"blue"
)
ctx
.
ui
.
info
(
""
)
pool
.
close
()
pool
.
join
()
...
...
@@ -201,7 +207,7 @@ def add_package(params):
try
:
path
,
deltas
,
repo_uri
=
params
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
(
_
(
'Adding package to index:
\"
{}
\"
'
)
.
format
(
os
.
path
.
basename
(
path
))),
noln
=
True
)
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
_
(
' -> Adding package to index:
\"
{}
\"
'
)
.
format
(
os
.
path
.
basename
(
path
))),
noln
=
True
)
package
=
inary
.
package
.
Package
(
path
)
md
=
package
.
get_metadata
()
...
...
@@ -216,7 +222,7 @@ def add_package(params):
errs
=
md
.
errors
()
if
md
.
errors
():
ctx
.
ui
.
info
(
""
)
ctx
.
ui
.
error
(
_
(
'Package
\"
{}
\"
: metadata corrupt, skipping...'
)
.
format
(
md
.
package
.
name
))
ctx
.
ui
.
error
(
_
(
'
*
Package
\"
{}
\"
: metadata corrupt, skipping...'
)
.
format
(
md
.
package
.
name
))
ctx
.
ui
.
error
(
str
(
*
errs
))
else
:
# No need to carry these with index (#3965)
...
...
@@ -262,32 +268,32 @@ def add_package(params):
def
add_groups
(
path
):
ctx
.
ui
.
info
(
_
(
'
Adding groups.xml
to index'
))
ctx
.
ui
.
info
(
_
(
'
* Adding
\"
groups.xml
\"
to index'
))
groups_xml
=
group
.
Groups
()
groups_xml
.
read
(
path
)
return
groups_xml
.
groups
def
add_components
(
path
):
ctx
.
ui
.
info
(
_
(
'Adding
\"
components.xml
\"
to index'
))
ctx
.
ui
.
info
(
_
(
'
*
Adding
\"
components.xml
\"
to index'
))
components_xml
=
component
.
Components
()
components_xml
.
read
(
path
)
#
try:
return
components_xml
.
components
#
except:
# raise Error(_('
Component in {} is corrupt').format(path))
# ctx.ui.error(str(Error(*errs)
))
try
:
return
components_xml
.
components
except
:
ctx
.
ui
.
error
(
_
(
' *
Component in {} is corrupt'
)
.
format
(
path
))
ctx
.
ui
.
error
(
str
(
*
errs
))
def
add_distro
(
path
):
ctx
.
ui
.
info
(
_
(
'Adding
\"
distribution.xml
\"
to index'
))
ctx
.
ui
.
info
(
_
(
'
*
Adding
\"
distribution.xml
\"
to index'
))
distro
=
component
.
Distribution
()
#
try:
distro
.
read
(
path
)
return
distro
#
except:
# raise Error(_('
Distribution in {} is corrupt').format(path))
# ctx.ui.error(str(Error(*errs)
))
try
:
distro
.
read
(
path
)
return
distro
except
:
ctx
.
ui
.
error
(
_
(
' *
Distribution in {} is corrupt'
)
.
format
(
path
))
ctx
.
ui
.
error
(
str
(
*
errs
))
def
add_spec
(
params
):
...
...
@@ -302,7 +308,7 @@ def add_spec(params):
else
:
sf
.
source
.
sourceURI
=
util
.
removepathprefix
(
repo_uri
,
path
)
ctx
.
ui
.
info
(
"
%-80.80
s
\r
"
%
(
_
(
'
Adding source to index:
\"
{}
\"
'
)
.
format
(
path
)),
ctx
.
ui
.
info
(
"
{:80.80}
\r
"
.
format
(
_
(
' ->
Adding source to index:
\"
{}
\"
'
)
.
format
(
path
)),
noln
=
False
if
ctx
.
config
.
get_option
(
"verbose"
)
else
True
)
return
sf
...
...
@@ -322,9 +328,9 @@ def index(dirs=None, output='inary-index.xml',
dirs
=
[
'.'
]
for
repo_dir
in
dirs
:
repo_dir
=
str
(
repo_dir
)
ctx
.
ui
.
info
(
_
(
'Building index of Inary files under
\"
{}
\"
'
)
.
format
(
repo_dir
))
ctx
.
ui
.
info
(
_
(
'Building index of Inary files under
\"
{}
\"
\n
'
)
.
format
(
repo_dir
))
index
.
index
(
repo_dir
,
skip_sources
)
sign
=
None
if
skip_signing
else
inary
.
file
.
File
.
detached
index
.
write
(
output
,
sha1sum
=
True
,
compress
=
compression
,
sign
=
sign
)
ctx
.
ui
.
info
(
_
(
'
Index file written.'
)
)
ctx
.
ui
.
info
(
_
(
'
* Index file written.'
),
color
=
"green"
)
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