Skip to contentSkip to conversation

uhubctl: add recipe

PATCH Superseded Richard Leitner 2 participants 3 messages May 22, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uhubctl: add recipe

Add recipe for uhubctl v2.0.0, an utility to control USB power per-port on "smart" USB hubs.

---
 ...001-Makefile-set-program-version-to-2.0.0.patch | 34 ++++++++++++++++++++++
 meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb   | 22 ++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch
 create mode 100644 meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +34 -0
new file mode 100644
index 000000000..e9e06bc71
@@ -0,0 +1,34 @@
+From 4f241d2f407e834c30db4047cfb6863cd5f14ea6 Mon Sep 17 00:00:00 2001
+From: Richard Leitner <[email protected]>
+Date: Tue, 22 May 2018 13:42:20 +0200
+Subject: [PATCH] Makefile: set program version to 2.0.0
+
+Remove the dynamic PROGRAM_VERSION gathering via "git describe" an
+replace it with the hardcoded value "2.0.0".
+
+This is needed because "git describe" fails with an error when executed
+in a non-git directory as it will occur when uhubctl source is not
+downloaded via "git clone". But for example as an source archive.
+
+Signed-off-by: Richard Leitner <[email protected]>
+---
+ Makefile | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7074cbf..c80fa17 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,8 +14,7 @@ RM		:= rm -rf
+ CC ?= gcc
+ CFLAGS ?= -g -O0
+ CFLAGS += -Wall -Wextra -std=c99 -pedantic
+-GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
+-CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
++CFLAGS += -DPROGRAM_VERSION=\"2.0.0\"
+ 
+ ifeq ($(UNAME_S),Linux)
+ 	LDFLAGS += -Wl,-z,relro -lusb-1.0
+-- 
+2.11.0
+
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +22 -0
new file mode 100644
index 000000000..80fc92332
@@ -0,0 +1,22 @@
+SUMMARY = "USB hub per-port power control"
+HOMEPAGE = "https://github.com/mvp/uhubctl"
+BUGTRACKER = "https://github.com/mvp/uhubctl/issues"
+DEPENDS = "libusb1"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "\
+    https://github.com/mvp/${PN}/archive/v${PV}.tar.gz \
+    file://0001-Makefile-set-program-version-to-2.0.0.patch \
+    "
+SRC_URI[md5sum] = "5c711911d766d76813333c3812277574"
+SRC_URI[sha256sum] = "4c31278b2c03e5be5a696c3088bc86cf2557a70e00f697799c163aba18e3c40e"
+
+S = "${WORKDIR}/${PN}-${PV}"
+
+do_install () {
+    oe_runmake install DESTDIR=${D}
+}
+
+FILES_${PN} = "${sbindir}/uhubctl"
Signature · 1 line
2.11.0
#1 lore raw
Quoted 35 lines · Richard Leitner

Add recipe for uhubctl v2.0.0, an utility to control USB power per-port on "smart" USB hubs.

---
 ...001-Makefile-set-program-version-to-2.0.0.patch | 34 ++++++++++++++++++++++
 meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb   | 22 ++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch
 create mode 100644 meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +18 -0
new file mode 100644
index 000000000..e9e06bc71
@@ -0,0 +1,34 @@
+From 4f241d2f407e834c30db4047cfb6863cd5f14ea6 Mon Sep 17 00:00:00 2001
+From: Richard Leitner <[email protected]>
+Date: Tue, 22 May 2018 13:42:20 +0200
+Subject: [PATCH] Makefile: set program version to 2.0.0
+
+Remove the dynamic PROGRAM_VERSION gathering via "git describe" an
+replace it with the hardcoded value "2.0.0".
+
+This is needed because "git describe" fails with an error when executed
+in a non-git directory as it will occur when uhubctl source is not
+downloaded via "git clone". But for example as an source archive.
+
+Signed-off-by: Richard Leitner <[email protected]>
+---
+ Makefile | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile

meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch line 28

Quoted 10 lines
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +10 -0
+index 7074cbf..c80fa17 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,8 +14,7 @@ RM           := rm -rf
+ CC ?= gcc
+ CFLAGS ?= -g -O0
+ CFLAGS += -Wall -Wextra -std=c99 -pedantic
+-GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always --tags)
+-CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
++CFLAGS += -DPROGRAM_VERSION=\"2.0.0\"

