Linters & CI updates
This commit is contained in:
parent
ff4f97ab8f
commit
ab47483a51
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Install pylint
|
- name: Install pylint
|
||||||
run: sudo pip3 install pylint
|
run: sudo pip3 install pylint
|
||||||
- name: pylint
|
- name: pylint
|
||||||
run: pylint rootfs.py sysa.py sysc.py lib/utils.py lib/sysgeneral.py lib/tmpdir.py --disable=duplicate-code
|
run: pylint rootfs.py lib/utils.py lib/generator.py lib/tmpdir.py --disable=duplicate-code
|
||||||
|
|
||||||
shellcheck:
|
shellcheck:
|
||||||
name: Lint shell files
|
name: Lint shell files
|
||||||
|
@ -30,7 +30,7 @@ jobs:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: shellcheck
|
- name: shellcheck
|
||||||
run: shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh
|
run: shellcheck steps/helpers.sh download-distfiles.sh
|
||||||
|
|
||||||
reuse:
|
reuse:
|
||||||
name: Lint reuse information
|
name: Lint reuse information
|
||||||
|
|
|
@ -9,6 +9,6 @@ Source: https://github.com/fosslinux/live-bootstrap
|
||||||
# Copyright: $YEAR $NAME <$CONTACT>
|
# Copyright: $YEAR $NAME <$CONTACT>
|
||||||
# License: ...
|
# License: ...
|
||||||
|
|
||||||
Files: sys*/*/sources sysa/*/*.checksums sysa/SHA256SUMS.pkgs sysa/*/simple-patches/*
|
Files: steps/*/sources steps/*/*.checksums steps/SHA256SUMS.pkgs steps/*/simple-patches/* steps/pre-network-sources
|
||||||
Copyright: none
|
Copyright: none
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
This file contains all code required to generate the boot image for live-bootstrap
|
||||||
|
"""
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
|
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
|
||||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||||
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
||||||
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
||||||
|
|
||||||
import glob
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
|
||||||
import tarfile
|
import tarfile
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ class Generator():
|
||||||
self.repo_path = repo_path
|
self.repo_path = repo_path
|
||||||
self.tmpdir = tmpdir
|
self.tmpdir = tmpdir
|
||||||
self.tmp_dir = tmpdir.path
|
self.tmp_dir = tmpdir.path
|
||||||
|
self.external_dir = os.path.join(self.tmp_dir, 'external')
|
||||||
|
|
||||||
def prepare(self, using_kernel=False, kernel_bootstrap=False):
|
def prepare(self, using_kernel=False, kernel_bootstrap=False):
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +40,6 @@ class Generator():
|
||||||
/ -- contains seed to allow steps to be built, containing custom
|
/ -- contains seed to allow steps to be built, containing custom
|
||||||
scripts and stage0-posix
|
scripts and stage0-posix
|
||||||
"""
|
"""
|
||||||
self.external_dir = os.path.join(self.tmp_dir, 'external')
|
|
||||||
# We use ext3 here; ext4 actually has a variety of extensions that
|
# We use ext3 here; ext4 actually has a variety of extensions that
|
||||||
# have been added with varying levels of recency
|
# have been added with varying levels of recency
|
||||||
# Linux 4.9.10 does not support a bunch of them
|
# Linux 4.9.10 does not support a bunch of them
|
||||||
|
@ -151,7 +152,8 @@ class Generator():
|
||||||
"""Copy in distfiles"""
|
"""Copy in distfiles"""
|
||||||
def copy_no_network_distfiles(out):
|
def copy_no_network_distfiles(out):
|
||||||
# Note that no network == no disk for kernel bootstrap mode
|
# Note that no network == no disk for kernel bootstrap mode
|
||||||
with open(os.path.join(self.git_dir, 'steps', 'pre-network-sources'), 'r') as source_list:
|
pre_src_path = os.path.join(self.git_dir, 'steps', 'pre-network-sources')
|
||||||
|
with open(pre_src_path, 'r', encoding="utf-8") as source_list:
|
||||||
for file in source_list.readlines():
|
for file in source_list.readlines():
|
||||||
file = file.strip()
|
file = file.strip()
|
||||||
shutil.copy2(os.path.join(self.distfiles_dir, file),
|
shutil.copy2(os.path.join(self.distfiles_dir, file),
|
||||||
|
|
|
@ -59,7 +59,8 @@ class Tmpdir:
|
||||||
mount("tmpfs", self.path, "tmpfs", f"size={size}")
|
mount("tmpfs", self.path, "tmpfs", f"size={size}")
|
||||||
self._type = TmpType.TMPFS
|
self._type = TmpType.TMPFS
|
||||||
|
|
||||||
def add_disk(self, name, size="16G", filesystem="ext4", tabletype="msdos", mkfs_args=[]):
|
# pylint: disable=too-many-arguments
|
||||||
|
def add_disk(self, name, size="16G", filesystem="ext4", tabletype="msdos", mkfs_args=None):
|
||||||
"""Add a disk"""
|
"""Add a disk"""
|
||||||
disk_path = os.path.join(self.path, f"{name}.img")
|
disk_path = os.path.join(self.path, f"{name}.img")
|
||||||
self._disks[name] = create_disk(disk_path, tabletype, filesystem, size, mkfs_args=mkfs_args)
|
self._disks[name] = create_disk(disk_path, tabletype, filesystem, size, mkfs_args=mkfs_args)
|
||||||
|
|
|
@ -31,8 +31,10 @@ def run_as_root(*args, **kwargs):
|
||||||
return run("sudo", *args, **kwargs)
|
return run("sudo", *args, **kwargs)
|
||||||
return run(*args, **kwargs)
|
return run(*args, **kwargs)
|
||||||
|
|
||||||
def create_disk(image, disk_type, fs_type, size, mkfs_args=[]):
|
def create_disk(image, disk_type, fs_type, size, mkfs_args=None):
|
||||||
"""Create a disk image, with a filesystem on it"""
|
"""Create a disk image, with a filesystem on it"""
|
||||||
|
if mkfs_args is None:
|
||||||
|
mkfs_args = []
|
||||||
run('truncate', '-s', size, image)
|
run('truncate', '-s', size, image)
|
||||||
# First find the device we will use, then actually use it
|
# First find the device we will use, then actually use it
|
||||||
loop_dev = run_as_root('losetup', '-f', capture_output=True).stdout.decode().strip()
|
loop_dev = run_as_root('losetup', '-f', capture_output=True).stdout.decode().strip()
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
/script-generator /steps/manifest
|
/script-generator /steps/manifest
|
||||||
/usr/bin/kaem --file /preseed-jump.kaem
|
/usr/bin/kaem --file /preseed-jump.kaem
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
* SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
*
|
*
|
||||||
* SPDX-License-Idnetifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_TOKEN 64
|
#define MAX_TOKEN 64
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
DISTFILES=/external/distfiles
|
DISTFILES=/external/distfiles
|
||||||
PREFIX=/usr
|
PREFIX=/usr
|
||||||
BINDIR=${PREFIX}/bin
|
BINDIR=${PREFIX}/bin
|
||||||
|
|
|
@ -289,7 +289,7 @@ default_src_unpack() {
|
||||||
# Then it copies our custom makefile and any other custom files from files directory.
|
# Then it copies our custom makefile and any other custom files from files directory.
|
||||||
default_src_prepare() {
|
default_src_prepare() {
|
||||||
if test -d "${patch_dir}"; then
|
if test -d "${patch_dir}"; then
|
||||||
if ls "${patch_dir}"/*.patch 2>&1 >/dev/null; then
|
if ls "${patch_dir}"/*.patch >/dev/null 2>&1; then
|
||||||
for p in "${patch_dir}"/*.patch; do
|
for p in "${patch_dir}"/*.patch; do
|
||||||
echo "Applying patch: ${p}"
|
echo "Applying patch: ${p}"
|
||||||
patch -Np0 < "${p}"
|
patch -Np0 < "${p}"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# Save because linux deletes all distfiles to save space
|
# Save because linux deletes all distfiles to save space
|
||||||
cp "${DISTFILES}"/musl-1.2.4.tar.gz /tmp
|
cp "${DISTFILES}"/musl-1.2.4.tar.gz /tmp
|
||||||
cp "${DISTFILES}"/curl-7.88.1.tar.bz2 /tmp
|
cp "${DISTFILES}"/curl-7.88.1.tar.bz2 /tmp
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
# Add the rest of the FHS that we will use and is not created pre-boot
|
# Add the rest of the FHS that we will use and is not created pre-boot
|
||||||
rm -rf /sbin /usr/sbin
|
rm -rf /sbin /usr/sbin
|
||||||
for d in bin lib sbin; do
|
for d in bin lib sbin; do
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
dhcpcd --waitip=4
|
dhcpcd --waitip=4
|
||||||
# Ensure network accessible
|
# Ensure network accessible
|
||||||
timeout=120
|
timeout=120
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
sed -i "/^LIBDIR/d" /steps/env
|
sed -i "/^LIBDIR/d" /steps/env
|
||||||
LIBDIR=${PREFIX}/lib/i386-unknown-linux-musl
|
LIBDIR=${PREFIX}/lib/i386-unknown-linux-musl
|
||||||
echo "LIBDIR=${LIBDIR}" >> /steps/env
|
echo "LIBDIR=${LIBDIR}" >> /steps/env
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# Set modified dates of all files to be 0 unix time.
|
# Set modified dates of all files to be 0 unix time.
|
||||||
# This function needs `touch` that supports --no-dereference
|
# This function needs `touch` that supports --no-dereference
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# http://www.linuxfromscratch.org/lfs/view/6.1/chapter06/devices.html
|
# http://www.linuxfromscratch.org/lfs/view/6.1/chapter06/devices.html
|
||||||
mkdir -p "/dev"
|
mkdir -p "/dev"
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
mkdir -p /external/repo
|
mkdir -p /external/repo
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
unset GUILE_LOAD_PATH
|
unset GUILE_LOAD_PATH
|
||||||
|
|
||||||
cat > /steps/env <<- EOF
|
cat > /steps/env <<- EOF
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
. /steps/bootstrap.cfg
|
. /steps/bootstrap.cfg
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
# This file follows a very simple, human readable and machine parseable syntax.
|
# This file follows a very simple, human readable and machine parseable syntax.
|
||||||
# Each line is in the format:
|
# Each line is in the format:
|
||||||
# <directive>: <arguments> <predicate>
|
# <directive>: <arguments> <predicate>
|
||||||
|
|
Loading…
Reference in New Issue