Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.package
Commits
eb1cd142
Commit
eb1cd142
authored
Jun 11, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos.package: Minor style/pep changes
parent
cd600cda
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
slapos/package/distribution.py
slapos/package/distribution.py
+9
-4
slapos/package/test/test_distribution.py
slapos/package/test/test_distribution.py
+0
-2
No files found.
slapos/package/distribution.py
View file @
eb1cd142
...
@@ -196,15 +196,18 @@ class AptGet:
...
@@ -196,15 +196,18 @@ class AptGet:
def
updateSystem
(
self
,
caller
):
def
updateSystem
(
self
,
caller
):
""" Dist-Upgrade of system """
""" Dist-Upgrade of system """
self
.
updateRepository
(
caller
)
caller
([
'apt-get'
,
'dist-upgrade'
,
'-y'
],
stdout
=
None
)
caller
([
'apt-get'
,
'dist-upgrade'
,
'-y'
],
stdout
=
None
)
class
Zypper
:
class
Zypper
:
def
purgeRepository
(
self
,
caller
):
def
purgeRepository
(
self
,
caller
):
"""Remove all repositories"""
"""Remove all repositories"""
listing
,
err
=
caller
([
'zypper'
,
'lr'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
listing
,
err
=
caller
([
'zypper'
,
'lr'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
while
listing
.
count
(
'
\
n
'
)
>
2
:
while
listing
.
count
(
'
\
n
'
)
>
2
:
output
,
err
=
caller
([
'zypper'
,
'rr'
,
'1'
],
stdout
=
None
)
output
,
err
=
caller
([
'zypper'
,
'rr'
,
'1'
],
stdout
=
None
)
listing
,
err
=
caller
([
'zypper'
,
'lr'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
listing
,
err
=
caller
([
'zypper'
,
'lr'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
def
addRepository
(
self
,
caller
,
url
,
alias
):
def
addRepository
(
self
,
caller
,
url
,
alias
):
""" Add a repository """
""" Add a repository """
...
@@ -223,7 +226,8 @@ class Zypper:
...
@@ -223,7 +226,8 @@ class Zypper:
caller
([
'zypper'
,
'--gpg-auto-import-keys'
,
'in'
,
'-Dly'
],
stdout
=
None
)
caller
([
'zypper'
,
'--gpg-auto-import-keys'
,
'in'
,
'-Dly'
],
stdout
=
None
)
def
isUpgradable
(
self
,
caller
,
name
):
def
isUpgradable
(
self
,
caller
,
name
):
output
,
err
=
caller
([
'zypper'
,
'--gpg-auto-import-keys'
,
'up'
,
'-ly'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
output
,
err
=
caller
([
'zypper'
,
'--gpg-auto-import-keys'
,
'up'
,
'-ly'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
for
line
in
output
.
splitlines
():
for
line
in
output
.
splitlines
():
if
line
.
startswith
(
"'%s' is already installed."
%
name
):
if
line
.
startswith
(
"'%s' is already installed."
%
name
):
return
False
return
False
...
@@ -247,5 +251,6 @@ class Zypper:
...
@@ -247,5 +251,6 @@ class Zypper:
def
do_discover
():
def
do_discover
():
package_manager
=
PackageManager
()
package_manager
=
PackageManager
()
print
"The signature for your current system is: %s"
%
package_manager
.
getOSSignature
()
print
"The signature for your current system is: %s"
%
\
package_manager
.
getOSSignature
()
slapos/package/test/test_distribution.py
View file @
eb1cd142
...
@@ -130,7 +130,6 @@ class testPackageManager(unittest.TestCase):
...
@@ -130,7 +130,6 @@ class testPackageManager(unittest.TestCase):
return
dummy_handler
return
dummy_handler
package_manager
.
_getDistributionHandler
=
DummyCase
package_manager
.
_getDistributionHandler
=
DummyCase
self
.
assertEquals
(
package_manager
.
_getDistributionHandler
(),
dummy_handler
)
self
.
assertEquals
(
package_manager
.
_getDistributionHandler
(),
dummy_handler
)
self
.
assertEquals
(
dummy_handler
.
called
,
[])
self
.
assertEquals
(
dummy_handler
.
called
,
[])
return
package_manager
,
dummy_handler
return
package_manager
,
dummy_handler
...
@@ -150,7 +149,6 @@ class testPackageManager(unittest.TestCase):
...
@@ -150,7 +149,6 @@ class testPackageManager(unittest.TestCase):
package_manager
.
_addKey
(
"http://..."
,
"slapos"
)
package_manager
.
_addKey
(
"http://..."
,
"slapos"
)
self
.
assertEquals
(
handler
.
called
,
[
"addKey"
])
self
.
assertEquals
(
handler
.
called
,
[
"addKey"
])
def
testUpdateRepositoryAPI
(
self
):
def
testUpdateRepositoryAPI
(
self
):
package_manager
,
handler
=
self
.
_getPatchedPackageManagerForApiTest
()
package_manager
,
handler
=
self
.
_getPatchedPackageManagerForApiTest
()
package_manager
.
_updateRepository
()
package_manager
.
_updateRepository
()
...
...
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