summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2019-01-24 15:00:29 +0100
committerRichard Hughes <richard@hughsie.com>2020-01-10 09:06:26 +0000
commitf144fbc20df1aa21e666ef2256adbbc63ffcf131 (patch)
tree0acebe2d5fd962166732d4bf52a2a0baf9327e70 /data
parent3de80c8eb0dca0b57a5dbdca20e754a7de7c053a (diff)
Port to the meson build system
With much help from Martin Blanchard <tchaik@gmx.com> too, thanks to all. https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
Diffstat (limited to 'data')
-rw-r--r--data/Makefile.am72
-rw-r--r--data/meson.build60
-rw-r--r--data/tests/Makefile.am35
l---------data/tests/packagekit2
-rwxr-xr-xdata/tests/pk-client-helper-test.py (renamed from data/tests/pk-client-helper-test.py.in)16
-rwxr-xr-xdata/tests/pk-spawn-dispatcher.py (renamed from data/tests/pk-spawn-dispatcher.py.in)16
-rwxr-xr-xdata/tests/pk-spawn-test-sigquit.py (renamed from data/tests/pk-spawn-test-sigquit.py.in)4
7 files changed, 81 insertions, 124 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index 02c257f2e..000000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-## We require new-style dependency handling.
-AUTOMAKE_OPTIONS = 1.7
-
-NULL =
-
-SUBDIRS = \
- tests
-
-upgradescriptdir = $(datadir)/PackageKit
-upgradescript_SCRIPTS = pk-upgrade-distro.sh
-
-dbusdir = ${DBUS_SYS_DIR}
-dist_dbus_DATA = \
- org.freedesktop.PackageKit.conf
-
-%.service: %.service.in Makefile
- $(AM_V_GEN)sed -e 's|\@libexecdir\@|$(libexecdir)|' \
- -e 's|\@PACKAGEKIT_USER\@|$(PACKAGEKIT_USER)|' $< > $@.tmp && mv $@.tmp $@
-
-servicemaindir = $(DBUS_SERVICES_DIR)
-servicemain_in_files = org.freedesktop.PackageKit.service.in
-servicemain_DATA = $(servicemain_in_files:.service.in=.service)
-
-systemdservice_in_files = \
- packagekit.service.in \
- packagekit-offline-update.service.in
-
-if HAVE_SYSTEMD
-systemdservicedir = $(systemdsystemunitdir)
-systemdservice_DATA = packagekit.service
-if ENABLE_OFFLINE_UPDATE
-systemdservice_DATA += packagekit-offline-update.service
-endif
-endif
-
-
-databasedir = $(localstatedir)/lib/PackageKit
-database_DATA = \
- transactions.db
-
-install-data-hook:
- @for file in $(database_DATA); do \
- echo "Remove global read access for: $(DESTDIR)$(localstatedir)/lib/PackageKit/$$file"; \
- chmod o-r $(DESTDIR)$(localstatedir)/lib/PackageKit/$$file; \
- done
-if ENABLE_OFFLINE_UPDATE
- mkdir -p $(DESTDIR)$(systemdservicedir)/system-update.target.wants
- ln -sf ../packagekit-offline-update.service $(DESTDIR)$(systemdservicedir)/system-update.target.wants/packagekit-offline-update.service
-endif
-
-EXTRA_DIST = \
- org.freedesktop.PackageKit.conf.in \
- $(servicemain_in_files) \
- $(servicetest_in_files) \
- $(serviceapt_in_files) \
- $(systemdservice_in_files) \
- $(localcache_DATA) \
- $(database_DATA) \
- $(upgradescript_SCRIPTS)
-
-clean-local:
- rm -f *~
-
-DISTCLEANFILES = \
- $(systemdservice_DATA) \
- org.freedesktop.PackageKit.service
-
-MAINTAINERCLEANFILES = \
- *~ \
- Makefile.in
-
--include $(top_srcdir)/git.mk
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 000000000..7fc41144c
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,60 @@
+install_data(
+ 'pk-upgrade-distro.sh',
+ install_dir: join_paths(get_option('datadir'), 'PackageKit'),
+)
+
+dbus_config_data = configuration_data()
+dbus_config_data.set('PACKAGEKIT_USER', get_option('packagekit_user'))
+dbus_config_data.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
+
+dbus_sys_dir = get_option('dbus_sys')
+if dbus_sys_dir == ''
+ dbus_sys_dir = join_paths(get_option('sysconfdir'), 'dbus-1', 'system.d')
+endif
+
+configure_file(
+ input: 'org.freedesktop.PackageKit.conf.in',
+ output: 'org.freedesktop.PackageKit.conf',
+ configuration: dbus_config_data,
+ install: true,
+ install_dir: dbus_sys_dir,
+)
+
+dbus_services_dir = get_option('dbus_services')
+if dbus_services_dir == ''
+ dbus_services_dir = join_paths(get_option('datadir'), 'dbus-1', 'system-services')
+endif
+
+configure_file(
+ input: 'org.freedesktop.PackageKit.service.in',
+ output: 'org.freedesktop.PackageKit.service',
+ configuration: dbus_config_data,
+ install: true,
+ install_dir: dbus_services_dir,
+)
+
+
+if get_option('systemd')
+ configure_file(
+ input: 'packagekit.service.in',
+ output: 'packagekit.service',
+ configuration: dbus_config_data,
+ install: true,
+ install_dir: systemd_system_unit_dir,
+ )
+
+ if get_option('offline_update')
+ configure_file(
+ input: 'packagekit-offline-update.service.in',
+ output: 'packagekit-offline-update.service',
+ configuration: dbus_config_data,
+ install: true,
+ install_dir: systemd_system_unit_dir,
+ )
+ endif
+endif
+
+install_data(
+ 'transactions.db',
+ install_dir: join_paths(get_option('localstatedir'), 'lib', 'PackageKit'),
+)
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am
deleted file mode 100644
index 8787d80ec..000000000
--- a/data/tests/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## We require new-style dependency handling.
-AUTOMAKE_OPTIONS = 1.7
-
-NULL =
-
-TEST_FILES = \
- pk-client-helper-test.py.in \
- pk-spawn-test.sh \
- pk-spawn-proxy.sh \
- pk-spawn-test-sigquit.sh \
- pk-spawn-test-sigquit.py.in \
- pk-spawn-test-profiling.sh \
- pk-spawn-dispatcher.py.in \
- $(NULL)
-
-DISTCLEANFILES = \
- pk-client-helper-test.py \
- pk-spawn-test-sigquit.py \
- pk-spawn-dispatcher.py \
- $(NULL)
-
-EXTRA_DIST = \
- $(TEST_FILES) \
- $(NULL)
-
-clean-local:
- rm -f *~
-
-MAINTAINERCLEANFILES = \
- *~ \
- Makefile.in \
- $(NULL)
-
-
--include $(top_srcdir)/git.mk
diff --git a/data/tests/packagekit b/data/tests/packagekit
index 2e8d94955..571b05c0c 120000
--- a/data/tests/packagekit
+++ b/data/tests/packagekit
@@ -1 +1 @@
-../../lib/python/packagekit \ No newline at end of file
+../../lib/python/packagekit/ \ No newline at end of file
diff --git a/data/tests/pk-client-helper-test.py.in b/data/tests/pk-client-helper-test.py
index 9fa693817..159008eaa 100755
--- a/data/tests/pk-client-helper-test.py.in
+++ b/data/tests/pk-client-helper-test.py
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/python3
# Licensed under the GNU General Public License Version 2
#
# This program is free software; you can redistribute it and/or modify
@@ -23,19 +23,19 @@ def main():
while True:
try:
line = sys.stdin.readline().strip('\n')
- except IOError, e:
- print "could not read from stdin: %s", str(e)
+ except IOError as e:
+ print("could not read from stdin: %s", str(e))
+ break
+ except KeyboardInterrupt as e:
+ print("process was killed by ctrl-c", str(e))
break
- except KeyboardInterrupt, e:
- print "process was killed by ctrl-c", str(e)
- break;
if not line or line == 'exit':
break
if line == 'ping':
- sys.stdout.write ('pong\n')
+ sys.stdout.write('pong\n')
sys.stdout.flush()
else:
- sys.stdout.write ("you said to me: %s\n" % line)
+ sys.stdout.write("you said to me: %s\n" % line)
sys.stdout.flush()
if __name__ == "__main__":
diff --git a/data/tests/pk-spawn-dispatcher.py.in b/data/tests/pk-spawn-dispatcher.py
index fe47e0789..2fa36d57e 100755
--- a/data/tests/pk-spawn-dispatcher.py.in
+++ b/data/tests/pk-spawn-dispatcher.py
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/python3
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,11 +16,15 @@
import sys
import time
+import os
+
+sys.path.insert(0,os.path.join(os.getcwd(), 'lib', 'python'))
+
from packagekit.backend import *
class PackageKitYumBackend(PackageKitBaseBackend):
- def __init__(self,args,lock=True):
- PackageKitBaseBackend.__init__(self,args)
+ def __init__(self, args, lock=True):
+ PackageKitBaseBackend.__init__(self, args)
PackageKitBaseBackend.doLock(self)
# simulate doing something
time.sleep(2)
@@ -30,13 +34,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
# simulate doing something
time.sleep(0.5)
- def search_name(self,filters,key):
+ def search_name(self, filters, key):
# check we escape spaces properly
if key == ['power manager']:
- self.package("polkit;0.0.1;i386;data",INFO_AVAILABLE,"PolicyKit daemon")
+ self.package("polkit;0.0.1;i386;data", INFO_AVAILABLE, "PolicyKit daemon")
def main():
- backend = PackageKitYumBackend('',lock=True)
+ backend = PackageKitYumBackend('', lock=True)
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
diff --git a/data/tests/pk-spawn-test-sigquit.py.in b/data/tests/pk-spawn-test-sigquit.py
index 2f8d08262..b15e7a47e 100755
--- a/data/tests/pk-spawn-test-sigquit.py.in
+++ b/data/tests/pk-spawn-test-sigquit.py
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/python3
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,7 +21,7 @@ def process_quit(signum, frame):
def main():
signal(SIGQUIT, process_quit)
- for i in [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
+ for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
stdout.write("percentage\t%i\n" % (i * 10))
stdout.flush()
sleep(0.3)