File tree 5 files changed +49
-25
lines changed
5 files changed +49
-25
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,13 @@ Run [rpmlint] on the current Copr project or Koji build
7
7
## Synopsis
8
8
9
9
``` yaml
10
- plans :
11
- import :
12
- url : https://github.com/packit/tmt-plans
13
- ref : main
14
- name : /plans/rpmlint
10
+ discover :
11
+ how : fmf
12
+ filter : " tag: rpmlint"
13
+ url : https://github.com/packit/tmt-plans
14
+ ref : main
15
+ execute :
16
+ how : tmt
15
17
` ` `
16
18
17
19
## Description
@@ -22,8 +24,9 @@ This plan simply runs the command
22
24
$ rpmlint ./*.rpm
23
25
```
24
26
25
- Currently, there is no support to pass in additional ` .rpmlintrc ` due to limitations of the [ ` tmt ` ] [ tmt-import ]
26
- interface. The ` rpm ` and ` srpm ` artifacts are taken from the testing-farm artifacts
27
+ The ` rpm ` and ` srpm ` artifacts are taken from the testing-farm artifacts. In order to pass a ` .rpmlintrc ` file, use the
28
+ [ ` prepare ` ] step of the plan to copy the file to ` TMT_PLAN_DATA ` . Only the ` rpmlintrc ` file that matches the spec file
29
+ is used.
27
30
28
31
::: note
29
32
@@ -39,11 +42,26 @@ No options available
39
42
40
43
- Rpmlint the upstream packit project
41
44
``` yaml
42
- plans :
43
- import :
44
- url : https://github.com/packit/tmt-plans
45
- ref : main
46
- name : /plans/rpmlint
45
+ discover :
46
+ how : fmf
47
+ filter : " tag: rpmlint"
48
+ url : https://github.com/packit/tmt-plans
49
+ ref : main
50
+ execute :
51
+ how : tmt
52
+ ` ` `
53
+ - Use ` rpmlintrc` file
54
+ ` ` ` yaml
55
+ prepare:
56
+ - how: shell
57
+ script: cp ./*.rpmlintrc $TMT_PLAN_DATA/
58
+ discover:
59
+ how: fmf
60
+ filter: "tag: rpmlint"
61
+ url: https://github.com/packit/tmt-plans
62
+ ref: main
63
+ execute:
64
+ how: tmt
47
65
` ` `
48
66
49
67
# # See Also
@@ -53,4 +71,4 @@ No options available
53
71
<!-- SPHINX-END -->
54
72
55
73
[rpmlint] : https://github.com/rpm-software-management/rpmlint
56
- [tmt-import ]: https://tmt.readthedocs.io/en/stable/spec/plans.html#import-plans
74
+ [`prepare` ] : https://tmt.readthedocs.io/en/stable/spec/plans.html#prepare
Original file line number Diff line number Diff line change @@ -3,16 +3,5 @@ summary: Run rpmlint on all rpms and spec file
3
3
description: |
4
4
Equivalent to zuul job running rpmlint
5
5
6
- prepare:
7
- - name: Get necessary packages
8
- how: install
9
- package:
10
- - rpmlint
11
- - tree
12
- - name: Copy rpmlint toml configuration file
13
- how: shell
14
- script: cp plans/rpmlint/packit.toml $TMT_PLAN_DATA/packit.toml
15
- # TODO: How to get the .rpmlintrc files?
16
-
17
6
discover+:
18
7
filter: "tag: rpmlint"
Original file line number Diff line number Diff line change 1
1
summary: Run rpmlint
2
2
tag: rpmlint
3
+ require:
4
+ - rpmlint
3
5
4
6
test+: rpmlint.sh
File renamed without changes.
Original file line number Diff line number Diff line change 5
5
rlJournalStart
6
6
rlPhaseStartSetup
7
7
rlRun " tmp=\$ (mktemp -d)" 0 " Create tmp directory"
8
+ rlRun " work_dir=$( pwd) " 0 " Save original work_dir"
8
9
rlRun " pushd $tmp "
9
10
rlRun " set -o pipefail"
10
11
rlIsCentOS && rlLogWarning " rpmlint on CentOS+Epel is outdated. Reported information might not be relevant"
11
12
rlPhaseEnd
12
13
13
14
rlPhaseStartTest
15
+ if [[ -f " $TMT_PLAN_DATA /rpmlint.toml" ]]; then
16
+ # A custom rpmlint toml file was provided. Use that instead of the local files
17
+ rlRun " config_file=$TMT_PLAN_DATA /rpmlint.toml" 0 " Use config file from plan data"
18
+ else
19
+ # TODO: Use packit.toml only in packit context
20
+ rlRun " config_file=$work_dir /tests/rpmlint/packit.toml" 0 " Use the provided packit config file"
21
+ fi
14
22
rlRun " rpm2cpio /var/share/test-artifacts/*.src.rpm | cpio -civ '*.spec'" 0 " Extract spec file from srpm"
15
23
rlRun " cp ./*.spec $TMT_TEST_DATA /" 0 " Expose spec file"
24
+ # Dummy loop over spec file to extract the file name
25
+ for spec_file in * .spec; do
26
+ # Extract the base name from the file name and save it in BASH_REMATCH
27
+ [[ $spec_file =~ (.* ).spec ]];
28
+ # Only use rpmlintrc file with the same name as the spec file
29
+ [[ -f " $TMT_PLAN_DATA /${BASH_REMATCH[1]} .rpmlintrc" ]] && rlRun " rc_file=$TMT_PLAN_DATA /${BASH_REMATCH[1]} .rpmlintrc" 0 " Use the rpmlintrc file of $spec_file "
30
+ done
16
31
# The spec rpmlint is already executed from the srpm
17
- rlIsCentOS || rlRun " rpmlint -c $TMT_PLAN_DATA /packit.toml /var/share/test-artifacts/*.rpm" 0 " Run rpmlint (non-CentOS)"
32
+ rlIsCentOS || rlRun " rpmlint -c $config_file ${rc_file : + " -r $rc_file " } /var/share/test-artifacts/*.rpm" 0 " Run rpmlint (non-CentOS)"
18
33
rlIsCentOS && rlRun " rpmlint /var/share/test-artifacts/*.rpm || true" 0 " Run rpmlint (CentOS)"
19
34
rlPhaseEnd
20
35
You can’t perform that action at this time.
0 commit comments