Skip to content

Commit bc1eb2e

Browse files
authored
Merge branch 'master' into pyup-update-humanize-3.13.1-to-4.11.0
2 parents 1cec161 + bb0fc18 commit bc1eb2e

207 files changed

Lines changed: 8289 additions & 2640 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: furlongm
2+
patreon: furlongm

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ name: "Code Scanning - Action"
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main]
66
pull_request:
7-
branches: [master]
7+
branches: [main]
88

99
jobs:
1010
CodeQL-Build:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
- name: Initialize CodeQL
16-
uses: github/codeql-action/init@v2
16+
uses: github/codeql-action/init@v3
1717
- name: Autobuild
18-
uses: github/codeql-action/autobuild@v2
18+
uses: github/codeql-action/autobuild@v3
1919
- name: Perform CodeQL Analysis
20-
uses: github/codeql-action/analyze@v2
20+
uses: github/codeql-action/analyze@v3

.github/workflows/create-release-and-upload-assets.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
create-release:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14-
ref: master
14+
ref: main
1515
- name: git fetch --all
1616
run: |
1717
git fetch --all
@@ -29,18 +29,18 @@ jobs:
2929
run: |
3030
echo "${{ steps.create_release.outputs.upload_url }}" > upload_url.txt
3131
- name: Upload upload_url artifact
32-
uses: actions/upload-artifact@v1
32+
uses: actions/upload-artifact@v4
3333
with:
3434
name: upload_url.txt
3535
path: upload_url.txt
3636
update-version-and-changelog:
3737
needs: create-release
3838
runs-on: ubuntu-latest
3939
steps:
40-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v4
4141
with:
4242
fetch-depth: 0
43-
ref: master
43+
ref: main
4444
- name: git fetch --all
4545
run: |
4646
git fetch --all
@@ -62,7 +62,7 @@ jobs:
6262
echo "${{ github.ref }}" | cut -dv -f2 > VERSION.txt
6363
git add VERSION.txt
6464
git diff --quiet && git diff --staged --quiet || git commit -m "${COMMIT_MSG}"
65-
git push origin master
65+
git push origin main
6666
- name: Update debian changelog
6767
env:
6868
EMAIL: furlongm@gmail.com
@@ -72,7 +72,7 @@ jobs:
7272
skip-checks: true
7373
run: |
7474
gbp dch --new-version=$(cat VERSION.txt)-1 --release --distribution=stable --spawn-editor=never --commit --commit-msg="${COMMIT_MSG}"
75-
git push origin master
75+
git push origin main
7676
build-and-upload-deb-assets:
7777
needs: update-version-and-changelog
7878
runs-on: ubuntu-latest
@@ -88,10 +88,10 @@ jobs:
8888
run: |
8989
rm /bin/sh
9090
ln -sf /bin/bash /bin/sh
91-
- uses: actions/checkout@v3
91+
- uses: actions/checkout@v4
9292
with:
9393
fetch-depth: 0
94-
ref: master
94+
ref: main
9595
- name: git fetch --all
9696
run: |
9797
git config --global --add safe.directory /__w/patchman/patchman
@@ -101,7 +101,7 @@ jobs:
101101
export version=$(echo "${{ github.ref }}" | cut -dv -f2)
102102
echo "version=${version}" >> $GITHUB_ENV
103103
- name: Download upload_url artifact
104-
uses: actions/download-artifact@v1
104+
uses: actions/download-artifact@v4
105105
with:
106106
name: upload_url.txt
107107
path: /home/runner/work/patchman/patchman
@@ -126,7 +126,7 @@ jobs:
126126
git tag v${version}
127127
gbp buildpackage --git-upstream-tree=${{ github.ref }} -uc -us
128128
- name: Upload python3-patchman deb
129-
uses: actions/upload-release-asset@v1.0.1
129+
uses: actions/upload-release-asset@v1
130130
env:
131131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132132
with:
@@ -135,7 +135,7 @@ jobs:
135135
asset_path: ../${{ format('python3-patchman_{0}-1_all.deb', env.version) }}
136136
asset_content_type: application/vnd.debian.binary-package
137137
- name: Upload patchman-client deb
138-
uses: actions/upload-release-asset@v1.0.1
138+
uses: actions/upload-release-asset@v1
139139
env:
140140
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141141
with:
@@ -153,10 +153,10 @@ jobs:
153153
run: |
154154
dnf -y install epel-release
155155
dnf -y install rpm-build python3 python3-setuptools git
156-
- uses: actions/checkout@v3
156+
- uses: actions/checkout@v4
157157
with:
158158
fetch-depth: 0
159-
ref: master
159+
ref: main
160160
- name: git fetch --all
161161
run: |
162162
git config --global --add safe.directory /__w/patchman/patchman
@@ -166,7 +166,7 @@ jobs:
166166
export version=$(echo "${{ github.ref }}" | cut -dv -f2)
167167
echo "version=${version}" >> $GITHUB_ENV
168168
- name: Download upload_url artifact
169-
uses: actions/download-artifact@v1
169+
uses: actions/download-artifact@v4
170170
with:
171171
name: upload_url.txt
172172
path: /home/runner/work/patchman/patchman
@@ -180,7 +180,7 @@ jobs:
180180
python3 setup.py bdist_rpm --python=/usr/bin/python3
181181
rpmbuild -bb patchman-client.spec
182182
- name: Upload patchman rpm
183-
uses: actions/upload-release-asset@v1.0.1
183+
uses: actions/upload-release-asset@v1
184184
env:
185185
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186186
with:
@@ -189,7 +189,7 @@ jobs:
189189
asset_path: ${{ format('dist/patchman-{0}-1.noarch.rpm', env.version) }}
190190
asset_content_type: application/x-rpm
191191
- name: Upload patchman-client rpm
192-
uses: actions/upload-release-asset@v1.0.1
192+
uses: actions/upload-release-asset@v1
193193
env:
194194
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195195
with:
@@ -201,9 +201,9 @@ jobs:
201201
needs: update-version-and-changelog
202202
runs-on: ubuntu-latest
203203
steps:
204-
- uses: actions/checkout@v3
204+
- uses: actions/checkout@v4
205205
- name: Set up python
206-
uses: actions/setup-python@v4
206+
uses: actions/setup-python@v5
207207
with:
208208
python-version: '3.x'
209209
- name: Set version

