On Tue, 3 May 2016 19:24:00 +0200
Florian Stinglmayr <[email protected]> wrote:

> On Mon, May 02, 2016 at 02:48:28PM +0800, Ray Lai wrote:
>  [...]  
> 
> This patch works fine for me, and ledger works fine on my
> ledger files. But someone with more complex files should also
> probably take a look and test.

I've enabled the test suite. It doesn't pass completely; for some
reason "ledger balance --time-report" always sets
latest_checkout_cleared, which causes ansi codes to be printed, even
with --no-color. I don't know enough C++ to debug the cause, but I
suspect that latest_checkout_cleared is being used uninitialized.

For some reason the sort order also seems to be off a bit. But in terms
of numbers, everything seems A-okay.

For more details, run "make test" and look at:
/home/ports/pobj/ledger-3.1.1/build-amd64/test/Testing/Temporary/LastTest.log

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/productivity/ledger/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile    4 Apr 2016 16:09:10 -0000       1.15
+++ Makefile    8 May 2016 07:26:47 -0000
@@ -1,44 +1,54 @@
 # $OpenBSD: Makefile,v 1.15 2016/04/04 16:09:10 naddy Exp $
 
 COMMENT=       command line double-entry accounting ledger
+V=             3.1.1
 
-DISTNAME=      ledger-2.6.3
-REVISION=      3
+DISTNAME=      ${GH_PROJECT}-${V}
 CATEGORIES=    productivity
 
 HOMEPAGE=      http://www.ledger-cli.org/
 
 MAINTAINER=    Sergey Bronnikov <[email protected]>
 
-SHARED_LIBS=   amounts 0.0
+SHARED_LIBS=   ledger  0.0
 
 # BSD
 PERMIT_PACKAGE_CDROM=  Yes
 
-MASTER_SITES=  https://github.com/downloads/jwiegley/ledger/
+GH_ACCOUNT =   ledger
+GH_PROJECT =   ledger
+GH_TAGNAME =   v${V}
+
+WANTLIB+=      boost_date_time-mt boost_filesystem-mt boost_iostreams-mt
+WANTLIB+=      boost_regex-mt boost_system-mt boost_unit_test_framework-mt
+WANTLIB+=      c estdc++ gmp>=4 m mpfr pthread
+
+BUILD_DEPENDS= lang/gcc/4.9,-c++>=4.9 \
+               devel/cmake
+
+LIB_DEPENDS=   devel/boost \
+               devel/gmp \
+               devel/mpfr \
+               ${MODGCC4_CPPLIBDEP}
+
+TEST_DEPENDS=  lang/python/${MODPY_VERSION}
+
+MODULES=       devel/cmake \
+               gcc4 \
+               lang/python
 
-WANTLIB=       c gmp>=4 m pcre stdc++
-
-LIB_DEPENDS=   devel/gmp \
-               devel/pcre
+MODGCC4_LANGS= c++
+MODGCC4_ARCHS= *
 
 SEPARATE_BUILD=        Yes
 
+CONFIGURE_ENV= CC=egcc CXX=eg++
+CONFIGURE_ARGS=        -DUSE_PYTHON=OFF -DBUILD_LIBRARY=ON
 
