Skip to content

Commit

Permalink
Cover various usages of apt-repos
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed Nov 17, 2024
1 parent 8cfd518 commit 5885fac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions scale_build/bootstrap/bootstrapdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil

from scale_build.clean import clean_packages
from scale_build.utils.manifest import get_manifest
from scale_build.utils.manifest import get_manifest, get_apt_repos
from scale_build.utils.paths import BUILDER_DIR, CHROOT_BASEDIR, REFERENCE_FILES, REFERENCE_FILES_DIR
from scale_build.utils.run import run

Expand Down Expand Up @@ -34,7 +34,7 @@ def debootstrap_debian(self):
['debootstrap'] + self.deopts + [
'--keyring', '/etc/apt/trusted.gpg.d/debian-archive-truenas-automatic.gpg',
manifest['debian_release'],
self.chroot_basedir, manifest['apt-repos']['url']
self.chroot_basedir, get_apt_repos(check_custom=True)['url']
]
)

Expand All @@ -45,7 +45,7 @@ def setup_impl(self):
return

self.add_trusted_apt_key()
apt_repos = get_manifest()['apt-repos']
apt_repos = get_apt_repos(check_custom=True)
self.debootstrap_debian()
self.setup_mounts()

Expand Down Expand Up @@ -151,7 +151,7 @@ def debootstrap_debian(self):
['debootstrap'] + self.deopts + [
'--foreign', '--keyring', '/etc/apt/trusted.gpg.d/debian-archive-truenas-automatic.gpg',
manifest['debian_release'],
self.chroot_basedir, manifest['apt-repos']['url']
self.chroot_basedir, get_apt_repos(check_custom=True)['url']
]
)
for reference_file in REFERENCE_FILES:
Expand Down
4 changes: 2 additions & 2 deletions scale_build/bootstrap/hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests
import urllib.parse

from scale_build.utils.manifest import get_manifest
from scale_build.utils.manifest import get_apt_repos
from scale_build.utils.run import run
from scale_build.utils.paths import CACHE_DIR, HASH_DIR

Expand All @@ -26,7 +26,7 @@ def get_repo_hash(repo_url: str, distribution: str) -> str:


def get_all_repo_hash():
apt_repos = get_manifest()['apt-repos']
apt_repos = get_apt_repos(check_custom=True)
# Start by validating the main APT repo
all_repo_hash = get_repo_hash(apt_repos['url'], apt_repos['distribution'])

Expand Down
9 changes: 5 additions & 4 deletions scale_build/image/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests

from scale_build.exceptions import CallError
from scale_build.utils.manifest import get_manifest
from scale_build.utils.manifest import get_apt_repos, get_manifest
from scale_build.utils.run import run
from scale_build.utils.paths import CD_DIR, CD_FILES_DIR, CHROOT_BASEDIR, CONF_GRUB, PKG_DIR, RELEASE_DIR, TMP_DIR
from scale_build.config import TRUENAS_VENDOR
Expand Down Expand Up @@ -133,7 +133,7 @@ def make_iso_file():
# Let's use pre-built Debian GRUB EFI image that the official Debian ISO installer uses.
with tempfile.NamedTemporaryFile(dir=RELEASE_DIR) as efi_img:
with tempfile.NamedTemporaryFile(suffix='.tar.gz') as f:
apt_repos = get_manifest()['apt-repos']
apt_repos = get_apt_repos(check_custom=True)
r = requests.get(
f'{apt_repos["url"]}dists/{apt_repos["distribution"]}/main/installer-amd64/current/images/cdrom/'
'debian-cd_info.tar.gz',
Expand All @@ -152,8 +152,9 @@ def make_iso_file():
run_in_chroot([
'grub-mkrescue',
'-o', iso,
'--efi-boot-part', os.path.join(RELEASE_DIR,
os.path.relpath(efi_img.name, os.path.abspath(RELEASE_DIR))),
'--efi-boot-part', os.path.join(
RELEASE_DIR, os.path.relpath(efi_img.name, os.path.abspath(RELEASE_DIR))
),
CD_DIR,
])

Expand Down
5 changes: 3 additions & 2 deletions scale_build/image/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import tempfile

from scale_build.config import SIGNING_KEY, SIGNING_PASSWORD
from scale_build.utils.manifest import get_manifest
from scale_build.utils.manifest import get_manifest, get_apt_repos
from scale_build.utils.run import run
from scale_build.utils.paths import CHROOT_BASEDIR, RELEASE_DIR, UPDATE_DIR

Expand Down Expand Up @@ -110,7 +110,8 @@ def install_rootfs_packages_impl():


def get_apt_sources():
apt_repos = get_manifest()['apt-repos']
# We want the final sources.list to be in the rootfs image
apt_repos = get_apt_repos(check_custom=False)
apt_sources = [f'deb {apt_repos["url"]} {apt_repos["distribution"]} {apt_repos["components"]}']
for repo in apt_repos['additional']:
apt_sources.append(f'deb {repo["url"]} {repo["distribution"]} {repo["component"]}')
Expand Down

0 comments on commit 5885fac

Please sign in to comment.