Permalink
Browse files

libpcp: use public domain getdate instead of gnulib version

Replace the GPL version of getdate previously used in libpcp
(incompatible with the LGPL license of libpcp, inadvertently)
with one based on the public domain version from BSD sources.
Small modifications to build within PCP tree, to use the PCP
time(zone) interfaces, and for thread-safety.

Resolves #44
  • Loading branch information...
1 parent 7e47e5a commit cbc75afe905fb26577218312b9de6fe61d8a2400 @natoscott natoscott committed Sep 3, 2015
Showing with 759 additions and 1,214 deletions.
  1. +6 −23 qa/752
  2. +0 −27 qa/752.out
  3. +5 −9 src/libpcp/src/check-statics
  4. +743 −1,150 src/libpcp/src/getdate.y
  5. +1 −1 src/libpcp/src/internal.h
  6. +4 −4 src/libpcp/src/rtime.c
View
29 qa/752
@@ -23,42 +23,35 @@ echo "tomorrow: $(date '+%Y-%m-%d' -d 'tomorrow')" >>$seq.full
echo "sunday: $(date '+%Y-%m-%d' -d 'sunday')" >>$seq.full
echo "first sunday: $(date '+%Y-%m-%d' -d 'first sunday')" >>$seq.full
echo "this sunday: $(date '+%Y-%m-%d' -d 'this sunday')" >>$seq.full
-echo "next sunday: $(date '+%Y-%m-%d' -d 'next sunday')" >>$seq.full
echo "last sunday: $(date '+%Y-%m-%d' -d 'last sunday')" >>$seq.full
echo "monday: $(date '+%Y-%m-%d' -d 'monday')" >>$seq.full
echo "first monday: $(date '+%Y-%m-%d' -d 'first monday')" >>$seq.full
echo "this monday: $(date '+%Y-%m-%d' -d 'this monday')" >>$seq.full
-echo "next monday: $(date '+%Y-%m-%d' -d 'next monday')" >>$seq.full
echo "last monday: $(date '+%Y-%m-%d' -d 'last monday')" >>$seq.full
echo "tuesday: $(date '+%Y-%m-%d' -d 'tuesday')" >>$seq.full
echo "first tuesday: $(date '+%Y-%m-%d' -d 'first tuesday')" >>$seq.full
echo "this tuesday: $(date '+%Y-%m-%d' -d 'this tuesday')" >>$seq.full
-echo "next tuesday: $(date '+%Y-%m-%d' -d 'next tuesday')" >>$seq.full
echo "last tuesday: $(date '+%Y-%m-%d' -d 'last tuesday')" >>$seq.full
echo "wednesday: $(date '+%Y-%m-%d' -d 'wednesday')" >>$seq.full
echo "first wednesday: $(date '+%Y-%m-%d' -d 'first wednesday')" >>$seq.full
echo "this wednesday: $(date '+%Y-%m-%d' -d 'this wednesday')" >>$seq.full
-echo "next wednesday: $(date '+%Y-%m-%d' -d 'next wednesday')" >>$seq.full
echo "last wednesday: $(date '+%Y-%m-%d' -d 'last wednesday')" >>$seq.full
echo "thursday: $(date '+%Y-%m-%d' -d 'thursday')" >>$seq.full
echo "first thursday: $(date '+%Y-%m-%d' -d 'first thursday')" >>$seq.full
echo "this thursday: $(date '+%Y-%m-%d' -d 'this thursday')" >>$seq.full
-echo "next thursday: $(date '+%Y-%m-%d' -d 'next thursday')" >>$seq.full
echo "last thursday: $(date '+%Y-%m-%d' -d 'last thursday')" >>$seq.full
echo "friday: $(date '+%Y-%m-%d' -d 'friday')" >>$seq.full
echo "first friday: $(date '+%Y-%m-%d' -d 'first friday')" >>$seq.full
echo "this friday: $(date '+%Y-%m-%d' -d 'this friday')" >>$seq.full
-echo "next friday: $(date '+%Y-%m-%d' -d 'next friday')" >>$seq.full
echo "last friday: $(date '+%Y-%m-%d' -d 'last friday')" >>$seq.full
echo "saturday: $(date '+%Y-%m-%d' -d 'saturday')" >>$seq.full
echo "first saturday: $(date '+%Y-%m-%d' -d 'first saturday')" >>$seq.full
echo "this saturday: $(date '+%Y-%m-%d' -d 'this saturday')" >>$seq.full
-echo "next saturday: $(date '+%Y-%m-%d' -d 'next saturday')" >>$seq.full
echo "last saturday: $(date '+%Y-%m-%d' -d 'last saturday')" >>$seq.full
-# just as our libpcp code is based on gnulib code that has changed
+# just as our libpcp code is based on getdate code that has changed
# over time, date(1) also may have different semantics ... try to
-# suss out if we have an older dodgey date(1)
+# suss out if we have an older, dodgey date(1)
#
dodgey_date=false
TODAY=`date -d today '+%A' | tr '[a-z]' '[A-Z]'`
@@ -72,7 +65,7 @@ echo "t2=$t2" >>$seq.full
[ "$t1" != "$t2" ] && dodgey_date=true
echo "dodgey_date=$dodgey_date" >>$seq.full
-# Be careful, sunday, first sunday, next sunday and today could all be
+# Be careful, sunday, first sunday, and today could all be
# the same date.
# Ditto for all the other days of the week.
#
@@ -97,15 +90,6 @@ src/rtimetest \
/friday/s/'$(date '+%Y-%m-%d' -d 'this friday')' ..:..:../this FRIDAY/
/saturday/s/'$(date '+%Y-%m-%d' -d 'this saturday')' ..:..:../this SATURDAY/
}' \
- -e '/next /{
-/sunday/s/'$(date '+%Y-%m-%d' -d 'next sunday')' ..:..:../next SUNDAY/
-/monday/s/'$(date '+%Y-%m-%d' -d 'next monday')' ..:..:../next MONDAY/
-/tuesday/s/'$(date '+%Y-%m-%d' -d 'next tuesday')' ..:..:../next TUESDAY/
-/wednesday/s/'$(date '+%Y-%m-%d' -d 'next wednesday')' ..:..:../next WEDNESDAY/
-/thursday/s/'$(date '+%Y-%m-%d' -d 'next thursday')' ..:..:../next THURSDAY/
-/friday/s/'$(date '+%Y-%m-%d' -d 'next friday')' ..:..:../next FRIDAY/
-/saturday/s/'$(date '+%Y-%m-%d' -d 'next saturday')' ..:..:../next SATURDAY/
-}' \
-e '/last /{
/sunday/s/'$(date '+%Y-%m-%d' -d 'last sunday')' ..:..:../last SUNDAY/
/monday/s/'$(date '+%Y-%m-%d' -d 'last monday')' ..:..:../last MONDAY/
@@ -126,13 +110,12 @@ src/rtimetest \
-e "/tomorrow/s/$(date '+%Y-%m-%d' -d 'tomorrow') ..:..:../TOMORROW/" \
-e "/now/s/$(date '+%Y-%m-%d') ..:..:../TODAY/" \
-e "/today/s/$(date '+%Y-%m-%d') ..:..:../TODAY/" \
+ -e "/next .*/d" \
| if $dodgey_date
then
- sed \
- -e "/next $today/s/$(date '+%Y-%m-%d' -d "$today week") ..:..:../next $TODAY/" \
- -e "/first $today/s/$(date '+%Y-%m-%d' -d "$today week") ..:..:../first $TODAY/"
+ sed -e "/first $today/s/$(date '+%Y-%m-%d' -d "$today week") ..:..:../first $TODAY/"
else
- cat
+ sed -e "/first $today/s/$(date '+%Y-%m-%d' -d "$today") ..:..:../first $TODAY/"
fi
unset TZ
View
@@ -67,9 +67,6 @@ These time terms are relative to the start/end time.
#1 "@19 Jan 2014 11:45:50" 2014-01-19 11:45:50
#2 "@19 Jan 2014 11:45:50" 2014-01-19 11:45:50
#3 "@19 Jan 2014 11:45:50" 2014-01-27 11:28:50
-#1 "@next day" 2014-01-19 15:08:50
-#2 "@next day" 2014-01-19 15:08:50
-#3 "@next day" 2014-01-27 11:28:50
#1 "@1 day ago" 2014-01-26 11:28:50
#2 "@1 day ago" 2014-01-26 11:28:50
#3 "@1 day ago" 2014-01-27 11:28:50
@@ -85,9 +82,6 @@ These time terms are relative to the start/end time.
#1 "last day" 2014-01-26 11:28:50
#2 "last day" 2014-01-26 11:28:50
#3 "last day" 2014-01-27 11:28:50
-#1 "next day" 2014-01-19 15:08:50
-#2 "next day" 2014-01-19 15:08:50
-#3 "next day" 2014-01-27 11:28:50
These time terms for a specific day are relative to the current time.
#1 "now" TODAY
#2 "now" TODAY
@@ -113,9 +107,6 @@ These time terms for a specific day are relative to the current time.
#1 "this sunday" this SUNDAY
#2 "this sunday" this SUNDAY
#3 "this sunday" 2014-01-27 11:28:50
-#1 "next sunday" next SUNDAY
-#2 "next sunday" next SUNDAY
-#3 "next sunday" 2014-01-27 11:28:50
#1 "last sunday" last SUNDAY
#2 "last sunday" last SUNDAY
#3 "last sunday" 2014-01-27 11:28:50
@@ -128,9 +119,6 @@ These time terms for a specific day are relative to the current time.
#1 "this monday" this MONDAY
#2 "this monday" this MONDAY
#3 "this monday" 2014-01-27 11:28:50
-#1 "next monday" next MONDAY
-#2 "next monday" next MONDAY
-#3 "next monday" 2014-01-27 11:28:50
#1 "last monday" last MONDAY
#2 "last monday" last MONDAY
#3 "last monday" 2014-01-27 11:28:50
@@ -143,9 +131,6 @@ These time terms for a specific day are relative to the current time.
#1 "this tuesday" this TUESDAY
#2 "this tuesday" this TUESDAY
#3 "this tuesday" 2014-01-27 11:28:50
-#1 "next tuesday" next TUESDAY
-#2 "next tuesday" next TUESDAY
-#3 "next tuesday" 2014-01-27 11:28:50
#1 "last tuesday" last TUESDAY
#2 "last tuesday" last TUESDAY
#3 "last tuesday" 2014-01-27 11:28:50
@@ -158,9 +143,6 @@ These time terms for a specific day are relative to the current time.
#1 "this wednesday" this WEDNESDAY
#2 "this wednesday" this WEDNESDAY
#3 "this wednesday" 2014-01-27 11:28:50
-#1 "next wednesday" next WEDNESDAY
-#2 "next wednesday" next WEDNESDAY
-#3 "next wednesday" 2014-01-27 11:28:50
#1 "last wednesday" last WEDNESDAY
#2 "last wednesday" last WEDNESDAY
#3 "last wednesday" 2014-01-27 11:28:50
@@ -173,9 +155,6 @@ These time terms for a specific day are relative to the current time.
#1 "this thursday" this THURSDAY
#2 "this thursday" this THURSDAY
#3 "this thursday" 2014-01-27 11:28:50
-#1 "next thursday" next THURSDAY
-#2 "next thursday" next THURSDAY
-#3 "next thursday" 2014-01-27 11:28:50
#1 "last thursday" last THURSDAY
#2 "last thursday" last THURSDAY
#3 "last thursday" 2014-01-27 11:28:50
@@ -188,9 +167,6 @@ These time terms for a specific day are relative to the current time.
#1 "this friday" this FRIDAY
#2 "this friday" this FRIDAY
#3 "this friday" 2014-01-27 11:28:50
-#1 "next friday" next FRIDAY
-#2 "next friday" next FRIDAY
-#3 "next friday" 2014-01-27 11:28:50
#1 "last friday" last FRIDAY
#2 "last friday" last FRIDAY
#3 "last friday" 2014-01-27 11:28:50
@@ -203,9 +179,6 @@ These time terms for a specific day are relative to the current time.
#1 "this saturday" this SATURDAY
#2 "this saturday" this SATURDAY
#3 "this saturday" 2014-01-27 11:28:50
-#1 "next saturday" next SATURDAY
-#2 "next saturday" next SATURDAY
-#3 "next saturday" 2014-01-27 11:28:50
#1 "last saturday" last SATURDAY
#2 "last saturday" last SATURDAY
#3 "last saturday" 2014-01-27 11:28:50
@@ -193,14 +193,11 @@ fetchlocal.o
fetch.o
freeresult.o
getdate.tab.o
- dst_table # const
- meridian_table # const
- military_table # const
- month_and_day_table # const
- relative_time_table # const
- time_units_table # const
- time_zone_table # const
- universal_time_zone_table # const
+ MilitaryTable # const
+ OtherTable # const
+ MonthDayTable # const
+ TimezoneTable # const
+ UnitsTable # const
yycheck # const
yydefact # const
yydefgoto # const
@@ -212,7 +209,6 @@ getdate.tab.o
?yyval_default # local to parser ... depends on yacc/bison version
yytable # const
yytranslate # const
- ?yyparse.yyval_default # const
getopt.o
hash.o
help.o
Oops, something went wrong.

0 comments on commit cbc75af

Please sign in to comment.