Skip to content

Commit

Permalink
Merge pull request #192 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 6.3.0
  • Loading branch information
andyone authored Sep 4, 2024
2 parents 0e62e40 + d936bd4 commit 578994c
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .docker/micro.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG REGISTRY="docker.io"

## BUILDER #####################################################################

FROM ${REGISTRY}/essentialkaos/golang:alpine3.18 as builder
FROM ${REGISTRY}/essentialkaos/golang:alpine3.20 as builder

WORKDIR /go/src/github.com/essentialkaos/perfecto

Expand All @@ -14,7 +14,7 @@ RUN make deps && make all

## FINAL IMAGE #################################################################

FROM ${REGISTRY}/essentialkaos/alpine:3.18
FROM ${REGISTRY}/essentialkaos/alpine:3.20

LABEL org.opencontainers.image.title="perfecto" \
org.opencontainers.image.description="Tool for checking perfectly written RPM specs" \
Expand Down
8 changes: 5 additions & 3 deletions .docker/ol8.docker
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ COPY --from=builder /go/src/github.com/essentialkaos/perfecto/perfecto /usr/bin/
RUN dnf -y -q install https://yum.kaos.st/kaos-repo-latest.el8.noarch.rpm && \
dnf -y -q install oracle-epel-release-el8 && \
dnf -y -q module disable "*" && \
dnf -y -q install @python36 && \
dnf -y -q install rpmlint && \
dnf -y -q install uv && \
uv tool install rpmlint --no-cache --no-progress && \
dnf -y -q remove uv && \
dnf clean all && \
rm -rf /var/cache/dnf /var/log/dnf.*
rm -rf /var/cache/dnf /var/log/dnf.* && \
ln -sf /root/.local/bin/rpmlint /usr/bin/rpmlint

COPY common/perfecto.toml /etc/xdg/rpmlint/perfecto.toml

Expand Down
7 changes: 5 additions & 2 deletions .docker/ol9.docker
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ COPY --from=builder /go/src/github.com/essentialkaos/perfecto/perfecto /usr/bin/
# hadolint ignore=DL3031,DL3041
RUN dnf -y -q install https://yum.kaos.st/kaos-repo-latest.el9.noarch.rpm && \
dnf -y -q install oracle-epel-release-el9 && \
dnf -y -q install --enablerepo=ol9_codeready_builder rpmlint && \
dnf -y -q install uv && \
uv tool install rpmlint --no-cache --no-progress && \
dnf -y -q remove uv && \
dnf clean all && \
rm -rf /var/cache/dnf /var/log/dnf.*
rm -rf /var/cache/dnf /var/log/dnf.* && \
ln -sf /root/.local/bin/rpmlint /usr/bin/rpmlint

COPY common/perfecto.toml /etc/xdg/rpmlint/perfecto.toml

Expand Down
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ updates:
target-branch: "develop"
schedule:
interval: "daily"
timezone: "Europe/London"
time: "03:00"
timezone: "Etc/UTC"
time: "07:00"
labels:
- "PR • MAINTENANCE"
assignees:
Expand All @@ -26,8 +26,8 @@ updates:
target-branch: "develop"
schedule:
interval: "daily"
timezone: "Europe/London"
time: "04:00"
timezone: "Etc/UTC"
time: "08:00"
labels:
- "PR • MAINTENANCE"
assignees:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI (Push)
name: CI

on:
workflow_call:
Expand All @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
go: [ '1.21.x', '1.22.x' ]
go: [ '1.22.x', '1.23.x' ]

steps:
- name: Checkout
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 3.0.2 using next command:
# This Makefile generated by GoMakeGen 3.1.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
Expand All @@ -11,6 +11,10 @@ ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

ifdef PROXY ## Force proxy usage for downloading dependencies (Flag)
export GOPROXY=https://proxy.golang.org/cached-only,direct
endif

