Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
f52a1c8f
Commit
f52a1c8f
authored
Aug 17, 2013
by
Mark Harrison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow installation of local packages with pacman
parent
58477207
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
library/packaging/pacman
+20
-4
No files found.
library/packaging/pacman
View file @
f52a1c8f
...
...
@@ -79,6 +79,7 @@ EXAMPLES = '''
import
json
import
shlex
import
os
import
re
import
sys
PACMAN_PATH
=
"/usr/bin/pacman"
...
...
@@ -130,15 +131,20 @@ def remove_packages(module, packages):
module
.
exit_json
(
changed
=
False
,
msg
=
"package(s) already absent"
)
def
install_packages
(
module
,
packages
):
def
install_packages
(
module
,
packages
,
package_files
):
install_c
=
0
for
package
in
packages
:
for
i
,
package
in
enumerate
(
packages
)
:
if
query_package
(
module
,
package
):
continue
rc
=
os
.
system
(
"pacman -S
%
s --noconfirm > /dev/null"
%
(
package
))
if
package_files
[
i
]:
params
=
'-U
%
s'
%
package_files
[
i
]
else
:
params
=
'-S
%
s'
%
package
rc
=
os
.
system
(
"pacman
%
s --noconfirm > /dev/null"
%
(
params
))
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"failed to install
%
s"
%
(
package
))
...
...
@@ -172,8 +178,18 @@ def main():
pkgs
=
p
[
"name"
]
.
split
(
","
)
pkg_files
=
[]
for
i
,
pkg
in
enumerate
(
pkgs
):
if
pkg
.
endswith
(
'.pkg.tar.xz'
):
# The package given is a filename, extract the raw pkg name from
# it and store the filename
pkg_files
.
append
(
pkg
)
pkgs
[
i
]
=
re
.
sub
(
'-[0-9].*$'
,
''
,
pkgs
[
i
]
.
split
(
'/'
)[
-
1
])
else
:
pkg_files
.
append
(
None
)
if
p
[
"state"
]
==
"installed"
:
install_packages
(
module
,
pkgs
)
install_packages
(
module
,
pkgs
,
pkg_files
)
elif
p
[
"state"
]
==
"absent"
:
remove_packages
(
module
,
pkgs
)
...
...
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