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
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.package
Commits
eb6dd293
Commit
eb6dd293
authored
May 19, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos.package] Include support for keys (WIP)
Include API Support for download keys/gpg slapos.
parent
d10612bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
slapos/package/distribution.py
slapos/package/distribution.py
+22
-3
slapos/package/promise/core.py
slapos/package/promise/core.py
+8
-1
No files found.
slapos/package/distribution.py
View file @
eb6dd293
...
...
@@ -98,6 +98,10 @@ class PackageManager:
""" Add a repository """
return
self
.
_getDistribitionHandler
().
addRepository
(
self
.
_call
,
url
,
alias
)
def
_addKey
(
self
,
url
,
alias
):
""" Add a gpg or a key """
return
self
.
_getDistributionHandler
().
addKey
(
self
.
call
,
url
)
def
_updateRepository
(
self
):
""" Add a repository """
return
self
.
_getDistribitionHandler
().
updateRepository
(
self
.
_call
)
...
...
@@ -114,12 +118,14 @@ class PackageManager:
""" Dist-Upgrade of system """
return
self
.
_getDistribitionHandler
().
updateSystem
(
self
.
_call
)
def
update
(
self
,
repository_list
=
[],
package_list
=
[]):
def
update
(
self
,
repository_list
=
[],
package_list
=
[]
,
key_list
=
[]
):
""" Perform upgrade """
self
.
_purgeRepository
()
for
alias
,
url
in
repository_list
:
self
.
_addRepository
(
url
,
alias
)
self
.
_updateRepository
()
for
alias
,
url
in
key_list
:
self
.
_addKey
(
url
,
alias
)
if
len
(
package_list
):
self
.
_installSoftwareList
(
package_list
)
...
...
@@ -128,12 +134,14 @@ class AptGet:
source_list_path
=
"/etc/apt/sources.list"
source_list_d_path
=
"/etc/apt/sources.list.d"
trusted_gpg_d_path
=
"/etc/apt/trusted.gpg.d"
def
purgeRepository
(
self
,
caller
):
""" Remove all repositories """
# Aggressive removal
os
.
remove
(
self
.
source_list_path
)
open
(
"/etc/apt/sources.list"
,
"w+"
).
write
(
"# Removed all"
)
open
(
self
.
source_list_path
,
"w+"
).
write
(
"# Removed all"
)
for
file_path
in
glob
.
glob
(
"%s/*"
%
self
.
source_list_d_path
):
os
.
remove
(
file_path
)
...
...
@@ -146,6 +154,14 @@ class AptGet:
repos_file
.
write
(
prefix
+
url
)
repos_file
.
close
()
def
addKey
(
self
,
caller
,
url
,
alias
):
""" Download and add a gpg key """
gpg_path
=
open
(
"%s/%s.gpg"
%
self
.
trusted_gpg_d_path
,
alias
)
if
os
.
path
.
exists
(
gpg_path
):
# File already exists, skip
return
raise
NotImplementedError
(
"Download part is missing"
)
def
updateRepository
(
self
,
caller
):
""" Add a repository """
caller
([
'apt-get'
,
'update'
],
stdout
=
None
)
...
...
@@ -189,6 +205,10 @@ class Zypper:
base_command
.
extend
([
url
,
alias
])
output
,
err
=
caller
(
base_command
,
stdout
=
None
)
def
addKey
(
self
,
caller
,
url
,
alias
):
""" Add gpg or key """
raise
NotImplementedError
(
"Not implemented for this distribution"
)
def
updateRepository
(
self
,
caller
):
""" Add a repository """
caller
([
'zypper'
,
'--gpg-auto-import-keys'
,
'in'
,
'-Dly'
],
stdout
=
None
)
...
...
@@ -220,4 +240,3 @@ def do_discover():
package_manager
=
PackageManager
()
print
"The signature for your current system is: %s"
%
package_manager
.
getOSSignature
()
slapos/package/promise/core.py
View file @
eb6dd293
...
...
@@ -50,7 +50,14 @@ class Promise(BasePromise):
alias
,
url
=
repository
.
split
(
"="
)
repository_tuple_list
.
append
((
alias
.
strip
(),
url
.
strip
()))
self
.
update
(
repository_tuple_list
,
upgrade_goal
[
'filter-package-list'
])
key_tuple_list
=
[]
for
key
in
upgrade_goal
[
'key-list'
]:
alias
,
url
=
key
.
split
(
"="
)
key_tuple_list
.
append
((
alias
.
strip
(),
url
.
strip
()))
self
.
update
(
repository_tuple_list
,
upgrade_goal
[
'filter-package-list'
],
key_tuple_list
)
if
upgrade
and
boot
:
signature
.
update
(
reboot
=
today
,
upgrade
=
today
)
...
...
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