mirror of
https://abf.rosa.ru/djam/livecd-tools.git
synced 2025-02-23 15:42:58 +00:00
Workaround failing dependency resolution when bootstrapping chroot
It's a bad way of solving problems, but currently we don't have enought time to debug and solve them properly.
This commit is contained in:
parent
96a9f914e8
commit
2a864a20b0
4 changed files with 65 additions and 52 deletions
|
@ -1,6 +1,5 @@
|
|||
diff -Naur livecd-tools-21.1.orig/imgcreate/creator.py livecd-tools-21.1.new/imgcreate/creator.py
|
||||
--- livecd-tools-21.1.orig/imgcreate/creator.py 2015-07-07 18:42:31.899609044 +0300
|
||||
+++ livecd-tools-21.1.new/imgcreate/creator.py 2015-07-07 21:14:28.885166029 +0300
|
||||
--- livecd-tools-21.1/imgcreate/creator.py 2019-03-08 16:47:04.577622000 +0300
|
||||
+++ livecd-tools-21.1.patched/imgcreate/creator.py 2019-03-08 16:40:38.728219000 +0300
|
||||
@@ -25,6 +25,7 @@
|
||||
import shutil
|
||||
import logging
|
||||
|
@ -9,7 +8,7 @@ diff -Naur livecd-tools-21.1.orig/imgcreate/creator.py livecd-tools-21.1.new/img
|
|||
|
||||
import selinux
|
||||
import rpm
|
||||
@@ -577,17 +578,36 @@
|
||||
@@ -577,17 +578,23 @@
|
||||
urpmi_conf = self.__builddir + "/urpmi_conf"
|
||||
print urpmi_conf
|
||||
time.sleep(5)
|
||||
|
@ -17,6 +16,13 @@ diff -Naur livecd-tools-21.1.orig/imgcreate/creator.py livecd-tools-21.1.new/img
|
|||
- (name, baseurl, mirrorlist, proxy, inc, exc, cost, sslverify) = repo
|
||||
- subprocess.call(["/usr/sbin/urpmi.addmedia", "--urpmi-root", urpmi_conf, name, baseurl])
|
||||
- packages = self.ks.handler.packages.packageList
|
||||
- if "basesystem" in packages:
|
||||
- print "Basesystem should be installed first"
|
||||
- subprocess.call(["/usr/sbin/urpmi", "--auto", "--split-length", "0", "--fastunsafe", "--nolock", "--ignorearch", "--no-verify-rpm", "--no-suggests", "--urpmi-root", urpmi_conf, "--root", self._instroot] + ['basesystem'])
|
||||
-
|
||||
-
|
||||
- print "Now let's install all other packages"
|
||||
- subprocess.call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--no-verify", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
+ try:
|
||||
+ for repo in kickstart.get_repos(self.ks, repo_urls):
|
||||
+ (name, baseurl, mirrorlist, proxy, inc, exc, cost, sslverify) = repo
|
||||
|
@ -26,29 +32,12 @@ diff -Naur livecd-tools-21.1.orig/imgcreate/creator.py livecd-tools-21.1.new/img
|
|||
+
|
||||
+ packages = self.ks.handler.packages.packageList
|
||||
+ try:
|
||||
if "basesystem" in packages:
|
||||
print "Basesystem should be installed first"
|
||||
- subprocess.call(["/usr/sbin/urpmi", "--auto", "--split-length", "0", "--fastunsafe", "--nolock", "--ignorearch", "--no-verify-rpm", "--no-suggests", "--urpmi-root", urpmi_conf, "--root", self._instroot] + ['basesystem'])
|
||||
-
|
||||
-
|
||||
+ cmd = ["/usr/sbin/urpmi",
|
||||
+ "--auto", "--split-length", "0",
|
||||
+ "--fastunsafe", "--nolock", "--ignorearch",
|
||||
+ "--no-verify-rpm", "--no-suggests",
|
||||
+ "--urpmi-root", urpmi_conf,
|
||||
+ "--root", self._instroot,
|
||||
+ 'basesystem']
|
||||
+
|
||||
+ pattern = re.compile(r'^kernel-.*-latest$')
|
||||
+ kernel_pkgs = [pkg for pkg in packages if pattern.match(pkg)]
|
||||
+ if kernel_pkgs:
|
||||
+ cmd.extend(kernel_pkgs)
|
||||
+
|
||||
+ subprocess.check_call(cmd)
|
||||
+
|
||||
print "Now let's install all other packages"
|
||||
- subprocess.call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--no-verify", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
+ subprocess.check_call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--no-verify", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
+ print "Let's bootstrap chroot with all packages that must be installed into ISO..."
|
||||
+ os.environ["urpmiRoot"] = urpmi_conf
|
||||
+ os.environ["rpmRoot"] = self._instroot
|
||||
+ os.environ["packagesList"] = packages
|
||||
+ #subprocess.check_call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
+ subprocess.check_call("/usr/sbin/livecd-urpmi-bootstrapper")
|
||||
+ except subprocess.CalledProcessError, err:
|
||||
+ raise CreatorError("Package installation failed, error code %d" % err.returncode)
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
|
||||
index 156a95b..02b0cac 100644
|
||||
--- a/imgcreate/creator.py
|
||||
+++ b/imgcreate/creator.py
|
||||
@@ -592,7 +592,7 @@ class ImageCreator(object):
|
||||
cmd = ["/usr/sbin/urpmi",
|
||||
"--auto", "--split-length", "0",
|
||||
"--fastunsafe", "--nolock", "--ignorearch",
|
||||
- "--no-verify-rpm", "--no-suggests",
|
||||
+ "--no-suggests",
|
||||
"--urpmi-root", urpmi_conf,
|
||||
"--root", self._instroot,
|
||||
'basesystem']
|
||||
@@ -605,7 +605,7 @@ class ImageCreator(object):
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
print "Now let's install all other packages"
|
||||
- subprocess.check_call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--no-verify", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
+ subprocess.check_call(["/usr/sbin/urpmi", "--auto", "--no-suggests", "--fastunsafe", "--debug", "--urpmi-root", urpmi_conf, "--root", self._instroot] + packages)
|
||||
except subprocess.CalledProcessError, err:
|
||||
raise CreatorError("Package installation failed, error code %d" % err.returncode)
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
Summary: Tools for building live CDs
|
||||
Name: livecd-tools
|
||||
Version: 21.1
|
||||
Release: 33
|
||||
Release: 34
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: System/Base
|
||||
|
@ -11,6 +11,7 @@ Url: http://git.fedorahosted.org/git/livecd
|
|||
Source0: http://fedorahosted.org/releases/l/i/livecd/%{name}-%{version}.tar.bz2
|
||||
Source1: arch.py
|
||||
Source3: rosa-image-fix-x86.pl
|
||||
Source4: urpmi-bootstrapper.sh
|
||||
Patch0: livecd-tools-21.1.urpmi.patch
|
||||
Patch1: livecd-tools-21.1.split.install.patch
|
||||
Patch2: livecd-tools-21.1.efi.fixes.patch
|
||||
|
@ -29,7 +30,6 @@ Patch15: livecd-tools-21.1.secureboot.unsigned.kernel.patch
|
|||
Patch17: livecd-tools-21.1.efi.grub.cfg.echo.patch
|
||||
Patch18: livecd-tools-21.1.fixed.boot.menu.os.name.patch
|
||||
Patch19: livecd-tools-21.1.support.efi32.patch
|
||||
Patch20: livecd-tools-21.1.verify.signatures.patch
|
||||
Patch21: livecd-tools-21.1.use.add_drivers.patch
|
||||
Patch22: livecd-tools-21.1.no.vga.opts.patch
|
||||
Patch23: livecd-tools-21.1-genisoimage.patch
|
||||
|
@ -65,6 +65,7 @@ http://fedoraproject.org/wiki/FedoraLiveCD for more details.
|
|||
%{_bindir}/edit-livecd
|
||||
%{_bindir}/mkbiarch
|
||||
%{_bindir}/rosa-image-fix-x86.pl
|
||||
%{_sbindir}/livecd-urpmi-bootstrapper
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -104,4 +105,5 @@ make
|
|||
%makeinstall_std
|
||||
install -m 0644 %{SOURCE1} %{buildroot}%{python_sitelib}/imgcreate/
|
||||
install -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/
|
||||
|
||||
mkdir -p %{buildroot}%{_sbindir}/
|
||||
install -m 0755 %{SOURCE4} %{buildroot}%{_sbindir}/livecd-urpmi-bootstrapper
|
||||
|
|
44
urpmi-bootstrapper.sh
Executable file
44
urpmi-bootstrapper.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
# Author: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
# This script tries to "solve" problems with bootstrapping chroot,
|
||||
# where urpmi fails due to failed dependencies,
|
||||
# but, if we run it for multiple times, it does bootstrap all required packages.
|
||||
# Unfortunately, we currently don't have enought time to solve bootstrapping issues properly,
|
||||
# so let's make this ugly hack.
|
||||
# I previously made this hack in
|
||||
# https://github.com/mikhailnov/docker-rosa/blob/master/mkimage-urpmi.sh
|
||||
set -efu
|
||||
|
||||
# try to workaround urpmi bug due to which it randomly
|
||||
# can't resolve dependencies during bootstrap
|
||||
urpmi_bootstrap(){
|
||||
for urpmi_options in \
|
||||
"--auto --no-suggests --allow-force --allow-nodeps --ignore-missing" \
|
||||
"--auto --no-suggests"
|
||||
do
|
||||
urpmi \
|
||||
--urpmi-root "$urpmiRoot" \
|
||||
--root "$rpmRoot" \
|
||||
--fastunsafe --debug --no-verify \
|
||||
${urpmi_options} \
|
||||
${packagesList}
|
||||
urpmi_return_code="$?"
|
||||
done
|
||||
}
|
||||
# temporarily don't fail the whole scripts when not last iteration of urpmi fails
|
||||
set +e
|
||||
for i in $(seq 1 10)
|
||||
do
|
||||
urpmi_bootstrap
|
||||
if [ "${urpmi_return_code}" = 0 ]; then
|
||||
echo "urpmi iteration #${i} was successfull."
|
||||
break
|
||||
fi
|
||||
done
|
||||
# now check the return code of the _last_ urpmi iteration
|
||||
if [ "${urpmi_return_code}" != 0 ]; then
|
||||
echo "urpmi bootstrapping failed!"
|
||||
exit "${urpmi_return_code}"
|
||||
fi
|
||||
# return failing the whole script on any error
|
||||
set -e
|
Loading…
Add table
Reference in a new issue