Blame SOURCES/0012-Remove-support-for-OCaml-Calendar-v1.patch

056839
From 61ded220af5511b6c164123e612e5650af8e49be Mon Sep 17 00:00:00 2001
263533
From: "Richard W.M. Jones" <rjones@redhat.com>
263533
Date: Mon, 27 Mar 2017 12:41:21 +0100
056839
Subject: [PATCH 12/23] Remove support for OCaml Calendar v1.
263533
263533
Calendar v2 was released in 2008 (9 years ago!), thus remove support
263533
for v1.
263533
263533
This was already broken by commit dc0e217390132f7e76a4d9c0a8a81a9556d19081
263533
so it likely didn't work anyway.
263533
---
263533
 MANIFEST                                  |  3 +-
263533
 configure.ac                              |  6 ---
263533
 po/POTFILES                               |  3 +-
263533
 src/.depend                               |  6 +--
263533
 src/Makefile.in                           |  7 +--
263533
 src/README                                |  8 ++--
263533
 src/{opt_calendar2.ml => opt_calendar.ml} |  0
263533
 src/opt_calendar1.ml                      | 56 -----------------------
263533
 8 files changed, 9 insertions(+), 80 deletions(-)
263533
 rename src/{opt_calendar2.ml => opt_calendar.ml} (100%)
263533
 delete mode 100644 src/opt_calendar1.ml
263533
263533
diff --git a/MANIFEST b/MANIFEST
263533
index 2cf377f..26e87b2 100644
263533
--- a/MANIFEST
263533
+++ b/MANIFEST
263533
@@ -55,8 +55,7 @@ src/.depend
263533
 src/Makefile.in
263533
 src/README
263533
 src/main.ml
263533
-src/opt_calendar1.ml
263533
-src/opt_calendar2.ml
263533
+src/opt_calendar.ml
263533
 src/opt_csv.ml
263533
 src/opt_xml.ml
263533
 src/top.ml
263533
diff --git a/configure.ac b/configure.ac
263533
index ad65465..c9c7e34 100644
263533
--- a/configure.ac
263533
+++ b/configure.ac
263533
@@ -57,12 +57,7 @@ dnl Check for optional OCaml packages.
263533
 AC_CHECK_OCAML_PKG(gettext)
263533
 AC_CHECK_OCAML_PKG(xml-light)
263533
 AC_CHECK_OCAML_PKG(csv)
263533
-
263533
-dnl Need to check which version of calendar is installed.
263533
 AC_CHECK_OCAML_PKG(calendar)
263533
-if test "x$OCAML_PKG_calendar" != "xno"; then
263533
-    AC_CHECK_OCAML_MODULE(is_calendar2,calendar,[CalendarLib.Date],[+$OCAML_PKG_calendar])
263533
-fi
263533
 
263533
 AC_SUBST(OCAML_PKG_unix)
263533
 AC_SUBST(OCAML_PKG_extlib)
263533
@@ -71,7 +66,6 @@ AC_SUBST(OCAML_PKG_gettext)
263533
 AC_SUBST(OCAML_PKG_xml_light)
263533
 AC_SUBST(OCAML_PKG_csv)
263533
 AC_SUBST(OCAML_PKG_calendar)
263533
-AC_SUBST(is_calendar2)
263533
 
263533
 dnl Check for optional perldoc (for building manual pages).
263533
 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
263533
diff --git a/po/POTFILES b/po/POTFILES
263533
index 70d62d5..b826a2a 100644
263533
--- a/po/POTFILES
263533
+++ b/po/POTFILES
263533
@@ -1,6 +1,5 @@
263533
 ../src/main.ml
263533
-../src/opt_calendar1.ml
263533
-../src/opt_calendar2.ml
263533
+../src/opt_calendar.ml
263533
 ../src/opt_csv.ml
263533
 ../src/opt_gettext.ml
263533
 ../src/opt_xml.ml
263533
diff --git a/src/.depend b/src/.depend
263533
index 5325c54..f487c18 100644
263533
--- a/src/.depend
263533
+++ b/src/.depend
263533
@@ -1,9 +1,7 @@
263533
 main.cmo: top.cmi opt_gettext.cmo
263533
 main.cmx: top.cmx opt_gettext.cmx
263533
-opt_calendar1.cmo: top.cmi opt_gettext.cmo
263533
-opt_calendar1.cmx: top.cmx opt_gettext.cmx
263533
-opt_calendar2.cmo: top.cmi opt_gettext.cmo
263533
-opt_calendar2.cmx: top.cmx opt_gettext.cmx
263533
+opt_calendar.cmo: top.cmi opt_gettext.cmo
263533
+opt_calendar.cmx: top.cmx opt_gettext.cmx
263533
 opt_csv.cmo: top.cmi opt_gettext.cmo
263533
 opt_csv.cmx: top.cmx opt_gettext.cmx
263533
 opt_gettext.cmo:
