commit singularity for openSUSE:Factory
Hello community, here is the log from the commit of package singularity for openSUSE:Factory checked in at 2019-05-02 19:16:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/singularity (Old) and /work/SRC/openSUSE:Factory/.singularity.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "singularity" Thu May 2 19:16:41 2019 rev:9 rq:699554 version:2.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/singularity/singularity.changes 2019-02-19 12:02:40.305067650 +0100 +++ /work/SRC/openSUSE:Factory/.singularity.new.5148/singularity.changes 2019-05-02 19:16:42.857351503 +0200 @@ -1,0 +2,27 @@ +Sun Apr 28 06:32:08 UTC 2019 - Egbert Eich <eich@suse.com> + +- Improve support for openSUSE/SLE Singularity image creation: + * Add-support-for-SLE.patch + Add support for SLE. + * Create-chroot-only-after-settings-have-been-verified.patch + Create chroot only after settings have been verified. + * Don-t-hard-code-OS-version-if-non-is-specified.patch + Don't hard code OS version if non is specified. + * Handle-zypper-error-code-correctly.patch + Do not consider installation scriptlet failures an installation + failure. + * Support-multi-line-bootdef-settings.patch + If lines are separated by a '\' in a bootdef setting definition + concatenate them. If the characters before the trailing '\' are + '\n', replace by a newline. + * When-writing-a-file-to-the-container-unlink-if-it-exists-as-link-or-directory.patch + If a link or a directory exists with the same name as a file to + be written to the container, remove it before writing the the file. + Removing a link avoids issues if the link target cannot be written + to. + * Update README.SUSE: Describe bootdef variables. +- Fix rpmlint warning: + * api.py-Remove-shbang-not-meant-for-direct-execution.patch + Remove shbang - not meant for direct execution. + +------------------------------------------------------------------- New: ---- Add-support-for-SLE.patch Create-chroot-only-after-settings-have-been-verified.patch Don-t-hard-code-OS-version-if-non-is-specified.patch Handle-zypper-error-code-correctly.patch Support-multi-line-bootdef-settings.patch When-writing-a-file-to-the-container-unlink-if-it-exists-as-link-or-directory.patch api.py-Remove-shbang-not-meant-for-direct-execution.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ singularity.spec ++++++ --- /var/tmp/diff_new_pack.DZMAQU/_old 2019-05-02 19:16:43.749353142 +0200 +++ /var/tmp/diff_new_pack.DZMAQU/_new 2019-05-02 19:16:43.749353142 +0200 @@ -42,6 +42,14 @@ Source1: README.SUSE Source5: singularity-rpmlintrc Patch1: zypper-install-Fix-dbpath-for-newer-versions-of-SUSE-Linux.patch +Patch2: Handle-zypper-error-code-correctly.patch +Patch3: When-writing-a-file-to-the-container-unlink-if-it-exists-as-link-or-directory.patch +Patch4: Support-multi-line-bootdef-settings.patch +Patch5: api.py-Remove-shbang-not-meant-for-direct-execution.patch +Patch6: Add-support-for-SLE.patch +Patch7: Don-t-hard-code-OS-version-if-non-is-specified.patch +Patch8: Create-chroot-only-after-settings-have-been-verified.patch + BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool @@ -87,6 +95,13 @@ %prep %setup -q -n %{name}-%{github_ref} %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 cp %{S:1} . %build ++++++ Add-support-for-SLE.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Sun Apr 28 07:36:08 2019 +0200 Subject: Add support for SLE Patch-mainline: Not yet Git-commit: da37d2c1863e019a0d187f0c25620bc91649aac1 References: SLE uses SUSEConnect to register a product and find its repositories. SLE-15 requires the installer to be present as well as a list of modules. Signed-off-by: Egbert Eich <eich@suse.com> --- singularity-2.6.0/bootstrap-scripts/deffile-driver-zypper.sh | 116 ++++++++++++++++++--- 1 file changed, 103 insertions(+), 13 deletions(-) diff --git a/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh index 3052a52..d744d9e 100644 --- a/libexec/bootstrap-scripts/deffile-driver-zypper.sh +++ b/libexec/bootstrap-scripts/deffile-driver-zypper.sh @@ -37,6 +37,7 @@ if [ -z "${SINGULARITY_ROOTFS:-}" ]; then exit 1 fi +BASE_PACKAGE_LIST=aaa_base ########## BEGIN BOOTSTRAP SCRIPT ########## @@ -88,17 +89,68 @@ if [ -z "${OSVERSION:-}" ]; then fi fi -MIRROR=`echo "${MIRRORURL:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` -MIRROR_META=`echo "${METALINK:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` -if [ -z "${MIRROR:-}" ] && [ -z "${MIRROR_META:-}" ]; then - message ERROR "No 'MirrorURL' or 'MetaLink' defined in bootstrap definition\n" - ABORT 1 - fi +if [ -n "${SLEPRODUCT:-}" -o -n "${SLEUSER:-}" -o -n "${SLEREGCODE:-}" ]; then + if [ -z "${SLEPRODUCT:-}" -o -z "${SLEUSER:-}" -o -z "${SLEREGCODE:-}" ]; then + message ERROR "For installation of SLE 'SLEProduct', 'SLEUser' and 'SLERegcode' need to be set\n" + ABORT 1 + fi + + if [ -n "${MIRRORURL:-}" -o -n "${UPDATEURL:-}" ]; then + message ERROR "'MirrorURL' or 'UpdateURL' may not be defined together with 'SLEProduct', 'SLEUser' and 'SLERegcode'\n" + ABORT 1 + fi -MIRROR_UPDATES=`echo "${UPDATEURL:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` -MIRROR_UPDATES_META=`echo "${UPDATEMETALINK:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` -if [ -n "${MIRROR_UPDATES:-}" ] || [ -n "${MIRROR_UPDATES_META:-}" ]; then - message 1 "'UpdateURL' or 'UpdateMetaLink' defined in bootstrap definition\n" + SUSECONNECT_CMD=`singularity_which SUSEConnect` + if [ -z ${SUSECONNECT_CMD:-} ]; then + message ERROR "To install a SLE Product 'SUSEConnect' has to be installed\n" + ABORT 1 + fi + if [ -n "${SLEGPG:-}" ]; then + SUSECONNECT_GPGKEY=$(mktemp "/tmp/gkgkey-XXXXX") + echo "$SLEGPG" > $SUSECONNECT_GPGKEY + else + message ERROR "No 'SLEgpg' defined in bootstrap definition\n" + ABORT 1 + fi + OSMAJOR=${OSVERSION%%.*} + tmp=${OSVERSION#*.} + if [ $tmp -gt 0 ]; then + OSSERVICEPACK=-SP${tmp} + OSMINOR=".%{tmp}" + else + OSSERVICEPACK= + OSMINOR= + fi + if [[ ${SLEPRODUCT} =~ .+/.+/.+ ]]; then + SUSECONNECT_PRODUCT=${SLEPRODUCT} + SUSECONNECT_MODVER=${SLEPRODUCT#*/} + elif [[ ${SLEPRODUCT} =~ .+/.+ ]]; then + SUSECONNECT_PRODUCT=${SUSECONNECT_PRODUCT}/$(uname -m) + SUSECONNECT_MODVER=${SLEPRODUCT#*/}/$(uname -m) + else + SUSECONNECT_PRODUCT=${SLEPRODUCT}/$OSVERSION/$(uname -m) + SUSECONNECT_MODVER=$OSVERSION/$(uname -m) + fi + SUSECONNECT_PRODUCT=`echo "${SLEPRODUCT}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` + SUSECONNECT_MODVER=`echo "${SUSECONNECT_MODVER}" | sed -r "s/%\{?OSVERSION\}?/${OSMAJOR}${OSMINOR}/gi"` + + INSTALLER=`echo "${SLEINSTALLERURL:-}" | sed -r "s/%\{?OSVERSION\}?/${OSMAJOR}${OSSERVICEPACK}/gi"` + if [ ${OSMAJOR} -gt 12 -a -z "${INSTALLER:-}" ] ; then + message ERROR "No 'SLEInstallerURL' defined in bootstrap definition\n" + ABORT 1 + fi + BASE_PACKAGE_LIST="$BASE_PACKAGE_LIST SUSEConnect" +else + MIRROR=`echo "${MIRRORURL:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` + if [ -z "${MIRROR:-}" ] ; then + message ERROR "No 'MirrorURL' defined in bootstrap definition\n" + ABORT 1 + fi + + MIRROR_UPDATES=`echo "${UPDATEURL:-}" | sed -r "s/%\{?OSVERSION\}?/$OSVERSION/gi"` + if [ -n "${MIRROR_UPDATES:-}" ] ; then + message 1 "'UpdateURL' defined in bootstrap definition\n" + fi fi ZYPP_CONF="/etc/zypp/zypp.conf" @@ -115,12 +167,50 @@ echo "[main]" >> "$SINGULARITY_ROOTFS/$ZYPP_CONF" echo 'cachedir=/var/cache/zypp-bootstrap' >> "$SINGULARITY_ROOTFS/$ZYPP_CONF" echo "" >> "$SINGULARITY_ROOTFS/$ZYPP_CONF" -# Import zypper repos -$INSTALL_CMD --root $SINGULARITY_ROOTFS ar $MIRROR repo-oss +# On SLE import zypper repos using SCC +if [ -n "${SUSECONNECT_PRODUCT:-}" ]; then + case ${OSMAJOR} in + 12) mkdir -p $SINGULARITY_ROOTFS/var/lib/rpm + mkdir -p $SINGULARITY_ROOTFS/usr/lib/sysimage + rm -rf $SINGULARITY_ROOTFS/usr/lib/sysimage/rpm + ln -s ../../../var/lib/rpm $SINGULARITY_ROOTFS/usr/lib/sysimage/rpm + ;; + *) mkdir -p $SINGULARITY_ROOTFS/var/lib + mkdir -p $SINGULARITY_ROOTFS/usr/lib/sysimage/rpm + rm -rf $SINGULARITY_ROOTFS/var/lib/rpm + ln -s ../../usr/lib/sysimage/rpm $SINGULARITY_ROOTFS/var/lib/rpm + ;; + esac + rpmkeys --root=$SINGULARITY_ROOTFS --import $SUSECONNECT_GPGKEY + rm -f $SUSECONNECT_GPGKEY + [ -n "$INSTALLER" ] && $INSTALL_CMD --root $SINGULARITY_ROOTFS ar $INSTALLER Minimal_$OSVERSION + if ! eval "$SUSECONNECT_CMD --product $SUSECONNECT_PRODUCT \ + --root $SINGULARITY_ROOTFS \ + --email $SLEUSER \ + --regcode $SLEREGCODE \ + ${SLEURL:+--url $SLEURL}"; then + message ERROR "The 'SUSEConnect' command has failed. No repos available\n" + ABORT 1 + fi + OFS=$IFS + IFS=, + for i in $SLEMODULES; do + if ! eval "$SUSECONNECT_CMD -p $i/$SUSECONNECT_MODVER" --root $SINGULARITY_ROOTFS; then + message ERROR "Failed to register $i\n" + ABORT 1 + fi + done + IFS=$OFS +else + $INSTALL_CMD --root $SINGULARITY_ROOTFS ar $MIRROR repo-oss + if [ -n "${MIRROR_UPDATES:-}" ]; then + $INSTALL_CMD --root $SINGULARITY_ROOTFS ar $MIRROR_UPDATES repo-oss-update + fi +fi $INSTALL_CMD --root $SINGULARITY_ROOTFS --gpg-auto-import-keys refresh # Do the install! -eval "$INSTALL_CMD -c $SINGULARITY_ROOTFS/$ZYPP_CONF --root $SINGULARITY_ROOTFS --releasever=${OSVERSION} -n install --auto-agree-with-licenses aaa_base ${INCLUDE:-}" +eval "$INSTALL_CMD -c $SINGULARITY_ROOTFS/$ZYPP_CONF --root $SINGULARITY_ROOTFS --releasever=${OSVERSION} -n install --auto-agree-with-licenses ${BASE_PACKAGE_LIST} ${INCLUDE:-}" ret=$? case $ret in 0) message 1 "Bootstrap succeeded\n" ;; ++++++ Create-chroot-only-after-settings-have-been-verified.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Sun Apr 28 07:38:30 2019 +0200 Subject: Create chroot only after settings have been verified Patch-mainline: Not yet Git-commit: 8615d2ccc92dc756cf9749759b6e746273435991 References: Signed-off-by: Egbert Eich <eich@suse.com> --- .../bootstrap-scripts/deffile-driver-zypper.sh | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/libexec/bootstrap-scripts/deffile-driver-zypper.sh index 8a6d605..5fde90d 100644 --- a/libexec/bootstrap-scripts/deffile-driver-zypper.sh +++ b/libexec/bootstrap-scripts/deffile-driver-zypper.sh @@ -17,7 +17,6 @@ # file found in the top-level directory of this distribution and at # https://github.com/singularityware/singularity/blob/master/LICENSE-LBNL.md. - ## Basic sanity if [ -z "$SINGULARITY_libexecdir" ]; then echo "Could not identify the Singularity libexecdir." @@ -41,16 +40,6 @@ BASE_PACKAGE_LIST=aaa_base ########## BEGIN BOOTSTRAP SCRIPT ########## -umask 0002 - -install -d -m 0755 "$SINGULARITY_ROOTFS/dev" - -cp -a /dev/null "$SINGULARITY_ROOTFS/dev/null" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/null" -cp -a /dev/zero "$SINGULARITY_ROOTFS/dev/zero" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/zero" -cp -a /dev/random "$SINGULARITY_ROOTFS/dev/random" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/random" -cp -a /dev/urandom "$SINGULARITY_ROOTFS/dev/urandom" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/urandom" - - # dnf should probably be preferred if it's present, at some point we will make # a dnf specific bootstrap module. if INSTALL_CMD=`singularity_which zypper`; then @@ -153,13 +142,21 @@ else message 1 "'UpdateURL' defined in bootstrap definition\n" fi fi +umask 0002 + +mkdir -p "$SINGULARITY_ROOTFS" + +install -d -m 0755 "$SINGULARITY_ROOTFS/dev" + +cp -a /dev/null "$SINGULARITY_ROOTFS/dev/null" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/null" +cp -a /dev/zero "$SINGULARITY_ROOTFS/dev/zero" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/zero" +cp -a /dev/random "$SINGULARITY_ROOTFS/dev/random" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/random" +cp -a /dev/urandom "$SINGULARITY_ROOTFS/dev/urandom" 2>/dev/null || > "$SINGULARITY_ROOTFS/dev/urandom" ZYPP_CONF="/etc/zypp/zypp.conf" export ZYPP_CONF # Create the main portion of zypper config -mkdir -p "$SINGULARITY_ROOTFS" - ZYPP_CONF_DIRNAME=`dirname $ZYPP_CONF` mkdir -m 0755 -p "$SINGULARITY_ROOTFS/$ZYPP_CONF_DIRNAME" ++++++ Don-t-hard-code-OS-version-if-non-is-specified.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Sun Apr 28 07:37:38 2019 +0200 Subject: Don't hard code OS version if non is specified Patch-mainline: Not yet Git-commit: 922e74384dd3b48ab424d0e00d4f4658956247a5 References: Signed-off-by: Egbert Eich <eich@suse.com> --- singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh index d744d9e..8a6d605 100644 --- a/libexec/bootstrap-scripts/deffile-driver-zypper.sh +++ b/libexec/bootstrap-scripts/deffile-driver-zypper.sh @@ -85,7 +85,8 @@ if [ -z "${OSVERSION:-}" ]; then if [ -f "/etc/os-release" ]; then OSVERSION=`rpm -qf --qf '%{VERSION}' /etc/os-release` else - OSVERSION=12.2 + message ERROR "No OsVersion specified - bailing out\n" + ABORT 1 fi fi ++++++ Handle-zypper-error-code-correctly.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Wed Nov 21 21:02:12 2018 +0100 Subject: Handle zypper error code correctly Patch-mainline: Not yet Git-commit: d416e74f7b9184e24ed36366f87fc7ccf555fd46 References: Do not consider installation scriptlet failures an installation failure. Signed-off-by: Egbert Eich <eich@suse.com> --- .../libexec/bootstrap-scripts/deffile-driver-zypper.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh index 1f8252d..3052a52 100644 --- a/libexec/bootstrap-scripts/deffile-driver-zypper.sh +++ b/libexec/bootstrap-scripts/deffile-driver-zypper.sh @@ -120,10 +120,14 @@ $INSTALL_CMD --root $SINGULARITY_ROOTFS ar $MIRROR repo-oss $INSTALL_CMD --root $SINGULARITY_ROOTFS --gpg-auto-import-keys refresh # Do the install! -if ! eval "$INSTALL_CMD -c $SINGULARITY_ROOTFS/$ZYPP_CONF --root $SINGULARITY_ROOTFS --releasever=${OSVERSION} -n install --auto-agree-with-licenses aaa_base ${INCLUDE:-}"; then - message ERROR "Bootstrap failed... exiting\n" - ABORT 255 -fi +eval "$INSTALL_CMD -c $SINGULARITY_ROOTFS/$ZYPP_CONF --root $SINGULARITY_ROOTFS --releasever=${OSVERSION} -n install --auto-agree-with-licenses aaa_base ${INCLUDE:-}" +ret=$? +case $ret in + 0) message 1 "Bootstrap succeeded\n" ;; + 107) message 1 "Bootstrap succeeded, some RPM scripts failed\n" ;; + *) message ERROR "Bootstrap failed... return code: $ret - exiting\n"; + ABORT 255 ;; +esac if ! eval "rm -rf $SINGULARITY_ROOTFS/var/cache/zypp-bootstrap"; then message WARNING "Failed cleaning Bootstrap packages\n" ++++++ README.SUSE ++++++ --- /var/tmp/diff_new_pack.DZMAQU/_old 2019-05-02 19:16:43.805353245 +0200 +++ /var/tmp/diff_new_pack.DZMAQU/_new 2019-05-02 19:16:43.805353245 +0200 @@ -1,4 +1,4 @@ -openSUSE/SUSE specific settings +openSUSE/SUSE specific Settings =============================== Different from the upstream default, the SUID root binaries @@ -7,3 +7,76 @@ To add a user to the group singularity, execute (as root): # usermod -a -G singularity <user_login> + +Create Singularity Images from openSUSE/SLE +=========================================== + +To create openSUSE/SLE singularity images from scratch a number +of bootdef variables need to be specified: + +1. Create a bootdef file 'Singularity', add + BootStrap: zypper +2. Set the OS version: + OSVersion: 15.0 + The version number corresponds to the Leap version or the + SLE version and service pack level: <version>.<service_pack_level> + Example: SLE-12 SP4 would be 12.4. + The inital release of a major version corresponds to + <service_pack_level> 0. +3. For openSUSE the following additional variables need to be + specified: + * MirrorURL: URL to the installation repository. + Check 'man 8 zypper' fir supported formats + * UpdateURL: (optional) URI of the update repository +4. For SLE, all required settings are obtained from SCC. + The following variables are recognized: + * SLEProduct: The product code: The following forms may be + used: + <product_id> + <product_id>/<os_version> + <product_id>/<os_version>/<arch> + <product_id>: SLES, SLE-HPC (SLE-12), + SLE_HPC (SLE-15), SLED + <os_version>: optional, if ommitted, the value + of OSVersion will be used. + The variable %{OSVERSION} is + recognized and replaced by OSVersion. + <arch> : The architecture to use. Defaults + to 'uname -m'. + * SLEUser: The email a subscription is registed with SCC. + * SLERegcode: The SCC registration code provided with the subscription. + * SLEgpg: The GPG key used to sign the repositories. Each line must + be terminated with \n. Long lines may be broken using the + continuation character '\'. See below. + Beginning with version 15, the URI to the installer image needs to be + provided as well: + * SLEInstallerURL: See MirrorURL above. + Since SLE-15 consists of modules, a list of modules to be used should + to be specified as well: + * SLEModules: Specify the modules in a comma separated list without + spaces. Example: + SLEModules: sle-module-basesystem,sle-module-server-applications,sle-module-web-scripting,sle-module-hpc + +SLEgpg +====== +SLEgpg: -----BEGIN PGP PUBLIC KEY BLOCK-----\n\ +Version: rpm-4.11.2 (NSS-3)\n\ +\n\ +mQENBFEKlmsBCADbpZZbbSC5Zi+HxCR/ynYsVxU5JNNiSSZabN5GMgc9Z0hxeXxp\n\ +YWvFoE/4n0+IXIsp83iKvxf06Eu8je/DXp0lMqDZu7WiT3XXAlkOPSNV4akHTDoY\n\ +91SJaZCpgUJ7K1QXOPABNbREsAMN1a7rxBowjNjBUyiTJ2YuvQRLtGdK1kExsVma\n\ +hieh/QxpoDyYd5w/aky3z23erCoEd+OPfAqEHd5tQIa6LOosa63BSCEl3milJ7J9\n\ +vDmoGPAoS6ui7S2R5X4/+PLN8Mm2kOBrFjhmL93LX0mrGCMxsNsKgP6zabYKQEb8\n\ +L028SXvl7EGoA+Vw5Vd3wIGbM73PfbgNrXjfABEBAAG0KFN1U0UgUGFja2FnZSBT\n\ +aWduaW5nIEtleSA8YnVpbGRAc3VzZS5kZT6JATwEEwECACYCGwMGCwkIBwMCBBUC\n\ +CAMEFgIDAQIeAQIXgAUCWEfrHwUJDsIitAAKCRBwr56BOdt8gpqUB/wPSSS5BcDu\n\ +Oi4n02cj4Hdt7WITKBjjo0lG1fXG1ppx1wOST+s8FertMVFY53TW6FGjcYtwVOIq\n\ +rsMYiV6kf1NxUV/jcAy7VmC5EZnO0R/D3sT4Oh5hsLtERauZolK5BZmd0S51Qa8e\n\ +TxZ5mX9PL2i3s/ShETc30drf83ugc7B4yZPNQWXNDPgGcC+hEeC5qw48RzHYIpUt\n\ +RzHmefR5Z3ioTUbDlzy+SGP2uA7mhR4Lfk/df5fYxWfCoKlyGjtrvA65cB+Pksyn\n\ +xrAeBuB+vBM+KnDrxW2Sn4AbWkzH//dfz9OJDJu4UM91hb7qxM0OkrXHQV3iNqzg\n\ +MDEhky/9NqMy\n\ +=GdP5\n\ +-----END PGP PUBLIC KEY BLOCK----- + + ++++++ Support-multi-line-bootdef-settings.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Fri Nov 23 18:22:36 2018 +0100 Subject: Support multi-line bootdef settings Patch-mainline: Not yet Git-commit: 0891e1c634b6eeb84f2bacc6fe80339965c6be8a References: If lines are separated by a '\' in a bootdef setting definition concatenate them. If the characters before the trailing '\' are '\n', replace by a newline. Signed-off-by: Egbert Eich <eich@suse.com> Signed-off-by: Egbert Eich <eich@suse.de> --- singularity-2.6.0/src/builddef.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/singularity-2.6.0/src/builddef.c b/singularity-2.6.0/src/builddef.c index 3bbb044..d79e606 100644 --- a/src/builddef.c +++ b/src/builddef.c @@ -112,17 +112,39 @@ int main(int argc, char **argv) { if ( line[0] == '%' ) { // We hit a section, stop parsing for keyword tags break; } else if ( ( bootdef_key = strtok(line, ":") ) != NULL ) { + char *tmp, *bootdef_value = NULL; chomp(bootdef_key); + bootdef_key = strdup(bootdef_key); - char *bootdef_value; - - bootdef_value = strtok(NULL, "\n"); - char empty[] = ""; - if (bootdef_value == NULL) { - bootdef_value = empty; + tmp = strtok(NULL, "\n"); + if (tmp == NULL) { + bootdef_value = strdup(""); } else { - chomp(bootdef_value); + int follow_line; + do { + int len = strlen(tmp) - 1; + if (len >= 0 && tmp[len] == '\\') { + follow_line = 1; + tmp[len] = '\0'; + if (len > 1 && tmp[len - 2] == '\\' && tmp[len - 1] == 'n') { + tmp[len - 2] = '\n'; + tmp[len - 1] = '\0'; + } + } else { + follow_line = 0; + } + len = (bootdef_value != NULL) ? strlen(bootdef_value) : 0; + bootdef_value = (char *)realloc(bootdef_value, len + strlen(tmp) + 1); + if (len == 0) bootdef_value[0] = '\0'; + strcat(bootdef_value, tmp); + if (follow_line == 0 || + fgets(line, MAX_LINE_LEN, bootdef_fp) == NULL || + (tmp = strtok(line, "\n")) == NULL ) { + break; + } + } while (1); + chomp(bootdef_value); } singularity_message(VERBOSE2, "Got bootstrap definition key/val '%s' = '%s'\n", bootdef_key, bootdef_value); @@ -145,6 +167,8 @@ int main(int argc, char **argv) { // to environment envar_set(uppercase(bootdef_key), bootdef_value, 1); envar_set(strjoin("SINGULARITY_DEFFILE_", uppercase(bootdef_key)), bootdef_value, 1); + free(bootdef_key); + free(bootdef_value); } } ++++++ When-writing-a-file-to-the-container-unlink-if-it-exists-as-link-or-directory.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Wed Nov 21 21:07:46 2018 +0100 Subject: When writing a file to the container unlink if it exists as link or directory Patch-mainline: Not yet Git-commit: 52f13615df2b3cd47b6d0c4b7a86ed08de0fbb72 References: If a link or a directory exists with the same name as a file to be written to the container, remove it before writing the the file. Removing a link avoids issues if the link target cannot be written to. Signed-off-by: Egbert Eich <eich@suse.com> --- singularity-2.6.0/src/util/file.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/singularity-2.6.0/src/util/file.c b/singularity-2.6.0/src/util/file.c index 0d57a12..f6ab7b9 100644 --- a/src/util/file.c +++ b/src/util/file.c @@ -567,6 +567,7 @@ static int fileput(char *path, char *string, unsigned char privileged) { int fd; size_t string_len = strlen(string); struct stat st_dir; + int ret = 0; if ( current == NULL || dir == NULL ) { singularity_message(ERROR, "Failed to allocate memory\n"); @@ -609,6 +610,22 @@ static int fileput(char *path, char *string, unsigned char privileged) { singularity_priv_escalate(); } + if (is_link(bname)) { + ret = unlink(bname); + } else if (is_dir(bname)) { + ret = s_rmdir(bname); + } + if (ret < 0) { + singularity_message(ERROR, "Could remove %s %s: %s\n", + (is_dir(bname) == 0) ? "dir" : "link", path, strerror(errno)); + if ( privileged ) { + singularity_priv_drop(); + } + free(dup_path); + free(current); + free(dir); + return(-1); + } if ( ( fd = open(bname, O_CREAT|O_WRONLY|O_TRUNC|O_NOFOLLOW, 0644) ) < 0 ) { // Flawfinder: ignore if ( privileged ) { singularity_priv_drop(); ++++++ api.py-Remove-shbang-not-meant-for-direct-execution.patch ++++++ From: Egbert Eich <eich@suse.com> Date: Fri Jan 4 12:01:09 2019 +0100 Subject: api.py: Remove shbang - not meant for direct execution Patch-mainline: Not yet Git-commit: d399271d58197bd8f1c52a80ca39b868f8998da2 References: Signed-off-by: Egbert Eich <eich@suse.com> --- singularity-2.6.0/libexec/python/shub/api.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/singularity-2.6.0/libexec/python/shub/api.py b/singularity-2.6.0/libexec/python/shub/api.py index ce7574a..276c108 100644 --- a/libexec/python/shub/api.py +++ b/libexec/python/shub/api.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - ''' api.py: Singularity Hub helper functions for python ++++++ zypper-install-Fix-dbpath-for-newer-versions-of-SUSE-Linux.patch ++++++ --- /var/tmp/diff_new_pack.DZMAQU/_old 2019-05-02 19:16:43.857353340 +0200 +++ /var/tmp/diff_new_pack.DZMAQU/_new 2019-05-02 19:16:43.857353340 +0200 @@ -9,7 +9,7 @@ --- singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/libexec/bootstrap-scripts/deffile-driver-zypper.sh +diff --git a/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh b/singularity-2.6.0/libexec/bootstrap-scripts/deffile-driver-zypper.sh index 5e0470c..1f8252d 100644 --- a/libexec/bootstrap-scripts/deffile-driver-zypper.sh +++ b/libexec/bootstrap-scripts/deffile-driver-zypper.sh
participants (1)
-
root