Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] xbps-src improvements
Date: Thu, 13 Jun 2019 17:26:01 +0200	[thread overview]
Message-ID: <20190613152601.xOLBLTeTcBc2dIXFlr8N_uz3vgP-uc8VKaAhJ7G7-dU@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-12433@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

There is an updated pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages xbps-src-improvements
https://github.com/void-linux/void-packages/pull/12433

xbps-src improvements


A patch file from https://github.com/void-linux/void-packages/pull/12433.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-src-improvements-12433.patch --]
[-- Type: application/text/x-diff, Size: 8568 bytes --]

From 7608f7e1fcc046a9eb6d789653f139f6b98aec34 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 12 Jun 2019 23:50:19 +0200
Subject: [PATCH 1/5] xbps-src: don't check if base-chroot is installed for
 every single sourced template

---
 common/xbps-src/shutils/common.sh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index cdf1803a4d5..62d6ae30aec 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -372,12 +372,9 @@ setup_pkg() {
     esac
 
     # Check if base-chroot is already installed.
-    if [ -z "$bootstrap" -a "z$show_problems" != "zignore-problems" ]; then
-        check_installed_pkg base-chroot-0.1_1
-        if [ $? -ne 0 ]; then
-            msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n"
-            msg_error "Please install bootstrap packages and try again.\n"
-        fi
+    if [ -z "$bootstrap" -a -z "$CHROOT_READY" -a "z$show_problems" != "zignore-problems" ]; then
+        msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n"
+        msg_error "Please install bootstrap packages and try again.\n"
     fi
 
     sourcepkg="${pkgname}"

From 0e02b2a76e150549b6e3db4786fda78e7addd57b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 12 Jun 2019 23:51:09 +0200
Subject: [PATCH 2/5] xbps-src: less forking in get_subpkgs and
 unset_package_funcs

---
 common/xbps-src/shutils/common.sh | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 62d6ae30aec..604be91a3d1 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -258,21 +258,26 @@ run_pkg_hooks() {
 unset_package_funcs() {
     local f
 
-    for f in $(typeset -F|grep -E '_package$'); do
-        eval unset -f $f
+    for f in "$(typeset -F)"; do
+        case "$f" in
+        *_package)
+            set -- $f
+            unset -f "$3"
+            ;;
+        esac
     done
 }
 
 get_subpkgs() {
     local args list
 
-    args="$(typeset -F|grep -E '_package$')"
-    set -- ${args}
-    while [ $# -gt 0 ]; do
-        list+=" ${3%_package}"; shift 3
-    done
-    for f in ${list}; do
-        echo "$f"
+    for f in "$(typeset -F)"; do
+        case "$f" in
+        *_package)
+            set -- $f
+            echo "${3%_package}"
+            ;;
+        esac
     done
 }
 

From 97f1d6ef8ddb7b25bf5359e1967bf5c86966ff41 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 12 Jun 2019 23:52:24 +0200
Subject: [PATCH 3/5] xbps-src: simplify set_build_options

---
 common/xbps-src/shutils/common.sh | 47 +++++++++----------------------
 1 file changed, 13 insertions(+), 34 deletions(-)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 604be91a3d1..d09d8b08914 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -154,7 +154,7 @@ msg_normal_append() {
 }
 
 set_build_options() {
-    local f j opt optval _optsset pkgopts _pkgname
+    local f j opt optval pkgopts _pkgname
     local -A options
 
     if [ -z "$build_options" ]; then
@@ -170,30 +170,21 @@ set_build_options() {
         fi
         OIFS="$IFS"; IFS=','
         for j in ${pkgopts}; do
-            opt=${j#\~}
-            opt_disabled=${j:0:1}
-            if [ "$opt" = "$f" ]; then
-                if [ "$opt_disabled" != "~" ]; then
-                    eval options[$opt]=1
-                else
-                    eval options[$opt]=0
-                fi
-            fi
+            case "$j" in
+            "$f") options[$j]=1 ;;
+            "~$f") options[${j#\~}]=0 ;;
+            esac
         done
         IFS="$OIFS"
     done
 
     for f in ${build_options_default}; do
-        optval=${options[$f]}
-        if [[ -z "$optval" ]] || [[ $optval -eq 1 ]]; then
-            options[$f]=1
-        fi
+        [[ -z "${options[$f]}" ]] && options[$f]=1
     done
 
     # Prepare final options.
     for f in ${!options[@]}; do
-        optval=${options[$f]}
-        if [[ $optval -eq 1 ]]; then
+        if [[ ${options[$f]} -eq 1 ]]; then
             eval export build_option_${f}=1
         else
             eval unset build_option_${f}
@@ -210,25 +201,13 @@ set_build_options() {
         return 0
     fi
 
-    for f in ${build_options}; do
-        eval optval=${options[$f]}
-        if [[ $optval -eq 1 ]]; then
-            _optsset+=" ${f}"
-        else
-            _optsset+=" ~${f}"
-        fi
-    done
-
-    for f in ${_optsset}; do
-        if [ -z "$PKG_BUILD_OPTIONS" ]; then
-            PKG_BUILD_OPTIONS="$f"
-        else
-            PKG_BUILD_OPTIONS+=" $f"
-        fi
-    done
-
     # Sort pkg build options alphabetically.
-    export PKG_BUILD_OPTIONS="$(echo "$PKG_BUILD_OPTIONS"|tr ' ' '\n'|sort|tr '\n' ' ')"
+    export PKG_BUILD_OPTIONS=$(
+        for f in ${build_options}; do
+            [[ "${options[$f]}" -eq 1 ]] || printf '~'
+            printf '%s\n' "$f"
+        done | sort
+    )
 }
 
 source_file() {

From 5145c453b97681f1ac84252c77a5ca2a1c2b502b Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 13 Jun 2019 00:29:49 +0200
Subject: [PATCH 4/5] xbps-src: open $XBPS_MASTERDIR/etc/xbps/xbps-src.conf
 only once

---
 common/xbps-src/shutils/chroot.sh | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 50eb195a4bd..968ea0e843a 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -3,17 +3,11 @@
 # FIXME: $XBPS_FFLAGS is not set when chroot_init() is run
 # It is set in common/build-profiles/bootstrap.sh but lost somewhere?
 chroot_init() {
-    XBPSSRC_CF=$XBPS_MASTERDIR/etc/xbps/xbps-src.conf
-
     mkdir -p $XBPS_MASTERDIR/etc/xbps
 
-    cat > $XBPSSRC_CF <<_EOF
+    cat > $XBPS_MASTERDIR/etc/xbps/xbps-src.conf <<_EOF
 # Generated configuration file by xbps-src, DO NOT EDIT!
-_EOF
-    if [ -e "$XBPS_CONFIG_FILE" ]; then
-        grep -E '^XBPS_.*' $XBPS_CONFIG_FILE >> $XBPSSRC_CF
-    fi
-    cat >> $XBPSSRC_CF <<_EOF
+$(grep -E '^XBPS_.*' "$XBPS_CONFIG_FILE")
 XBPS_MASTERDIR=/
 XBPS_CFLAGS="$XBPS_CFLAGS"
 XBPS_CXXFLAGS="$XBPS_CXXFLAGS"
@@ -21,10 +15,9 @@ XBPS_FFLAGS="-fPIC -pipe"
 XBPS_CPPFLAGS="$XBPS_CPPFLAGS"
 XBPS_LDFLAGS="$XBPS_LDFLAGS"
 XBPS_HOSTDIR=/host
+# End of configuration file.
 _EOF
 
-    echo "# End of configuration file." >> $XBPSSRC_CF
-
     # Create custom script to start the chroot bash shell.
     cat > $XBPS_MASTERDIR/bin/xbps-shell <<_EOF
 #!/bin/sh

From 06506fe0cc537f5a493e18d511f12795dbba51ce Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Thu, 13 Jun 2019 00:37:59 +0200
Subject: [PATCH 5/5] xbps-src: use substitutions instead of sed for xbps-shell

---
 common/xbps-src/shutils/chroot.sh | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 968ea0e843a..ea8f7b62465 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -28,20 +28,12 @@ XBPS_SRC_VERSION="$XBPS_SRC_VERSION"
 
 PATH=/void-packages:/usr/bin:/usr/sbin
 
-exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" @@XARCH@@ \
-    @@CHECK@@ CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
+exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
+    ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
+    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
     PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
 _EOF
-    if [ -n "$XBPS_ARCH" ]; then
-        sed -e "s,@@XARCH@@,XBPS_ARCH=${XBPS_ARCH},g" -i $XBPS_MASTERDIR/bin/xbps-shell
-    else
-        sed -e 's,@@XARCH@@,,g' -i $XBPS_MASTERDIR/bin/xbps-shell
-    fi
-    if [ -z "$XBPS_CHECK_PKGS" ]; then
-        sed -e 's,@@CHECK@@,,g' -i $XBPS_MASTERDIR/bin/xbps-shell
-    else
-        sed -e "s,@@CHECK@@,XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS,g" -i $XBPS_MASTERDIR/bin/xbps-shell
-    fi
+
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
 
     cp -f /etc/resolv.conf $XBPS_MASTERDIR/etc

  parent reply	other threads:[~2019-06-13 15:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 21:58 [PR PATCH] " voidlinux-github
2019-06-12 22:00 ` [PR PATCH] [Updated] " voidlinux-github
2019-06-12 22:00 ` voidlinux-github
2019-06-12 22:03 ` voidlinux-github
2019-06-12 22:41 ` [PR PATCH] [Updated] " voidlinux-github
2019-06-12 22:41 ` voidlinux-github
2019-06-13 15:26 ` voidlinux-github [this message]
2019-06-13 15:26 ` voidlinux-github
2019-06-13 15:27 ` voidlinux-github
2019-06-13 15:27 ` voidlinux-github
2019-06-13 23:25 ` voidlinux-github
2019-06-13 23:25 ` voidlinux-github
2019-06-13 23:26 ` [PR PATCH] [Updated] [WIP] xbps-0.54 - " voidlinux-github
2019-06-13 23:26 ` voidlinux-github
2019-06-19  9:35 ` voidlinux-github
2019-07-05  9:47 ` [PR PATCH] [Closed]: " voidlinux-github
2019-07-05  9:51 ` voidlinux-github
2019-07-05  9:53 ` voidlinux-github

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190613152601.xOLBLTeTcBc2dIXFlr8N_uz3vgP-uc8VKaAhJ7G7-dU@z \
    --to=voidlinux-github@inbox.vuxu.org \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).