[arch-commits] Commit in deepin-go-lib/trunk (PKGBUILD dbus-fix.patch)
Felix Yan
felixonmars at archlinux.org
Thu Jan 3 20:47:07 UTC 2019
Date: Thursday, January 3, 2019 @ 20:47:06
Author: felixonmars
Revision: 420367
upgpkg: deepin-go-lib 1.8.0-1
Modified:
deepin-go-lib/trunk/PKGBUILD
Deleted:
deepin-go-lib/trunk/dbus-fix.patch
----------------+
PKGBUILD | 13 +----
dbus-fix.patch | 139 -------------------------------------------------------
2 files changed, 3 insertions(+), 149 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-01-03 20:46:40 UTC (rev 420366)
+++ PKGBUILD 2019-01-03 20:47:06 UTC (rev 420367)
@@ -1,7 +1,7 @@
# Maintainer: Felix Yan <felixonmars at archlinux.org>
pkgname=deepin-go-lib
-pkgver=1.7.0
+pkgver=1.8.0
pkgrel=1
pkgdesc='A library containing many useful go routines for things such as glib, gettext, archive, graphic,etc.'
arch=('any')
@@ -8,16 +8,9 @@
url="https://github.com/linuxdeepin/go-lib"
license=('GPL3')
depends=('libpulse' 'gdk-pixbuf2' 'mobile-broadband-provider-info' 'libx11')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/go-lib/archive/$pkgver.tar.gz"
- dbus-fix.patch)
-sha512sums=('edfc5f50e3126a2ef563027c2b000d60c25f5eee540fa49fb69c36a100bbc4bb3b46e1aa2b161fa93e8fee5223c95d4a7e241697cbb43044c61a60b3ce7ab1a7'
- '7cd2f41d0b26fce32a775043c4da2328e899f6bb8f34557e3c6f8f1d9a14ef9a218def555dabadb3e57ae501795c84c86e19172c39053b704c281277507bf181')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/go-lib/archive/$pkgver.tar.gz")
+sha512sums=('95eeed5857657453782cf7ed0e98152e899607675f3bfd187e5ba6b2e0a26964248539341380bcd09d877577d43909a47f820ade2c4d610aeedc0a5b847daaea')
-prepare() {
- cd go-lib-$pkgver
- patch -p1 -i ../dbus-fix.patch
-}
-
package() {
mkdir -p "$pkgdir"/usr/share/gocode/src/pkg.deepin.io
cp -a go-lib-$pkgver "$pkgdir"/usr/share/gocode/src/pkg.deepin.io/lib
Deleted: dbus-fix.patch
===================================================================
--- dbus-fix.patch 2019-01-03 20:46:40 UTC (rev 420366)
+++ dbus-fix.patch 2019-01-03 20:47:06 UTC (rev 420367)
@@ -1,139 +0,0 @@
-From e9e0a68a7eb72da7dfa181375e6ec891be89d662 Mon Sep 17 00:00:00 2001
-From: electricface <songwentai at deepin.com>
-Date: Sat, 29 Dec 2018 09:42:54 +0800
-Subject: [PATCH] fix(dbus): failed to find session bus address in systemd 240+
-
-Change-Id: I401cf471ad396003b950fc9fc038bbee0b60bc6c
----
-
-diff --git a/dbus/conn.go b/dbus/conn.go
-index 20f65b1..41bb6e5 100644
---- a/dbus/conn.go
-+++ b/dbus/conn.go
-@@ -110,14 +110,25 @@
- return
- }
-
-+func getSessionBusAddress() (string, error) {
-+ if address := os.Getenv("DBUS_SESSION_BUS_ADDRESS"); address != "" && address != "autolaunch:" {
-+ return address, nil
-+
-+ } else if address := tryDiscoverDbusSessionBusAddress(); address != "" {
-+ os.Setenv("DBUS_SESSION_BUS_ADDRESS", address)
-+ return address, nil
-+ }
-+ return getSessionBusPlatformAddress()
-+}
-+
- // SessionBusPrivate returns a new private connection to the session bus.
- func SessionBusPrivate() (*Conn, error) {
-- address := os.Getenv("DBUS_SESSION_BUS_ADDRESS")
-- if address != "" && address != "autolaunch:" {
-- return Dial(address)
-+ address, err := getSessionBusAddress()
-+ if err != nil {
-+ return nil, err
- }
-
-- return sessionBusPlatform()
-+ return Dial(address)
- }
-
- // SystemBus returns a shared connection to the system bus, connecting to it if
-diff --git a/dbus/conn_other.go b/dbus/conn_other.go
-index 293d8cb..d8d1adf 100644
---- a/dbus/conn_other.go
-+++ b/dbus/conn_other.go
-@@ -24,23 +24,87 @@
- import (
- "bytes"
- "errors"
-+ "fmt"
-+ "io/ioutil"
-+ "os"
- "os/exec"
-+ "os/user"
-+ "path"
-+ "strings"
- )
-
--func sessionBusPlatform() (*Conn, error) {
-- cmd := exec.Command("/usr/bin/dbus-launch")
-+func getSessionBusPlatformAddress() (string, error) {
-+ cmd := exec.Command("dbus-launch")
- b, err := cmd.CombinedOutput()
-
- if err != nil {
-- return nil, err
-+ return "", err
- }
-
- i := bytes.IndexByte(b, '=')
- j := bytes.IndexByte(b, '\n')
-
- if i == -1 || j == -1 {
-- return nil, errors.New("dbus: couldn't determine address of session bus")
-+ return "", errors.New("dbus: couldn't determine address of session bus")
- }
-
-- return Dial(string(b[i+1 : j]))
-+ env, addr := string(b[0:i]), string(b[i+1:j])
-+ os.Setenv(env, addr)
-+
-+ return addr, nil
-+}
-+
-+// tryDiscoverDbusSessionBusAddress tries to discover an existing dbus session
-+// and return the value of its DBUS_SESSION_BUS_ADDRESS.
-+// It tries different techniques employed by different operating systems,
-+// returning the first valid address it finds, or an empty string.
-+//
-+// * /run/user/<uid>/bus if this exists, it *is* the bus socket. present on
-+// Ubuntu 18.04
-+// * /run/user/<uid>/dbus-session: if this exists, it can be parsed for the bus
-+// address. present on Ubuntu 16.04
-+//
-+// See https://dbus.freedesktop.org/doc/dbus-launch.1.html
-+func tryDiscoverDbusSessionBusAddress() string {
-+ if runtimeDirectory, err := getRuntimeDirectory(); err == nil {
-+
-+ if runUserBusFile := path.Join(runtimeDirectory, "bus"); fileExists(runUserBusFile) {
-+ // if /run/user/<uid>/bus exists, that file itself
-+ // *is* the unix socket, so return its path
-+ return fmt.Sprintf("unix:path=%s", runUserBusFile)
-+ }
-+ if runUserSessionDbusFile := path.Join(runtimeDirectory, "dbus-session"); fileExists(runUserSessionDbusFile) {
-+ // if /run/user/<uid>/dbus-session exists, it's a
-+ // text file // containing the address of the socket, e.g.:
-+ // DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-E1c73yNqrG
-+
-+ if f, err := ioutil.ReadFile(runUserSessionDbusFile); err == nil {
-+ fileContent := string(f)
-+
-+ prefix := "DBUS_SESSION_BUS_ADDRESS="
-+
-+ if strings.HasPrefix(fileContent, prefix) {
-+ address := strings.TrimRight(strings.TrimPrefix(fileContent, prefix), "\n\r")
-+ return address
-+ }
-+ }
-+ }
-+ }
-+ return ""
-+}
-+
-+func getRuntimeDirectory() (string, error) {
-+ if currentUser, err := user.Current(); err != nil {
-+ return "", err
-+ } else {
-+ return fmt.Sprintf("/run/user/%s", currentUser.Uid), nil
-+ }
-+}
-+
-+func fileExists(filename string) bool {
-+ if _, err := os.Stat(filename); !os.IsNotExist(err) {
-+ return true
-+ } else {
-+ return false
-+ }
- }
More information about the arch-commits
mailing list