From 19cdc0e5457d42c9bde068c443a29bf9187b31ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= Date: Tue, 15 Oct 2024 09:52:42 +0000 Subject: [PATCH] freedom-maker: update patches for newer release --- ...01-documentation_could-be-upstreamed.patch | 52 ++--- ...distro-fork-name_could-be-upstreamed.patch | 31 +-- .../0003-trisquelize-documentation.patch | 132 +++++++------ .../freedom-maker/0005-trisquelize-code.patch | 16 +- .../0006-remove-nonfree-support.patch | 180 ++++++++---------- .../0007-patch-test_library-nabia.patch | 111 ++++++----- .../0008-specify-generic-kernels.patch | 28 +-- helpers/make-freedom-maker | 4 +- 8 files changed, 284 insertions(+), 270 deletions(-) diff --git a/helpers/DATA/freedom-maker/0001-documentation_could-be-upstreamed.patch b/helpers/DATA/freedom-maker/0001-documentation_could-be-upstreamed.patch index 4038e5c..41707e2 100644 --- a/helpers/DATA/freedom-maker/0001-documentation_could-be-upstreamed.patch +++ b/helpers/DATA/freedom-maker/0001-documentation_could-be-upstreamed.patch @@ -1,5 +1,5 @@ diff --git a/README.md b/README.md -index cd1815f..aaa7caa 100644 +index 2ea7ebf3..aa30828e 100644 --- a/README.md +++ b/README.md @@ -26,31 +26,32 @@ tweaks, see the *Build Images* section below. @@ -28,35 +28,35 @@ index cd1815f..aaa7caa 100644 -- *raspberry2*: RasbperryPi 2's SD card -- *raspberry3*: RasbperryPi 3's SD card -- *raspberry3-b-plus*: RasbperryPi 3 Model B+'s SD card --- *test*: build virtualbox i386 image and run diagnostics tests on it +-- *raspberry64*: Single image for Raspberry Pi 3B, Raspberry Pi 3B+ and Raspberry Pi 4B -- *virtualbox-amd64*: 64-bit image for the VirtualBox virtualization tool -- *virtualbox-i386*: 32-bit image for the VirtualBox virtualization tool +| target | description | +|-----------------------|-------------| -+| *a20-olinuxino-lime* | A20 OLinuXino Lime's SD card | -+| *a20-olinuxino-lime2* | A20 OLinuXino Lime2's SD card | -+| *a20-olinuxino-micro* | A20 OLinuXino MICRO's SD card | -+| *amd64* | Disk image for any machine with amd64 architecture | -+| *arm64* | Disk image for any machine with arm64/aarch64 architecture | -+| *armhf* | Disk image for any machine with arm32 architecture | -+| *banana-pro* | Banana Pro's SD card | -+| *beaglebone* | BeagleBone Black's SD card | -+| *cubieboard2* | Cubieboard2's SD card | -+| *cubietruck* | Cubietruck's SD card | -+| *i386* | Disk image for any machine with i386 architecture | -+| *lamobo-r1* | Lamobo R1 aka BananaPi Router SD card | -+| *orange-pi-zero* | Orange Pi Zero's SD card | -+| *pcduino3* | pcDuino3's SD card | -+| *pine64-lts* | Pine64 LTS board's SD card | -+| *pine64-plus* | Pine64+ board's SD card | -+| *qemu-amd64* | 64-bit image for the Qemu virtualization tool | -+| *qemu-i386* | 32-bit image for the Qemu virtualization tool | -+| *raspberry2* | RasbperryPi 2's SD card | -+| *raspberry3* | RasbperryPi 3's SD card | -+| *raspberry3-b-plus* | RasbperryPi 3 Model B+'s SD card | -+| *test* | build virtualbox i386 image and run diagnostics tests on it -+| *virtualbox-amd64* | 64-bit image for the VirtualBox virtualization tool | -+| *virtualbox-i386* | 32-bit image for the VirtualBox virtualization tool | ++| *a20-olinuxino-lime* | A20 OLinuXino Lime's SD card | ++| *a20-olinuxino-lime2* | A20 OLinuXino Lime2's SD card | ++| *a20-olinuxino-micro* | A20 OLinuXino MICRO's SD card | ++| *amd64* | Disk image for any machine with amd64 architecture | ++| *arm64* | Disk image for any machine with arm64/aarch64 architecture | ++| *armhf* | Disk image for any machine with arm32 architecture | ++| *banana-pro* | Banana Pro's SD card | ++| *beaglebone* | BeagleBone Black's SD card | ++| *cubieboard2* | Cubieboard2's SD card | ++| *cubietruck* | Cubietruck's SD card | ++| *i386* | Disk image for any machine with i386 architecture | ++| *lamobo-r1* | Lamobo R1 aka BananaPi Router SD card | ++| *orange-pi-zero* | Orange Pi Zero's SD card | ++| *pcduino3* | pcDuino3's SD card | ++| *pine64-lts* | Pine64 LTS board's SD card | ++| *pine64-plus* | Pine64+ board's SD card | ++| *qemu-amd64* | 64-bit image for the Qemu virtualization tool | ++| *qemu-i386* | 32-bit image for the Qemu virtualization tool | ++| *raspberry2* | RasbperryPi 2's SD card | ++| *raspberry3* | RasbperryPi 3's SD card | ++| *raspberry3-b-plus* | RasbperryPi 3 Model B+'s SD card | ++| *raspberry64* | Single image for Raspberry Pi 3B, Raspberry Pi 3B+ and Raspberry Pi 4B | ++| *virtualbox-amd64* | 64-bit image for the VirtualBox virtualization tool | ++| *virtualbox-i386* | 32-bit image for the VirtualBox virtualization tool | ## Running Build diff --git a/helpers/DATA/freedom-maker/0002-generalize-distro-fork-name_could-be-upstreamed.patch b/helpers/DATA/freedom-maker/0002-generalize-distro-fork-name_could-be-upstreamed.patch index aa38523..4f924ec 100644 --- a/helpers/DATA/freedom-maker/0002-generalize-distro-fork-name_could-be-upstreamed.patch +++ b/helpers/DATA/freedom-maker/0002-generalize-distro-fork-name_could-be-upstreamed.patch @@ -11,22 +11,31 @@ index ca998d9..1b051e2 100644 # initramfs-tools is a dependency for the kernel-image package. However, when # kernel is not installed, as in case of Raspberry Pi image, explicit # dependency is needed. -@@ -114,14 +116,15 @@ class ImageBuilder(object): # pylint: disable=too-many-instance-attributes - elif 'contrib' in self.release_components: - free_tag = 'contrib' - else: -- free_tag = 'free' -+ free_tag = 'libre' - else: -- free_tag = 'nonfree' -+ free_tag = 'libre' +diff --git a/freedommaker/builder.py b/freedommaker/builder.py +index e4ccddd5..1ec3026b 100644 +--- a/freedommaker/builder.py ++++ b/freedommaker/builder.py +@@ -87,10 +87,10 @@ class ImageBuilder: # pylint: disable=too-many-instance-attributes + """Return the Debian release components to use for the build.""" + components = ['main'] + if self.include_non_free_firmware: +- components.append('non-free-firmware') ++ components.append('libre') + if self.include_contrib: +- components.append('contrib') ++ components.append('libre') + + if self.arguments.release_component: + for component in self.arguments.release_component: +@@ -120,8 +120,9 @@ class ImageBuilder: # pylint: disable=too-many-instance-attributes + """Return the base file name of the final image.""" build_stamp = self.arguments.build_stamp build_stamp = build_stamp + '_' if build_stamp else '' -- return 'freedombox-{distribution}-{free_tag}_{build_stamp}{machine}' \ +- return 'freedombox-{distribution}_{build_stamp}{machine}' \ + return '{distro}freedombox-{distribution}-{free_tag}_{build_stamp}_{machine}' \ '-{architecture}'.format( + distro=DISTRO_BRAND.lower() + '-' if DISTRO_BRAND else '', - distribution=self.arguments.distribution, free_tag=free_tag, + distribution=self.arguments.distribution, build_stamp=build_stamp, machine=self.machine, architecture=self.architecture) diff --git a/helpers/DATA/freedom-maker/0003-trisquelize-documentation.patch b/helpers/DATA/freedom-maker/0003-trisquelize-documentation.patch index 4292ec1..2ea68f0 100644 --- a/helpers/DATA/freedom-maker/0003-trisquelize-documentation.patch +++ b/helpers/DATA/freedom-maker/0003-trisquelize-documentation.patch @@ -31,16 +31,16 @@ index aaa7caa..293545b 100644 | target | description | |-----------------------|-------------| -@@ -46,25 +42,18 @@ Freedom-maker supports building for the following targets: - | *pine64-plus* | Pine64+ board's SD card | - | *qemu-amd64* | 64-bit image for the Qemu virtualization tool | - | *qemu-i386* | 32-bit image for the Qemu virtualization tool | --| *raspberry2* | RasbperryPi 2's SD card | --| *raspberry3* | RasbperryPi 3's SD card | --| *raspberry3-b-plus* | RasbperryPi 3 Model B+'s SD card | --| *test* | build virtualbox i386 image and run diagnostics tests on it --| *virtualbox-amd64* | 64-bit image for the VirtualBox virtualization tool | --| *virtualbox-i386* | 32-bit image for the VirtualBox virtualization tool | +@@ -42,25 +42,18 @@ Trisquel Freedom-maker supports building for the following targets: + | *pine64-plus* | Pine64+ board's SD card | + | *qemu-amd64* | 64-bit image for the Qemu virtualization tool | + | *qemu-i386* | 32-bit image for the Qemu virtualization tool | +-| *raspberry2* | RasbperryPi 2's SD card | +-| *raspberry3* | RasbperryPi 3's SD card | +-| *raspberry3-b-plus* | RasbperryPi 3 Model B+'s SD card | +-| *raspberry64* | Single image for Raspberry Pi 3B, Raspberry Pi 3B+ and Raspberry Pi 4B | +-| *virtualbox-amd64* | 64-bit image for the VirtualBox virtualization tool | +-| *virtualbox-i386* | 32-bit image for the VirtualBox virtualization tool | ## Running Build @@ -53,7 +53,7 @@ index aaa7caa..293545b 100644 2. Install the required dependencies: ```shell - $ sudo apt install btrfs-progs debootstrap kpartx parted qemu-user-static qemu-utils sshpass + $ sudo apt install binfmt-support btrfs-progs debootstrap dmsetup dosfstools fdisk git kpartx parted psmisc qemu-user-static qemu-utils sshpass sudo u-boot-tools xz-utils - $ cd freedom-maker - $ sudo apt build-dep . + $ sudo apt build-dep freedom-maker @@ -68,47 +68,69 @@ index aaa7caa..293545b 100644 $ sudo python3 -m freedommaker ``` where: <TARGET> is one of the 'Supported Targets' above. -diff --git a/debian/freedom-maker.1 b/debian/freedom-maker.1 -index 71a9a9b..58051f3 100644 ---- a/debian/freedom-maker.1 -+++ b/debian/freedom-maker.1 -@@ -51,17 +51,17 @@ Size of the image to build - .PP - \fB\-\-build\-mirror\fR - .RS 4 --Debian mirror to use for building -+Trisquel mirror to use for building - .RE - .PP - \fB\-\-mirror\fR - .RS 4 --Debian mirror to use in built image -+Trisquel mirror to use in built image - .RE - .PP - \fB\-\-distribution\fR - .RS 4 --Debian release to use in built image -+Trisquel release to use in built image - .RE - .PP - \fB\-\-package\fR -@@ -101,7 +101,7 @@ Force rebuild of images even when required image exists - .PP - \fBtargets\fR - .RS 4 --Image targets to build\&. Choose one or more of a20\-olinuxino\-lime, a20\-olinuxino\-lime2, a20\-olinuxino\-micro, amd64, arm64, armhf, banana\-pro, beaglebone, cubieboard2, cubietruck, i386, lamobo\-r1, orange\-pi\-zero, pcduino3, pine64\-lts, pine64\-plus, qemu\-amd64, qemu\-i386, raspberry2, raspberry3, raspberry3\-b\-plus, test, virtualbox\-amd64, virtualbox\-i386 -+Image targets to build\&. Choose one or more of freedommaker, dreamplug, beaglebone, cubieboard2, cubietruck, a20\-olinuxino\-lime, a20\-olinuxino\-lime2, a20\-olinuxino\-micro, i386, amd64, qemu\-i386, qemu\-amd64, pcDuino3 - .RE - .SH "EXAMPLES" - .PP -@@ -128,8 +128,7 @@ Build a FreedomBox image for the BeagleBone Single Board Computer\&. - $ freedommaker a20\-olinuxino\-lime a20\-olinuxino\-lime2 - a20\-olinuxino\-micro amd64 arm64 armhf banana\-pro beaglebone cubieboard2 - cubietruck i386 lamobo\-r1 orange\-pi\-zero pcduino3 pine64\-lts pine64\-plus -- qemu\-amd64 qemu\-i386 raspberry2 raspberry3 raspberry3\-b\-plus test -- virtualbox\-amd64 virtualbox\-i386 -+ qemu\-amd64 qemu\-i386 - .fi - .if n \{\ - .RE +diff --git a/doc/freedom-maker.xml b/doc/freedom-maker.xml +index 09c2f001..8c4abdd6 100644 +--- a/doc/freedom-maker.xml ++++ b/doc/freedom-maker.xml +@@ -85,7 +85,7 @@ + + + +- Debian mirror to use for building ++ Trisquel mirror to use for building + + + +@@ -93,7 +93,7 @@ + + + +- Debian mirror to use in built image ++ Trisquel mirror to use in built image + + + +@@ -101,15 +101,7 @@ + + + +- Debian release to use in built image +- +- +- +- +- +- +- +- Add an extra Debian release component (other than main) ++ Trisquel release to use in built image + + + +@@ -208,12 +200,10 @@ + + + +- Image targets to build. Choose one or more of a20-olinuxino-lime, +- a20-olinuxino-lime2, a20-olinuxino-micro, amd64, arm64, armhf, +- banana-pro, beaglebone, cubieboard2, cubietruck, i386, lamobo-r1, +- orange-pi-zero, pcduino3, pine64-lts, pine64-plus, qemu-amd64, +- qemu-i386, raspberry2, raspberry3, raspberry3-b-plus, raspberry64, +- vagrant virtualbox-amd64, virtualbox-i386 ++ Image targets to build. Choose one or more of freedommaker, ++ dreamplug, beaglebone, cubieboard2, cubietruck, ++ a20-olinuxino-lime,a20-olinuxino-lime2, a20-olinuxino-micro, ++ i386, amd64, qemu-i386, qemu-amd64, pcDuino3 + + + +@@ -236,8 +226,7 @@ + $ freedommaker a20-olinuxino-lime a20-olinuxino-lime2 + a20-olinuxino-micro amd64 arm64 armhf banana-pro beaglebone cubieboard2 + cubietruck i386 lamobo-r1 orange-pi-zero pcduino3 pine64-lts pine64-plus +- qemu-amd64 qemu-i386 raspberry2 raspberry3 raspberry3-b-plus raspberry64 +- vagrant virtualbox-amd64 virtualbox-i386 ++ qemu-amd64 qemu-i386 + + Build all the available FreedomBox images using freedom-maker. + diff --git a/helpers/DATA/freedom-maker/0005-trisquelize-code.patch b/helpers/DATA/freedom-maker/0005-trisquelize-code.patch index ca9c46e..539e4df 100644 --- a/helpers/DATA/freedom-maker/0005-trisquelize-code.patch +++ b/helpers/DATA/freedom-maker/0005-trisquelize-code.patch @@ -16,23 +16,23 @@ index c5175a8..a479721 100644 LOG_LEVEL = 'debug' HOSTNAME = 'freedombox' diff --git a/freedommaker/library.py b/freedommaker/library.py -index f8ea629..04954b5 100644 +index 28f10cfa..b821226b 100644 --- a/freedommaker/library.py +++ b/freedommaker/library.py -@@ -493,12 +493,12 @@ deb {mirror} {distribution}-updates {components} +@@ -527,12 +527,12 @@ deb {mirror} {distribution}-updates {components} deb-src {mirror} {distribution}-updates {components} ''' security_template = ''' -deb http://security.debian.org/debian-security/ {distribution}-security {components} -deb-src http://security.debian.org/debian-security/ {distribution}-security {components} -+deb {mirror} {distribution}-security {components} -+deb-src {mirror} {distribution}-security {components} ++deb https://archive.trisquel.org/trisquel/ {distribution}-security {components} ++deb-src https://archive.trisquel.org/trisquel/ {distribution}-security {components} ''' backports_template = f''' --deb http://deb.debian.org/debian {STABLE_CODENAME}-backports main --deb-src http://deb.debian.org/debian {STABLE_CODENAME}-backports main -+#deb {mirror} {distribution}-backports {components} -+#deb-src {mirror} {distribution}-backports {components} +-deb http://deb.debian.org/debian {releases.STABLE_CODENAME}-backports main +-deb-src http://deb.debian.org/debian {releases.STABLE_CODENAME}-backports main ++deb {mirror} {distribution}-backports {components} ++deb-src {mirror} {distribution}-backports {components} ''' file_path = path_in_mount(state, 'etc/apt/sources.list') with open(file_path, 'w') as file_handle: diff --git a/helpers/DATA/freedom-maker/0006-remove-nonfree-support.patch b/helpers/DATA/freedom-maker/0006-remove-nonfree-support.patch index 0241e69..94b8a80 100644 --- a/helpers/DATA/freedom-maker/0006-remove-nonfree-support.patch +++ b/helpers/DATA/freedom-maker/0006-remove-nonfree-support.patch @@ -12,23 +12,24 @@ index 1f2c207..c97d392 100644 FreedomBox is a personal cloud server which can be installed on single board computers and Debian machines. diff --git a/freedommaker/builders/__init__.py b/freedommaker/builders/__init__.py -index dd694f3..139c654 100644 +index 56c180db..139c6541 100644 --- a/freedommaker/builders/__init__.py +++ b/freedommaker/builders/__init__.py -@@ -25,10 +25,3 @@ from . import pine64_plus +@@ -25,11 +25,3 @@ from . import pine64_plus from . import pine64_lts from . import qemu_amd64 from . import qemu_i386 -from . import raspberry_pi_2 -from . import raspberry_pi_3 -from . import raspberry_pi_3_b_plus +-from . import raspberry_pi_64bit -from . import raspberry_pi_with_uboot -from . import vagrant -from . import virtualbox_amd64 -from . import virtualbox_i386 diff --git a/freedommaker/builders/raspberry_pi_2.py b/freedommaker/builders/raspberry_pi_2.py deleted file mode 100644 -index c226683..0000000 +index 439444e7..00000000 --- a/freedommaker/builders/raspberry_pi_2.py +++ /dev/null @@ -1,15 +0,0 @@ @@ -46,13 +47,13 @@ index c226683..0000000 - machine = 'raspberry2' - kernel_flavor = 'armmp' - flash_kernel_name = 'Raspberry Pi 2 Model B' -- uboot_variant = 'rpi_2' +- u_boot_rpi_variant = 'rpi_2' diff --git a/freedommaker/builders/raspberry_pi_3.py b/freedommaker/builders/raspberry_pi_3.py deleted file mode 100644 -index 797e8df..0000000 +index 3b9bf82b..00000000 --- a/freedommaker/builders/raspberry_pi_3.py +++ /dev/null -@@ -1,16 +0,0 @@ +@@ -1,15 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -""" -Worker class to build Raspberry Pi 3 image. @@ -65,34 +66,67 @@ index 797e8df..0000000 - """Image builder for Raspberry Pi 3 target.""" - architecture = 'armhf' - machine = 'raspberry3' -- free = False - kernel_flavor = 'armmp' - flash_kernel_name = 'Raspberry Pi 3 Model B' -- uboot_variant = 'rpi_3_32b' -diff --git a/freedommaker/builders/raspberry_pi_3_b_plus.py b/freedommaker/builders/raspberry_pi_3_b_plus.py +- u_boot_rpi_variant = 'rpi_3_32b' +diff --git a/freedommaker/builders/raspberry_pi_64bit.py b/freedommaker/builders/raspberry_pi_64bit.py deleted file mode 100644 -index 7a54842..0000000 ---- a/freedommaker/builders/raspberry_pi_3_b_plus.py +index e6a9ffa0..00000000 +--- a/freedommaker/builders/raspberry_pi_64bit.py +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,46 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -""" --Worker class to build Raspberry Pi 3 Model B+ image. +-Worker class to build Raspberry Pi 64-bit image. -""" - --from .raspberry_pi_3 import RaspberryPi3ImageBuilder +-from .. import library +-from ..builder import ImageBuilder - - --class RaspberryPi3BPlusImageBuilder(RaspberryPi3ImageBuilder): -- """Image builder for Raspberry Pi 3 Model B+ target.""" -- machine = 'raspberry3-b-plus' -- flash_kernel_name = 'Raspberry Pi 3 Model B+' +-class RaspberryPi64ImageBuilder(ImageBuilder): +- """Image builder for Raspberry Pi 64-bit target.""" +- architecture = 'arm64' +- boot_loader = None +- firmware_filesystem_type = 'vfat' +- firmware_size = '256MiB' +- include_non_free_firmware = True +- kernel_flavor = 'arm64' +- machine = 'raspberry64' +- update_initramfs = False +- +- def __init__(self, arguments): +- """Add to list of packages.""" +- super().__init__(arguments) +- self.packages += ['firmware-brcm80211'] +- +- @classmethod +- def get_target_name(cls): +- """Return the name of the target for an image builder.""" +- return getattr(cls, 'machine', None) +- +- def install_boot_loader(self, state): +- """Install the firmware onto the image.""" +- uuid = library.get_uuid_of_device(state['devices']['root']) +- script = ''' +-set -e +-set -x +-set -o pipefail +- +-# This will trigger installing firmware and updating initramfs. +-apt-get install raspi-firmware +- +-# Fixup cmdline.txt and set defaults +-echo "console=tty0 console=ttyS1,115200 root=UUID={uuid} rw fsck.repair=yes net.ifnames=0 rootwait" >/boot/firmware/cmdline.txt +-sed -i 's/^#ROOTPART=.*/ROOTPART=UUID={uuid}/' /etc/default/raspi-firmware +-'''.format(uuid=uuid) +- library.run_in_chroot(state, ['bash', '-c', script]) diff --git a/freedommaker/builders/raspberry_pi_with_uboot.py b/freedommaker/builders/raspberry_pi_with_uboot.py deleted file mode 100644 -index 8057f87..0000000 +index c4be09cd..00000000 --- a/freedommaker/builders/raspberry_pi_with_uboot.py +++ /dev/null -@@ -1,44 +0,0 @@ +@@ -1,46 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -""" -Base worker class to build Raspberry Pi 2 and 3 images. @@ -104,14 +138,15 @@ index 8057f87..0000000 - -class RaspberryPiWithUBoot(ARMImageBuilder): - """Base image builder for Raspberry Pi 2 and 3 targets.""" -- free = False +- include_non_free_firmware = True - uboot_variant = None - firmware_filesystem_type = 'vfat' -- firmware_size = '64MiB' +- firmware_size = '256MiB' +- u_boot_variant = 'rpi' - - def install_boot_loader(self, state): - """Install the boot loader onto the image.""" -- if not self.uboot_variant: +- if not self.u_boot_rpi_variant: - raise NotImplementedError - - firmware_package = 'raspi-firmware' @@ -133,29 +168,35 @@ index 8057f87..0000000 - -# u-boot setup -apt-get install -y u-boot-rpi --cp /usr/lib/u-boot/{uboot_variant}/u-boot.bin /boot/firmware/kernel.img --cp /usr/lib/u-boot/{uboot_variant}/u-boot.bin /boot/firmware/kernel7.img --'''.format(firmware_package=firmware_package, uboot_variant=self.uboot_variant) +-cp /usr/lib/u-boot/{u_boot_rpi_variant}/u-boot.bin /boot/firmware/kernel.img +-cp /usr/lib/u-boot/{u_boot_rpi_variant}/u-boot.bin /boot/firmware/kernel7.img +-'''.format(firmware_package=firmware_package, +- u_boot_rpi_variant=self.u_boot_rpi_variant) - library.run_in_chroot(state, ['bash', '-c', script]) diff --git a/freedommaker/builders/vagrant.py b/freedommaker/builders/vagrant.py deleted file mode 100644 -index 13d124d..0000000 +index 30df772b..00000000 --- a/freedommaker/builders/vagrant.py +++ /dev/null -@@ -1,41 +0,0 @@ +@@ -1,56 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -""" -Worker class to build Vagrant images. -""" - +-import logging -import os +-import subprocess - -from .. import library -from .virtualbox_amd64 import VirtualBoxAmd64ImageBuilder - +-logger = logging.getLogger(__name__) +- - -class VagrantImageBuilder(VirtualBoxAmd64ImageBuilder): - """Image builder for Vagrant package.""" +- include_contrib = True - vagrant_extension = '.box' - - @classmethod @@ -174,86 +215,23 @@ index 13d124d..0000000 - self.create_vm_file(self.image_file, vm_file) - os.remove(self.image_file) - self.vagrant_package(vm_file, vagrant_file) +- self.store_hash(vagrant_file) - - def vagrant_package(self, vm_file, vagrant_file): - """Create a vagrant package from VM file.""" - command = [ -- 'bin/vagrant-package', '--distribution', +- 'freedommaker/vagrant_package.py', '--distribution', - self.arguments.distribution, '--release-components' - ] - command.extend(self.release_components) - command += ['--output', vagrant_file, vm_file] - library.run(command) -diff --git a/freedommaker/builders/virtualbox.py b/freedommaker/builders/virtualbox.py -deleted file mode 100644 -index 73c1965..0000000 ---- a/freedommaker/builders/virtualbox.py -+++ /dev/null -@@ -1,31 +0,0 @@ --# SPDX-License-Identifier: GPL-3.0-or-later --""" --Base worker class to build VirtualBox images. --""" - --import os -- --from .. import library --from .vm import VMImageBuilder -- -- --class VirtualBoxImageBuilder(VMImageBuilder): -- """Base image builder for all VirtualBox targets.""" -- vm_image_extension = '.vdi' -- -- @classmethod -- def get_target_name(cls): -- """Return the name of the target for an image builder.""" -- if getattr(cls, 'architecture', None): -- return 'virtualbox-' + cls.architecture -- -- return None -- -- def create_vm_file(self, image_file, vm_file): -- """Create a VM file from image file.""" -- try: -- os.remove(vm_file) -- except FileNotFoundError: -- pass -- -- library.run(['VBoxManage', 'convertdd', image_file, vm_file]) -diff --git a/freedommaker/builders/virtualbox_amd64.py b/freedommaker/builders/virtualbox_amd64.py -deleted file mode 100644 -index 20108d6..0000000 ---- a/freedommaker/builders/virtualbox_amd64.py -+++ /dev/null -@@ -1,12 +0,0 @@ --# SPDX-License-Identifier: GPL-3.0-or-later --""" --Worker class to build VirtualBox amd64 images. --""" -- --from .virtualbox import VirtualBoxImageBuilder -- -- --class VirtualBoxAmd64ImageBuilder(VirtualBoxImageBuilder): -- """Image builder for all VirtualBox amd64 targets.""" -- architecture = 'amd64' -- kernel_flavor = 'amd64' -diff --git a/freedommaker/builders/virtualbox_i386.py b/freedommaker/builders/virtualbox_i386.py -deleted file mode 100644 -index 9380a6a..0000000 ---- a/freedommaker/builders/virtualbox_i386.py -+++ /dev/null -@@ -1,12 +0,0 @@ --# SPDX-License-Identifier: GPL-3.0-or-later --""" --Worker class to build VirtualBox i386 images. --""" -- --from .virtualbox import VirtualBoxImageBuilder -- -- --class VirtualBoxI386ImageBuilder(VirtualBoxImageBuilder): -- """Image builder for all VirtualBox i386 targets.""" -- architecture = 'i386' -- kernel_flavor = '686' +- def store_hash(self, vagrant_file): +- """Store the SHA-256 hash of the vagrant box file.""" +- output = subprocess.check_output(['sha256sum', vagrant_file]) +- result = output.decode() +- logger.info('sha256sum: %s', result) +- hash_filename = self._replace_extension(vagrant_file, '.sha256') +- with open(hash_filename, 'w') as hash_file: +- hash_file.write(result) diff --git a/helpers/DATA/freedom-maker/0007-patch-test_library-nabia.patch b/helpers/DATA/freedom-maker/0007-patch-test_library-nabia.patch index 86c318d..d6cd449 100644 --- a/helpers/DATA/freedom-maker/0007-patch-test_library-nabia.patch +++ b/helpers/DATA/freedom-maker/0007-patch-test_library-nabia.patch @@ -1,76 +1,75 @@ diff --git a/freedommaker/tests/test_library.py b/freedommaker/tests/test_library.py -index 2cc840a..6e63917 100644 +index 4b52b278..b4688a11 100644 --- a/freedommaker/tests/test_library.py +++ b/freedommaker/tests/test_library.py -@@ -422,13 +422,13 @@ modify x x - @patch('freedommaker.library.run') - def test_debootstrap(self, run): - """Test debootstrapping.""" -- library.debootstrap(self.state, 'i386', 'stretch', 'minbase', -- ['main', 'contrib'], ['p1', 'p2'], -- 'http://deb.debian.org/debian') -+ library.debootstrap(self.state, 'amd64', 'nabia', 'minbase', -+ ['main'], ['p1', 'p2'], -+ 'http://archive.trisquel.org/trisquel') - run.assert_called_with([ -- 'debootstrap', '--arch=i386', '--variant=minbase', -- '--components=main,contrib', '--include=p1,p2', 'stretch', -- self.state['mount_point'], 'http://deb.debian.org/debian' -+ 'debootstrap', '--arch=amd64', '--variant=minbase', -+ '--components=main', '--include=p1,p2', 'nabia', -+ self.state['mount_point'], 'http://archive.trisquel.org/trisquel' - ]) +@@ -446,13 +446,13 @@ def test_cleanup_extra_storage(run, image, state, random_string): + @patch('freedommaker.library.run') + def test_debootstrap(run, state): + """Test debootstrapping.""" +- library.debootstrap(state, 'i386', 'stretch', 'minbase', +- ['main', 'contrib'], ['p1', 'p2'], +- 'http://deb.debian.org/debian') ++ library.debootstrap(state, 'amd64', 'aramo', 'minbase', ++ ['main'], ['p1', 'p2'], ++ 'http://archive.trisquel.org/trisquel') + run.assert_called_with([ +- 'debootstrap', '--arch=i386', '--variant=minbase', +- '--components=main,contrib', '--include=p1,p2', 'stretch', +- state['mount_point'], 'http://deb.debian.org/debian' ++ 'debootstrap', '--arch=amd64', '--variant=minbase', ++ '--components=main', '--include=p1,p2', 'aramo', ++ state['mount_point'], 'http://archive.trisquel.org/trisquel' + ]) - self.assertEqual(self.state['cleanup'], [[ -@@ -574,31 +574,37 @@ ff02::2 ip6-allrouters - sources_path = self.state['mount_point'] + '/etc/apt/sources.list' + assert state['cleanup'] == [[ +@@ -602,17 +602,17 @@ def test_setup_apt(run, state): + sources_path = state['mount_point'] + '/etc/apt/sources.list' - stable_content = ''' + stable_content = ''' -deb http://deb.debian.org/debian stable main -deb-src http://deb.debian.org/debian stable main -+deb http://archive.trisquel.org/trisquel nabia main -+deb-src http://archive.trisquel.org/trisquel nabia main ++deb http://archive.trisquel.org/trisquel aramo main ++deb-src http://archive.trisquel.org/trisquel aramo main -deb http://deb.debian.org/debian stable-updates main -deb-src http://deb.debian.org/debian stable-updates main -+deb http://archive.trisquel.org/trisquel nabia-updates main -+deb-src http://archive.trisquel.org/trisquel nabia-updates main ++deb http://archive.trisquel.org/trisquel aramo-updates main ++deb-src http://archive.trisquel.org/trisquel aramo-updates main -deb http://security.debian.org/debian-security/ stable-security main -deb-src http://security.debian.org/debian-security/ stable-security main -+deb http://archive.trisquel.org/trisquel nabia-security main -+deb-src http://archive.trisquel.org/trisquel nabia-security main ++deb https://archive.trisquel.org/trisquel/ aramo-security main ++deb-src https://archive.trisquel.org/trisquel/ aramo-security main ''' - with self.assert_file_change(sources_path, None, stable_content): -- library.setup_apt(self.state, 'http://deb.debian.org/debian', -- 'stable', ['main']) -+ library.setup_apt(self.state, 'http://archive.trisquel.org/trisquel', -+ 'nabia', ['main']) + with assert_file_change(sources_path, None, stable_content): +- library.setup_apt(state, 'http://deb.debian.org/debian', 'stable', ++ library.setup_apt(state, 'http://archive.trisquel.org/trisquel', 'aramo', + ['main']) - self.assertEqual(run.call_args_list, [ - call(self.state, ['apt-get', 'update']), - call(self.state, ['apt-get', 'clean']) - ]) + assert run.call_args_list == [ +@@ -620,13 +620,19 @@ deb-src https://archive.trisquel.org/trisquel/ aramo-security main + call(state, ['apt-get', 'clean']) + ] -- unstable_content = ''' --deb http://ftp.us.debian.org/debian unstable main contrib non-free --deb-src http://ftp.us.debian.org/debian unstable main contrib non-free -+ aramo_content = ''' -+deb http://archive.trisquel.org/trisquel aramo main -+deb-src http://archive.trisquel.org/trisquel aramo main +- unstable_content = ''' +-deb http://ftp.us.debian.org/debian unstable main contrib non-free-firmware +-deb-src http://ftp.us.debian.org/debian unstable main contrib non-free-firmware ++ ecne_content = ''' ++deb http://archive.trisquel.org/trisquel ecne main ++deb-src http://archive.trisquel.org/trisquel ecne main + -+deb http://archive.trisquel.org/trisquel aramo-updates main -+deb-src http://archive.trisquel.org/trisquel aramo-updates main ++deb http://archive.trisquel.org/trisquel ecne-updates main ++deb-src http://archive.trisquel.org/trisquel ecne-updates main + -+deb http://archive.trisquel.org/trisquel aramo-security main -+deb-src http://archive.trisquel.org/trisquel aramo-security main ++deb https://archive.trisquel.org/trisquel/ ecne-security main ++deb-src https://archive.trisquel.org/trisquel/ ecne-security main ''' -- with self.assert_file_change(sources_path, None, unstable_content): -- library.setup_apt(self.state, 'http://ftp.us.debian.org/debian', -- 'unstable', ['main', 'contrib', 'non-free']) -+ with self.assert_file_change(sources_path, None, aramo_content): -+ library.setup_apt(self.state, 'http://archive.trisquel.org/trisquel', -+ 'aramo', ['main']) +- with assert_file_change(sources_path, None, unstable_content): +- library.setup_apt(state, 'http://ftp.us.debian.org/debian', 'unstable', +- ['main', 'contrib', 'non-free-firmware']) ++ with assert_file_change(sources_path, None, ecne_content): ++ library.setup_apt(state, 'http://archive.trisquel.org/trisquel', 'ecne', ++ ['main']) - @patch('freedommaker.library.run_in_chroot') - def test_setup_flash_kernel(self, run): + + @patch('freedommaker.library.run_in_chroot') diff --git a/helpers/DATA/freedom-maker/0008-specify-generic-kernels.patch b/helpers/DATA/freedom-maker/0008-specify-generic-kernels.patch index ac7a908..08c2472 100644 --- a/helpers/DATA/freedom-maker/0008-specify-generic-kernels.patch +++ b/helpers/DATA/freedom-maker/0008-specify-generic-kernels.patch @@ -5,12 +5,12 @@ index ff7f807..ad94e1c 100644 @@ -10,7 +10,7 @@ from .arm import ARMImageBuilder class A20ImageBuilder(ARMImageBuilder): """Base image builder for all Allwinner A20 board based targets.""" - architecture = 'armhf' -- kernel_flavor = 'armmp-lpae' -+ kernel_flavor = 'generic' - u_boot_path = None + architecture: str = 'armhf' +- kernel_flavor: str = 'armmp-lpae' ++ kernel_flavor: str = 'generic' + u_boot_path: str | None = None + u_boot_variant: str = 'sunxi' - def install_boot_loader(self, state): diff --git a/freedommaker/builders/a64.py b/ffreedommaker/builders/a64.py index 7314724..21f3ae1 100644 --- a/freedommaker/builders/a64.py @@ -18,22 +18,25 @@ index 7314724..21f3ae1 100644 @@ -12,7 +12,7 @@ from .arm import ARMImageBuilder class A64ImageBuilder(ARMImageBuilder): """Image builder for all Allwinner A64 board targets.""" - architecture = 'arm64' -- kernel_flavor = 'arm64' -+ kernel_flavor = 'generic' - u_boot_target = None + architecture: str = 'arm64' +- kernel_flavor: str = 'arm64' ++ kernel_flavor: str = 'generic' + u_boot_target: str | None = None def __init__(self, *args, **kwargs): diff --git a/freedommaker/builders/amd64.py b/ffreedommaker/builders/amd64.py index d577ece..1b758f8 100644 --- a/freedommaker/builders/amd64.py +++ b/ffreedommaker/builders/amd64.py -@@ -9,4 +9,4 @@ from .amd_intel import AMDIntelImageBuilder +@@ -9,7 +9,7 @@ from .amd_intel import AMDIntelImageBuilder class AMD64ImageBuilder(AMDIntelImageBuilder): """Image builder for all amd64 targets.""" architecture = 'amd64' - kernel_flavor = 'amd64' + kernel_flavor = 'generic' + include_non_free_firmware = True + + def __init__(self, *args, **kwargs): diff --git a/freedommaker/builders/arm64.py b/ffreedommaker/builders/arm64.py index 4576d3e..fc593f9 100644 --- a/freedommaker/builders/arm64.py @@ -77,12 +80,15 @@ diff --git a/freedommaker/builders/i386.py b/ffreedommaker/builders/i386.py index 98a48da..692122d 100644 --- a/freedommaker/builders/i386.py +++ b/ffreedommaker/builders/i386.py -@@ -9,4 +9,4 @@ from .amd_intel import AMDIntelImageBuilder +@@ -9,7 +9,7 @@ from .amd_intel import AMDIntelImageBuilder class I386ImageBuilder(AMDIntelImageBuilder): """Image builder for all i386 targets.""" architecture = 'i386' - kernel_flavor = '686' + kernel_flavor = 'generic' + include_non_free_firmware = True + + def __init__(self, *args, **kwargs): diff --git a/freedommaker/builders/qemu_amd64.py b/ffreedommaker/builders/qemu_amd64.py index bb28f0a..61e5863 100644 --- a/freedommaker/builders/qemu_amd64.py diff --git a/helpers/make-freedom-maker b/helpers/make-freedom-maker index 18237cc..34ac16b 100644 --- a/helpers/make-freedom-maker +++ b/helpers/make-freedom-maker @@ -2,6 +2,7 @@ # trisquel package helper for 'freedom-maker' # +# Copyright (C) 2024 Luis Guzmán # Copyright (C) 2022 bill-auger # # This program is free software: you can redistribute it and/or modify @@ -24,8 +25,7 @@ VERSION=1 for patch in $(ls -v ${DATA}/*.patch) do -echo "Applying $patch" -patch --no-backup-if-mismatch -Np1 < $patch + patch_p1 $patch done changelog "Build from Trisquel repos - Delete support for non-free hardware and emulators"