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

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