Skip to content

Commit

Permalink
Make update also update the specfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Mar 30, 2021
1 parent cb78080 commit 2e740c7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
2 changes: 2 additions & 0 deletions obal/data/playbooks/update/metadata.obal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ variables:
commit:
help: When true, creates a git branch and commits the update changes to it.
action: store_true
template:
help: The template to use
45 changes: 43 additions & 2 deletions obal/data/playbooks/update/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
- git_annex_setup
- spec_file
tasks:
- name: Read changelog
changelog:
spec: "{{ spec_file_path }}"
register: changelog

- name: Determine source file from spec
shell: "spectool --list-files --all {{ spec_file_path }} | awk '{print $2}'"
args:
Expand All @@ -23,9 +28,18 @@
when:
- "'://' in item"

- name: 'Fetch sources'
- name: 'update spec file'
include_role:
name: update_spec_file

- name: 'update source files'
include_role:
name: fetch_sources
name: setup_sources

- name: Run spec update template
shell: "gem2rpm -o {{ spec_file_path }} -t {{ template }} {{ inventory_dir }}/{{ package_base_dir }}/{{ inventory_hostname }}/*.gem"
args:
chdir: "{{ inventory_dir }}"

- name: Determine new source file from spec
shell: "spectool --list-files --all {{ spec_file_path }} | awk '{print $2}'"
Expand All @@ -51,6 +65,33 @@
when:
- "'://' not in item"

- name: Add back changelog
lineinfile:
path: "{{ spec_file_path }}"
insertafter: "%changelog"
line: "{{ changelog.changelog }}"

- name: Check for updates
command: git status --porcelain
register: git_status
args:
chdir: "{{ inventory_dir }}"

- when: git_status.stdout
block:
- name: 'Bump release'
command: "rpmdev-bumpspec {{ spec_file_path | basename }} -c \"Update spec file\""
args:
chdir: "{{ spec_file_path | dirname }}"
changed_when: true
when: version is not defined

- name: 'Add changelog entry'
changelog:
spec: "{{ spec_file_path }}"
entry: "Release {{ version }}"
when: version is defined

- hosts:
- packages
gather_facts: false
Expand Down

0 comments on commit 2e740c7

Please sign in to comment.