[dywang@dywmac ~]$ cd rpmbuild [dywang@dywmac rpmbuild]$ wget https://li.nux.ro/download/nux/tmp/\ libgweather6/x86_64/libgweather-2.28.0-6.el6.nux.src.rpm
[dywang@dywmac rpmbuild]$ rpm -ivh libgweather-2.28.0-6.el6.nux.src.rpm
[dywang@dywmac SOURCES]$ rpm -qpl ../libgweather-2.28.0-6.el6.nux.src.rpm better-weather-in-montreal.patch changeprovider.patch gettext-not-xml.patch libgweather-2.28.0.tar.bz2 libgweather-add-jerusalem-location.patch libgweather-translations.patch libgweather-translations2.patch libgweather.spec
[dywang@dywmac SOURCES]$ ls libgweather-2.28.0.tar.bz2 libgweather-2.28.0.tar.bz2
[dywang@dywmac SOURCES]$ tar jxvf libgweather-2.28.0.tar.bz2
[dywang@dywmac SOURCES]$ ls libgweather-2.28.0 acinclude.m4 config.h configure.in INSTALL MAINTAINERS NEWS aclocal.m4 config.h.in COPYING install-sh Makefile po AUTHORS config.log data libgweather Makefile.am po-locations ChangeLog config.status depcomp libtool Makefile.in python compile config.sub doc ltmain.sh missing README config.guess configure gtk-doc.make m4 mkinstalldirs stamp-h1
[dywang@dywmac SOURCES]$ cd ../tmp/ [dywang@dywmac tmp]$ rm ./* -rf [dywang@dywmac tmp]$ rpm2cpio ../libgweather-2.28.0-6.el6.nux.src.rpm | cpio -idvm
[dywang@dywmac tmp]$ tar jxvf libgweather-2.28.0.tar.bz2
[dywang@dywmac SOURCES]$ diff -qr ../tmp/libgweather-2.28.0 libgweather-2.28.0/ | grep differ Files ../tmp/libgweather-2.28.0/configure and libgweather-2.28.0/configure differ Files ../tmp/libgweather-2.28.0/configure.in and libgweather-2.28.0/configure.in differ Files ../tmp/libgweather-2.28.0/data/Locations.xml.in and libgweather-2.28.0/data/Locations.xml.in differ Files ../tmp/libgweather-2.28.0/libgweather/gweather-gconf.c and libgweather-2.28.0/libgweather/gweather-gconf.c differ Files ../tmp/libgweather-2.28.0/libgweather/gweather.schemas.in and libgweather-2.28.0/libgweather/gweather.schemas.in differ Files ../tmp/libgweather-2.28.0/libgweather/weather-metar.c and libgweather-2.28.0/libgweather/weather-metar.c differ Files ../tmp/libgweather-2.28.0/po/zh_TW.po and libgweather-2.28.0/po/zh_TW.po differ
[dywang@dywmac tmp]$ cd ../SOURCES/
[dywang@dywmac SOURCES]$ vim ../SPECS/libgweather.spec
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather.spec ../SPECS/libgweather.spec
--- ../tmp/libgweather.spec 2016-08-25 15:56:19.000000000 +0800
+++ ../SPECS/libgweather.spec 2018-09-08 19:50:22.217329228 +0800
@@ -1,13 +1,13 @@
Name: libgweather
Version: 2.28.0
-Release: 6%{?dist}
+Release: 6%{?dist}.dyw
Summary: A library for weather information
Group: System Environment/Libraries
License: GPLv2+
URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/libgweather/2.28/%{name}-%{version}.tar.bz2
-Patch100: changeprovider.patch
+#Patch100: libgweather-2.28.0-metar.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -63,7 +63,7 @@
%patch2 -p1 -b .translations
%patch3 -p2 -b .translations2
%patch4 -p1 -b .jerusalem
-%patch100 -p0 -b .changeprovider
+#%patch100 -p0 -b .libgweather-2.28.0-metar
gtkdocize
autoreconf -i -f
@@ -87,6 +87,7 @@
/sbin/ldconfig
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gweather.schemas > /dev/null || :
+sed -ri 's|(<stringvalue><location).*(</stringvalue>)$|\1 name=\"\" city=\"\
+Taichung\" timezone=\"Asia/Taipei\" latitude=\"24.264668\" longitude=\
+\"120.620583\" code=\"RCMQ\" current=\"true\"\>\2|g' \
+/etc/gconf/gconf.xml.defaults/%gconf-tree.xml
%pre
if [ "$1" -gt 1 ]; then
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/configure libgweather-2.28.0/configure --- ../tmp/libgweather-2.28.0/configure 2009-09-22 00:33:19.000000000 +0800 +++ libgweather-2.28.0/configure 2018-09-08 19:00:28.756537843 +0800 @@ -16477,7 +16477,7 @@ if test "$gtk_ok" = "yes"; then cat >>confdefs.h <<\_ACEOF -#define HAVE__NL_MEASUREMENT_MEASUREMENT 1 +#define HAVE__NL_MEASUREMENT_MEASUREMENT 0 _ACEOF fi
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/data/Locations.xml.in \
libgweather-2.28.0/data/Locations.xml.in
--- ../tmp/libgweather-2.28.0/data/Locations.xml.in 2009-04-20 01:41:11.000000000 +0800
+++ libgweather-2.28.0/data/Locations.xml.in 2018-09-08 15:36:32.443791340 +0800
@@ -5481,36 +5481,49 @@
<tz-hint>Asia/Taipei</tz-hint>
<city>
<!-- A city in Taiwan.
- The name is also written "高雄巿".
+ The name is also written "高雄". RCKH
-->
- <_name>Kao-hsiung-shih</_name>
+ <_name>Kaohsiung</_name>
<coordinates>22.616256 120.313329</coordinates>
<location>
- <name>Kao-hsiung-shih International Airport</name>
+ <name>Kaohsiung International Airport</name>
<code>RCKH</code>
<coordinates>22.583333 120.350000</coordinates>
</location>
</city>
<city>
<!-- A city in Taiwan.
- The name is also written "埔頂".
+ The name is also written "台中". RCMQ
-->
- <_name>Pu-ting</_name>
+ <_name>Taichung</_name>
+ <coordinates>24.264667 120.620581</coordinates>
+ <location>
+ <name>Taichung International Airport</name>
+ <code>RCMQ</code>
+ <zone>CST</zone>
+ <coordinates>24.264667 120.620581</coordinates>
+ </location>
+ </city>
+ <city>
+ <!-- A city in Taiwan.
+ The name is also written "桃園". RCTP
+ -->
+ <_name>Taoyuan</_name>
<coordinates>25.083498 121.215105</coordinates>
<location>
- <name>Chiang Kai Shek</name>
+ <name>Taoyuan International Airport</name>
<code>RCTP</code>
<coordinates>25.083333 121.216667</coordinates>
</location>
</city>
<city>
<!-- The capital of Taiwan.
- The name is also written "臺北市".
+ The name is also written "臺北市". RCSS
-->
- <_name>T'ai-pei Shih</_name>
+ <_name>Taipei</_name>
<coordinates>25.047763 121.531846</coordinates>
<location>
- <name>Sung-shan / T'ai-pei Shih</name>
+ <name>Sung-shan / Taipei</name>
<code>RCSS</code>
<coordinates>25.066667 121.550000</coordinates>
</location>
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/libgweather/gweather-gconf.c \
libgweather-2.28.0/libgweather/gweather-gconf.c
--- ../tmp/libgweather-2.28.0/libgweather/gweather-gconf.c 2009-06-30 09:10:32.000000000 +0800
+++ libgweather-2.28.0/libgweather/gweather-gconf.c 2018-09-08 16:58:25.437879709 +0800
@@ -212,7 +212,7 @@
if (strcmp ("DEFAULT_LOCATION", _("DEFAULT_LOCATION")))
name = g_strdup (_("DEFAULT_LOCATION"));
else
- name = g_strdup ("Pittsburgh");
+ name = g_strdup ("Taichung");
}
code = gweather_gconf_get_string (ctx, "location1", NULL);
@@ -232,7 +232,7 @@
if (strcmp ("DEFAULT_CODE", _("DEFAULT_CODE")))
code = g_strdup (_("DEFAULT_CODE"));
else
- code = g_strdup ("KPIT");
+ code = g_strdup ("RCMQ");
}
zone = gweather_gconf_get_string (ctx, "location2", NULL);
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/libgweather/weather-metar.c libgweather-2.28.0/libgweather/weather-metar.c
--- ../tmp/libgweather-2.28.0/libgweather/weather-metar.c 2009-06-04 22:41:13.000000000 +0800
+++ libgweather-2.28.0/libgweather/weather-metar.c 2018-09-07 15:29:42.487644049 +0800
@@ -510,7 +510,7 @@
loc = info->location;
- searchkey = g_strdup_printf ("\n%s", loc->code);
+ searchkey = g_strdup_printf ("<raw_text>%s", loc->code);
p = strstr (msg->response_body->data, searchkey);
g_free (searchkey);
if (p) {
@@ -522,8 +522,8 @@
metar = g_strdup (p);
success = metar_parse (metar, info);
g_free (metar);
- } else if (!strstr (msg->response_body->data, "National Weather Service")) {
- /* The response doesn't even seem to have come from NWS...
+ } else if (!strstr (msg->response_body->data, "aviationweather.gov")) {
+ /* The response doesn't even seem to have come from NOAA...
* most likely it is a wifi hotspot login page. Call that a
* network error.
*/
@@ -550,9 +550,15 @@
}
msg = soup_form_request_new (
- "GET", "http://weather.noaa.gov/cgi-bin/mgetmetar.pl",
- "cccc", loc->code,
- NULL);
+ "GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam",
+ "dataSource", "metars",
+ "requestType", "retrieve",
+ "format", "xml",
+ "hoursBeforeNow", "3",
+ "mostRecent", "true",
+ "fields", "raw_text",
+ "stationString", loc->code,
+ NULL);
soup_session_queue_message (info->session, msg, metar_finish, info);
info->requests_pending++;
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/libgweather/gweather-gconf.c \
libgweather-2.28.0/libgweather/gweather-gconf.c
--- ../tmp/libgweather-2.28.0/libgweather/gweather-gconf.c 2009-06-30 09:10:32.000000000 +0800
+++ libgweather-2.28.0/libgweather/gweather-gconf.c 2018-09-08 16:58:25.437879709 +0800
@@ -212,7 +212,7 @@
if (strcmp ("DEFAULT_LOCATION", _("DEFAULT_LOCATION")))
name = g_strdup (_("DEFAULT_LOCATION"));
else
- name = g_strdup ("Pittsburgh");
+ name = g_strdup ("Taichung");
}
code = gweather_gconf_get_string (ctx, "location1", NULL);
@@ -232,7 +232,7 @@
if (strcmp ("DEFAULT_CODE", _("DEFAULT_CODE")))
code = g_strdup (_("DEFAULT_CODE"));
else
- code = g_strdup ("KPIT");
+ code = g_strdup ("RCMQ");
}
zone = gweather_gconf_get_string (ctx, "location2", NULL);
[dywang@dywmac SOURCES]$ diff -uN ../tmp/libgweather-2.28.0/po/zh_TW.po \ libgweather-2.28.0/po/zh_TW.po --- ../tmp/libgweather-2.28.0/po/zh_TW.po 2009-06-04 22:41:13.000000000 +0800 +++ libgweather-2.28.0/po/zh_TW.po 2018-09-08 17:12:03.395028306 +0800 @@ -38,7 +38,7 @@ #: ../libgweather/gweather-gconf.c:212 ../libgweather/gweather-gconf.c:213 #: ../libgweather/gweather.schemas.in.h:5 msgid "DEFAULT_LOCATION" -msgstr "松山/臺北" +msgstr "Taichung" # zh_HK: msgstr "VHHH" # zh_TW: msgstr "RCSS" @@ -56,7 +56,7 @@ #: ../libgweather/gweather-gconf.c:232 ../libgweather/gweather-gconf.c:233 #: ../libgweather/gweather.schemas.in.h:3 msgid "DEFAULT_CODE" -msgstr "RCSS" +msgstr "RCMQ" #. TRANSLATOR: Change this to the zone of your default location that #. * corresponds to the DEFAULT_LOCATION and DEFAULT_CODE you put above. @@ -108,7 +108,7 @@ #: ../libgweather/gweather-gconf.c:294 ../libgweather/gweather-gconf.c:295 #: ../libgweather/gweather.schemas.in.h:4 msgid "DEFAULT_COORDINATES" -msgstr "25-04N 121-33E" +msgstr "24-26N 120-62E" #: ../libgweather/gweather-prefs.c:34 ../libgweather/gweather-prefs.c:45 #: ../libgweather/gweather-prefs.c:60 ../libgweather/gweather-prefs.c:77
[dywang@dywmac SOURCES]$ tar jcvf libgweather-2.28.0.tar.bz2 libgweather-2.28.0
[dywang@dywmac SOURCES]$ rpmbuild -ba --clean --target=$(uname -m) ../SPECS/libgweather.spec .................. Wrote: /home/dywang/rpmbuild/SRPMS/libgweather-2.28.0-6.el6.dyw.src.rpm Wrote: /home/dywang/rpmbuild/RPMS/x86_64/libgweather-2.28.0-6.el6.dyw.x86_64.rpm Wrote: /home/dywang/rpmbuild/RPMS/x86_64/libgweather-devel-2.28.0-6.el6.dyw.x86_64.rpm Wrote: /home/dywang/rpmbuild/RPMS/x86_64/libgweather-debuginfo-2.28.0-6.el6.dyw.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.y1Er5Y + umask 022 + cd /home/dywang/rpmbuild/BUILD + cd libgweather-2.28.0 + rm -rf /home/dywang/rpmbuild/BUILDROOT/libgweather-2.28.0-6.el6.dyw.x86_64 + exit 0 Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.MSreAY + umask 022 + cd /home/dywang/rpmbuild/BUILD + rm -rf libgweather-2.28.0 + exit 0