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
77a4826a
Commit
77a4826a
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
list only last version of one image by repo by default
parent
86173182
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/is
+4
-2
4 additions, 2 deletions
bin/is
completion/bash/is
+1
-1
1 addition, 1 deletion
completion/bash/is
installsystems/repository.py
+14
-3
14 additions, 3 deletions
installsystems/repository.py
with
19 additions
and
6 deletions
bin/is
+
4
−
2
View file @
77a4826a
...
...
@@ -257,7 +257,7 @@ def c_list(parser, args):
'''
repoman
=
load_repositories
(
args
)
for
pattern
in
args
.
image
:
repoman
.
show_images
(
pattern
,
o_long
=
args
.
long
,
o_json
=
args
.
json
,
repoman
.
show_images
(
pattern
,
all_version
=
args
.
all_version
,
o_long
=
args
.
long
,
o_json
=
args
.
json
,
o_md5
=
args
.
md5
,
o_date
=
args
.
date
,
o_author
=
args
.
author
,
o_size
=
args
.
size
,
o_url
=
args
.
url
,
o_description
=
args
.
description
)
...
...
@@ -505,7 +505,9 @@ p_install.set_defaults(func=c_install, subparser=p_install)
# list command parser
p_list
=
subparsers
.
add_parser
(
"
list
"
,
help
=
c_list
.
__doc__
.
lower
())
p_list
.
add_argument
(
"
-a
"
,
"
--author
"
,
action
=
"
store_true
"
,
default
=
False
,
p_list
.
add_argument
(
"
-a
"
,
"
--all-version
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
list all versions of the same image
"
)
p_list
.
add_argument
(
"
-A
"
,
"
--author
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
display image author
"
)
p_list
.
add_argument
(
"
-d
"
,
"
--date
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
"
display image date
"
)
...
...
This diff is collapsed.
Click to expand it.
completion/bash/is
+
1
−
1
View file @
77a4826a
...
...
@@ -127,7 +127,7 @@ _is() {
(( args > 2 )) && _filedir
;;
list)
[[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -a --author -u --url -D --description --no-sync' && return 0
[[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -a
--all-version -A
--author -u --url -D --description --no-sync' && return 0
_remote_image
;;
move)
...
...
This diff is collapsed.
Click to expand it.
installsystems/repository.py
+
14
−
3
View file @
77a4826a
...
...
@@ -595,7 +595,7 @@ class RepositoryManager(object):
'''
return
[
r
.
config
.
name
for
r
in
self
.
repos
if
r
.
config
.
offline
]
def
images
(
self
,
pattern
):
def
images
(
self
,
pattern
,
all_version
=
True
):
'''
Return a list of available images
'''
...
...
@@ -609,6 +609,17 @@ class RepositoryManager(object):
for
k
in
images
.
keys
():
if
not
fnmatch
.
fnmatch
(
k
,
pattern
):
del
images
[
k
]
# filter multiple versions
if
not
all_version
:
for
repo
in
set
((
images
[
i
][
"
repo
"
]
for
i
in
images
)):
for
img
in
set
((
images
[
i
][
"
name
"
]
for
i
in
images
if
images
[
i
][
"
repo
"
]
==
repo
)):
versions
=
[
images
[
i
][
'
version
'
]
for
i
in
images
if
images
[
i
][
"
repo
"
]
==
repo
and
images
[
i
][
"
name
"
]
==
img
]
f
=
lambda
x
,
y
:
x
if
istools
.
compare_versions
(
x
,
y
)
>
0
else
y
last
=
reduce
(
f
,
versions
)
versions
.
remove
(
last
)
for
rmv
in
versions
:
del
images
[
"
%s/%s:%s
"
%
(
repo
,
img
,
rmv
)]
return
images
def
get
(
self
,
name
,
version
=
None
,
best
=
False
):
...
...
@@ -671,7 +682,7 @@ class RepositoryManager(object):
s
+=
"
(%s)
"
%
repo
.
config
.
path
out
(
s
)
def
show_images
(
self
,
pattern
,
o_json
=
False
,
o_long
=
False
,
def
show_images
(
self
,
pattern
,
all_version
=
True
,
o_json
=
False
,
o_long
=
False
,
o_md5
=
False
,
o_date
=
False
,
o_author
=
False
,
o_size
=
False
,
o_url
=
False
,
o_description
=
False
):
'''
...
...
@@ -681,7 +692,7 @@ class RepositoryManager(object):
all images parameter can be given in arguments to displayed
'''
# get image list
images
=
self
.
images
(
pattern
)
images
=
self
.
images
(
pattern
,
all_version
)
# display result
if
o_json
:
s
=
json
.
dumps
(
images
)
...
...
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