Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/docker/l2tbuilds_ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:resolute
FROM ubuntu:noble

# Create container with:
# docker build -f l2tbuilds_ubuntu.Dockerfile --force-rm --no-cache -t log2timeline/l2tbuilds_ubuntu .
Expand Down
2 changes: 1 addition & 1 deletion data/rpm_templates/artifacts.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BuildArch: noarch
Vendor: Forensic artifacts <forensicartifacts@googlegroups.com>
Packager: Forensic artifacts <forensicartifacts@googlegroups.com>
Url: https://github.com/ForensicArtifacts/artifacts
BuildRequires: python3-devel, python3-setuptools
BuildRequires: python3-devel, python3-pip, python3-setuptools

%{{?python_disable_dependency_generator}}

Expand Down
2 changes: 1 addition & 1 deletion data/rpm_templates/plaso.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BuildArch: noarch
Vendor: Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com>
Packager: Log2Timeline maintainers <log2timeline-maintainers@googlegroups.com>
Url: https://github.com/log2timeline/plaso
BuildRequires: python3-devel, python3-setuptools
BuildRequires: python3-devel, python3-pip, python3-setuptools

%{{?python_disable_dependency_generator}}

Expand Down
27 changes: 26 additions & 1 deletion l2tdevtools/build_helpers/dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Helper for building projects from source."""

import datetime
import fileinput
import glob
import logging
import os
Expand Down Expand Up @@ -264,6 +265,23 @@ def _CreatePackagingFiles(self, source_directory, project_version):
source_directory))
return False

if self.distribution == 'noble':
control_file_path = os.path.join(debian_directory, 'control')
for line in fileinput.input(control_file_path, inplace=True):
if line.startswith('Build-Depends:'):
line = line.rstrip() + ', pybuild-plugin-pyproject\n'
print(line, end='')

patches_path = os.path.join(debian_directory, 'patches')
if not os.path.exists(patches_path):
os.mkdir(patches_path)

# pyproject_patch = os.path.join(patches_path, 'pyproject.patch')
# TODO: add option to control patches for noble pyproject.toml builds

# TODO: create series file
# patches_series = os.path.join(patches_path, 'series')

return True

# pylint: disable=redundant-returns-doc,unused-argument
Expand Down Expand Up @@ -831,7 +849,14 @@ def _DetermineBuildConfiguration(self, source_directory):
for directory_entry in os.listdir(dist_packages):
directory_entry_path = os.path.join(dist_packages, directory_entry)

if directory_entry.endswith('.egg-info'):
if directory_entry.endswith('.dist-info'):
# pylint: disable=simplifiable-if-statement
if os.path.isdir(directory_entry_path):
build_configuration.has_dist_info_directory = True
else:
build_configuration.has_dist_info_file = True

elif directory_entry.endswith('.egg-info'):
# pylint: disable=simplifiable-if-statement
if os.path.isdir(directory_entry_path):
build_configuration.has_egg_info_directory = True
Expand Down
33 changes: 25 additions & 8 deletions l2tdevtools/dependency_writers/dpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ class DPKGControlWriter(interface.DependencyFileWriter):
'Standards-Version: 4.1.4',
'X-Python3-Version: >= 3.6',
'Homepage: {homepage_url:s}',
''] # yapf: disable
'']

_DATA_PACKAGE = [
'Package: {project_name:s}-data',
'Architecture: all',
'Depends: ${{misc:Depends}}',
'Description: Data files for {name_description:s}',
'{description_long:s}',
''] # yapf: disable
'']

_PYTHON3_PACKAGE = [
'Package: python3-{python_module_name:s}',
'Architecture: all',
'Depends: {python3_dependencies:s}${{misc:Depends}}',
'Description: Python 3 module of {python_module_description:s}',
'{description_long:s}',
''] # yapf: disable
'']

_TOOLS_PACKAGE = [
'Package: {project_name:s}-tools',
Expand All @@ -58,7 +58,7 @@ class DPKGControlWriter(interface.DependencyFileWriter):
'${{misc:Depends}}'),
'Description: {tools_description:s}',
'{tool_description_long:s}',
''] # yapf: disable
'']

def Write(self):
"""Writes a dpkg control file."""
Expand Down Expand Up @@ -91,11 +91,10 @@ def Write(self):
[' {0:s}'.format(line) for line in tool_description_long.split('\n')])

file_content = []

file_content.extend(self._PYTHON3_FILE_HEADER)

data_dependency = ''
if os.path.isdir('data'):
if self._project_definition.name in ('artifacts', 'plaso'):
data_dependency = '{0:s}-data (>= ${{binary:Version}})'.format(
self._project_definition.name)

Expand Down Expand Up @@ -153,7 +152,7 @@ class DPKGRulesWriter(interface.DependencyFileWriter):

PATH = os.path.join('config', 'dpkg', 'rules')

_FILE_CONTENT = [
_HEADER = [
'#!/usr/bin/make -f',
'',
'%:',
Expand All @@ -164,12 +163,30 @@ class DPKGRulesWriter(interface.DependencyFileWriter):
'',
'']

_DATA_PACKAGE = [
'.PHONY: override_dh_auto_install',
'override_dh_auto_install:',
'\tdh_auto_install',
'\tmkdir -p debian/tmp/usr/share/{project_name:s}',
('\tmv debian/tmp/usr/lib/python*/dist-packages/{project_name:s}/data/* '
'debian/tmp/usr/share/{project_name:s}'),
'\trmdir debian/tmp/usr/lib/python*/dist-packages/{project_name:s}/data',
'\tfind debian/tmp/usr/bin/ -type f -exec mv {{}} {{}}.py \\;',
'',
'']

def Write(self):
"""Writes a dpkg control file."""
template_mappings = {
'project_name': self._project_definition.name}

file_content = '\n'.join(self._FILE_CONTENT)
file_content = []
file_content.extend(self._HEADER)

if self._project_definition.name in ('artifacts', 'plaso'):
file_content.extend(self._DATA_PACKAGE)

file_content = '\n'.join(file_content)
file_content = file_content.format(**template_mappings)

with open(self.PATH, 'w', encoding='utf-8') as file_object:
Expand Down
9 changes: 8 additions & 1 deletion l2tdevtools/dpkg_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class DPKGBuildConfiguration(object):
Attributes:
has_bin_directory (bool): True if the Python module creates
a /usr/bin directory.
has_dist_info_directory (bool): True if the Python module has
a .dist_info directory in the dist-packages directory.
has_egg_info_directory (bool): True if the Python module has
an .egg_info directory in the dist-packages directory.
has_egg_info_file (bool): True if the Python module has
Expand All @@ -30,6 +32,7 @@ def __init__(self):
"""Initializes a dpkg build configuration."""
super(DPKGBuildConfiguration, self).__init__()
self.has_bin_directory = False
self.has_dist_info_directory = False
self.has_egg_info_directory = False
self.has_egg_info_file = False
self.has_module_source_files = False
Expand Down Expand Up @@ -509,7 +512,11 @@ def _GeneratePython3ModuleInstallFile(self, dpkg_path, template_values):
module_directory)
for module_directory in module_directories])

if self._build_configuration.has_egg_info_directory:
if self._build_configuration.has_dist_info_directory:
template_data.append(
'usr/lib/python3*/dist-packages/*.dist-info/*')

elif self._build_configuration.has_egg_info_directory:
template_data.append(
'usr/lib/python3*/dist-packages/*.egg-info/*')

Expand Down
2 changes: 1 addition & 1 deletion tests/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GithubRepoDownloadHelperTest(test_lib.BaseTestCase):
_DOWNLOAD_URL = 'https://github.com/ForensicArtifacts/artifacts/releases'

_PROJECT_NAME = 'artifacts'
_PROJECT_VERSION = '20250913'
_PROJECT_VERSION = '20260127'

def testGetPackageDownloadURLs(self):
"""Tests the GetPackageDownloadURLs function."""
Expand Down
Loading