[gnome-control-center/wip/inigomartinez/meson: 4/4] build: Add update scripts replacements



commit 8c31c280b87c104a4ee28095d9400a82c23bd823
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Sep 13 12:39:18 2017 +0200

    build: Add update scripts replacements
    
    autotools used different targets to update the source code from
    software that gnome-control-center shares code with. Those
    targets are as follows:
    
    - update-from-nma: Updates the "wireless-security" panel code from
      "network-manager-applet".
    - update-from-gsd: Updates the "info" panel and "common" code from
      "gnome-settings-daemon".
    
    This patch adds replacements for those targets. "update-from-gsd"
    has been split in two different targets:
    
    - update-common-from-gsd: Updates the "common" code.
    - update-info-from-gsd: Updates the "info" panel code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785414

 meson.build                                  |    4 ++
 panels/common/meson.build                    |   40 ++++++++++++++++-
 panels/info/meson.build                      |   30 ++++++++++++-
 panels/network/wireless-security/meson.build |   59 ++++++++++++++++++++++---
 update-from-gsd.in                           |   10 ++++
 update-from-gsd.sh                           |    2 +-
 update-from-nma.in                           |   19 ++++++++
 7 files changed, 151 insertions(+), 13 deletions(-)
---
diff --git a/meson.build b/meson.build
index 3bd6e30..01d938b 100644
--- a/meson.build
+++ b/meson.build
@@ -358,6 +358,10 @@ intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@
 top_inc = include_directories('.')
 shell_inc = include_directories('shell')
 
+update_from_gsd = find_program('update-from-gsd.sh')
+update_from_gsd_in = files('update-from-gsd.in')
+update_from_nma_in = files('update-from-nma.in')
+
 subdir('po')
 subdir('panels')
 subdir('shell')
diff --git a/panels/common/meson.build b/panels/common/meson.build
index 6289be9..74865e9 100644
--- a/panels/common/meson.build
+++ b/panels/common/meson.build
@@ -53,16 +53,27 @@ liblanguage = static_library(
   dependencies: deps
 )
 
-sources = common_sources + files(
+gsd_headers = [
+  'gsd-device-manager.h',
+  'gsd-device-manager-udev.h',
+  'gsd-device-manager-x11.h',
+  'gsd-input-helper.h'
+]
+
+gsd_sources_udev = ['gsd-device-manager-udev.c']
+
+gsd_sources = [
   'gsd-device-manager.c',
   'gsd-device-manager-x11.c',
   'gsd-input-helper.c'
-)
+]
+
+sources = files(gsd_sources) + common_sources
 
 deps = common_deps
 
 if have_udep