can we do it via some other means ? may be via sed or some such and use ${PV} be used instead of hardcoding version.

Quoted 19 lines
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +6 -0
+
+ ifeq ($(UNAME_S),Linux)
+       LDFLAGS += -Wl,-z,relro -lusb-1.0
+--
+2.11.0
+
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +7 -0
new file mode 100644
index 000000000..80fc92332
@@ -0,0 +1,22 @@
+SUMMARY = "USB hub per-port power control"
+HOMEPAGE = "https://github.com/mvp/uhubctl"
+BUGTRACKER = "https://github.com/mvp/uhubctl/issues"
+DEPENDS = "libusb1"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 17

Quoted 10 lines
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +10 -0
+
+SRC_URI = "\
+    https://github.com/mvp/${PN}/archive/v${PV}.tar.gz \
+    file://0001-Makefile-set-program-version-to-2.0.0.patch \
+    "
+SRC_URI[md5sum] = "5c711911d766d76813333c3812277574"
+SRC_URI[sha256sum] = "4c31278b2c03e5be5a696c3088bc86cf2557a70e00f697799c163aba18e3c40e"
+
+S = "${WORKDIR}/${PN}-${PV}"
+

this looks redundant.

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 21

Quoted 4 lines
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +4 -0
+do_install () {
+    oe_runmake install DESTDIR=${D}
+}
+

do we need this ?

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 22

Quoted 1 line
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +1 -0
+FILES_${PN} = "${sbindir}/uhubctl"

Do we need this ?

Quoted 8 lines

--
2.11.0

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#2 lore raw

Hi Khem,
thank you for your feedback!

Quoted 13 lines · Khem Raj
Quoted 11 lines · Richard Leitner

Add recipe for uhubctl v2.0.0, an utility to control USB power per-port on "smart" USB hubs.

---
  ...001-Makefile-set-program-version-to-2.0.0.patch | 34 ++++++++++++++++++++++
  meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb   | 22 ++++++++++++++
  2 files changed, 56 insertions(+)

create mode 100644 meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch create mode 100644 meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb

Quoted 8 lines

meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch

Quoted 5 lines
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +0 -0
new file mode 100644
index 000000000..e9e06bc71

can we do it via some other means ? may be via sed or some such and use ${PV} be used instead of hardcoding version.

You're right... a sed using ${PV} is cleaner and will avoid modifying the patch on each recipe update. I'll do that in a v2.

Quoted 18 lines
Quoted 18 lines
meta-oe/recipes-support/uhubctl/files/0001-Makefile-set-program-version-to-2.0.0.patch new file +1 -0
+
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +11 -0
new file mode 100644
index 000000000..80fc92332
@@ -0,0 +1,22 @@
+SUMMARY = "USB hub per-port power control"
+HOMEPAGE = "https://github.com/mvp/uhubctl"
+BUGTRACKER = "https://github.com/mvp/uhubctl/issues"
+DEPENDS = "libusb1"
+
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+SRC_URI = "\
+    https://github.com/mvp/${PN}/archive/v${PV}.tar.gz \
+    file://0001-Makefile-set-program-version-to-2.0.0.patch \
Quoted 8 lines

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 17

Quoted 6 lines
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +6 -0
+    "
+SRC_URI[md5sum] = "5c711911d766d76813333c3812277574"
+SRC_URI[sha256sum] = "4c31278b2c03e5be5a696c3088bc86cf2557a70e00f697799c163aba18e3c40e"
+
+S = "${WORKDIR}/${PN}-${PV}"
+

this looks redundant.

Indeed... it is :-). I'll remove it in v2.

Quoted 7 lines

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 21

Quoted 5 lines
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +4 -0
+do_install () {
+    oe_runmake install DESTDIR=${D}
+}
+

do we need this ?

Yes. Otherwise the uhubctl binary won't get installed anywhere (except the build inside ${S}) and therefore no package is created.

Quoted 4 lines

meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb line 22

Quoted 2 lines
meta-oe/recipes-support/uhubctl/uhubctl_2.0.0.bb new file +1 -0
+FILES_${PN} = "${sbindir}/uhubctl"

Do we need this ?

Nope... I'll remove it in v2.

regards;Richard.L