.github/workflows/lint-and-test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ jobs:
1010
strategy:
1111
max-parallel: 5
1212
matrix:
13-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
13+
python-version: ['3.x']
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install --upgrade pip
22+
sudo apt update
23+
sudo apt -y install libxslt-dev libxml2-dev
24+
python -m pip install --upgrade pip setuptools
2325
pip install -r requirements.txt
2426
- name: Lint with flake8
2527
run: |
@@ -29,4 +31,6 @@ jobs:
2931
- name: Set secret key
3032
run: ./sbin/patchman-set-secret-key
3133
- name: Test with django
32-
run: ./manage.py test
34+
run: |
35+
pip install legacy-cgi
36+
./manage.py test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ tmp*
99
.svn
1010
.tox
1111
patchman.egg-info
12+
build
13+
dist
14+
run
15+
pyvenv.cfg
16+
.vscode
17+
.venv
18+
*.xml

INSTALL.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ apt -y install gcc libxml2-dev libxslt1-dev virtualenv python3-dev zlib1g-dev #
6363
dnf -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/rocky/alma)
6464
mkdir /srv/patchman
6565
cd /srv/patchman
66-
virtualenv .
67-
. bin/activate
66+
python3 -m venv .venv
67+
. .venv/bin/activate
6868
pip install --upgrade pip
6969
pip install patchman gunicorn whitenoise==3.3.1
7070
patchman-manage migrate
@@ -119,6 +119,28 @@ be configured:
119119
* STATIC_ROOT - should point to `/srv/patchman/run/static` if installing from
120120
source
121121

