Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert data/ntp_servers.ycp to an include file #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .gitignore
@@ -0,0 +1,31 @@
Makefile
Makefile.am
Makefile.in
*.ami
aclocal.m4
autom4te.cache
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
configure.in
depcomp
install-sh
libtool
ltconfig
ltmain.sh
missing
mkinstalldirs
stamp-h*
*.pot
Makefile.am.common
.dep
*.ybc
doc/autodocs/*.html
testsuite/tmp.*
package/*.spec
package/*.tar.bz2
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.21.2
2.24.0
9 changes: 0 additions & 9 deletions data/Makefile.am

This file was deleted.

5 changes: 4 additions & 1 deletion data/get_servers.pl
Expand Up @@ -103,6 +103,9 @@ sub push_server_info {
} @servers;

open (OUT, ">ntp_servers.ycp");

print OUT "{\nlist<map<string,string> > servers =\n\n";

print OUT "[\n";
foreach my $sr (@servers) {
print OUT " \$[\n";
Expand All @@ -114,7 +117,7 @@ sub push_server_info {
}
print OUT " ],\n";
}
print OUT "]\n";
print OUT "];\n}\n";
close (OUT);


Expand Down
7 changes: 7 additions & 0 deletions package/yast2-ntp-client.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 25 09:05:31 UTC 2013 - lslezak@suse.cz

- convert data/ntp_servers.ycp to an include file
(needed for the future ruby conversion)
- 2.24.0

-------------------------------------------------------------------
Thu Mar 29 15:32:06 CEST 2012 - jsuchome@suse.cz

Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Expand Up @@ -19,6 +19,7 @@ ynclude_DATA = \
widgets.ycp \
misc.ycp \
clocktypes.ycp \
ntp_servers.ycp \
commandline.ycp

desktop_DATA = \
Expand Down
23 changes: 9 additions & 14 deletions src/NtpClient.ycp
Expand Up @@ -33,6 +33,8 @@ import "Summary";
import "SuSEFirewall";
import "FileChanges";

include "ntp-client/ntp_servers.ycp";


/**
* Abort function
Expand Down Expand Up @@ -237,20 +239,13 @@ global map<string, map<string,string> > GetNtpServers() {
if (ntp_servers == nil)
{
ntp_servers = $[];
list<map<string,string> > servers =(list<map<string,string> >)
SCR::Read(.target.ycp, Directory::datadir + "/ntp_servers.ycp");
if (servers == nil)
{
y2error("Failed to read the list of NTP servers");
}
else
{
y2milestone("%1 known NTP servers read", size(servers));
ntp_servers = listmap(map<string,string> s, servers, {
string server = s["address"]:"";
return $[ server : s ];
});
}

y2milestone("%1 known NTP servers read", size(servers));
ntp_servers = listmap(map<string,string> s, servers, {
string server = s["address"]:"";
return $[ server : s ];
});

foreach(string short_country, string country_name, GetAllKnownCountries(), {
// just refactored existing code
map<string, string> p = MakePoolRecord(short_country, country_name);
Expand Down
9 changes: 8 additions & 1 deletion data/ntp_servers.ycp → src/ntp_servers.ycp
@@ -1,3 +1,7 @@
{

list<map<string,string> > servers =

[
$[
"access_policy" : "open access, please send a message to notify",
Expand Down Expand Up @@ -1819,4 +1823,7 @@
"stratum" : "1",
"synchronization" : "ACTS Dial-up and lockclock algorithm, DEC Alpha/UNIX",
],
]
];

}

2 changes: 0 additions & 2 deletions testsuite/tests/Read.out
@@ -1,6 +1,4 @@
Read .sysconfig.network.config.NETCONFIG_NTP_POLICY ""
Read .target.ycp "/usr/share/YaST2/data/ntp_servers.ycp" nil
Log Failed to read the list of NTP servers
Read .target.ycp "/usr/share/YaST2/data/country.ycp" nil
Read .target.yast2 "country.ycp" nil
Log Failed to read country names
Expand Down
1 change: 0 additions & 1 deletion yast2-ntp-client.spec.in
Expand Up @@ -36,6 +36,5 @@ This package contains the YaST2 component for NTP client configuration.
@scrconfdir@/etc_ntp.scr
@moduledir@/*.y*
@desktopdir@/ntp-client.desktop
@ydatadir@/ntp_servers.ycp
%doc @docdir@
@schemadir@/autoyast/rnc/ntpclient.rnc