From d12be8cc264f999a1394a06b5ac69113c97b002e Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 18 Jul 2021 20:04:14 -0400 Subject: [h-client]: wip --- pcr/h-client/PKGBUILD | 43 +++++++++++-------- pcr/h-client/fix_test.patch | 75 +++++++++++++++++++++++++++++++++ pcr/h-client/h-client-fix_test.patch | 80 ------------------------------------ 3 files changed, 102 insertions(+), 96 deletions(-) create mode 100644 pcr/h-client/fix_test.patch delete mode 100644 pcr/h-client/h-client-fix_test.patch (limited to 'pcr') diff --git a/pcr/h-client/PKGBUILD b/pcr/h-client/PKGBUILD index 489aedb5c..f66b82363 100644 --- a/pcr/h-client/PKGBUILD +++ b/pcr/h-client/PKGBUILD @@ -1,9 +1,11 @@ # Maintainer: Omar Vega Ramos # Contributor: Michał Masłowski +# Contributor: bill-auger + pkgname=h-client pkgver=0.0a0.dev134 -pkgrel=1 +pkgrel=2 epoch=1 pkgdesc="A client for an h-source server (such as https://www.h-node.org/)" arch=('any') @@ -13,32 +15,41 @@ depends=('python2' 'python2-distribute' 'python2-pycurl' 'pygtk' 'pciutils' 'usb makedepends=('subversion') options=(!emptydirs) source=("svn+http://svn.savannah.nongnu.org/svn/${pkgname}/trunk/${pkgname}" - 'h-client-fix_test.patch') + 'fix_test.patch') sha256sums=('SKIP' - 'df842c88bb5bcf6a97db1e2ea813f7f968d9b2e8460a16a4359d62240eb44d1a') + 'f80a2a5971c091093c8ce4a8d963ace36383e7bd819b98c9c86846fb82db9e0d') + + +prepare() +{ + cd "${srcdir}"/${pkgname} -prepare() { - cd "$srcdir/${pkgname}" sed -i "s/dev/dev134/g" setup.cfg sed -i "s/tag_svn_revision = 1//g" setup.cfg sed -i "s/'h-node.org'/'https:\/\/h-node.org'/g" hclient/gtkclient.py - patch -Np1 -i "$srcdir/h-client-fix_test.patch" + + echo "applying fix_test.patch" + patch -Np1 -i "${srcdir}"/fix_test.patch } -build() { - cd "$srcdir/${pkgname}" +build() +{ + cd "${srcdir}"/${pkgname} + make } -check() { - cd "$srcdir/${pkgname}" +check() +{ + cd "${srcdir}"/${pkgname} + python2 setup.py test } -package() { - cd "$srcdir/${pkgname}" - python2 setup.py install --root="$pkgdir/" --optimize=1 - make DESTDIR="$pkgdir" prefix=/usr install-data -} +package() +{ + cd "${srcdir}"/${pkgname} -# vim:set ts=2 sw=2 et: + python2 setup.py install --root="${pkgdir}"/ --optimize=1 + make DESTDIR="${pkgdir}" prefix=/usr install-data +} diff --git a/pcr/h-client/fix_test.patch b/pcr/h-client/fix_test.patch new file mode 100644 index 000000000..8ffbd50f9 --- /dev/null +++ b/pcr/h-client/fix_test.patch @@ -0,0 +1,75 @@ +--- h-client.orig/hclient/machine.py 2016-07-23 02:00:01.290465000 -0500 ++++ h-client/hclient/machine.py 2016-07-23 04:48:58.908039710 -0500 +@@ -72,7 +72,7 @@ + + + def parse_os_release(file_object): +- """Parse /etc/os-release into a dictionary.""" ++ """Parse /usr/lib/os-release into a dictionary.""" + data = {} + # See os-release(5) for specification of the format parsed. + for line in file_object: +@@ -89,7 +89,7 @@ + def distro_from_os_release(data): + """Return distro code as string for the specified dictionary of + os-release data.""" +- # TODO detect other distros if they have /etc/os-release. The ++ # TODO detect other distros if they have /usr/lib/os-release. The + # reason for not using the data directly is different distro + # naming in h-source. + if data.get("ID", "") == "parabola": +@@ -122,7 +122,7 @@ + An empty string is returned if the distro is not known. + """ + try: +- with opener.open("/etc/os-release") as os_release: ++ with opener.open("/usr/lib/os-release") as os_release: + release = distro_from_os_release(parse_os_release(os_release)) + except IOError: + pass # missing file, try other release files +--- h-client.orig/tests_hclient/machine.py 2016-07-23 02:00:01.930436000 -0500 ++++ h-client/tests_hclient/machine.py 2016-07-23 05:04:55.380405303 -0500 +@@ -37,7 +37,7 @@ + self.assertTrue(re.match('^\d+\.\d+.*', KERNEL_VERSION)) + + +-#: ``/etc/os-release`` from Parabola. ++#: ``/usr/lib/os-release`` from Parabola. + _PARABOLA_OS_RELEASE ="""NAME="Parabola" + ID=parabola + ID_LIKE=arch +@@ -73,7 +74,7 @@ + DISTRIB_RELEASE=rolling + DISTRIB_DESCRIPTION="Parabola GNU/Linux-libre" + """) +- elif file_name == "/etc/os-release": ++ elif file_name == "/usr/lib/os-release": + string = StringIO(_PARABOLA_OS_RELEASE) + elif file_name == "/etc/parabola-release": + string = StringIO("Parabola GNU/Linux-libre release\n") +@@ -87,7 +88,7 @@ + if pattern != "/etc/*-release": + raise NotImplemented("Unknown pattern %r" % pattern) + return ["/etc/arch-release", "/etc/lsb-release", +- "/etc/os-release", "/etc/parabola-release"] ++ "/usr/lib/os-release", "/etc/parabola-release"] + + + class _TaranisOpener(object): +@@ -177,14 +178,14 @@ + self.assertTrue(user_distribution()) + + def test_parse_os_release(self): +- """Check that Parabola /etc/os-release is correctly parsed.""" ++ """Check that Parabola /usr/lib/os-release is correctly parsed.""" + from hclient.machine import parse_os_release + from StringIO import StringIO + self.assertEquals(_PARABOLA_DATA, + parse_os_release(StringIO(_PARABOLA_OS_RELEASE))) + + def test_distro_from_os_release(self): +- """Check that Parabola is detected using /etc/os-release.""" ++ """Check that Parabola is detected using /usr/lib/os-release.""" + from hclient.machine import distro_from_os_release + self.assertEquals("parabola", distro_from_os_release(_PARABOLA_DATA)) + diff --git a/pcr/h-client/h-client-fix_test.patch b/pcr/h-client/h-client-fix_test.patch deleted file mode 100644 index 930c7c35b..000000000 --- a/pcr/h-client/h-client-fix_test.patch +++ /dev/null @@ -1,80 +0,0 @@ ---- h-client.orig/hclient/machine.py 2016-07-23 02:00:01.290465000 -0500 -+++ h-client/hclient/machine.py 2016-07-23 04:48:58.908039710 -0500 -@@ -72,7 +72,7 @@ - - - def parse_os_release(file_object): -- """Parse /etc/os-release into a dictionary.""" -+ """Parse /usr/lib/os-release into a dictionary.""" - data = {} - # See os-release(5) for specification of the format parsed. - for line in file_object: -@@ -89,7 +89,7 @@ - def distro_from_os_release(data): - """Return distro code as string for the specified dictionary of - os-release data.""" -- # TODO detect other distros if they have /etc/os-release. The -+ # TODO detect other distros if they have /usr/lib/os-release. The - # reason for not using the data directly is different distro - # naming in h-source. - if data.get("ID", "") == "parabola": -@@ -122,7 +122,7 @@ - An empty string is returned if the distro is not known. - """ - try: -- with opener.open("/etc/os-release") as os_release: -+ with opener.open("/usr/lib/os-release") as os_release: - release = distro_from_os_release(parse_os_release(os_release)) - except IOError: - pass # missing file, try other release files ---- h-client.orig/tests_hclient/machine.py 2016-07-23 02:00:01.930436000 -0500 -+++ h-client/tests_hclient/machine.py 2016-07-23 05:04:55.380405303 -0500 -@@ -34,10 +34,11 @@ - """Check that obtained kernel version looks like Linux version""" - from hclient.machine import KERNEL_VERSION - self.assertTrue(KERNEL_VERSION.startswith("2.6.") -- or KERNEL_VERSION.startswith("3.")) -+ or KERNEL_VERSION.startswith("3.") -+ or KERNEL_VERSION.startswith("4.")) - - --#: ``/etc/os-release`` from Parabola. -+#: ``/usr/lib/os-release`` from Parabola. - _PARABOLA_OS_RELEASE ="""NAME="Parabola" - ID=parabola - ID_LIKE=arch -@@ -73,7 +74,7 @@ - DISTRIB_RELEASE=rolling - DISTRIB_DESCRIPTION="Parabola GNU/Linux-libre" - """) -- elif file_name == "/etc/os-release": -+ elif file_name == "/usr/lib/os-release": - string = StringIO(_PARABOLA_OS_RELEASE) - elif file_name == "/etc/parabola-release": - string = StringIO("Parabola GNU/Linux-libre release\n") -@@ -87,7 +88,7 @@ - if pattern != "/etc/*-release": - raise NotImplemented("Unknown pattern %r" % pattern) - return ["/etc/arch-release", "/etc/lsb-release", -- "/etc/os-release", "/etc/parabola-release"] -+ "/usr/lib/os-release", "/etc/parabola-release"] - - - class _TaranisOpener(object): -@@ -177,14 +178,14 @@ - self.assertTrue(user_distribution()) - - def test_parse_os_release(self): -- """Check that Parabola /etc/os-release is correctly parsed.""" -+ """Check that Parabola /usr/lib/os-release is correctly parsed.""" - from hclient.machine import parse_os_release - from StringIO import StringIO - self.assertEquals(_PARABOLA_DATA, - parse_os_release(StringIO(_PARABOLA_OS_RELEASE))) - - def test_distro_from_os_release(self): -- """Check that Parabola is detected using /etc/os-release.""" -+ """Check that Parabola is detected using /usr/lib/os-release.""" - from hclient.machine import distro_from_os_release - self.assertEquals("parabola", distro_from_os_release(_PARABOLA_DATA)) - -- cgit v1.2.2