Skip to content

Commit 5896e2b

Browse files
committed
Merge branch 'main' into 340_packaging_for_fedora
2 parents 0ecb7c2 + 0b2311d commit 5896e2b

File tree

206 files changed

+4257
-907
lines changed

Some content is hidden

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

206 files changed

+4257
-907
lines changed

.github/workflows/run-unit-tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ jobs:
4545
- name: Install python-ldap OS dependencies
4646
run: |
4747
sudo apt-get update
48-
sudo apt-get install -y libldap2-dev libsasl2-dev
48+
sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils
49+
50+
- name: Disable AppArmor for slapd
51+
run: |
52+
sudo ln -s /etc/apparmor.d/usr.sbin.slapd /etc/apparmor.d/disable/
53+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.slapd
4954
5055
- name: Install dependencies
5156
run: make dev envfile

CHANGELOG.rst

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
Release notes
22
=============
33

4-
### Version 5.3.1-dev (unreleased)
4+
### Version 5.5.0-dev
5+
6+
- Update ProductPackage "unknown" license during "Scan all Packages".
7+
Only "unknown" licenses are updated.
8+
Products with a is_locked configuration status are excluded.
9+
Inactive is_active=False products are excluded.
10+
https://github.com/aboutcode-org/dejacode/issues/388
11+
12+
### Version 5.4.2
13+
14+
- Migrate the LDAP testing from using mockldap to slapdtest.
15+
The mockldap and funcparserlib dependencies has been removed.
16+
https://github.com/aboutcode-org/dejacode/issues/394
17+
18+
### Version 5.4.1
19+
20+
- Upgrade Django to latest security release 5.2.7
21+
Also upgrade dependencies to latest releases.
22+
https://github.com/aboutcode-org/dejacode/pull/389
23+
24+
### Version 5.4.0
525

626
- Upgrade Python version to 3.13 and Django to 5.2.x
727
https://github.com/aboutcode-org/dejacode/pull/315
@@ -42,6 +62,26 @@ Release notes
4262
* `/products/{uuid}/imports/`
4363
https://github.com/aboutcode-org/dejacode/issues/273
4464

65+
- Add GitHub workflow Request integration.
66+
Documentation: https://dejacode.readthedocs.io/en/latest/integrations-github.html
67+
https://github.com/aboutcode-org/dejacode/issues/349
68+
69+
- Add GitLab workflow Request integration.
70+
Documentation: https://dejacode.readthedocs.io/en/latest/integrations-gitlab.html
71+
https://github.com/aboutcode-org/dejacode/issues/346
72+
73+
- Add Jira workflow Request integration.
74+
Documentation: https://dejacode.readthedocs.io/en/latest/integrations-jira.html
75+
https://github.com/aboutcode-org/dejacode/issues/350
76+
77+
- Add Forgejo workflow Request integration.
78+
Documentation: https://dejacode.readthedocs.io/en/latest/integrations-forgejo.html
79+
https://github.com/aboutcode-org/dejacode/issues/347
80+
81+
- Add SourceHut workflow Request integration.
82+
Documentation: https://dejacode.readthedocs.io/en/latest/integrations-sourcehut.html
83+
https://github.com/aboutcode-org/dejacode/issues/348
84+
4585
### Version 5.3.0
4686

4787
- Rename ProductDependency is_resolved to is_pinned.

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ RUN apt-get update \
3636
build-essential \
3737
libldap2-dev \
3838
libsasl2-dev \
39+
slapd \
40+
ldap-utils \
3941
libpq5 \
4042
git \
4143
wait-for-it \
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.4 on 2025-07-30 13:00
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('component_catalog', '0011_alter_component_owner'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='component',
15+
name='children',
16+
field=models.ManyToManyField(through='component_catalog.Subcomponent', through_fields=('parent', 'child'), to='component_catalog.component'),
17+
),
18+
]

component_catalog/models.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,19 +2630,28 @@ def update_from_purldb(self, user):
26302630
)
26312631
return updated_fields
26322632

2633-
def update_from_scan(self, user):
2634-
scancodeio = ScanCodeIO(self.dataspace)
2633+
def update_from_scan(self, user, update_products=False):
2634+
package = self
2635+
dataspace = self.dataspace
2636+
scancodeio = ScanCodeIO(dataspace)
2637+
26352638
can_update_from_scan = all(
26362639
[
2637-
self.dataspace.enable_package_scanning,
2638-
self.dataspace.update_packages_from_scan,
2640+
dataspace.enable_package_scanning,
2641+
dataspace.update_packages_from_scan,
26392642
scancodeio.is_configured(),
26402643
]
26412644
)
2645+
if not can_update_from_scan:
2646+
return
2647+
2648+
updated_fields = scancodeio.update_from_scan(package=package, user=user)
26422649

