diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-11-04 03:03:54 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-11-04 03:03:54 +0000 |
commit | 3cc82055be7dba177f4aea15af9f5414b532da7e (patch) | |
tree | 1eed8bbe7a93b3a0a7d6091ead40e81519978a38 /app-office/ledger | |
parent | 212000bb5eabdfeb9a6e7a9b8f28e2740cae555a (diff) |
gentoo auto-resync : 04:11:2024 - 03:03:54
Diffstat (limited to 'app-office/ledger')
-rw-r--r-- | app-office/ledger/Manifest | 3 | ||||
-rw-r--r-- | app-office/ledger/files/sha1sum.patch | 110 | ||||
-rw-r--r-- | app-office/ledger/ledger-3.3.2-r2.ebuild (renamed from app-office/ledger/ledger-3.3.2.ebuild) | 24 |
3 files changed, 130 insertions, 7 deletions
diff --git a/app-office/ledger/Manifest b/app-office/ledger/Manifest index 0910a0df0582..36c3dcf9de87 100644 --- a/app-office/ledger/Manifest +++ b/app-office/ledger/Manifest @@ -1,5 +1,6 @@ AUX convenience.patch 425 BLAKE2B 681557bc92a8006109abc3317a2e2d729e998f2ed9d3478b028cc38ebbb0d3f13fef21a6ad928b2c8fe0de1551342c33908e52e0043ba27c296eb1956267be96 SHA512 99782978e3877a4a896ea07d01dd40a0a7001becc422dc183a51bc39baf950f391da0d79d98249db9b103472deebdbc82428ca91f9c2f42010afc1ead42b5acc +AUX sha1sum.patch 3438 BLAKE2B 28309d9f7377825abbdaf115f284cc9186bf0248d58b57c4f4a61ce9dd4ed15feab330c03fd879539847601b1a28351a7c7000ea2154492c06ab700930dbc28b SHA512 0818f243634b181f854efc18a539dd5030e673d3fa7910b581eac3656aba4b74562baeafe790af536b91f538fad724673e369d30026c67418ec18a0d4103b725 DIST ledger-3.3.2.tar.gz 825274 BLAKE2B ee0901eaba234688cc36e399bd86118269d8691162feacf25e70ffaf28e8d572f47a62fb014126f5dce65c73135f21ad4364a642637a80d2577bf20b657fc9a4 SHA512 d5d7058f0e9a02ad1d46e6780675d446070824b321f0f4c1ea6ac0c3dd4f11f259113bc36cbc796e4bb6d0a7898d6a68a25cce639e27a2b2434eec11a612ecb0 EBUILD ledger-3.3.2-r1.ebuild 2447 BLAKE2B 8bb037421eb51cfd8113528275d10e0d1c97bebad13a42ae54ae855ef852d504afa4cc1695f54577468a6480e0fe7e4d06ac78eb5261be9ef6c11bbe982e2f4d SHA512 794adfadabfae5c14ee7b6b792852b0e5002fdd50daf7cd376cb3512800ca40f2f44363dc47b642caa43fb8ac9e847a7f9b18a3b2aab96c4b12c86bc84e6c3f9 -EBUILD ledger-3.3.2.ebuild 2392 BLAKE2B 0ca2fb25ab9bc07ad8da27d6800115c0791aa8d9c658f75fbe74a5743c2d9dd07f6d058cdd9fe23659a4fcdf72d1bd1ef44d44bc379b97d0d8f59c286a85492f SHA512 1bfff76995e6c3fbb6146d836e0399612baade304bd8b800575b880567e7dc0560fd17339537e7a55df30c336b098df564e165ef483015a8ef6be3f0fd95f957 +EBUILD ledger-3.3.2-r2.ebuild 2781 BLAKE2B ea998e31cf762fd5b95f46d619c25ba050b78bbc48bdcd2fac656703542db5a9501ee68fbb734b2ee2b2284d1af9ede06b428a87655386aa1e331d4975a1127e SHA512 715de9587dfa17e13a64b39c6d9573368b3516ca3e99870cc3a60255f2867711ece36aa76df5284b29c3f14e4fbed3feae09cfb6b780be71b7deba56b3482f91 MISC metadata.xml 307 BLAKE2B f3dac05e0bf7b2902ba20eb344829c1b835ff3847c71aaf1c53d28c5045b350fbf140e2f6b3cdb80f3be99b9fa3afffdd2c52d5081c6500c42233a402ce25a54 SHA512 db8c5c551a20e1e19151f31188fb1e61642591dbb01ad4e52b4542dabde3fd374ed234b7de6c9fdd11cf57477acc8dda07e26bc5ae8f251ab306309bf3772668 diff --git a/app-office/ledger/files/sha1sum.patch b/app-office/ledger/files/sha1sum.patch new file mode 100644 index 000000000000..2de66a672e68 --- /dev/null +++ b/app-office/ledger/files/sha1sum.patch @@ -0,0 +1,110 @@ +diff --git a/src/filters.cc b/src/filters.cc +index f725c247..030a5fb4 100644 +--- a/src/filters.cc ++++ b/src/filters.cc +@@ -237,8 +237,6 @@ void anonymize_posts::render_commodity(amount_t& amt) + + void anonymize_posts::operator()(post_t& post) + { +- boost::uuids::detail::sha1 sha; +- unsigned int message_digest[5]; + bool copy_xact_details = false; + + if (last_xact != post.xact) { +@@ -255,12 +253,7 @@ void anonymize_posts::operator()(post_t& post) + std::ostringstream buf; + buf << reinterpret_cast<boost::uintmax_t>(post.xact->payee.c_str()) + << integer_gen() << post.xact->payee.c_str(); +- +- sha.reset(); +- sha.process_bytes(buf.str().c_str(), buf.str().length()); +- sha.get_digest(message_digest); +- +- xact.payee = to_hex(message_digest); ++ xact.payee = sha1sum(buf.str(), 8); + xact.note = none; + } else { + xact.journal = post.xact->journal; +@@ -273,12 +266,7 @@ void anonymize_posts::operator()(post_t& post) + acct = acct->parent) { + std::ostringstream buf; + buf << integer_gen() << acct << acct->fullname(); +- +- sha.reset(); +- sha.process_bytes(buf.str().c_str(), buf.str().length()); +- sha.get_digest(message_digest); +- +- account_names.push_front(to_hex(message_digest)); ++ account_names.push_front(sha1sum(buf.str(), 8)); + } + + account_t * new_account = +@@ -1268,7 +1256,7 @@ void budget_posts::report_budget_items(const date_t& date) + foreach (pending_posts_list::iterator& i, posts_to_erase) + pending_posts.erase(i); + } +- ++ + if (pending_posts.size() == 0) + return; + +diff --git a/src/utils.h b/src/utils.h +index b09377b8..510686fd 100644 +--- a/src/utils.h ++++ b/src/utils.h +@@ -607,29 +607,39 @@ inline int peek_next_nonws(std::istream& in) { + *_p = '\0'; \ + } + +-inline string to_hex(unsigned int * message_digest, const int len = 1) +-{ ++inline string digest_to_hex( ++ const boost::uuids::detail::sha1::digest_type& message_digest, ++ size_t len = sizeof(boost::uuids::detail::sha1::digest_type) * 2 ++) { + std::ostringstream buf; +- +- for(int i = 0; i < 5 ; i++) { +- buf.width(8); +- buf.fill('0'); +- buf << std::hex << message_digest[i]; +- if (i + 1 >= len) +- break; // only output the first LEN dwords ++ buf.setf(std::ios_base::hex, std::ios_base::basefield); ++ buf.fill('0'); ++ ++ // sha1::digest_type is an array type and may change between Boost versions ++ const size_t count = std::min( ++ sizeof(message_digest) / sizeof(message_digest[0]), ++ (len - 1) / (sizeof(message_digest[0]) * 2) + 1 ++ ); ++ for(size_t i = 0; i < count; i++) { ++ buf.width(sizeof(message_digest[i]) * 2); ++ buf << (unsigned int)message_digest[i]; + } +- return buf.str(); ++ string hex = buf.str(); ++ hex.resize(len, '0'); // in case a partial element is requested ++ return hex; + } + +-inline string sha1sum(const string& str) +-{ +- boost::uuids::detail::sha1 sha; ++inline string sha1sum( ++ const string& str, ++ size_t len = sizeof(boost::uuids::detail::sha1::digest_type) * 2 ++) { ++ static boost::uuids::detail::sha1 sha; ++ boost::uuids::detail::sha1::digest_type message_digest; + ++ sha.reset(); + sha.process_bytes(str.c_str(), str.length()); +- +- unsigned int message_digest[5]; + sha.get_digest(message_digest); +- return to_hex(message_digest, 5); ++ return digest_to_hex(message_digest, len); + } + + extern const string version; diff --git a/app-office/ledger/ledger-3.3.2.ebuild b/app-office/ledger/ledger-3.3.2-r2.ebuild index c9108199104d..4d99599fedda 100644 --- a/app-office/ledger/ledger-3.3.2.ebuild +++ b/app-office/ledger/ledger-3.3.2-r2.ebuild @@ -1,11 +1,11 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -PYTHON_COMPAT=( python3_{9,10,11} ) +PYTHON_COMPAT=( python3_{10,11,12,13} ) CMAKE_REMOVE_MODULES_LIST=( FindPython Support ) -inherit bash-completion-r1 check-reqs cmake python-single-r1 +inherit bash-completion-r1 check-reqs cmake optfeature python-single-r1 DESCRIPTION="Double-entry accounting system with a command-line reporting interface" HOMEPAGE="https://www.ledger-cli.org/" @@ -13,7 +13,7 @@ SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" LICENSE="BSD" SLOT="0" -KEYWORDS="amd64 arm arm64 ~ppc64 ~riscv x86" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" IUSE="debug doc python" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -67,6 +67,10 @@ src_prepare() { mv doc/ledger{3,}.texi || die "Failed to rename info file name" rm -r lib/utfcpp || die + + eapply "${FILESDIR}/convenience.patch" + eapply "${FILESDIR}/sha1sum.patch" + eapply_user } src_configure() { @@ -98,6 +102,10 @@ src_compile() { src_install() { cmake_src_install + # Requires gnuplot + exeinto /usr/bin + doexe contrib/report + newbashcomp contrib/${PN}-completion.bash ${PN} } @@ -105,9 +113,13 @@ pkg_postinst() { elog elog "Since version 3, vim support is released separately." elog "See https://github.com/ledger/vim-ledger" - elog - elog "For Emacs mode, emerge app-emacs/ledger-mode" + optfeature_header \ + "Install the following packages for additional features:" + optfeature "Emacs support" "app-emacs/ledger-mode" + optfeature "Plot visualization" "sci-visualization/gnuplot" + optfeature "Graph visualization" "media-gfx/graphviz" } # rainy day TODO: # - IUSE test +# - create vim-ledger ebuild |