summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO10
-rw-r--r--0001-cups-use-accessor-functions-instead-of-private-cups-.patch111
-rw-r--r--PKGBUILD30
3 files changed, 140 insertions, 11 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6cec105a1216..5372308aa4a7 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,7 @@
-# Generated by mksrcinfo v8
-# Wed Sep 12 10:49:16 UTC 2018
pkgbase = cloud-print-connector-git
pkgdesc = Share printers from your Windows, Linux, FreeBSD or OS X computer with ChromeOS and Android devices, using the Cloud Print Connector
- pkgver = v1.16.r2.g9386e53
- pkgrel = 1
+ pkgver = v1.16.r7.gcee4c3e
+ pkgrel = 2
url = https://github.com/google/cloud-print-connector
arch = i686
arch = x86_64
@@ -22,7 +20,9 @@ pkgbase = cloud-print-connector-git
conflicts = gcp-cups-connector
replaces = gcp-cups-connector
source = git+https://github.com/google/cloud-print-connector.git
- md5sums = SKIP
+ source = 0001-cups-use-accessor-functions-instead-of-private-cups-.patch
+ sha256sums = SKIP
+ sha256sums = 0ff47659ecf3af5e6438e241724cf33ee2add01ff0b14abd0226217885b8144e
pkgname = cloud-print-connector-git
diff --git a/0001-cups-use-accessor-functions-instead-of-private-cups-.patch b/0001-cups-use-accessor-functions-instead-of-private-cups-.patch
new file mode 100644
index 000000000000..169af6057da1
--- /dev/null
+++ b/0001-cups-use-accessor-functions-instead-of-private-cups-.patch
@@ -0,0 +1,111 @@
+From 6a77c7c283b83cbcc9cbfab59710023cd09da3ed Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Fri, 20 Dec 2019 13:43:33 +0000
+Subject: [PATCH] cups: use accessor functions instead of private cups fields
+
+Cups has made some structures private. https://github.com/apple/cups/commit/0fb02fb9cef39fd0b0c838f11af21d99fe5eab9b#diff-a299fb5293cedc8102f5963e50fbe22c
+Update the code to use accessor functions instead.
+---
+ cups/cups.c | 25 ++++++++++++++-----------
+ cups/cups.go | 12 ++++++------
+ 2 files changed, 20 insertions(+), 17 deletions(-)
+
+diff --git a/cups/cups.c b/cups/cups.c
+index 4f0b583..853cdb8 100644
+--- a/cups/cups.c
++++ b/cups/cups.c
+@@ -39,41 +39,44 @@ void freeStringArrayAndStrings(char **stringArray, int size) {
+ // getIPPRequestStatusCode gets the status_code field.
+ // This field is not visible to cgo (don't know why).
+ ipp_status_t getIPPRequestStatusCode(ipp_t *ipp) {
+- return ipp->request.status.status_code;
++
++ return ippGetStatusCode(ipp);
+ }
+
+ // getAttributeDateValue gets the ith date value from attr.
+ const ipp_uchar_t *getAttributeDateValue(ipp_attribute_t *attr, int i) {
+- return attr->values[i].date;
++ return ippGetDate(attr,i);
+ }
+
+ // getAttributeIntegerValue gets the ith integer value from attr.
+ int getAttributeIntegerValue(ipp_attribute_t *attr, int i) {
+- return attr->values[i].integer;
++ return ippGetInteger(attr,i);
+ }
+
+ // getAttributeStringValue gets the ith string value from attr.
+ const char *getAttributeStringValue(ipp_attribute_t *attr, int i) {
+- return attr->values[i].string.text;
++ return ippGetString(attr,i,NULL);
+ }
+
+ // getAttributeValueRange gets the ith range value from attr.
+ void getAttributeValueRange(ipp_attribute_t *attr, int i, int *lower,
+ int *upper) {
+- *lower = attr->values[i].range.lower;
+- *upper = attr->values[i].range.upper;
++ *lower = ippGetRange(attr,i,upper);
+ }
+
+ // getAttributeValueResolution gets the ith resolution value from attr.
+ // The values returned are always "per inch" not "per centimeter".
+ void getAttributeValueResolution(ipp_attribute_t *attr, int i, int *xres,
+ int *yres) {
+- if (IPP_RES_PER_CM == attr->values[i].resolution.units) {
+- *xres = attr->values[i].resolution.xres * 2.54;
+- *yres = attr->values[i].resolution.yres * 2.54;
++ int yreslocal;
++ ipp_res_t unitslocal;
++ int xreslocal = ippGetResolution(attr,i,&yreslocal,&unitslocal);
++ if (IPP_RES_PER_CM == unitslocal) {
++ *xres = xreslocal * 2.54;
++ *yres = yreslocal * 2.54;
+ } else {
+- *xres = attr->values[i].resolution.xres;
+- *yres = attr->values[i].resolution.yres;
++ *xres = xreslocal;
++ *yres = yreslocal;
+ }
+ }
+
+diff --git a/cups/cups.go b/cups/cups.go
+index efa3361..1826e83 100644
+--- a/cups/cups.go
++++ b/cups/cups.go
+@@ -240,13 +240,13 @@ func (c *CUPS) GetPrinters() ([]lib.Printer, error) {
+ func (c *CUPS) responseToPrinters(response *C.ipp_t) []lib.Printer {
+ printers := make([]lib.Printer, 0, 1)
+
+- for a := response.attrs; a != nil; a = a.next {
+- if a.group_tag != C.IPP_TAG_PRINTER {
++ for a := C.ippFirstAttribute(response); a != nil; a = C.ippNextAttribute(response) {
++ if C.ippGetGroupTag(a) != C.IPP_TAG_PRINTER {
+ continue
+ }
+
+ attributes := make([]*C.ipp_attribute_t, 0, C.int(len(c.printerAttributes)))
+- for ; a != nil && a.group_tag == C.IPP_TAG_PRINTER; a = a.next {
++ for ; a != nil && C.ippGetGroupTag(a) == C.IPP_TAG_PRINTER; a = C.ippNextAttribute(response) {
+ attributes = append(attributes, a)
+ }
+ mAttributes := attributesToMap(attributes)
+@@ -562,11 +562,11 @@ func attributesToMap(attributes []*C.ipp_attribute_t) map[string][]string {
+ m := make(map[string][]string)
+
+ for _, a := range attributes {
+- key := C.GoString(a.name)
+- count := int(a.num_values)
++ key := C.GoString(C.ippGetName(a))
++ count := int(C.ippGetCount(a))
+ values := make([]string, count)
+
+- switch a.value_tag {
++ switch C.ippGetValueTag(a) {
+ case C.IPP_TAG_NOVALUE, C.IPP_TAG_NOTSETTABLE:
+ // No value means no value.
+
+--
+2.26.2
+
diff --git a/PKGBUILD b/PKGBUILD
index ad779aae275d..ae0d6725f6f0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,9 +1,10 @@
-# Maintainer: grimsock <lord.grimsock at gmail dot com>
+# Maintainer: kXuan <kxuanobj at gmail dot com>
+# Contributor: grimsock <lord.grimsock at gmail dot com>
# Contributor: Fraser P. Newton <fpnewton90 [at] gmail [dot] com>
pkgname=cloud-print-connector-git
-pkgver=v1.16.r2.g9386e53
-pkgrel=1
+pkgver=v1.16.r7.gcee4c3e
+pkgrel=2
pkgdesc="Share printers from your Windows, Linux, FreeBSD or OS X computer with ChromeOS and Android devices, using the Cloud Print Connector"
arch=('i686' 'x86_64' 'armv7h' 'armv6h')
url="https://github.com/google/cloud-print-connector"
@@ -14,8 +15,12 @@ optdepends=('gcp-cups-connector-systemd')
provides=("${pkgname%-git}")
conflicts=('gcp-cups-connector')
replaces=('gcp-cups-connector')
-source=('git+https://github.com/google/cloud-print-connector.git')
-md5sums=('SKIP')
+source=(
+ 'git+https://github.com/google/cloud-print-connector.git'
+ '0001-cups-use-accessor-functions-instead-of-private-cups-.patch'
+)
+sha256sums=('SKIP'
+ '0ff47659ecf3af5e6438e241724cf33ee2add01ff0b14abd0226217885b8144e')
_gourl=github.com/google/cloud-print-connector
pkgver() {
@@ -23,8 +28,21 @@ pkgver() {
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
+prepare() {
+ pushd "cloud-print-connector"
+ for p in "${srcdir}"/*.patch; do
+ echo "Apply patch $p"
+ git apply $p
+ done
+ popd
+
+ mkdir -p "$srcdir/src/github.com/google"
+ ln -sfrn "cloud-print-connector" "$srcdir/src/github.com/google/"
+}
+
build() {
- GOPATH="$srcdir" go get -fix -v -x ${_gourl}/gcp-cups-connector
+ GOPATH="$srcdir" go get -fix -v -x ${_gourl}/gcp-cups-connector ||
+ GOPATH="$srcdir" go get -fix -v -x ${_gourl}/gcp-cups-connector # go get exit with status 1, but it seems everything is ok. Run again seems a good workaround.
GOPATH="$srcdir" go get -fix -v -x ${_gourl}/gcp-connector-util
}