122+
## Patchman-client Settings
123+
124+
The client comes with a default configuration. This configuration will attempt to upload the reports to a server at *patchman.example.com*. This configuration needs to be updated to connect to your own patchman installation.
125+
126+
In `/etc/patchman/patchman-client.conf`, look for the following line(s):
127+
128+
```
129+
# Patchman server
130+
server=https://patchman.example.com
131+
132+
# Options to curl
133+
curl_options="--insecure --connect-timeout 60 --max-time 300"
134+
135+
...
136+
```
137+
* *server* needs to point the URL where your patchman server
138+
is running
139+
* *--insecure* in the curl_options tells the client to ignore certificates, if you set them up correctly and are using patchman with "https:/...", you could remove this flag to increase security
140+
141+
142+
143+
122144

123145
## Configure Database
124146

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ python3-requests
106106
python3-colorama
107107
python3-magic
108108
python3-humanize
109+
python3-yaml
109110
```
110111
111112
The server can optionally make use of celery to asynchronously process the

TODO

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
* allow sending updates from Red Hat / SuSE machines
2-
* web interface support for updating repos, finding updates
31
* add checkrestart-style options to see which services need restarting
4-
* CVE/OVAL apps
2+
* OVAL/OSCAP apps
53
* CA support (tinyca?)
6-
* native python client, using apt/yum/debian libraries
4+
* native python/go client, using apt/yum/debian libraries
75
* record the history of installed packages on a host
86
* also store package descriptions/tags/urls
97
* check for unused repos
108
* suggest names for repos with the same checksum
119
* helper script to change paths (e.g. /usr/lib/python3/dist-packages/patchman)
1210
* Dockerfile/Dockerimage
1311
* compressed reports
14-
* add cronjobs to built packages
15-
* install celery/rabbit/memcache with packages
12+
* add cronjobs to build packages
13+
* dnf5 support
14+
* proxy support
15+
* GLSA support
16+
* only use date for errata issue date?
17+
* parallelize package extraction
18+
* use django-tables2
19+
* autonaming for deb repos
20+
* associate repos with gentoo hosts
21+
* populate authenticated repos with package lists from hosts?

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.10
1+
3.0.19

arch/utils.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2025 Marcus Furlong <furlongm@gmail.com>
2+
#
3+
# This file is part of Patchman.
4+
#
5+
# Patchman is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, version 3 only.
8+
#
9+
# Patchman is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
16+
17+
from arch.models import PackageArchitecture, MachineArchitecture
18+
from patchman.signals import info_message
19+
20+
21+
def clean_package_architectures():
22+
""" Remove package architectures that are no longer in use
23+
"""
24+
parches = PackageArchitecture.objects.filter(package__isnull=True)
25+
plen = parches.count()
26+
if plen == 0:
27+
info_message.send(sender=None, text='No orphaned PackageArchitectures found.')
28+
else:
29+
info_message.send(sender=None, text=f'Removing {plen} orphaned PackageArchitectures')
30+
parches.delete()
31+
32+
33+
def clean_machine_architectures():
34+
""" Remove machine architectures that are no longer in use
35+
"""
36+
marches = MachineArchitecture.objects.filter(
37+
host__isnull=True,
38+
repository__isnull=True,
39+
)
40+
mlen = marches.count()
41+
if mlen == 0:
42+
info_message.send(sender=None, text='No orphaned MachineArchitectures found.')
43+
else:
44+
info_message.send(sender=None, text=f'Removing {mlen} orphaned MachineArchitectures')
45+
marches.delete()
46+
47+
48+
def clean_architectures():
49+
""" Remove architectures that are no longer in use
50+
"""
51+
clean_package_architectures()
52+
clean_machine_architectures()

0 commit comments

Comments
 (0)