Github messages for voidlinux
 help / color / Atom feed
* [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
@ 2019-07-27  0:51 voidlinux-github
  2019-07-30 15:34 ` voidlinux-github
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: voidlinux-github @ 2019-07-27  0:51 UTC (permalink / raw)
  To: ml

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

There is a new pull request by q66 against master on the void-packages repository

https://github.com/void-ppc/void-packages xbps-libc
https://github.com/void-linux/void-packages/pull/13356

xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
This can be used in template checks to remove the clunky case statements and pattern matching, as well as simplify normal ifs.

For example:

```
if [ "${XBPS_TARGET_MACHINE%-musl}" = "${XBPS_TARGET_MACHINE}" ]; then
    ... glibc specific ...
fi
```

or

```
case "$XBPS_TARGET_MACHINE" in
    *-musl) ;;
    *) ... glibc specific ...
esac
```

becomes a simple:

```
if [ "${XBPS_TARGET_LIBC}" = "glibc" ]; then
   ... glibc specific ...
fi
```

I've noticed these are common enough of patterns in our stuff to make this worthwhile. The implementation should be sound, I checked and there aren't any `uname` values with a dash in them.

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

[-- Warning: decoded text below may be mangled --]
[-- Attachment #2: github-pr-xbps-libc-13356.patch --]
[-- Type: text/x-diff, Size: 1406 bytes --]

From 359fd986fd67956560fa7317bd7a5cc21f8f2eb4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 27 Jul 2019 02:44:57 +0200
Subject: [PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC

This can be used in template checks to remove the clunky case
statements and pattern matching, as well as simplify normal ifs.

For example:

if [ "${XBPS_TARGET_MACHINE%-musl}" = "${XBPS_TARGET_MACHINE}" ]; then
    ... glibc specific ...
fi

becomes:

if [ "${XBPS_TARGET_LIBC}" = "glibc" ]; then
   ... glibc specific ...
fi
---
 common/xbps-src/shutils/common.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/xbps-src/shutils/common.sh b/common/xbps-src/shutils/common.sh
index 146d4e0604d..6aa9ad14d7e 100644
--- a/common/xbps-src/shutils/common.sh
+++ b/common/xbps-src/shutils/common.sh
@@ -312,6 +312,18 @@ setup_pkg() {
         XBPS_CHECKVERS_XCMD="$XBPS_CHECKVERS_CMD"
     fi
 
+    if [ "${XBPS_MACHINE%-*}" = "${XBPS_MACHINE}" ]; then
+        export XBPS_LIBC="glibc"
+    else
+        export XBPS_LIBC="${XBPS_MACHINE#*-}"
+    fi
+
+    if [ "${XBPS_TARGET_MACHINE%-*}" = "${XBPS_TARGET_MACHINE}" ]; then
+        export XBPS_TARGET_LIBC="glibc"
+    else
+        export XBPS_TARGET_LIBC="${XBPS_TARGET_MACHINE#*-}"
+    fi
+
     export XBPS_INSTALL_XCMD XBPS_QUERY_XCMD XBPS_RECONFIGURE_XCMD \
         XBPS_REMOVE_XCMD XBPS_RINDEX_XCMD XBPS_UHELPER_XCMD
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
  2019-07-27  0:51 [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC voidlinux-github
@ 2019-07-30 15:34 ` voidlinux-github
  2019-07-30 15:38 ` voidlinux-github
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: voidlinux-github @ 2019-07-30 15:34 UTC (permalink / raw)
  To: ml

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

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/13356#issuecomment-516472989
Comment:
This should work AFAICT while I think it'd be better to add this to the profiles.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
  2019-07-27  0:51 [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC voidlinux-github
  2019-07-30 15:34 ` voidlinux-github
@ 2019-07-30 15:38 ` voidlinux-github
  2019-07-30 15:38 ` voidlinux-github
  2019-07-30 15:39 ` voidlinux-github
  3 siblings, 0 replies; 5+ messages in thread
From: voidlinux-github @ 2019-07-30 15:38 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/13356#issuecomment-516474521
Comment:
Why? IMO if the variable can be guessed from available information, there isn't any need to further complicate the profiles by explicitly specifying it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
  2019-07-27  0:51 [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC voidlinux-github
  2019-07-30 15:34 ` voidlinux-github
  2019-07-30 15:38 ` voidlinux-github
@ 2019-07-30 15:38 ` voidlinux-github
  2019-07-30 15:39 ` voidlinux-github
  3 siblings, 0 replies; 5+ messages in thread
From: voidlinux-github @ 2019-07-30 15:38 UTC (permalink / raw)
  To: ml

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

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/13356#issuecomment-516472989
Comment:
This should work AFAICT while I think it'd be better to add this to the profiles.
Perhaps at the same time we could once and for all define the endianness of the machine and target as well.
`XBPS_ENDIAN=little` or `XBPS_ENDIAN=big` and also `XBPS_TARGET_ENDIAN...` in cross-profiles. No more case/esac for endianness specific template sections.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC
  2019-07-27  0:51 [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC voidlinux-github
                   ` (2 preceding siblings ...)
  2019-07-30 15:38 ` voidlinux-github
@ 2019-07-30 15:39 ` voidlinux-github
  3 siblings, 0 replies; 5+ messages in thread
From: voidlinux-github @ 2019-07-30 15:39 UTC (permalink / raw)
  To: ml

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

New comment by pullmoll on void-packages repository

https://github.com/void-linux/void-packages/pull/13356#issuecomment-516474865
Comment:
It's a matter of taste I'd say. I would like to have everything (most things) in one place.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-27  0:51 [PR PATCH] xbps-src: add XBPS_LIBC/XBPS_TARGET_LIBC voidlinux-github
2019-07-30 15:34 ` voidlinux-github
2019-07-30 15:38 ` voidlinux-github
2019-07-30 15:38 ` voidlinux-github
2019-07-30 15:39 ` voidlinux-github

Github messages for voidlinux

Archives are clonable: git clone --mirror http://inbox.vuxu.org/voidlinux-github

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.voidlinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git