-  sources += files('gsd-device-manager-udev.c')
+  sources += files(gsd_sources_udev)
 
   deps += [
     udev_dep,
@@ -81,3 +92,26 @@ install_data(
   'gnome-control-center.rules',
   install_dir: join_paths(control_center_datadir, 'polkit-1', 'rules.d')
 )
+
+# FIXME: workaround for updating different sources code
+input_dir = join_paths(meson.source_root(), '..', 'gnome-settings-daemon', 'plugins', 'common')
+
+script_conf = configuration_data()
+script_conf.set('program', update_from_gsd.path())
+script_conf.set('input_dir', input_dir)
+script_conf.set('working_dir', meson.current_source_dir())
+script_conf.set('source_files', ' '.join(gsd_sources + gsd_sources_udev + gsd_headers))
+script_conf.set('source_message', 'common: Update from gnome-settings-daemon')
+
+script_name = 'update-common-from-gsd'
+
+script = configure_file(
+  input: update_from_gsd_in,
+  output: script_name + '.sh',
+  configuration: script_conf
+)
+
+run_target(
+  script_name,
+  command: [find_program(join_paths(meson.current_build_dir(), script_name + '.sh'))]
+)
diff --git a/panels/info/meson.build b/panels/info/meson.build
index e41efc2..3b87894 100644
--- a/panels/info/meson.build
+++ b/panels/info/meson.build
@@ -33,12 +33,15 @@ common_cflags = [
   '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
 ]
 
-sources = files(
+gsd_headers = ['gsd-disk-space-helper.h']
+
+gsd_sources = ['gsd-disk-space-helper.c']
+
+sources = files(gsd_sources) + files(
   'cc-' + cappletname + '-panel.c',
   'cc-info-default-apps-panel.c',
   'cc-info-overview-panel.c',
   'cc-info-removable-media-panel.c',
-  'gsd-disk-space-helper.c',
   'info-cleanup.c'
 )
 
@@ -90,3 +93,26 @@ exe = executable(
 )
 
 test(name, exe)
+
+# FIXME: workaround for updating different sources code
+input_dir = join_paths(meson.source_root(), '..', 'gnome-settings-daemon', 'plugins', 'housekeeping')
+
+script_conf = configuration_data()
+script_conf.set('program', update_from_gsd.path())
+script_conf.set('input_dir', input_dir)
+script_conf.set('working_dir', meson.current_source_dir())
+script_conf.set('source_files', ' '.join(gsd_sources + gsd_headers))
+script_conf.set('source_message', 'info: Update from gnome-settings-daemon')
+
+script_name = 'update-info-from-gsd'
+
+script = configure_file(
+  input: update_from_gsd_in,
+  output: script_name + '.sh',
+  configuration: script_conf
+)
+
+run_target(
+  script_name,
+  command: [find_program(join_paths(meson.current_build_dir(), script_name + '.sh'))]
+)
diff --git a/panels/network/wireless-security/meson.build b/panels/network/wireless-security/meson.build
index 1554c2f..55f92e1 100644
--- a/panels/network/wireless-security/meson.build
+++ b/panels/network/wireless-security/meson.build
@@ -2,25 +2,43 @@ name = 'wireless-security'
 
 wireless_security_inc = include_directories('.')
 
-sources = files(
+nm_applet_headers = [
+  'eap-method.h',
+  'eap-method-fast.h',
+  'eap-method-leap.h',
+  'eap-method-peap.h',
+  'eap-method-simple.h',
+  'eap-method-tls.h',
+  'eap-method-ttls.h',
+  'helpers.h',
+  'wireless-security.h',
+  'ws-leap.h',
+  'ws-dynamic-wep.h',
+  'ws-wep-key.h',
+  'ws-wpa-eap.h',
+  'ws-wpa-psk.h'
+]
+
+nm_applet_sources = [
+  'eap-method.c',
   'eap-method-fast.c',
   'eap-method-leap.c',
   'eap-method-peap.c',
   'eap-method-simple.c',
   'eap-method-tls.c',
   'eap-method-ttls.c',
-  'eap-method.c',
   'helpers.c',
-  'utils.c',
   'wireless-security.c',
   'ws-leap.c',
   'ws-dynamic-wep.c',
   'ws-wep-key.c',
   'ws-wpa-eap.c',
   'ws-wpa-psk.c'
-)
+]
 
-resource_data = files(
+sources = files(nm_applet_sources) + files('utils.c')
+
+nm_resource_data = [
   'eap-method-fast.ui',
   'eap-method-leap.ui',
   'eap-method-peap.ui',
@@ -32,14 +50,14 @@ resource_data = files(
   'ws-wep-key.ui',
   'ws-wpa-eap.ui',
   'ws-wpa-psk.ui'
-)
+]
 
 sources += gnome.compile_resources(
   name + '-resources',
   name + '.gresource.xml',
   source_dir: '.',
   c_name: name.underscorify(),
-  dependencies: resource_data,
+  dependencies: files(nm_resource_data),
   export: true
 )
 
@@ -53,3 +71,30 @@ libwireless_security = static_library(
   dependencies: deps,
   c_args: cflags
 )
+
+# FIXME: workaround for updating different sources code
+input_dir = join_paths(meson.source_root(), '..', 'network-manager-applet', 'src', 'wireless-security')
+
+script_conf = configuration_data()
+script_conf.set('program', update_from_gsd.path())
+script_conf.set('input_dir', input_dir)
+script_conf.set('working_dir', meson.current_source_dir())
+script_conf.set('source_files', ' '.join(nm_applet_sources + nm_applet_headers))
+script_conf.set('source_patch', 'nm-connection-editor-to-network-panel.patch')
+script_conf.set('source_message', 'network: Update wireless-security from network-manager-applet')
+script_conf.set('resource_data', ' '.join(nm_resource_data))
+script_conf.set('resource_patch', 'nm-connection-editor-ui-to-network-panel.patch')
+script_conf.set('resource_message', 'network: Update wireless-security UI from network-manager-applet')
+
+script_name = 'update-from-nma'
+
+script = configure_file(
+  input: update_from_nma_in,
+  output: script_name + '.sh',
+  configuration: script_conf
+)
+
+run_target(
+  script_name,
+  command: [find_program(join_paths(meson.current_build_dir(), script_name + '.sh'))]
+)
diff --git a/update-from-gsd.in b/update-from-gsd.in
new file mode 100755
index 0000000..29d06be
--- /dev/null
+++ b/update-from-gsd.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd @working_dir@
+
+export FILES="@source_files@"
+export DIR="@input_dir@"
+
+@program@ &&
+git add @source_files@ &&
+git commit -m "@source_message@"
diff --git a/update-from-gsd.sh b/update-from-gsd.sh
index 6eccb4c..9f2d6b7 100755
--- a/update-from-gsd.sh
+++ b/update-from-gsd.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 function die() {
   echo $*
diff --git a/update-from-nma.in b/update-from-nma.in
new file mode 100755
index 0000000..76738b1
--- /dev/null
+++ b/update-from-nma.in
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+cd @working_dir@
+
+export FILES="@source_files@"
+export DIR="@input_dir@"
+
+@program@ &&
+patch -p4 < @source_patch@ &&
+git add @source_files@ &&
+git commit -m "@source_message@"
+
+export FILES="@resource_data@"
+export DIR="@input_dir@"
+
+@program@ &&
+patch -p4 < @resource_patch@ &&
+git add @resource_data@ &&
+git commit -m "@resource_message@"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]