2643-
if can_update_from_scan:
2644-
updated_fields = scancodeio.update_from_scan(package=self, user=user)
2645-
return updated_fields
2650+
if update_products:
2651+
if "declared_license_expression" in updated_fields:
2652+
package.productpackages.update_license_unknown()
2653+
2654+
return updated_fields
26462655

26472656
def get_related_packages_qs(self):
26482657
"""

component_catalog/tests/test_models.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,22 +1769,33 @@ def test_package_model_create_from_url_enable_purldb_access(
17691769

17701770
@mock.patch("dejacode_toolkit.scancodeio.ScanCodeIO.is_configured")
17711771
@mock.patch("dejacode_toolkit.scancodeio.ScanCodeIO.update_from_scan")
1772-
def test_package_model_update_from_scan(self, mock_update_from_scan, mock_is_configured):
1772+
def test_package_model_update_from_scan(self, mock_scio_update_from_scan, mock_is_configured):
17731773
mock_is_configured.return_value = True
1774-
package1 = make_package(self.dataspace)
1774+
package1 = make_package(self.dataspace, declared_license_expression="mit")
1775+
product1 = make_product(self.dataspace, inventory=[package1])
1776+
1777+
pp1 = product1.productpackages.get()
1778+
self.assertEqual("", pp1.license_expression)
1779+
pp1.update(license_expression="unknown")
17751780

17761781
results = package1.update_from_scan(user=self.user)
1777-
mock_update_from_scan.assert_not_called()
1782+
mock_scio_update_from_scan.assert_not_called()
17781783
self.assertIsNone(results)
17791784

17801785
self.dataspace.enable_package_scanning = True
17811786
self.dataspace.update_packages_from_scan = True
17821787
self.dataspace.save()
17831788

1784-
mock_update_from_scan.return_value = ["updated_field"]
1785-
results = package1.update_from_scan(user=self.user)
1786-
mock_update_from_scan.assert_called()
1787-
self.assertEqual(["updated_field"], results)
1789+
mock_scio_update_from_scan.return_value = ["declared_license_expression"]
1790+
results = package1.update_from_scan(user=self.user, update_products=False)
1791+
mock_scio_update_from_scan.assert_called()
1792+
self.assertEqual(["declared_license_expression"], results)
1793+
pp1.refresh_from_db()
1794+
self.assertEqual("unknown", pp1.license_expression)
1795+
1796+
results = package1.update_from_scan(user=self.user, update_products=True)
1797+
pp1.refresh_from_db()
1798+
self.assertEqual("mit", pp1.license_expression)
17881799

17891800
def test_package_model_get_url_methods(self):
17901801
package = Package(

component_catalog/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ def send_scan_notification(request, key):
17611761
run = json_data.get("run")
17621762
scan_status = run.get("status")
17631763
if scan_status.lower() == "success":
1764-
updated_fields = package.update_from_scan(user)
1764+
updated_fields = package.update_from_scan(user, update_products=True)
17651765

17661766
if updated_fields:
17671767
description = (

dejacode/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import git
1616

17-
VERSION = "5.3.1-dev"
17+
VERSION = "5.4.1"
1818

1919
PROJECT_DIR = Path(__file__).resolve().parent
2020
ROOT_DIR = PROJECT_DIR.parent

dejacode/static/css/dejacode_bootstrap.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,9 @@ body.signup-form .nav-link.active {
717717
body.signup-form label {
718718
display: none;
719719
}
720+
body.signup-form label.altcha-label {
721+
display: initial !important;
722+
}
720723
body.signup-form #div_id_updates_email_notification label {
721724
display: block;
722725
margin-bottom: 0!important;

dejacode_toolkit/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from os import getenv
1111

1212
from django.conf import settings
13-
from django.core.exceptions import ObjectDoesNotExist
1413

1514
import requests
1615

@@ -53,11 +52,7 @@ def __init__(self, dataspace):
5352
self.basic_auth_user = None
5453
self.basic_auth_password = None
5554

56-
try:
57-
dataspace_configuration = dataspace.configuration
58-
except ObjectDoesNotExist:
59-
dataspace_configuration = None
60-
55+
dataspace_configuration = dataspace.get_configuration()
6156
# Take the integration settings from the Dataspace when defined
6257
if dataspace_configuration:
6358
self.service_url = getattr(dataspace_configuration, self.url_field_name)

0 commit comments

Comments
 (0)