263533
diff --git a/src/Makefile.in b/src/Makefile.in
263533
index d744fd7..ae896cb 100644
263533
--- a/src/Makefile.in
263533
+++ b/src/Makefile.in
263533
@@ -52,13 +52,8 @@ OBJS		+= opt_csv.cmo
263533
 OCAMLCPACKAGES	+= -package csv
263533
 endif
263533
 ifneq ($(OCAML_PKG_calendar),no)
263533
-ifeq ($(is_calendar2),no)
263533
-OBJS		+= opt_calendar1.cmo
263533
+OBJS		+= opt_calendar.cmo
263533
 OCAMLCPACKAGES	+= -package calendar
263533
-else
263533
-OBJS		+= opt_calendar2.cmo
263533
-OCAMLCPACKAGES	+= -package calendar
263533
-endif
263533
 endif
263533
 OBJS		+= main.cmo
263533
 
263533
diff --git a/src/README b/src/README
263533
index 47382a5..8aa2348 100644
263533
--- a/src/README
263533
+++ b/src/README
263533
@@ -40,16 +40,16 @@ The code is structured into these files:
263533
     Any code which needs the optional ocaml-csv library goes
263533
     in here.  This implements the --csv command line option.
263533
 
263533
-  opt_calendar1.ml, opt_calendar2.ml
263533
+  opt_calendar.ml
263533
 
263533
     Any code which needs the optional ocaml-calendar library
263533
-    (v1 or v2) goes in here.  This implements the --end-time
263533
-    command line option.
263533
+    (v2) goes in here.  This implements the --end-time command
263533
+    line option.
263533
 
263533
   main.ml
263533
 
263533
     This is just a small bit of code to glue the modules together
263533
-    Top + Opt_xml? + Opt_csv? + Opt_calendar{1,2}?
263533
+    Top + Opt_xml? + Opt_csv? + Opt_calendar?
263533
 
263533
 The man-page is generated from the single file:
263533
 
263533
diff --git a/src/opt_calendar2.ml b/src/opt_calendar.ml
263533
similarity index 100%
263533
rename from src/opt_calendar2.ml
263533
rename to src/opt_calendar.ml
263533
diff --git a/src/opt_calendar1.ml b/src/opt_calendar1.ml
263533
deleted file mode 100644
263533
index 2c459fe..0000000
263533
--- a/src/opt_calendar1.ml
263533
+++ /dev/null
263533
@@ -1,56 +0,0 @@
263533
-(* 'top'-like tool for libvirt domains.
263533
-   (C) Copyright 2007-2009 Richard W.M. Jones, Red Hat Inc.
263533
-   http://libvirt.org/
263533
-
263533
-   This program is free software; you can redistribute it and/or modify
263533
-   it under the terms of the GNU General Public License as published by
263533
-   the Free Software Foundation; either version 2 of the License, or
263533
-   (at your option) any later version.
263533
-
263533
-   This program is distributed in the hope that it will be useful,
263533
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
263533
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
263533
-   GNU General Public License for more details.
263533
-
263533
-   You should have received a copy of the GNU General Public License
263533
-   along with this program; if not, write to the Free Software
263533
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
263533
-
263533
-   This file contains all code which requires ocaml-calendar < 2.0
263533
-*)
263533
-
263533
-open Printf
263533
-open ExtString
263533
-
263533
-open Opt_gettext.Gettext ;;
263533
-
263533
-Top.parse_date_time :=
263533
-fun time ->
263533
-  let cal : Calendar.t =
263533
-    if String.starts_with time "+" then ( (* +something *)
263533
-      let period = String.sub time 1 (String.length time - 1) in
263533
-      let period =
263533
-	if String.contains period ':' then ( (* +HH:MM:SS *)
263533
-	  let t = Printer.TimePrinter.from_string period in
263533
-	  let hh = Time.hour t and mm = Time.minute t and ss = Time.second t in
263533
-	  Calendar.Period.make 0 0 0 hh mm ss
263533
-	) else				(* +seconds *)
263533
-	  Calendar.Period.second (int_of_string period) in
263533
-      (* Add it as an offset from the current time. *)
263533
-      Calendar.add (Calendar.now ()) period
263533
-    ) else (
263533
-      if String.contains time '-' then	(* YYYY-MM-DD HH:MM:SS *)
263533
-	Printer.CalendarPrinter.from_string time
263533
-      else (				(* HH:MM:SS *)
263533
-	let time = Printer.TimePrinter.from_string time in
263533
-	Calendar.create (Date.today ()) time
263533
-      )
263533
-    ) in
263533
-
263533
-  eprintf "end time: %s\n" (Printer.CalendarPrinter.to_string cal);
263533
-
263533
-  (* Convert to a time_t.  Note that we compare this against
263533
-   * Unix.gettimeofday in the main module, so this must be returned as
263533
-   * plain seconds from 1970 with no timezone adjustment.  (RHBZ#637964)
263533
-   *)
263533
-  Calendar.to_unixfloat cal
263533
-- 
056839
2.31.1
263533