Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Seblu
installsystems
Commits
9af0fed2
Commit
9af0fed2
authored
13 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
change list behaviour
parent
e473755d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/is
+25
-42
25 additions, 42 deletions
bin/is
installsystems/image.py
+13
-17
13 additions, 17 deletions
installsystems/image.py
installsystems/repository.py
+22
-15
22 additions, 15 deletions
installsystems/repository.py
with
60 additions
and
74 deletions
bin/is
+
25
−
42
View file @
9af0fed2
...
...
@@ -139,56 +139,39 @@ def c_list(parser, args):
'''
List images in repository or image content
'''
args
.
repo_filter
=
None
# List available repositories
if
len
(
args
.
list_args
)
==
0
:
# List available repository
repoman
=
load_repositories
(
args
)
arrow
(
'
#light##green#[Repos]#reset#
'
)
for
repo
in
repoman
:
out
(
repo
.
config
.
name
)
# <repo> | <image> | <image file>
repoman
.
show
(
verbose
=
args
.
detail
)
return
# list direct image or reposity content
elif
len
(
args
.
list_args
)
==
1
:
#
<
image file
>
if
istools
.
pathtype
(
args
.
list_args
[
0
])
==
'
file
'
and
\
os
.
path
.
isfile
(
args
.
list_args
[
0
]):
pkg
=
PackageImage
(
istools
.
abspath
(
args
.
list_args
[
0
])
)
arrow
(
'
#light##green#[Image]#reset# %s
'
%
pkg
.
name
)
pkg
.
show
(
verbose
=
args
.
verbose_list
,
list
=
True
)
#
list
image file
content
if
(
istools
.
pathtype
(
args
.
list_args
[
0
])
==
'
file
'
and
os
.
path
.
isfile
(
args
.
list_args
[
0
])
)
:
pkg
=
PackageImage
(
args
.
list_args
[
0
])
pkg
.
show
(
verbose
=
args
.
detail
)
# list repository content
else
:
args
.
repo_filter
=
args
.
list_args
[
0
]
repoman
=
load_repositories
(
args
)
# <repo>
if
len
(
repoman
)
!=
0
:
for
repo
in
repoman
:
arrow
(
'
#light##green#[Repo]#reset# %s
'
%
repo
.
config
.
name
)
repo
.
show
(
args
.
verbose_list
)
# <image>
else
:
args
.
repo_filter
=
None
args
.
image
=
args
.
list_args
[
0
]
args
.
image_version
=
None
# <repo> <image> | <image> <version>
for
repo
in
repoman
:
repo
.
show
(
args
.
detail
)
return
# list last image version
elif
len
(
args
.
list_args
)
==
2
:
# <repo> <image>
if
not
PackageImage
.
check_image_version
(
args
.
list_args
[
1
]):
args
.
repo_filter
=
args
.
list_args
[
0
]
args
.
image
=
args
.
list_args
[
1
]
args
.
image_version
=
None
# <image> <version>
else
:
args
.
image
=
args
.
list_args
[
0
]
args
.
image_version
=
args
.
list_args
[
1
]
# <repo> <image> <version>
args
.
repo_filter
=
args
.
list_args
[
0
]
args
.
image
=
args
.
list_args
[
1
]
args
.
image_version
=
None
# list specific image version
elif
len
(
args
.
list_args
)
==
3
:
args
.
repo_filter
=
args
.
list_args
[
0
]
args
.
image
=
args
.
list_args
[
1
]
args
.
image_version
=
args
.
list_args
[
2
]
if
hasattr
(
args
,
'
image
'
):
repoman
=
load_repositories
(
args
)
pkg
=
repoman
.
get
(
args
.
image
,
args
.
image_version
)
arrow
(
'
#light##green#[Image]#reset# %s
'
%
pkg
.
name
)
pkg
.
show
(
verbose
=
args
.
verbose_list
,
list
=
True
)
# display content of image accross a repositories
repoman
=
load_repositories
(
args
)
pkg
=
repoman
.
get
(
args
.
image
,
args
.
image_version
)
pkg
.
show
(
verbose
=
args
.
detail
)
def
c_cat
(
parser
,
args
):
'''
...
...
@@ -321,9 +304,9 @@ p_get.set_defaults(func=c_get)
# list command parser
p_list
=
subparsers
.
add_parser
(
"
list
"
,
help
=
c_list
.
__doc__
.
lower
())
p_list
.
add_argument
(
"
-l
"
,
action
=
"
store_true
"
,
dest
=
'
verbose_list
'
,
default
=
False
,
help
=
'
D
etailled list output
'
)
p_list
.
add_argument
(
"
list_args
"
,
nargs
=
"
*
"
,
help
=
"
Repo
o
r
image
to list
"
)
p_list
.
add_argument
(
"
-l
"
,
action
=
"
store_true
"
,
dest
=
'
detail
'
,
default
=
False
,
help
=
'
d
etailled list output
'
)
p_list
.
add_argument
(
"
list_args
"
,
nargs
=
"
*
"
,
help
=
"
list content
o
f
image
or repositories
"
)
p_list
.
set_defaults
(
func
=
c_list
)
# search command parser
...
...
This diff is collapsed.
Click to expand it.
installsystems/image.py
+
13
−
17
View file @
9af0fed2
...
...
@@ -417,30 +417,26 @@ class PackageImage(Image):
arrowlevel
(
-
1
)
return
desc
def
show
(
self
,
verbose
=
False
,
list
=
False
):
def
show
(
self
,
verbose
=
False
):
'''
Display image content
'''
out
(
'
Name : %s
'
%
self
.
name
)
out
(
'
Version : %s
'
%
self
.
version
)
out
(
'
Date : %s
'
%
time
.
asctime
(
time
.
gmtime
(
self
.
date
)))
out
(
'
#light##yellow#Name:#reset# %s
'
%
self
.
name
)
out
(
'
#light##yellow#Version:#reset# %s
'
%
self
.
version
)
out
(
'
#yellow#Date:#reset# %s
'
%
time
.
asctime
(
time
.
gmtime
(
self
.
date
)))
out
(
'
#yellow#Description:#reset# %s
'
%
self
.
description
)
out
(
'
#yellow#Author:#reset# %s
'
%
self
.
author
)
out
(
'
#yellow#MD5:#reset# %s
'
%
self
.
md5
)
if
verbose
:
out
(
'
Description : %s
'
%
self
.
description
)
out
(
'
Author : %s
'
%
self
.
author
)
out
(
'
MD5 : %s
'
%
self
.
md5
)
out
(
'
Payload :
'
)
payloads
=
self
.
payload
for
payload_name
in
payloads
:
payload
=
payloads
[
payload_name
]
out
(
'
Name : %s
'
%
payload_name
)
out
(
'
Date : %s
'
%
time
.
asctime
(
time
.
gmtime
(
payload
.
mtime
)))
out
(
'
Size : %s
'
%
(
istools
.
human_size
(
payload
.
size
)))
out
(
'
MD5 : %s
'
%
payload
.
md5
)
out
(
''
)
out
(
''
)
if
list
:
out
(
'
Content :
'
)
self
.
_tarball
.
list
(
verbose
)
out
(
'
#light##yellow#Payload:#reset# %s
'
%
payload_name
)
out
(
'
#yellow#Date:#reset# %s
'
%
time
.
asctime
(
time
.
gmtime
(
payload
.
mtime
)))
out
(
'
#yellow#Size:#reset# %s
'
%
(
istools
.
human_size
(
payload
.
size
)))
out
(
'
#yellow#MD5:#reset# %s
'
%
payload
.
md5
)
out
(
'
#light##yellow#Content:#reset#
'
)
self
.
_tarball
.
list
(
verbose
)
def
check
(
self
,
message
=
"
Check MD5
"
):
'''
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
22
−
15
View file @
9af0fed2
...
...
@@ -185,26 +185,22 @@ class Repository(object):
List images in repository
'''
images
=
self
.
db
.
ask
(
"
SELECT md5, name, version, date,
\
author, description, size FROM image
"
).
fetchall
()
author, description, size FROM image
ORDER BY name, version
"
).
fetchall
()
for
image_md5
,
image_name
,
image_version
,
image_date
,
image_author
,
\
image_description
,
image_size
in
images
:
out
(
'
Name : %s
'
%
image_name
)
out
(
'
Version : %s
'
%
image_version
)
out
(
'
Date : %s
'
%
time
.
asctime
(
time
.
gmtime
(
image_date
)))
for
(
image_md5
,
image_name
,
image_version
,
image_date
,
image_author
,
image_description
,
image_size
)
in
images
:
out
(
'
#light##yellow#%s #reset#v%s
'
%
(
image_name
,
image_version
))
if
verbose
:
out
(
'
Description : %s
'
%
image_description
)
out
(
'
Author :
%s
'
%
image_
author
)
out
(
'
MD5 :
%s
'
%
image_
md5
)
out
(
'
Payload :
'
)
out
(
'
#yellow#Date:#reset# %s
'
%
time
.
asctime
(
time
.
gmtime
(
image_date
))
)
out
(
'
#yellow#Description:#reset#
%s
'
%
image_
description
)
out
(
'
#yellow#Author:#reset#
%s
'
%
image_
author
)
out
(
'
#yellow#MD5:#reset# %s
'
%
image_md5
)
payloads
=
self
.
db
.
ask
(
"
SELECT md5, name, size FROM payload
\
WHERE image_md5 = ?
"
,
(
image_md5
,)).
fetchall
()
for
payload_md5
,
payload_name
,
payload_size
in
payloads
:
out
(
'
Name : %s
'
%
payload_name
)
out
(
'
Size : %s
'
%
(
istools
.
human_size
(
payload_size
)))
out
(
'
MD5 : %s
'
%
payload_md5
)
out
(
''
)
out
(
''
)
out
(
'
#light##yellow#Payload:#reset# %s
'
%
payload_name
)
out
(
'
#yellow#Size:#reset# %s
'
%
(
istools
.
human_size
(
payload_size
)))
out
(
'
#yellow#MD5:#reset# %s
'
%
payload_md5
)
def
_remove_file
(
self
,
filename
):
'''
...
...
@@ -534,3 +530,14 @@ class RepositoryManager(object):
if
repo
.
has
(
name
,
version
):
return
repo
.
get
(
name
,
version
)
raise
Exception
(
"
Unable to find %s v%s
"
%
(
name
,
version
))
def
show
(
self
,
verbose
=
False
):
'''
Show repository inside manager
'''
for
repo
in
self
.
repos
:
repo
.
config
.
name
s
=
"
#light##blue#%s#reset#
"
%
repo
.
config
.
name
if
verbose
:
s
+=
'
(%s)
'
%
repo
.
config
.
path
out
(
s
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment