mirror of
https://github.com/kewlfft/ansible-aur.git
synced 2026-02-21 07:06:43 +03:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dec76ae77 | ||
|
|
4aa45133a6 | ||
|
|
0b6069083d | ||
|
|
7affd00193 | ||
|
|
8e6f0f49bd | ||
|
|
bb73f524ca | ||
|
|
62193e882c |
13
.github/workflows/galaxy.yml
vendored
13
.github/workflows/galaxy.yml
vendored
@@ -18,15 +18,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: collections/ansible_collections/kewlfft/aur
|
path: collections/ansible_collections/kewlfft/aur
|
||||||
|
|
||||||
|
- name: Debug workflow version
|
||||||
|
run: echo "=== RUNNING UPDATED WORKFLOW ==="
|
||||||
|
|
||||||
- name: Verify version in galaxy.yml matches release tag
|
- name: Verify version in galaxy.yml matches release tag
|
||||||
run: |
|
run: |
|
||||||
tag_version="${GITHUB_REF##*/}" # strip refs/tags/
|
tag_version="${GITHUB_REF##*/}" # e.g., v0.12.2
|
||||||
|
tag_version="${tag_version#v}" # strip leading 'v' if present
|
||||||
file_version=$(awk '/^version:/ {print $2}' galaxy.yml)
|
file_version=$(awk '/^version:/ {print $2}' galaxy.yml)
|
||||||
|
|
||||||
if [ "$file_version" != "$tag_version" ]; then
|
if [ "${GITHUB_EVENT_NAME}" != "workflow_dispatch" ] && [ "$file_version" != "$tag_version" ]; then
|
||||||
echo "❌ galaxy.yml version ($file_version) does not match tag ($tag_version)"
|
echo "❌ galaxy.yml version ($file_version) does not match tag ($tag_version)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "✅ Version check passed: $file_version"
|
||||||
|
|
||||||
- name: Build collection
|
- name: Build collection
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
kewlfft-aur-*.tar.gz
|
kewlfft-aur-*.tar.gz
|
||||||
*.swp
|
*.swp
|
||||||
|
*.log
|
||||||
|
job_logs.txt
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace: kewlfft
|
|||||||
name: aur
|
name: aur
|
||||||
|
|
||||||
# The version of the collection. Must be compatible with semantic versioning
|
# The version of the collection. Must be compatible with semantic versioning
|
||||||
version: 0.12.2
|
version: 0.13.1
|
||||||
|
|
||||||
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
||||||
readme: README.md
|
readme: README.md
|
||||||
|
|||||||
@@ -155,7 +155,9 @@ def check_packages(module, packages):
|
|||||||
"""
|
"""
|
||||||
Inform the user what would change if the module were run
|
Inform the user what would change if the module were run
|
||||||
"""
|
"""
|
||||||
would_be_changed = [package for package in packages if not package_installed(module, package)]
|
rc, stdout, stderr = module.run_command(['pacman', '-T'] + packages, check_rc=False)
|
||||||
|
missing = set(stdout.splitlines())
|
||||||
|
would_be_changed = [package for package in packages if package in missing]
|
||||||
diff = {'before': '', 'after': '\n'.join(package for package in would_be_changed if module._diff)}
|
diff = {'before': '', 'after': '\n'.join(package for package in would_be_changed if module._diff)}
|
||||||
|
|
||||||
if would_be_changed:
|
if would_be_changed:
|
||||||
@@ -166,10 +168,7 @@ def check_packages(module, packages):
|
|||||||
message = 'package would be installed'
|
message = 'package would be installed'
|
||||||
else:
|
else:
|
||||||
status = False
|
status = False
|
||||||
if len(packages) > 1:
|
message = 'all packages are already installed' if len(packages) > 1 else 'package is already installed'
|
||||||
message = 'all packages are already installed'
|
|
||||||
else:
|
|
||||||
message = 'package is already installed'
|
|
||||||
module.exit_json(changed=status, msg=message, diff=diff)
|
module.exit_json(changed=status, msg=message, diff=diff)
|
||||||
|
|
||||||
|
|
||||||
@@ -177,7 +176,9 @@ def check_packages_absent(module, packages):
|
|||||||
"""
|
"""
|
||||||
Inform the user what would change if the module were run with state=absent
|
Inform the user what would change if the module were run with state=absent
|
||||||
"""
|
"""
|
||||||
would_be_changed = [package for package in packages if package_installed(module, package)]
|
rc, stdout, stderr = module.run_command(['pacman', '-T'] + packages, check_rc=False)
|
||||||
|
missing = set(stdout.splitlines())
|
||||||
|
would_be_changed = [package for package in packages if package not in missing]
|
||||||
diff = {'before': '\n'.join(pkg for pkg in would_be_changed if module._diff), 'after': ''}
|
diff = {'before': '\n'.join(pkg for pkg in would_be_changed if module._diff), 'after': ''}
|
||||||
|
|
||||||
if would_be_changed:
|
if would_be_changed:
|
||||||
@@ -188,10 +189,7 @@ def check_packages_absent(module, packages):
|
|||||||
message = 'package would be removed'
|
message = 'package would be removed'
|
||||||
else:
|
else:
|
||||||
status = False
|
status = False
|
||||||
if len(packages) > 1:
|
message = 'all packages are already absent' if len(packages) > 1 else 'package is already absent'
|
||||||
message = 'all packages are already absent'
|
|
||||||
else:
|
|
||||||
message = 'package is already absent'
|
|
||||||
module.exit_json(changed=status, msg=message, diff=diff)
|
module.exit_json(changed=status, msg=message, diff=diff)
|
||||||
|
|
||||||
|
|
||||||
@@ -298,6 +296,9 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
|
|||||||
installed_pkgs = []
|
installed_pkgs = []
|
||||||
updated_pkgs = []
|
updated_pkgs = []
|
||||||
|
|
||||||
|
if use != 'makepkg' and not local_pkgbuild:
|
||||||
|
base_command = build_command_prefix(use, extra_args, aur_only=aur_only, update_cache=update_cache)
|
||||||
|
|
||||||
for package in packages:
|
for package in packages:
|
||||||
was_installed = package_installed(module, package)
|
was_installed = package_installed(module, package)
|
||||||
if state == 'present' and was_installed:
|
if state == 'present' and was_installed:
|
||||||
@@ -308,8 +309,7 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
|
|||||||
elif local_pkgbuild:
|
elif local_pkgbuild:
|
||||||
rc, out, err = install_local_package(module, package, use, extra_args, local_pkgbuild)
|
rc, out, err = install_local_package(module, package, use, extra_args, local_pkgbuild)
|
||||||
else:
|
else:
|
||||||
command = build_command_prefix(use, extra_args, aur_only=aur_only, update_cache=update_cache)
|
command = base_command + [package]
|
||||||
command.append(package)
|
|
||||||
rc, out, err = module.run_command(command, check_rc=True)
|
rc, out, err = module.run_command(command, check_rc=True)
|
||||||
|
|
||||||
changed_pkg = not (out == '' or 'up-to-date -- skipping' in out or 'nothing to do' in out.lower())
|
changed_pkg = not (out == '' or 'up-to-date -- skipping' in out or 'nothing to do' in out.lower())
|
||||||
@@ -350,14 +350,15 @@ def remove_packages(module, packages, use, extra_args):
|
|||||||
rc = 0
|
rc = 0
|
||||||
used_helper = use
|
used_helper = use
|
||||||
|
|
||||||
|
base_cmd, helper = base_remove_cmd(use)
|
||||||
|
used_helper = helper
|
||||||
|
if extra_args:
|
||||||
|
base_cmd += shlex.split(extra_args)
|
||||||
|
|
||||||
for package in packages:
|
for package in packages:
|
||||||
if not package_installed(module, package):
|
if not package_installed(module, package):
|
||||||
continue
|
continue
|
||||||
command, helper = base_remove_cmd(use)
|
command = base_cmd + [package]
|
||||||
used_helper = helper
|
|
||||||
if extra_args:
|
|
||||||
command += shlex.split(extra_args)
|
|
||||||
command.append(package)
|
|
||||||
rc, out, err = module.run_command(command, check_rc=True)
|
rc, out, err = module.run_command(command, check_rc=True)
|
||||||
changed_iter |= (rc == 0)
|
changed_iter |= (rc == 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user