Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
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
mediaserver
envsetup
Commits
ac0e95a5
Commit
ac0e95a5
authored
7 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Ignore packages with -generic in kernels listing.
parent
d5a336b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernels_cleaner.py
+5
-5
5 additions, 5 deletions
kernels_cleaner.py
with
5 additions
and
5 deletions
kernels_cleaner.py
+
5
−
5
View file @
ac0e95a5
...
@@ -32,10 +32,10 @@ def clean_kernels():
...
@@ -32,10 +32,10 @@ def clean_kernels():
log
(
RED
+
'
Failed to get sudo right.
'
+
DEFAULT
,
error
=
True
)
log
(
RED
+
'
Failed to get sudo right.
'
+
DEFAULT
,
error
=
True
)
return
1
return
1
# list installed kernels
# list installed kernels
p
=
subprocess
.
Popen
(
'
sudo dpkg --get-selections | grep linux
'
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
p
=
subprocess
.
Popen
(
'
sudo dpkg --get-selections
| grep -v -- -generic
| grep linux
'
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
out
,
err
=
p
.
communicate
()
out
,
err
=
p
.
communicate
()
out
=
str
(
out
,
'
utf-8
'
)
if
out
else
''
out
=
out
.
decode
(
'
utf-8
'
)
if
out
else
''
err
=
str
(
err
,
'
utf-8
'
)
if
err
else
''
err
=
err
.
decode
(
'
utf-8
'
)
if
err
else
''
if
p
.
returncode
!=
0
:
if
p
.
returncode
!=
0
:
log
(
RED
+
'
Failed to list kernels.
'
+
DEFAULT
+
'
\n
Out:
'
+
out
+
'
\n
Err:
'
+
err
,
error
=
True
)
log
(
RED
+
'
Failed to list kernels.
'
+
DEFAULT
+
'
\n
Out:
'
+
out
+
'
\n
Err:
'
+
err
,
error
=
True
)
return
1
return
1
...
@@ -55,8 +55,8 @@ def clean_kernels():
...
@@ -55,8 +55,8 @@ def clean_kernels():
# get current kernel
# get current kernel
p
=
subprocess
.
Popen
(
'
uname -a
'
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
p
=
subprocess
.
Popen
(
'
uname -a
'
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
out
,
err
=
p
.
communicate
()
out
,
err
=
p
.
communicate
()
out
=
str
(
out
,
'
utf-8
'
)
if
out
else
''
out
=
out
.
decode
(
'
utf-8
'
)
if
out
else
''
err
=
str
(
err
,
'
utf-8
'
)
if
err
else
''
err
=
err
.
decode
(
'
utf-8
'
)
if
err
else
''
if
p
.
returncode
!=
0
:
if
p
.
returncode
!=
0
:
log
(
RED
+
'
Failed to get current kernel.
'
+
DEFAULT
+
'
\n
Out:
'
+
out
+
'
\n
Err:
'
+
err
,
error
=
True
)
log
(
RED
+
'
Failed to get current kernel.
'
+
DEFAULT
+
'
\n
Out:
'
+
out
+
'
\n
Err:
'
+
err
,
error
=
True
)
return
1
return
1
...
...
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