COMPAT ?= 1.19
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)
Expand Down Expand Up @@ -117,6 +121,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-13s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 3.0.2\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 3.1.0\033[0m\n'

################################################################################
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You can find additional information about every _perfecto_ check in [project wik

#### From sources

Make sure you have a working Go 1.21+ workspace ([instructions](https://go.dev/doc/install)), then:
Make sure you have a working Go 1.22+ workspace ([instructions](https://go.dev/doc/install)), then:

```bash
go install github.com/essentialkaos/perfecto@latest
Expand Down Expand Up @@ -71,12 +71,12 @@ perfecto your.spec

Official container images with _perfecto_:

- [`ghcr.io/essentialkaos/perfecto:micro`](https://kaos.sh/p/perfecto)
- [`ghcr.io/essentialkaos/perfecto:ol8`](https://kaos.sh/p/perfecto)
- [`ghcr.io/essentialkaos/perfecto:ol9`](https://kaos.sh/p/perfecto)
- [`essentialkaos/perfecto:micro`](https://kaos.sh/d/perfecto)
- [`essentialkaos/perfecto:ol8`](https://kaos.sh/d/perfecto)
- [`essentialkaos/perfecto:ol9`](https://kaos.sh/d/perfecto)
- [`ghcr.io/essentialkaos/perfecto:micro`](https://kaos.sh/p/perfecto) (_without_ `rpmlint`)
- [`ghcr.io/essentialkaos/perfecto:ol8`](https://kaos.sh/p/perfecto) (_with_ `rpmlint`)
- [`ghcr.io/essentialkaos/perfecto:ol9`](https://kaos.sh/p/perfecto) (_with_ `rpmlint`)
- [`essentialkaos/perfecto:micro`](https://kaos.sh/d/perfecto) (_without_ `rpmlint`)
- [`essentialkaos/perfecto:ol8`](https://kaos.sh/d/perfecto) (_with_ `rpmlint`)
- [`essentialkaos/perfecto:ol9`](https://kaos.sh/d/perfecto) (_with_ `rpmlint`)

#### Using with Github Actions

Expand Down
12 changes: 6 additions & 6 deletions check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ package check
// ////////////////////////////////////////////////////////////////////////////////// //

import (
"slices"
"sort"
"strings"

"github.com/essentialkaos/ek/v12/sliceutil"
"github.com/essentialkaos/ek/v12/sortutil"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/system"
"github.com/essentialkaos/ek/v13/sortutil"
"github.com/essentialkaos/ek/v13/strutil"
"github.com/essentialkaos/ek/v13/system"

"github.com/essentialkaos/perfecto/spec"
)
Expand Down Expand Up @@ -175,7 +175,7 @@ func Check(s *spec.Spec, lint bool, linterConfig string, ignored []string) *Repo

checkers := getCheckers()

if lint && !sliceutil.Contains(ignored, RPMLINT_CHECK_ID) {
if lint && !slices.Contains(ignored, RPMLINT_CHECK_ID) {
alerts := Lint(s, linterConfig)
appendLinterAlerts(report, alerts)
}
Expand All @@ -187,7 +187,7 @@ func Check(s *spec.Spec, lint bool, linterConfig string, ignored []string) *Repo
continue
}

ignore := sliceutil.Contains(ignored, id)
ignore := slices.Contains(ignored, id)

for _, alert := range alerts {
if ignore || alert.Line.Ignore {
Expand Down
20 changes: 11 additions & 9 deletions check/checkers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ package check
import (
"fmt"
"regexp"
"slices"
"strings"
"time"

"github.com/essentialkaos/ek/v12/cache"
"github.com/essentialkaos/ek/v12/req"
"github.com/essentialkaos/ek/v12/sliceutil"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v13/cache"
"github.com/essentialkaos/ek/v13/cache/memory"
"github.com/essentialkaos/ek/v13/req"
"github.com/essentialkaos/ek/v13/strutil"

"github.com/essentialkaos/perfecto/spec"
)
Expand All @@ -33,7 +33,7 @@ type macro struct {

// ////////////////////////////////////////////////////////////////////////////////// //

var httpCheckCache *cache.Cache
var httpCheckCache cache.Cache

var pathMacroSlice = []macro{
{"/etc/init", "%{_initddir}"},
Expand Down Expand Up @@ -738,7 +738,9 @@ func checkURLForHTTPS(id string, s *spec.Spec) []Alert {
}

if httpCheckCache == nil {
httpCheckCache = cache.New(time.Hour, 0)
httpCheckCache, _ = memory.New(memory.Config{
DefaultExpiration: cache.HOUR,
})
}

var result []Alert
Expand Down Expand Up @@ -1121,7 +1123,7 @@ func containsMacro(line spec.Line, macro string) bool {

// containsField return true if line contains given field
func containsField(line spec.Line, value string) bool {
return sliceutil.Contains(strutil.Fields(line.Text), value)
return slices.Contains(strutil.Fields(line.Text), value)
}

// isComment return true if current line is commented
Expand All @@ -1143,7 +1145,7 @@ func isEmptyData(data []spec.Line) bool {
// containsArgs return true if section contains given args
func containsArgs(section *spec.Section, args ...string) bool {
for _, arg := range args {
if !sliceutil.Contains(section.Args, arg) {
if !slices.Contains(section.Args, arg) {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion check/checkers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"testing"

"github.com/essentialkaos/ek/v12/system"
"github.com/essentialkaos/ek/v13/system"

"github.com/essentialkaos/perfecto/spec"

Expand Down
4 changes: 2 additions & 2 deletions check/rpmlint.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"strconv"
"strings"

"github.com/essentialkaos/ek/v12/env"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v13/env"
"github.com/essentialkaos/ek/v13/strutil"

"github.com/essentialkaos/perfecto/spec"
)
Expand Down
34 changes: 17 additions & 17 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ import (
"fmt"
"os"
"os/exec"
"slices"
"strings"

"github.com/essentialkaos/ek/v12/fmtc"
"github.com/essentialkaos/ek/v12/mathutil"
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/sliceutil"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/support"
"github.com/essentialkaos/ek/v12/support/deps"
"github.com/essentialkaos/ek/v12/support/pkgs"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
"github.com/essentialkaos/ek/v12/usage/completion/fish"
"github.com/essentialkaos/ek/v12/usage/completion/zsh"
"github.com/essentialkaos/ek/v12/usage/man"
"github.com/essentialkaos/ek/v12/usage/update"
"github.com/essentialkaos/ek/v13/fmtc"
"github.com/essentialkaos/ek/v13/mathutil"
"github.com/essentialkaos/ek/v13/options"
"github.com/essentialkaos/ek/v13/strutil"
"github.com/essentialkaos/ek/v13/support"
"github.com/essentialkaos/ek/v13/support/deps"
"github.com/essentialkaos/ek/v13/support/pkgs"
"github.com/essentialkaos/ek/v13/terminal/tty"
"github.com/essentialkaos/ek/v13/usage"
"github.com/essentialkaos/ek/v13/usage/completion/bash"
"github.com/essentialkaos/ek/v13/usage/completion/fish"
"github.com/essentialkaos/ek/v13/usage/completion/zsh"
"github.com/essentialkaos/ek/v13/usage/man"
"github.com/essentialkaos/ek/v13/usage/update"

"github.com/essentialkaos/perfecto/check"
"github.com/essentialkaos/perfecto/spec"
Expand All @@ -40,7 +40,7 @@ import (
// App info
const (
APP = "perfecto"
VER = "6.2.1"
VER = "6.3.0"
DESC = "Tool for checking perfectly written RPM specs"
)

Expand Down Expand Up @@ -197,7 +197,7 @@ func process(files options.Arguments) {

format := getFormat(files)

if !sliceutil.Contains(formats, format) {
if !slices.Contains(formats, format) {
printErrorAndExit("Output format %q is not supported", format)
}

Expand Down
6 changes: 3 additions & 3 deletions cli/render/renderer_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ package render
import (
"fmt"

"github.com/essentialkaos/ek/v12/fmtc"
"github.com/essentialkaos/ek/v12/path"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v13/fmtc"
"github.com/essentialkaos/ek/v13/path"
"github.com/essentialkaos/ek/v13/strutil"

"github.com/essentialkaos/perfecto/check"
)
Expand Down
10 changes: 5 additions & 5 deletions cli/render/renderer_terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"strconv"
"strings"

"github.com/essentialkaos/ek/v12/fmtc"
"github.com/essentialkaos/ek/v12/fmtutil"
"github.com/essentialkaos/ek/v12/pager"
"github.com/essentialkaos/ek/v12/path"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v13/fmtc"
"github.com/essentialkaos/ek/v13/fmtutil"
"github.com/essentialkaos/ek/v13/pager"
"github.com/essentialkaos/ek/v13/path"
"github.com/essentialkaos/ek/v13/strutil"

"github.com/essentialkaos/perfecto/check"
)
Expand Down
16 changes: 8 additions & 8 deletions common/perfecto.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Summary: Tool for checking perfectly written RPM specs
Name: perfecto
Version: 6.2.1
Version: 6.3.0
Release: 0%{?dist}
Group: Development/Tools
License: Apache License, Version 2.0
Expand All @@ -22,9 +22,7 @@ Source100: checksum.sha512

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: golang >= 1.21

Requires: rpmlint
BuildRequires: golang >= 1.22

Provides: %{name} = %{version}-%{release}

Expand Down Expand Up @@ -59,9 +57,7 @@ rm -rf %{buildroot}
install -dm 755 %{buildroot}%{_bindir}
install -pm 755 %{name}/%{name} %{buildroot}%{_bindir}/

%if 0%{?rhel} >= 8
install -pDm 644 %{name}/common/perfecto.toml %{buildroot}%{_sysconfdir}/xdg/rpmlint/perfecto.toml
%endif

%clean
rm -rf %{buildroot}
Expand Down Expand Up @@ -100,13 +96,17 @@ fi
%defattr(-,root,root,-)
%doc LICENSE
%{_bindir}/%{name}
%if 0%{?rhel} >= 8
%{_sysconfdir}/xdg/rpmlint/perfecto.toml
%endif

################################################################################

%changelog
* Wed Sep 04 2024 Anton Novojilov <[email protected]> - 6.3.0-0
- ek package updated to v13
- Code refactoring
- Dependencies update
- rpmlint removed from dependencies

* Wed Jul 03 2024 Anton Novojilov <[email protected]> - 6.2.1-0
- Level changed for PF28 to notice

Expand Down
Loading

0 comments on commit 578994c

Please sign in to comment.