-CONFIGURE_STYLE=gnu
-CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
-               LDFLAGS="-L${LOCALBASE}/lib" \
-               EMACS=no
-CONFIGURE_ARGS=        --disable-xml \
-               --disable-ofx
+TEST_TARGET=   check
 
 post-install:
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/ledger
-       ${INSTALL_DATA} ${WRKSRC}/scripts/* ${PREFIX}/share/doc/ledger
-.for f in ledger.texi ledger.vim
-       ${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/share/doc/ledger
-.endfor
        ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/ledger
-       ${INSTALL_DATA} ${WRKSRC}/sample.dat ${PREFIX}/share/examples/ledger
+       ${INSTALL_DATA} ${WRKSRC}/test/input/sample.dat 
${PREFIX}/share/examples/ledger
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/productivity/ledger/distinfo,v
retrieving revision 1.5
diff -u -p -r1.5 distinfo
--- distinfo    18 Jan 2015 03:14:59 -0000      1.5
+++ distinfo    1 May 2016 17:15:51 -0000
@@ -1,2 +1,2 @@
-SHA256 (ledger-2.6.3.tar.gz) = s+zQF0o1ALuW/gR2F7HuhwzFGW3rAjA5PZM9zq639xc=
-SIZE (ledger-2.6.3.tar.gz) = 660752
+SHA256 (ledger-3.1.1.tar.gz) = kPBlYatpKxktRtZ7wQYVjanGxoE8w4SLUDJDqd/YVIo=
+SIZE (ledger-3.1.1.tar.gz) = 842364
Index: patches/patch-src_CMakeLists_txt
===================================================================
RCS file: patches/patch-src_CMakeLists_txt
diff -N patches/patch-src_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_CMakeLists_txt    1 May 2016 17:20:50 -0000
@@ -0,0 +1,53 @@
+$OpenBSD$
+--- src/CMakeLists.txt.orig    Mon Jan 11 16:59:38 2016
++++ src/CMakeLists.txt Tue Mar 15 17:26:08 2016
+@@ -263,21 +263,21 @@ include(GNUInstallDirs)
+ 
+ if (BUILD_LIBRARY)
+   set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+-  add_library(libledger SHARED ${LEDGER_SOURCES})
+-  add_ledger_library_dependencies(libledger)
+-  set_target_properties(libledger PROPERTIES
+-    PREFIX ""
++  add_library(ledger SHARED ${LEDGER_SOURCES})
++  add_ledger_library_dependencies(ledger)
++  set_target_properties(ledger PROPERTIES
+     INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
+     VERSION ${Ledger_VERSION_MAJOR}
+     SOVERSION ${Ledger_VERSION_MAJOR})
+ 
+-  add_executable(ledger main.cc global.cc)
+-  target_link_libraries(ledger libledger)
++  add_executable(ledger-bin main.cc global.cc)
++  set_target_properties(ledger-bin PROPERTIES OUTPUT_NAME ledger)
++  target_link_libraries(ledger-bin ledger)
+   if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON)
+-    target_link_libraries(ledger ${PYTHON_LIBRARIES})
++    target_link_libraries(ledger-bin ${PYTHON_LIBRARIES})
+   endif()
+ 
+-  install(TARGETS libledger DESTINATION ${CMAKE_INSTALL_LIBDIR})
++  install(TARGETS ledger DESTINATION ${CMAKE_INSTALL_LIBDIR})
+   install(FILES ${LEDGER_INCLUDES}
+     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ledger)
+ else()
+@@ -308,9 +308,9 @@ print(s.get_python_lib(True, prefix=''))"
+     # execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ...).
+     # Windows will need a special case due to not supporting symlinks.
+     add_custom_command(
+-      TARGET libledger POST_BUILD
++      TARGET ledger POST_BUILD
+       COMMAND ${CMAKE_COMMAND} -E copy_if_different
+-      $<TARGET_FILE:libledger> 
"${CMAKE_BINARY_DIR}/${_ledger_python_module_name}")
++      $<TARGET_FILE:ledger-bin> 
"${CMAKE_BINARY_DIR}/${_ledger_python_module_name}")
+     install(
+       FILES "${CMAKE_BINARY_DIR}/${_ledger_python_module_name}"
+       DESTINATION ${PYTHON_SITE_PACKAGES})
+@@ -319,6 +319,6 @@ print(s.get_python_lib(True, prefix=''))"
+   endif()
+ endif()
+ 
+-install(TARGETS ledger DESTINATION ${CMAKE_INSTALL_BINDIR})
++install(TARGETS ledger-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
+ 
+ ### CMakeLists.txt ends here
Index: patches/patch-test_CMakeLists_txt
===================================================================
RCS file: patches/patch-test_CMakeLists_txt
diff -N patches/patch-test_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_CMakeLists_txt   1 May 2016 17:21:07 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+--- test/CMakeLists.txt.orig   Tue Mar 15 17:27:29 2016
++++ test/CMakeLists.txt        Tue Mar 15 17:25:38 2016
+@@ -23,7 +23,7 @@ macro(add_ledger_harness_tests _class)
+       if ((TestFile_IsPythonTest EQUAL -1) OR HAVE_BOOST_PYTHON)
+         add_test(NAME ${_class}Test_${TestFile_Name}
+           COMMAND ${PYTHON_EXECUTABLE} 
${PROJECT_SOURCE_DIR}/test/RegressTests.py
+-          $<TARGET_FILE:ledger> ${PROJECT_SOURCE_DIR}
++          $<TARGET_FILE:ledger-bin> ${PROJECT_SOURCE_DIR}
+           ${TestFile} ${TEST_PYTHON_FLAGS})
+         set_tests_properties(${_class}Test_${TestFile_Name}
+           PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
+@@ -45,7 +45,7 @@ if (PYTHONINTERP_FOUND)
+     get_filename_component(TestFile_Name ${TestFile} NAME_WE)
+     add_test(NAME ${_class}Test_${TestFile_Name}
+       COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
+-      --ledger $<TARGET_FILE:ledger> --file ${TestFile})
++      --ledger $<TARGET_FILE:ledger-bin> --file ${TestFile})
+     set_tests_properties(${_class}Test_${TestFile_Name}
+       PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
+     set_target_properties(check
+@@ -58,7 +58,7 @@ if (PYTHONINTERP_FOUND)
+   foreach(_class ${CheckOptions})
+     add_test(NAME ${_class}
+       COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py
+-      --ledger $<TARGET_FILE:ledger> --source ${PROJECT_SOURCE_DIR})
++      --ledger $<TARGET_FILE:ledger-bin> --source ${PROJECT_SOURCE_DIR})
+     set_tests_properties(${_class}
+       PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
+   endforeach()
Index: patches/patch-test_CheckOptions_py
===================================================================
RCS file: patches/patch-test_CheckOptions_py
diff -N patches/patch-test_CheckOptions_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_CheckOptions_py  4 May 2016 08:11:56 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- test/CheckOptions.py.orig  Wed May  4 16:08:53 2016
++++ test/CheckOptions.py       Wed May  4 16:09:03 2016
+@@ -19,8 +19,8 @@ class CheckOptions (object):
+     self.source_file = None
+     self.sep = "\n  --"
+ 
+-    self.ledger     = os.path.abspath(args.ledger)
+-    self.source     = os.path.abspath(args.source)
++    self.ledger     = os.path.realpath(args.ledger)
++    self.source     = os.path.realpath(args.source)
+ 
+     self.missing_options = set()
+     self.unknown_options = set()
Index: patches/patch-test_DocTests_py
===================================================================
RCS file: patches/patch-test_DocTests_py
diff -N patches/patch-test_DocTests_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_DocTests_py      4 May 2016 08:11:56 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- test/DocTests.py.orig      Wed May  4 16:01:32 2016
++++ test/DocTests.py   Wed May  4 16:09:30 2016
+@@ -14,8 +14,8 @@ from difflib import unified_diff
+ class DocTests:
+   def __init__(self, args):
+     scriptpath      = os.path.dirname(os.path.realpath(__file__))
+-    self.ledger     = os.path.abspath(args.ledger)
+-    self.sourcepath = os.path.abspath(args.file)
++    self.ledger     = os.path.realpath(args.ledger)
++    self.sourcepath = os.path.realpath(args.file)
+     self.verbose    = args.verbose
+     self.tests      = args.examples
+ 
Index: patches/patch-test_LedgerHarness_py
===================================================================
RCS file: patches/patch-test_LedgerHarness_py
diff -N patches/patch-test_LedgerHarness_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_LedgerHarness_py 4 May 2016 08:11:56 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- test/LedgerHarness.py.orig Wed May  4 16:06:32 2016
++++ test/LedgerHarness.py      Wed May  4 16:06:37 2016
+@@ -44,8 +44,8 @@ class LedgerHarness:
+             print "Cannot find source path at '%s'" % argv[2]
+             sys.exit(1)
+ 
+-        self.ledger     = os.path.abspath(argv[1])
+-        self.sourcepath = os.path.abspath(argv[2])
++        self.ledger     = os.path.realpath(argv[1])
++        self.sourcepath = os.path.realpath(argv[2])
+         self.succeeded  = 0
+         self.failed     = 0
+         self.verify     = '--verify' in argv
Index: patches/patch-test_RegressTests_py
===================================================================
RCS file: patches/patch-test_RegressTests_py
diff -N patches/patch-test_RegressTests_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_RegressTests_py  4 May 2016 08:11:56 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+--- test/RegressTests.py.orig  Wed May  4 16:08:08 2016
++++ test/RegressTests.py       Wed May  4 16:08:11 2016
+@@ -42,7 +42,7 @@ class RegressFile(object):
+ 
+     def transform_line(self, line):
+         line = re.sub('\$sourcepath', harness.sourcepath, line)
+-        line = re.sub('\$FILE', os.path.abspath(self.filename), line)
++        line = re.sub('\$FILE', os.path.realpath(self.filename), line)
+         return line
+ 
+     def read_test(self):
+@@ -104,7 +104,7 @@ class RegressFile(object):
+                 use_stdin = True
+         else:
+             test['command'] = (('$ledger -f "%s" ' % 
+-                                os.path.abspath(self.filename)) +
++                                os.path.realpath(self.filename)) +
+                                test['command'])
+ 
+         p = harness.run(test['command'],
Index: patches/patch-test_convert_py
===================================================================
RCS file: patches/patch-test_convert_py
diff -N patches/patch-test_convert_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_convert_py       4 May 2016 08:11:56 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- test/convert.py.orig       Wed May  4 16:09:45 2016
++++ test/convert.py    Wed May  4 16:09:53 2016
+@@ -36,9 +36,9 @@ import re
+ import sys
+ import os
+ 
+-source = os.path.abspath(sys.argv[1])
++source = os.path.realpath(sys.argv[1])
+ base   = os.path.splitext(source)[0]
+-target = os.path.abspath(sys.argv[2])
++target = os.path.realpath(sys.argv[2])
+ 
+ dirname = os.path.dirname(target)
+ if not os.path.isdir(dirname):
Index: patches/patch-test_unit_CMakeLists_txt
===================================================================
RCS file: patches/patch-test_unit_CMakeLists_txt
diff -N patches/patch-test_unit_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_unit_CMakeLists_txt      1 May 2016 17:21:59 -0000
@@ -0,0 +1,10 @@
+$OpenBSD$
+--- test/unit/CMakeLists.txt.orig      Wed Jan 13 21:53:23 2016
++++ test/unit/CMakeLists.txt   Wed Jan 13 21:53:33 2016
+@@ -1,5 +1,5 @@
+ macro(add_ledger_test _name)
+-  target_link_libraries(${_name} libledger)
++  target_link_libraries(${_name} ledger)
+   add_test(Ledger${_name} ${PROJECT_BINARY_DIR}/${_name})
+   set_tests_properties(Ledger${_name}
+     PROPERTIES ENVIRONMENT "TZ=${Ledger_TEST_TIMEZONE}")
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/productivity/ledger/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- pkg/PLIST   4 Apr 2016 16:09:10 -0000       1.3
+++ pkg/PLIST   1 May 2016 17:16:13 -0000
@@ -1,57 +1,67 @@
 @comment $OpenBSD: PLIST,v 1.3 2016/04/04 16:09:10 naddy Exp $
 @bin bin/ledger
 include/ledger/
-include/ledger/acconf.h
+include/ledger/account.h
 include/ledger/amount.h
+include/ledger/annotate.h
 include/ledger/balance.h
-include/ledger/binary.h
-include/ledger/config.h
+include/ledger/chain.h
+include/ledger/commodity.h
+include/ledger/compare.h
+include/ledger/context.h
+include/ledger/convert.h
 include/ledger/csv.h
-include/ledger/datetime.h
-include/ledger/debug.h
-include/ledger/derive.h
+include/ledger/draft.h
 include/ledger/emacs.h
 include/ledger/error.h
+include/ledger/expr.h
+include/ledger/exprbase.h
+include/ledger/filters.h
+include/ledger/flags.h
 include/ledger/format.h
-include/ledger/gnucash.h
+include/ledger/generate.h
+include/ledger/global.h
+include/ledger/history.h
+include/ledger/item.h
+include/ledger/iterators.h
 include/ledger/journal.h
-include/ledger/ledger.h
+include/ledger/lookup.h
 include/ledger/mask.h
-include/ledger/ofx.h
+include/ledger/op.h
 include/ledger/option.h
+include/ledger/org.h
+include/ledger/output.h
 include/ledger/parser.h
-include/ledger/qif.h
+include/ledger/pool.h
+include/ledger/post.h
+include/ledger/precmd.h
+include/ledger/predicate.h
+include/ledger/print.h
+include/ledger/pstream.h
+include/ledger/ptree.h
+include/ledger/pyfstream.h
+include/ledger/pyinterp.h
+include/ledger/pyutils.h
+include/ledger/query.h
 include/ledger/quotes.h
-include/ledger/reconcile.h
 include/ledger/report.h
-include/ledger/textual.h
-include/ledger/timing.h
-include/ledger/util.h
-include/ledger/valexpr.h
+include/ledger/scope.h
+include/ledger/select.h
+include/ledger/session.h
+include/ledger/stats.h
+include/ledger/stream.h
+include/ledger/strptime.h
+include/ledger/system.hh
+include/ledger/temps.h
+include/ledger/timelog.h
+include/ledger/times.h
+include/ledger/token.h
+include/ledger/unistring.h
+include/ledger/utils.h
 include/ledger/value.h
-include/ledger/walk.h
-include/ledger/xml.h
-@info info/ledger.info
-lib/libamounts.a
-lib/libamounts.la
-@lib lib/libamounts.so.${LIBamounts_VERSION}
-lib/libledger-2.6.3.so
-lib/libledger.a
-lib/libledger.la
-lib/libledger.so
-share/doc/ledger/
-share/doc/ledger/README
-share/doc/ledger/bal
-share/doc/ledger/bal-huquq
-share/doc/ledger/entry
-share/doc/ledger/getquote
-share/doc/ledger/ledger-du
-share/doc/ledger/ledger.texi
-share/doc/ledger/ledger.vim
-share/doc/ledger/report
-share/doc/ledger/tc
-share/doc/ledger/ti
-share/doc/ledger/to
-share/doc/ledger/trend
+include/ledger/views.h
+include/ledger/xact.h
+@lib lib/libledger.so.${LIBledger_VERSION}
+@man man/man1/ledger.1
 share/examples/ledger/
 share/examples/ledger/sample.dat

Reply via email to