Compare commits
3
Commits
V0.8.1
...
d86cddbf24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d86cddbf24
|
||
|
|
d201402072
|
||
|
|
69c165e95c
|
No files matched your search
@@ -306,10 +306,20 @@ ls "$SDDIR" 2>/dev/null | head -25 || echo " (aucun service)"
|
|||||||
ls "$SDDIR/multi-user.target.wants/" 2>/dev/null || echo " (aucun symlink)"
|
ls "$SDDIR/multi-user.target.wants/" 2>/dev/null || echo " (aucun symlink)"
|
||||||
|
|
||||||
# Copie le repo local (fws-pacmanage + fws-dnd + deps Anaconda packagées)
|
# Copie le repo local (fws-pacmanage + fws-dnd + deps Anaconda packagées)
|
||||||
if ls "$WORK_DIR/local-repo/"*.pkg.tar.zst &>/dev/null 2>&1; then
|
# « ls glob » renvoie un statut d'échec dès qu'une entrée FANTÔME traîne dans
|
||||||
|
# local-repo (nom refusé par NTFS, laissé à moitié créé par un cp raté) : on
|
||||||
|
# testait alors « aucun repo » et l'ISO partait sans les paquets FWS. On sonde
|
||||||
|
# donc un fichier réellement stat-able, et on copie de même, un par un.
|
||||||
|
_localrepo_has=0
|
||||||
|
for _f in "$WORK_DIR/local-repo/"*.pkg.tar.*; do
|
||||||
|
if [ -e "$_f" ]; then _localrepo_has=1; break; fi
|
||||||
|
done
|
||||||
|
if [ "$_localrepo_has" = 1 ]; then
|
||||||
echo "==> Copie du repo local fws-local..."
|
echo "==> Copie du repo local fws-local..."
|
||||||
mkdir -p /tmp/fws-build/local-repo
|
mkdir -p /tmp/fws-build/local-repo
|
||||||
cp -a "$WORK_DIR/local-repo/"* /tmp/fws-build/local-repo/
|
for _f in "$WORK_DIR/local-repo/"*; do
|
||||||
|
if [ -e "$_f" ]; then cp -a "$_f" /tmp/fws-build/local-repo/; fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "==> Injection [fws-local] dans pacman.conf..."
|
echo "==> Injection [fws-local] dans pacman.conf..."
|
||||||
sed -i '/^\[fws-local\]/,/^$/d' /tmp/fws-build/releng/pacman.conf
|
sed -i '/^\[fws-local\]/,/^$/d' /tmp/fws-build/releng/pacman.conf
|
||||||
@@ -344,11 +354,25 @@ for _d in "$WORK_DIR"/pkgbuilds/*/; do
|
|||||||
[ -f "$_d/PKGBUILD" ] || continue
|
[ -f "$_d/PKGBUILD" ] || continue
|
||||||
_local_pkgs+=("$(basename "$_d")")
|
_local_pkgs+=("$(basename "$_d")")
|
||||||
done
|
done
|
||||||
|
# Liste AUR lue dans setup-aur.sh, sa seule source de vérité. L'extraction
|
||||||
|
# passe par bash : la déclaration est un tableau entre parenthèses, qu'un sed
|
||||||
|
# ramenait en UN SEUL mot — la comparaison ci-dessous ne matchait donc jamais
|
||||||
|
# packages.x86_64, et ce garde-fou ne vérifiait rien, en silence.
|
||||||
|
_aur_decl="$(awk '/^AUR_PACKAGES=\(/{f=1} f{print} f && /\)/{exit}' "$WORK_DIR/setup-aur.sh" 2>/dev/null)"
|
||||||
|
if [ -n "$_aur_decl" ]; then
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
_local_pkgs+=($(sed -n 's/^AUR_PACKAGES=(\(.*\))[[:space:]]*$//p' "$WORK_DIR/setup-aur.sh" 2>/dev/null))
|
_local_pkgs+=($(bash -c 'eval "$1"; printf "%s\n" "${AUR_PACKAGES[@]}"' _ "$_aur_decl" 2>/dev/null))
|
||||||
|
fi
|
||||||
|
# Présence testée par stat : « ls glob » renvoie un statut d'échec dès qu'une
|
||||||
|
# entrée fantôme traîne dans local-repo, et déclarerait absents des paquets
|
||||||
|
# pourtant présents.
|
||||||
for _p in "${_local_pkgs[@]}"; do
|
for _p in "${_local_pkgs[@]}"; do
|
||||||
grep -qx "$_p" /tmp/fws-build/releng/packages.x86_64 || continue
|
grep -qx "$_p" /tmp/fws-build/releng/packages.x86_64 || continue
|
||||||
ls "$WORK_DIR/local-repo/$_p"-[0-9]*.pkg.tar.* >/dev/null 2>&1 || _missing+=("$_p")
|
_found=0
|
||||||
|
for _f in "$WORK_DIR/local-repo/$_p"-[0-9]*.pkg.tar.*; do
|
||||||
|
if [ -e "$_f" ]; then _found=1; break; fi
|
||||||
|
done
|
||||||
|
[ "$_found" = 1 ] || _missing+=("$_p")
|
||||||
done
|
done
|
||||||
if [ "${#_missing[@]}" -gt 0 ]; then
|
if [ "${#_missing[@]}" -gt 0 ]; then
|
||||||
echo -e "\e[31m[ERR] Ces paquets sont demandés par packages.x86_64 mais absents de local-repo :\e[0m" >&2
|
echo -e "\e[31m[ERR] Ces paquets sont demandés par packages.x86_64 mais absents de local-repo :\e[0m" >&2
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ set -euo pipefail
|
|||||||
# ~3 Mo générés, vs 222 Mo pour le paquet glibc-locales complet.
|
# ~3 Mo générés, vs 222 Mo pour le paquet glibc-locales complet.
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
||||||
# --- Overlays pyanaconda (écran de progression FWS) ---------------------------
|
# --- Overlays pyanaconda (écran de progression FWS, journal en direct) ---------------------------
|
||||||
# mkarchiso copie l'airootfs AVANT le pacstrap (cf. fws/mkarchiso :
|
# mkarchiso copie l'airootfs AVANT le pacstrap (cf. fws/mkarchiso :
|
||||||
# _make_custom_airootfs puis _make_packages) : un fichier de l'airootfs qui
|
# _make_custom_airootfs puis _make_packages) : un fichier de l'airootfs qui
|
||||||
# remplace un fichier du paquet « anaconda » fait échouer pacman (« exists in
|
# remplace un fichier du paquet « anaconda » fait échouer pacman (« exists in
|
||||||
@@ -28,7 +28,8 @@ if [ -d /usr/local/share/fws/anaconda-overlay/pyanaconda ]; then
|
|||||||
|
|
||||||
# Le build doit s'arrêter net si l'overlay n'a pas atterri : sans lui, plus
|
# Le build doit s'arrêter net si l'overlay n'a pas atterri : sans lui, plus
|
||||||
# d'écran de progression détaillé (mais l'installateur fonctionne quand même).
|
# d'écran de progression détaillé (mais l'installateur fonctionne quand même).
|
||||||
for _f in modules/runtime/scripts/runtime.py modules/boss/installation.py; do
|
for _f in modules/runtime/scripts/runtime.py modules/boss/installation.py \
|
||||||
|
ui/gui/spokes/installation_progress.py; do
|
||||||
if [ ! -f "/usr/lib/python3.14/site-packages/pyanaconda/${_f}" ]; then
|
if [ ! -f "/usr/lib/python3.14/site-packages/pyanaconda/${_f}" ]; then
|
||||||
echo "[FWS] overlay pyanaconda manquant : ${_f}" >&2
|
echo "[FWS] overlay pyanaconda manquant : ${_f}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
+291
@@ -0,0 +1,291 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2011-2013 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This copyrighted material is made available to anyone wishing to use,
|
||||||
|
# modify, copy, or redistribute it subject to the terms and conditions of
|
||||||
|
# the GNU General Public License v.2, or (at your option) any later version.
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY expressed or implied, including the implied warranties of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
# Public License for more details. You should have received a copy of the
|
||||||
|
# GNU General Public License along with this program; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 31 Milk Street #960789 Boston, MA
|
||||||
|
# 02196 USA. Any Red Hat trademarks that are incorporated in the
|
||||||
|
# source code or documentation are not subject to the GNU General Public
|
||||||
|
# License and may only be used or replicated with the express permission of
|
||||||
|
# Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# FWS: this file is an overlay of the upstream Anaconda spoke. The only
|
||||||
|
# addition is a "journal" toggle under the progress bar that reveals a live
|
||||||
|
# tail of the FWS installation logs: the %pre and %post --nochroot logs on
|
||||||
|
# the live, and the chrooted %post log on the target. Without it, a user who
|
||||||
|
# saw the bar stop could not tell a slow mirror from a crash short of
|
||||||
|
# switching to a console, and the failures that matter (no EFI partition,
|
||||||
|
# no initramfs) are written as CRITIQUE in exactly those files.
|
||||||
|
#
|
||||||
|
import os
|
||||||
|
|
||||||
|
import gi
|
||||||
|
|
||||||
|
from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "3.0")
|
||||||
|
from gi.repository import GLib, Gtk
|
||||||
|
|
||||||
|
from pyanaconda.anaconda_loggers import get_module_logger
|
||||||
|
from pyanaconda.core import util
|
||||||
|
from pyanaconda.core.configuration.anaconda import conf
|
||||||
|
from pyanaconda.core.constants import IPMI_FINISHED
|
||||||
|
from pyanaconda.core.i18n import C_, _
|
||||||
|
from pyanaconda.core.product import get_product_name
|
||||||
|
from pyanaconda.flags import flags
|
||||||
|
from pyanaconda.modules.common.constants.services import RUNTIME
|
||||||
|
from pyanaconda.modules.common.structures.reboot import RebootData
|
||||||
|
from pyanaconda.ui.gui.hubs.summary import SummaryHub
|
||||||
|
from pyanaconda.ui.gui.spokes import StandaloneSpoke
|
||||||
|
from pyanaconda.ui.gui.utils import gtk_call_once
|
||||||
|
from pyanaconda.ui.lib.installation_progress_error import InstallationProgressErrorMixin
|
||||||
|
|
||||||
|
log = get_module_logger(__name__)
|
||||||
|
|
||||||
|
__all__ = ["ProgressSpoke"]
|
||||||
|
|
||||||
|
# Logs shown by the journal toggle, in the order the installation writes them.
|
||||||
|
# The target path is completed with conf.target.system_root at runtime.
|
||||||
|
FWS_LOGS = (
|
||||||
|
("pré-installation (live)", "/tmp/fws-pre.log"),
|
||||||
|
("préparation du disque (live)", "/tmp/fws-post-nochroot.log"),
|
||||||
|
("système installé", "var/log/fws-post.log"),
|
||||||
|
)
|
||||||
|
FWS_LOG_POLL_MS = 1000
|
||||||
|
# A log that is already large when the view opens is shown from its tail.
|
||||||
|
FWS_LOG_BACKLOG = 256 * 1024
|
||||||
|
FWS_LOG_MAX_CHARS = 2_000_000
|
||||||
|
|
||||||
|
|
||||||
|
class ProgressSpoke(StandaloneSpoke, InstallationProgressErrorMixin):
|
||||||
|
"""
|
||||||
|
.. inheritance-diagram:: ProgressSpoke
|
||||||
|
:parts: 3
|
||||||
|
"""
|
||||||
|
|
||||||
|
builderObjects = ["progressWindow"]
|
||||||
|
mainWidgetName = "progressWindow"
|
||||||
|
uiFile = "spokes/installation_progress.glade"
|
||||||
|
postForHub = SummaryHub
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_screen_id():
|
||||||
|
"""Return a unique id of this UI screen."""
|
||||||
|
return "installation-progress"
|
||||||
|
|
||||||
|
def __init__(self, data, storage, payload):
|
||||||
|
super().__init__(data, storage, payload)
|
||||||
|
self._progressBar = self.builder.get_object("progressBar")
|
||||||
|
self._progressLabel = self.builder.get_object("progressLabel")
|
||||||
|
self._progressNotebook = self.builder.get_object("progressNotebook")
|
||||||
|
self._spinner = self.builder.get_object("progressSpinner")
|
||||||
|
self._task_proxy = None
|
||||||
|
self._fws_build_log_view()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def completed(self):
|
||||||
|
"""This spoke is never completed, initially."""
|
||||||
|
return False
|
||||||
|
|
||||||
|
def apply(self):
|
||||||
|
"""There is nothing to apply."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _on_installation_done(self):
|
||||||
|
log.debug("The installation has finished.")
|
||||||
|
|
||||||
|
# Stop the spinner.
|
||||||
|
gtk_call_once(self._spinner.stop)
|
||||||
|
gtk_call_once(self._spinner.hide)
|
||||||
|
|
||||||
|
# Finish the installation task. Re-raise tracebacks if any.
|
||||||
|
self._task_proxy.Finish()
|
||||||
|
|
||||||
|
util.ipmi_report(IPMI_FINISHED)
|
||||||
|
|
||||||
|
if conf.license.eula:
|
||||||
|
self.set_warning(_("Use of this product is subject to the license agreement "
|
||||||
|
"found at %s") % conf.license.eula)
|
||||||
|
self.window.show_all()
|
||||||
|
|
||||||
|
# Show the reboot message.
|
||||||
|
self._progressNotebook.set_current_page(1)
|
||||||
|
|
||||||
|
# Enable the continue button.
|
||||||
|
self.window.set_may_continue(True)
|
||||||
|
|
||||||
|
# Hide the quit button.
|
||||||
|
quit_button = self.window.get_quit_button()
|
||||||
|
quit_button.hide()
|
||||||
|
|
||||||
|
runtime_proxy = RUNTIME.get_proxy()
|
||||||
|
reboot_data = RebootData.from_structure(runtime_proxy.Reboot)
|
||||||
|
# kickstart install, continue automatically if reboot or shutdown selected
|
||||||
|
if flags.automatedInstall and reboot_data.action in [KS_REBOOT, KS_SHUTDOWN]:
|
||||||
|
self.window.emit("continue-clicked")
|
||||||
|
|
||||||
|
def initialize(self):
|
||||||
|
super().initialize()
|
||||||
|
# Disable the continue button.
|
||||||
|
self.window.set_may_continue(False)
|
||||||
|
|
||||||
|
# Set the label of the continue button.
|
||||||
|
if conf.target.is_hardware and conf.system.can_reboot:
|
||||||
|
continue_label = C_("GUI|Progress", "_Reboot System")
|
||||||
|
else:
|
||||||
|
continue_label = C_("GUI|Progress", "_Finish Installation")
|
||||||
|
|
||||||
|
continue_button = self.window.get_continue_button()
|
||||||
|
continue_button.set_label(continue_label)
|
||||||
|
|
||||||
|
# Set the reboot label.
|
||||||
|
if conf.target.is_hardware:
|
||||||
|
continue_text = _(
|
||||||
|
"%s is now successfully installed and ready for you to use!\n"
|
||||||
|
"Go ahead and reboot your system to start using it!"
|
||||||
|
) % get_product_name()
|
||||||
|
else:
|
||||||
|
continue_text = _(
|
||||||
|
"%s is now successfully installed and ready for you to use!\n"
|
||||||
|
"Go ahead and quit the application to start using it!"
|
||||||
|
) % get_product_name()
|
||||||
|
|
||||||
|
label = self.builder.get_object("rebootLabel")
|
||||||
|
label.set_text(continue_text)
|
||||||
|
|
||||||
|
# Don't show the reboot message.
|
||||||
|
self._progressNotebook.set_current_page(0)
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
from pyanaconda.core.dbus import DBus
|
||||||
|
from pyanaconda.core.threads import thread_manager
|
||||||
|
from pyanaconda.modules.common.constants.services import BOSS
|
||||||
|
|
||||||
|
super().refresh()
|
||||||
|
|
||||||
|
# Wait for background threads to finish
|
||||||
|
if thread_manager.running > 1:
|
||||||
|
log.debug("Waiting for %s threads to finish...", thread_manager.running - 1)
|
||||||
|
for name in thread_manager.names:
|
||||||
|
log.debug("Thread %s is still running", name)
|
||||||
|
thread_manager.wait_all()
|
||||||
|
log.debug("No more threads are running, continuing with installation.")
|
||||||
|
|
||||||
|
# Initialize the progress bar
|
||||||
|
gtk_call_once(self._progressBar.set_fraction, 0.0)
|
||||||
|
|
||||||
|
# Start the installation task via D-Bus
|
||||||
|
boss_proxy = BOSS.get_proxy()
|
||||||
|
task_path = boss_proxy.InstallWithTasks()[0]
|
||||||
|
self._task_proxy = DBus.get_proxy(BOSS.service_name, task_path)
|
||||||
|
|
||||||
|
self._task_proxy.ProgressChanged.connect(self._on_progress_changed)
|
||||||
|
self._task_proxy.ErrorRaised.connect(self._on_error_raised)
|
||||||
|
self._task_proxy.Stopped.connect(self._on_installation_done)
|
||||||
|
|
||||||
|
self._task_proxy.Start()
|
||||||
|
|
||||||
|
# Start the spinner
|
||||||
|
gtk_call_once(self._spinner.start)
|
||||||
|
|
||||||
|
log.debug("The installation has started.")
|
||||||
|
|
||||||
|
# ---- FWS: live journal -------------------------------------------------
|
||||||
|
|
||||||
|
def _fws_build_log_view(self):
|
||||||
|
box = self.builder.get_object("progressBox")
|
||||||
|
|
||||||
|
self._fws_toggle = Gtk.ToggleButton(label="Afficher le journal")
|
||||||
|
self._fws_toggle.set_halign(Gtk.Align.START)
|
||||||
|
self._fws_toggle.connect("toggled", self._fws_on_toggled)
|
||||||
|
box.pack_start(self._fws_toggle, False, False, 6)
|
||||||
|
self._fws_toggle.show()
|
||||||
|
|
||||||
|
self._fws_text = Gtk.TextView(editable=False, cursor_visible=False,
|
||||||
|
monospace=True)
|
||||||
|
self._fws_text.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
|
||||||
|
self._fws_buffer = self._fws_text.get_buffer()
|
||||||
|
self._fws_end = self._fws_buffer.create_mark(
|
||||||
|
None, self._fws_buffer.get_end_iter(), False)
|
||||||
|
self._fws_scroll = Gtk.ScrolledWindow(vexpand=True, hexpand=True)
|
||||||
|
self._fws_scroll.set_policy(Gtk.PolicyType.AUTOMATIC,
|
||||||
|
Gtk.PolicyType.AUTOMATIC)
|
||||||
|
self._fws_scroll.set_min_content_height(260)
|
||||||
|
self._fws_scroll.set_shadow_type(Gtk.ShadowType.IN)
|
||||||
|
self._fws_scroll.add(self._fws_text)
|
||||||
|
self._fws_text.show()
|
||||||
|
# Hidden until the user asks for it: the plain progress screen stays
|
||||||
|
# the default.
|
||||||
|
box.pack_start(self._fws_scroll, True, True, 0)
|
||||||
|
|
||||||
|
root = conf.target.system_root
|
||||||
|
self._fws_logs = [
|
||||||
|
{"tag": tag, "path": path if path.startswith("/")
|
||||||
|
else os.path.join(root, path), "offset": None}
|
||||||
|
for tag, path in FWS_LOGS
|
||||||
|
]
|
||||||
|
self._fws_last_tag = None
|
||||||
|
self._fws_timer = None
|
||||||
|
|
||||||
|
def _fws_on_toggled(self, button):
|
||||||
|
if button.get_active():
|
||||||
|
button.set_label("Masquer le journal")
|
||||||
|
self._fws_scroll.show()
|
||||||
|
self._fws_poll()
|
||||||
|
if self._fws_timer is None:
|
||||||
|
self._fws_timer = GLib.timeout_add(FWS_LOG_POLL_MS,
|
||||||
|
self._fws_poll)
|
||||||
|
else:
|
||||||
|
button.set_label("Afficher le journal")
|
||||||
|
self._fws_scroll.hide()
|
||||||
|
if self._fws_timer is not None:
|
||||||
|
GLib.source_remove(self._fws_timer)
|
||||||
|
self._fws_timer = None
|
||||||
|
|
||||||
|
def _fws_poll(self):
|
||||||
|
"""Append what each log gained since the last poll. Always True so the
|
||||||
|
GLib timer keeps running while the view is shown."""
|
||||||
|
for entry in self._fws_logs:
|
||||||
|
try:
|
||||||
|
with open(entry["path"], "rb") as fh:
|
||||||
|
if entry["offset"] is None:
|
||||||
|
fh.seek(0, os.SEEK_END)
|
||||||
|
entry["offset"] = max(0, fh.tell() - FWS_LOG_BACKLOG)
|
||||||
|
fh.seek(entry["offset"])
|
||||||
|
data = fh.read()
|
||||||
|
except OSError:
|
||||||
|
# Not written yet: the chrooted %post has not started, or the
|
||||||
|
# log lives on the target which is not mounted yet.
|
||||||
|
continue
|
||||||
|
if not data:
|
||||||
|
continue
|
||||||
|
entry["offset"] += len(data)
|
||||||
|
text = data.decode("utf-8", errors="replace")
|
||||||
|
if self._fws_last_tag != entry["tag"]:
|
||||||
|
text = f"\n── {entry['tag']} : {entry['path']} ──\n{text}"
|
||||||
|
self._fws_last_tag = entry["tag"]
|
||||||
|
self._fws_append(text)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _fws_append(self, text):
|
||||||
|
buf = self._fws_buffer
|
||||||
|
buf.insert(buf.get_end_iter(), text)
|
||||||
|
if buf.get_char_count() > FWS_LOG_MAX_CHARS:
|
||||||
|
cut = buf.get_iter_at_offset(buf.get_char_count() - FWS_LOG_MAX_CHARS)
|
||||||
|
cut.forward_line()
|
||||||
|
buf.delete(buf.get_start_iter(), cut)
|
||||||
|
self._fws_text.scroll_to_mark(self._fws_end, 0.0, True, 0.0, 1.0)
|
||||||
|
|
||||||
|
def _on_progress_changed(self, step, message):
|
||||||
|
"""Handle a new progress report."""
|
||||||
|
if message:
|
||||||
|
gtk_call_once(self._progressLabel.set_text, message)
|
||||||
|
|
||||||
|
if self._task_proxy.Steps > 0:
|
||||||
|
gtk_call_once(self._progressBar.set_fraction, step/self._task_proxy.Steps)
|
||||||
+66
-5
@@ -237,6 +237,19 @@ chown -R "$BUILD_USER:$BUILD_USER" "$BUILD_DIR"
|
|||||||
# ============================================================
|
# ============================================================
|
||||||
mkdir -p "$LOCAL_REPO"
|
mkdir -p "$LOCAL_REPO"
|
||||||
|
|
||||||
|
# Certains FS (NTFS avec l'option « ads », FAT, partages exFAT) refusent « : »
|
||||||
|
# dans un nom de fichier, or makepkg nomme les paquets à epoch
|
||||||
|
# « <name>-<epoch>:<ver>-<rel>-<arch> ». Sans cette sonde, le run ne mourait
|
||||||
|
# qu'au premier paquet à epoch, en plein build, sur « Argument invalide ».
|
||||||
|
# On teste le FS une fois au démarrage pour l'annoncer, et publish_to_repo
|
||||||
|
# publie d'emblée sous un nom sans epoch : pacman lit l'epoch dans les
|
||||||
|
# métadonnées du paquet et dans la base du dépôt, jamais dans le nom.
|
||||||
|
if { : > "$LOCAL_REPO/.fws-probe:1"; } 2>/dev/null; then
|
||||||
|
rm -f "$LOCAL_REPO/.fws-probe:1"
|
||||||
|
else
|
||||||
|
warn "local-repo est sur un FS qui refuse « : » (NTFS/FAT) : les paquets à epoch seront publiés SANS epoch dans le nom (l'epoch reste dans les métadonnées)."
|
||||||
|
fi
|
||||||
|
|
||||||
# Version « [epoch:]pkgver-pkgrel » lue dans un PKGBUILD (sourcing en sous-shell).
|
# Version « [epoch:]pkgver-pkgrel » lue dans un PKGBUILD (sourcing en sous-shell).
|
||||||
# Vide si illisible → on (re)construit par sécurité. Nos paquets n'ont pas de
|
# Vide si illisible → on (re)construit par sécurité. Nos paquets n'ont pas de
|
||||||
# pkgver() VCS, donc le pkgver littéral est exact.
|
# pkgver() VCS, donc le pkgver littéral est exact.
|
||||||
@@ -249,11 +262,33 @@ pkgbuild_fullver() {
|
|||||||
# « -$ver- » borne la version (évite qu'« anaconda » matche « anaconda-widgets »).
|
# « -$ver- » borne la version (évite qu'« anaconda » matche « anaconda-widgets »).
|
||||||
repo_has() {
|
repo_has() {
|
||||||
[ -n "$2" ] || return 1
|
[ -n "$2" ] || return 1
|
||||||
local f
|
local v f
|
||||||
for f in "$LOCAL_REPO/$1-$2-"*.pkg.tar.*; do [ -e "$f" ] && return 0; done
|
# Deux formes à tester : avec l'epoch (nom produit par makepkg) et sans
|
||||||
|
# (nom publié — cf. publish_to_repo, qui le retire sur les FS qui refusent
|
||||||
|
# les deux-points).
|
||||||
|
local -a vers=("$2")
|
||||||
|
[ "${2#*:}" != "$2" ] && vers+=("${2#*:}")
|
||||||
|
for v in "${vers[@]}"; do
|
||||||
|
for f in "$LOCAL_REPO/$1-$v-"*.pkg.tar.*; do [ -e "$f" ] && return 0; done
|
||||||
|
done
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fichiers de <name> en version <fullver> réellement présents dans local-repo.
|
||||||
|
# Sert à réinstaller un paquet sauté : le nom sur disque peut être sans epoch.
|
||||||
|
repo_files() {
|
||||||
|
[ -n "$2" ] || return 1
|
||||||
|
local v f
|
||||||
|
local -a vers=("$2")
|
||||||
|
[ "${2#*:}" != "$2" ] && vers+=("${2#*:}")
|
||||||
|
for v in "${vers[@]}"; do
|
||||||
|
for f in "$LOCAL_REPO/$1-$v-"*.pkg.tar.*; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
printf '%s\n' "$f"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Installe des .pkg (pacman -U) en tolérant les fichiers RÉSIDUELS NON POSSÉDÉS
|
# Installe des .pkg (pacman -U) en tolérant les fichiers RÉSIDUELS NON POSSÉDÉS
|
||||||
# (« <pkg>: <path> exists in filesystem »). Ces fichiers sont des restes d'un
|
# (« <pkg>: <path> exists in filesystem »). Ces fichiers sont des restes d'un
|
||||||
# pacman -Syu interrompu (extraction à moitié faite, DB jamais commitée) : ils
|
# pacman -Syu interrompu (extraction à moitié faite, DB jamais commitée) : ils
|
||||||
@@ -335,7 +370,20 @@ publish_to_repo() {
|
|||||||
local name="$1"; shift
|
local name="$1"; shift
|
||||||
rm -f "$LOCAL_REPO/$name"-[0-9]*.pkg.tar.* \
|
rm -f "$LOCAL_REPO/$name"-[0-9]*.pkg.tar.* \
|
||||||
"$LOCAL_REPO/$name"-debug-[0-9]*.pkg.tar.* 2>/dev/null || true
|
"$LOCAL_REPO/$name"-debug-[0-9]*.pkg.tar.* 2>/dev/null || true
|
||||||
cp -f "$@" "$LOCAL_REPO/" || error "Copie de $name vers local-repo échouée"
|
# makepkg nomme les paquets à epoch « <name>-<epoch>:<ver>-<rel>-<arch> ».
|
||||||
|
# Certains FS (NTFS, FAT) refusent « : » dans un nom de fichier et la copie
|
||||||
|
# échoue en « Argument invalide ». On publie donc sous un nom SANS epoch :
|
||||||
|
# pacman lit l'epoch dans les métadonnées du paquet (et dans la base du
|
||||||
|
# dépôt), jamais dans le nom de fichier.
|
||||||
|
local f dest
|
||||||
|
for f in "$@"; do
|
||||||
|
dest="$LOCAL_REPO/$(basename "$f" | sed 's/-[0-9][0-9]*:/-/')"
|
||||||
|
cp -f "$f" "$dest" || error "Copie de $(basename "$f") vers local-repo échouée"
|
||||||
|
# Vérifie que la copie est bien un fichier lisible : un cp interrompu
|
||||||
|
# peut laisser un nom présent dans readdir mais absent au stat (entrée
|
||||||
|
# fantôme), que ni repo-add ni build.sh ne sauraient exploiter.
|
||||||
|
[ -s "$dest" ] || error "Paquet publié illisible : $dest (nom refusé par le FS de local-repo ?)"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Paquets construits SANS être installés dans l'environnement de build.
|
# Paquets construits SANS être installés dans l'environnement de build.
|
||||||
@@ -367,7 +415,11 @@ build_or_skip() {
|
|||||||
ver="$(pkgbuild_fullver "$d")"
|
ver="$(pkgbuild_fullver "$d")"
|
||||||
if repo_has "$name" "$ver"; then
|
if repo_has "$name" "$ver"; then
|
||||||
success "$name $ver déjà construit → saut"
|
success "$name $ver déjà construit → saut"
|
||||||
is_noinstall "$name" || pacman_ur "$LOCAL_REPO/$name-$ver-"*.pkg.tar.*
|
if ! is_noinstall "$name"; then
|
||||||
|
local -a skipfiles=()
|
||||||
|
mapfile -t skipfiles < <(repo_files "$name" "$ver")
|
||||||
|
if [ "${#skipfiles[@]}" -gt 0 ]; then pacman_ur "${skipfiles[@]}"; fi
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
info "Build $name ${ver:+($ver) }(peut prendre plusieurs minutes)…"
|
info "Build $name ${ver:+($ver) }(peut prendre plusieurs minutes)…"
|
||||||
@@ -468,7 +520,16 @@ step "4/4 — (Re)génération de la base du repo local fws-local"
|
|||||||
# local-repo contient déjà TOUS les paquets (construits ce run + sautés des
|
# local-repo contient déjà TOUS les paquets (construits ce run + sautés des
|
||||||
# runs précédents). On régénère juste la base de données pacman du dépôt.
|
# runs précédents). On régénère juste la base de données pacman du dépôt.
|
||||||
rm -f "$LOCAL_REPO"/fws-local.db* "$LOCAL_REPO"/fws-local.files* 2>/dev/null || true
|
rm -f "$LOCAL_REPO"/fws-local.db* "$LOCAL_REPO"/fws-local.files* 2>/dev/null || true
|
||||||
repo-add "$LOCAL_REPO/fws-local.db.tar.gz" "$LOCAL_REPO"/*.pkg.tar.* \
|
# Le glob peut ramener des entrées FANTÔMES : des noms refusés par le FS (NTFS
|
||||||
|
# n'accepte pas « : ») laissés à moitié créés par un cp raté. Elles sortent de
|
||||||
|
# readdir mais échouent au stat, et repo-add meurt dessus. On ne lui passe donc
|
||||||
|
# que les fichiers réellement lisibles.
|
||||||
|
_repo_pkgs=()
|
||||||
|
for _f in "$LOCAL_REPO"/*.pkg.tar.*; do
|
||||||
|
[ -e "$_f" ] && _repo_pkgs+=("$_f")
|
||||||
|
done
|
||||||
|
[ "${#_repo_pkgs[@]}" -gt 0 ] || error "local-repo ne contient aucun paquet à indexer"
|
||||||
|
repo-add "$LOCAL_REPO/fws-local.db.tar.gz" "${_repo_pkgs[@]}" \
|
||||||
|| error "repo-add a échoué"
|
|| error "repo-add a échoué"
|
||||||
success "Repo local prêt : $LOCAL_REPO"
|
success "Repo local prêt : $LOCAL_REPO"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user