From 198f6a39f509de62daa7aa9d72cf0ea0c75932dd Mon Sep 17 00:00:00 2001 From: Karol Wojtaszek Date: Sun, 18 Jun 2006 16:57:09 +0000 Subject: [PATCH] Add patch which fixes a serious performance problem when MLDonkey downloads lots of new files or torrents with a lot (>100) subfiles, bug #136700 Package-Manager: portage-2.1.1_pre1-r1 --- net-p2p/mldonkey/ChangeLog | 9 +- net-p2p/mldonkey/Manifest | 25 ++- .../mldonkey/files/digest-mldonkey-2.7.6-r1 | 3 + .../mldonkey/files/mldonkey-2.7.6-magic.patch | 173 ++++++++++++++++++ net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild | 167 +++++++++++++++++ 5 files changed, 369 insertions(+), 8 deletions(-) create mode 100644 net-p2p/mldonkey/files/digest-mldonkey-2.7.6-r1 create mode 100644 net-p2p/mldonkey/files/mldonkey-2.7.6-magic.patch create mode 100644 net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild diff --git a/net-p2p/mldonkey/ChangeLog b/net-p2p/mldonkey/ChangeLog index 59ff78d9d709..30b2c75b7b99 100644 --- a/net-p2p/mldonkey/ChangeLog +++ b/net-p2p/mldonkey/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for net-p2p/mldonkey # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.123 2006/06/09 13:48:52 sekretarz Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/ChangeLog,v 1.124 2006/06/18 16:57:09 sekretarz Exp $ + +*mldonkey-2.7.6-r1 (18 Jun 2006) + + 18 Jun 2006; Karol Wojtaszek + +files/mldonkey-2.7.6-magic.patch, +mldonkey-2.7.6-r1.ebuild: + Add patch which fixes a serious performance problem when MLDonkey + downloads lots of new files or torrents with a lot (>100) subfiles, bug #136700 09 Jun 2006; Karol Wojtaszek -mldonkey-2.5.21-r2.ebuild, -mldonkey-2.6.5.ebuild, diff --git a/net-p2p/mldonkey/Manifest b/net-p2p/mldonkey/Manifest index 9ee0e2648730..25f810ce9ffc 100644 --- a/net-p2p/mldonkey/Manifest +++ b/net-p2p/mldonkey/Manifest @@ -13,6 +13,10 @@ AUX mldonkey-2.7.3-configure.patch 497 RMD160 3a339c5e660cb9e9dfd0b159e20b77f0f6 MD5 e6ba1f14ca558c6834b6e0d47013e212 files/mldonkey-2.7.3-configure.patch 497 RMD160 3a339c5e660cb9e9dfd0b159e20b77f0f694689a files/mldonkey-2.7.3-configure.patch 497 SHA256 85380d0d908cbfcdf4e6e2245d50d8361a2db6d9519e35ddad7eecedcb8aadb5 files/mldonkey-2.7.3-configure.patch 497 +AUX mldonkey-2.7.6-magic.patch 6693 RMD160 96097de4fc7c2f17218da07df13a082f113e9ad1 SHA1 78db099391396ff61b79bec41872a5e5217daa95 SHA256 f95040c125e41c65381e90c124993a7769a5be0daa0790895f8e503a1d97304a +MD5 69a5142bc9dc243dbb8ae121b5dc5505 files/mldonkey-2.7.6-magic.patch 6693 +RMD160 96097de4fc7c2f17218da07df13a082f113e9ad1 files/mldonkey-2.7.6-magic.patch 6693 +SHA256 f95040c125e41c65381e90c124993a7769a5be0daa0790895f8e503a1d97304a files/mldonkey-2.7.6-magic.patch 6693 AUX mldonkey-gui.desktop 263 RMD160 c8da2a5e90446cefe75e93969b975093b2d367b0 SHA1 6e350814866f741ef76389c98df34af22751e164 SHA256 8ba9aec085500abbc7fcf53cf34a61e23a5b68cdc8b4b856f4395a5729608eb9 MD5 93e16748ad44af182177978057266aa7 files/mldonkey-gui.desktop 263 RMD160 c8da2a5e90446cefe75e93969b975093b2d367b0 files/mldonkey-gui.desktop 263 @@ -47,14 +51,18 @@ EBUILD mldonkey-2.7.3.ebuild 5030 RMD160 948720d0b9d30e99717b4000dd28a2e71e96b31 MD5 d49149ecf3e46e7abb3fac63f9c4cabf mldonkey-2.7.3.ebuild 5030 RMD160 948720d0b9d30e99717b4000dd28a2e71e96b312 mldonkey-2.7.3.ebuild 5030 SHA256 6561ef5f4d7eaf158319f90c154b5c91b23358c98dc5f0044fdfe4ad22d7fa2e mldonkey-2.7.3.ebuild 5030 +EBUILD mldonkey-2.7.6-r1.ebuild 4513 RMD160 aa675033dd9f9c93910738981e7988ee9addc562 SHA1 724e10eeab869186b81db99a561d3c3d3c17df43 SHA256 6fb03bec5710d57db2d2f15dd9ee5e4e2b32eeef9a1eb73d7aa6eb90d691886d +MD5 78b2496f5b487e8addc83abc36c9c3cf mldonkey-2.7.6-r1.ebuild 4513 +RMD160 aa675033dd9f9c93910738981e7988ee9addc562 mldonkey-2.7.6-r1.ebuild 4513 +SHA256 6fb03bec5710d57db2d2f15dd9ee5e4e2b32eeef9a1eb73d7aa6eb90d691886d mldonkey-2.7.6-r1.ebuild 4513 EBUILD mldonkey-2.7.6.ebuild 4473 RMD160 df7bd05868c5b54d6ed101c2d164bf55ab208cca SHA1 90d41b69ce4804ffbe6e130f8686dd73afba18af SHA256 1a4d546b722d1da0a3e36ece3b48856703986df99cd0d4f0d9007af7e983006b MD5 f6edaeaadf034a3ca286b562e638e3bb mldonkey-2.7.6.ebuild 4473 RMD160 df7bd05868c5b54d6ed101c2d164bf55ab208cca mldonkey-2.7.6.ebuild 4473 SHA256 1a4d546b722d1da0a3e36ece3b48856703986df99cd0d4f0d9007af7e983006b mldonkey-2.7.6.ebuild 4473 -MISC ChangeLog 20288 RMD160 7183406baeeec950ebc02293400a98c14105b4c4 SHA1 e6019feebe5161203545133ab74f6cbbf1cf7de2 SHA256 72d9150d849d43e8d063ef9a9e05fd3cf02b48bf5a2d6724462f6219700a7810 -MD5 01b9675a5a1da4c9f399d40336798f33 ChangeLog 20288 -RMD160 7183406baeeec950ebc02293400a98c14105b4c4 ChangeLog 20288 -SHA256 72d9150d849d43e8d063ef9a9e05fd3cf02b48bf5a2d6724462f6219700a7810 ChangeLog 20288 +MISC ChangeLog 20591 RMD160 d5bd71fe9c857fb08f998e503f62bb60017efc81 SHA1 969f9ab75da650ab9075d72ee266794b13c63d8e SHA256 6658738b450cf01f30ab9d62f0b7dc7b4ef73b451950a65209c5f7bc3aa4988e +MD5 b234c5399031cb572de69c596daa9857 ChangeLog 20591 +RMD160 d5bd71fe9c857fb08f998e503f62bb60017efc81 ChangeLog 20591 +SHA256 6658738b450cf01f30ab9d62f0b7dc7b4ef73b451950a65209c5f7bc3aa4988e ChangeLog 20591 MISC metadata.xml 242 RMD160 d0edc89382298dee00d3571b62a5f457ef268751 SHA1 25511186cac54f1353a3347f72da7f5d05b9da57 SHA256 b354d71d5efbed0ff97e27564894438b42a8bd8b577007cadc6972dd37d6b5f8 MD5 ee159929f3e247f937fe88bb1919d8bd metadata.xml 242 RMD160 d0edc89382298dee00d3571b62a5f457ef268751 metadata.xml 242 @@ -71,10 +79,13 @@ SHA256 b770761dd8501fd3bbb6f4f12aa79937ad0d9df9137a9e73d7381ca41f353420 files/di MD5 c916f61ac13be36cb0b88e7891ac537d files/digest-mldonkey-2.7.6 250 RMD160 a0114e8011e4a9fb2ebaf10f8e85561d68dcd9f1 files/digest-mldonkey-2.7.6 250 SHA256 c8a5f39b5b0615d37786156a034015a57a0a79531ab30b57054ed1ab640055a0 files/digest-mldonkey-2.7.6 250 +MD5 c916f61ac13be36cb0b88e7891ac537d files/digest-mldonkey-2.7.6-r1 250 +RMD160 a0114e8011e4a9fb2ebaf10f8e85561d68dcd9f1 files/digest-mldonkey-2.7.6-r1 250 +SHA256 c8a5f39b5b0615d37786156a034015a57a0a79531ab30b57054ed1ab640055a0 files/digest-mldonkey-2.7.6-r1 250 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) -iD8DBQFEifFrub4+zaPCR/oRAkZdAJ9quu/f5cn+ZafGdGi2+R/4Zn/3rQCgqc+V -ov5Z/ogX+645jFytdTOG2Y0= -=JSwd +iD8DBQFElYYAub4+zaPCR/oRAqf3AKCEJzHIEuwfla1yswzQmnCaPUvLkQCeORSQ +2N0N+hru6QhXdMMdV5s3cfs= +=awgn -----END PGP SIGNATURE----- diff --git a/net-p2p/mldonkey/files/digest-mldonkey-2.7.6-r1 b/net-p2p/mldonkey/files/digest-mldonkey-2.7.6-r1 new file mode 100644 index 000000000000..51aedc0ddf3d --- /dev/null +++ b/net-p2p/mldonkey/files/digest-mldonkey-2.7.6-r1 @@ -0,0 +1,3 @@ +MD5 08e3cccce6fe65f5437a309276fe2c68 mldonkey-2.7.6.tar.bz2 2835134 +RMD160 8989e86e26b6b4ed4fc8f783093c6e187b6d5051 mldonkey-2.7.6.tar.bz2 2835134 +SHA256 ec5e5723cc54c4ac3ef93e0b78ed9da58c4e75ca09fa4b2de4c9a58740085fa8 mldonkey-2.7.6.tar.bz2 2835134 diff --git a/net-p2p/mldonkey/files/mldonkey-2.7.6-magic.patch b/net-p2p/mldonkey/files/mldonkey-2.7.6-magic.patch new file mode 100644 index 000000000000..04c570c360f8 --- /dev/null +++ b/net-p2p/mldonkey/files/mldonkey-2.7.6-magic.patch @@ -0,0 +1,173 @@ +diff -uwNr ./org/src/daemon/common/commonFile.ml ./mldonkey-2.7.6/src/daemon/common/commonFile.ml +--- src/daemon/common/commonFile.ml 2006-05-20 01:43:54.000000000 +0200 ++++ src/daemon/common/commonFile.ml 2006-06-13 21:50:56.000000000 +0200 +@@ -450,6 +450,18 @@ + None -> () + | Some magic -> (as_file_impl file).impl_file_magic <- Some (HashMagic.merge files_magic magic) + ++let check_magic file = ++ let check file = ++ match Magic.M.magic_fileinfo (file_disk_name file) false with ++ None -> () ++ | Some magic -> set_file_magic file (Some magic) ++ in ++ let magic = file_magic file in ++ match magic with ++ None -> check file ++ | Some magic when magic = "data" || magic = "empty" -> check file ++ | _ -> () ++ + let set_file_last_seen file age = + let impl = as_file_impl file in + impl.impl_file_last_seen <- age +diff -uwNr ./org/src/daemon/common/commonFile.mli ./mldonkey-2.7.6/src/daemon/common/commonFile.mli +--- src/daemon/common/commonFile.mli 2006-05-12 23:08:30.000000000 +0200 ++++ src/daemon/common/commonFile.mli 2006-06-13 21:50:56.000000000 +0200 +@@ -119,7 +119,7 @@ + val file_comment : CommonTypes.file -> string + val file_magic : CommonTypes.file -> string option + val set_file_magic : CommonTypes.file -> string option -> unit +- ++val check_magic : CommonTypes.file -> unit + val recover_bytes : CommonTypes.file -> (int64 * int64) list + val file_write : CommonTypes.file -> int64 -> string -> int -> int -> unit + val file_verify : CommonTypes.file -> +diff -uwNr ./org/src/daemon/common/commonSwarming.ml ./mldonkey-2.7.6/src/daemon/common/commonSwarming.ml +--- src/daemon/common/commonSwarming.ml 2006-05-20 01:43:54.000000000 +0200 ++++ src/daemon/common/commonSwarming.ml 2006-06-13 21:52:52.000000000 +0200 +@@ -1073,6 +1073,7 @@ + let set_verified_chunk t i = + t.t_nverified_blocks <- t.t_nverified_blocks + 1; + t.t_converted_verified_bitmap.[i] <- '3'; ++ if i = 0 && !Autoconf.magic_works then check_magic t.t_file; + let s = t.t_s in + if t.t_primary then begin + (* The primary is supposed to propagate verified chunks to the file *) +diff -uwNr ./org/src/daemon/driver/driverInteractive.ml ./mldonkey-2.7.6/src/daemon/driver/driverInteractive.ml +--- src/daemon/driver/driverInteractive.ml 2006-05-21 09:50:05.000000000 +0200 ++++ src/daemon/driver/driverInteractive.ml 2006-06-13 21:50:56.000000000 +0200 +@@ -123,23 +123,6 @@ + close_log () + end + +-let file_magic_check () = +- if !Autoconf.magic_works then begin +- if !verbose then lprintf_nl "computing file magic values"; +- let check_magic file = +- match Magic.M.magic_fileinfo (file_disk_name file) false with +- None -> () +- | Some magic -> set_file_magic file (Some magic) +- in +- List.iter (fun file -> +- let magic = file_magic file in +- match magic with +- None -> check_magic file +- | Some magic when magic = "data" -> check_magic file +- | _ -> () +- ) !!files +- end +- + (* ripped from gui_downloads *) + + let calc_file_eta f = +diff -uwNr ./org/src/daemon/driver/driverMain.ml ./mldonkey-2.7.6/src/daemon/driver/driverMain.ml +--- src/daemon/driver/driverMain.ml 2006-05-20 01:43:54.000000000 +0200 ++++ src/daemon/driver/driverMain.ml 2006-06-13 21:50:56.000000000 +0200 +@@ -68,7 +68,6 @@ + + let minute_timer () = + DriverInteractive.hdd_check (); +- DriverInteractive.file_magic_check (); + CommonShared.shared_check_files (); + CommonUploads.upload_credit_timer (); + CommonInteractive.force_download_quotas (); +@@ -436,7 +435,6 @@ + + (* lprintf "(1) CommonComplexOptions.load\n"; *) + CommonComplexOptions.load (); +- DriverInteractive.file_magic_check (); + CommonUploads.load (); + + (* lprintf "(2) CommonComplexOptions.load done\n"; *) +diff -uwNr ./org/src/networks/bittorrent/bTInteractive.ml ./mldonkey-2.7.6/src/networks/bittorrent/bTInteractive.ml +--- src/networks/bittorrent/bTInteractive.ml 2006-05-20 01:43:54.000000000 +0200 ++++ src/networks/bittorrent/bTInteractive.ml 2006-06-13 21:50:56.000000000 +0200 +@@ -256,14 +256,24 @@ + end in + print_first_tracker file.file_trackers; + ++ let check_magic file = ++ match Magic.M.magic_fileinfo file false with ++ None -> None ++ | Some s -> Some (HashMagic.merge CommonGlobals.files_magic s) ++ in + let cntr = ref 0 in +- List.iter (fun (filename, size, magic) -> ++ List.iter (fun (filename, size, _) -> + Printf.bprintf buf "\\\\" (html_mods_cntr ()); + let fs = Printf.sprintf "File %d" !cntr in + let magic_string = +- match magic with ++ if !Autoconf.magic_works then ++ begin ++ let subfile = Filename.concat (file_disk_name file) filename in ++ match check_magic subfile with + None -> "" + | Some magic -> Printf.sprintf " / %s" magic ++ end ++ else "" + in + html_mods_td buf [ + (fs, "sr br", fs); +@@ -623,32 +633,6 @@ + lprintf_nl "ft_retry: exception %s" (Printexc2.to_string e) + ) ft_by_num + +-let file_magic_check () = +- if !Autoconf.magic_works then begin +- if !verbose then lprintf_nl "computing sub_file magic values"; +- let check_magic file = +- match Magic.M.magic_fileinfo file false with +- None -> None +- | Some s -> Some (HashMagic.merge CommonGlobals.files_magic s) +- in +- Hashtbl.iter (fun _ file -> +- let updated = ref false in +- let new_file_files = ref [] in +- List.iter (fun (filename, size, magic) -> +- let subfile = Filename.concat (file_disk_name file) filename in +- let new_magic = +- match magic with +- None -> check_magic subfile +- | Some magic when magic = "data" || magic = "empty" -> check_magic subfile +- | _ -> magic +- in +- if new_magic <> magic then updated := true; +- new_file_files := (filename, size, new_magic) :: !new_file_files +- ) file.file_files; +- if !updated then file.file_files <- !new_file_files +- ) files_by_uid +- end +- + let load_torrent_from_web r ft = + if !verbose then + lprintf_nl "Loading torrent from web"; +diff -uwNr ./org/src/networks/bittorrent/bTMain.ml ./mldonkey-2.7.6/src/networks/bittorrent/bTMain.ml +--- src/networks/bittorrent/bTMain.ml 2006-05-20 01:43:54.000000000 +0200 ++++ src/networks/bittorrent/bTMain.ml 2006-06-13 21:50:56.000000000 +0200 +@@ -115,7 +115,6 @@ + BTClients.recover_files (); + add_session_timer enabler 60.0 (fun timer -> + BTClients.recover_files (); +- BTInteractive.file_magic_check () + ); + + add_session_timer enabler 120.0 (fun timer -> +@@ -131,7 +130,6 @@ + ) !current_files; + ); + +- BTInteractive.file_magic_check (); + BTClients.listen (); + () + diff --git a/net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild b/net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild new file mode 100644 index 000000000000..53d2a399eda1 --- /dev/null +++ b/net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild @@ -0,0 +1,167 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/mldonkey-2.7.6-r1.ebuild,v 1.1 2006/06/18 16:57:09 sekretarz Exp $ + +inherit eutils flag-o-matic + +IUSE="gtk guionly batch gd doc" + +DESCRIPTION="mldonkey is a new client to access the eDonkey network. It is written in Objective-Caml, and comes with its own GTK GUI, an HTTP interface and a telnet interface." +HOMEPAGE="http://www.nongnu.org/mldonkey/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~x86" +RESTRICT="nomirror" + +RDEPEND="dev-lang/perl + guionly? ( >=gnome-base/librsvg-2.4.0 + >=dev-ml/lablgtk-2.6 ) + gtk? ( >=gnome-base/librsvg-2.4.0 + >=dev-ml/lablgtk-2.6 ) + gd? ( >=media-libs/gd-2.0.28 )" + +DEPEND="${RDEPEND} + >=sys-devel/autoconf-2.58 + !batch? ( >=dev-lang/ocaml-3.08.3 ) + batch? ( net-misc/wget )" + +MLUSER="p2p" + +pkg_setup() { + if use gtk; then + echo "" + einfo "If the compile with gui fails, and you have updated ocaml" + einfo "recently, you may have forgotten that you need to run" + einfo "/usr/portage/dev-lang/ocaml/files/ocaml-rebuild.sh" + einfo "to learn which ebuilds you need to recompile" + einfo "each time you update ocaml to a different version" + einfo "see the ocaml ebuild for details" + echo "" + fi + + if use gtk && !(built_with_use dev-ml/lablgtk svg); then + eerror "dev-ml/lablgtk must be built with the 'svg' USE flag to use the gtk gui" + die "Recompile dev-ml/lablgtk with enabled svg USE flag" + fi + + if use gd && !(built_with_use media-libs/gd truetype); then + eerror "media-libs/gd must be built with 'truetype' to compile" + eerror "mldonkey with gd support" + die "Recompile media-libs/gd with enabled truetype USE flag" + fi +} + +src_unpack() { + unpack ${A} + cd ${S} + + export WANT_AUTOCONF=2.5 + cd ${S}/config + autoconf + cd ${S} + epatch ${FILESDIR}/${P}-magic.patch +} + +src_compile() { + append-ldflags -Wl,-z,noexecstack + + # the dirs are not (yet) used, but it doesn't hurt to specify them anyway + + # batch Automatically download and build OCAML-3.08.3 for compiling itself + # onlygui Disable all nets support, build only chosen GUI + + if use gtk || use guionly; then + myconf="--enable-gui=newgui2" + else + myconf="--disable-gui" + fi + + if use guionly; then + myconf="${myconf} --disable-multinet --disable-donkey" + fi + + cd ${S} + econf \ + --sysconfdir=/etc/mldonkey \ + --sharedstatedir=/var/mldonkey \ + --localstatedir=/var/mldonkey \ + --enable-checks \ + `use_enable batch` \ + `use_enable gd` \ + ${myconf} || die "Configure Failed!" + + export OCAMLRUNPARAM="l=256M" + emake || die "Make Failed" + + if ! use guionly; then + emake utils || die "make utils failed" + fi; +} + +src_install() { + if ! use guionly; then + dobin mlnet mld_hash get_range copysources make_torrent subconv + dobin ${FILESDIR}/mldonkey + + insinto /etc/conf.d; newins ${FILESDIR}/mldonkey.confd mldonkey + exeinto /etc/init.d; newexe ${FILESDIR}/mldonkey.initd mldonkey + fi + + if use gtk; then + dobin mlgui mlguistarter mlchat mlim + domenu ${FILESDIR}/${PN}-gui.desktop + doicon ${FILESDIR}/${PN}.png + fi + + if use doc ; then + cd ${S}/distrib + dodoc ChangeLog *.txt + dohtml *.html + + insinto /usr/share/doc/${PF}/scripts + doins kill_mldonkey mldonkey_command mldonkey_previewer make_buginfo + + cd ${S}/docs + dodoc *.txt *.tex *.pdf + dohtml *.html + + cd ${S}/docs/developers + dodoc *.txt *.tex + + cd ${S}/docs/images + insinto /usr/share/doc/${PF}/html/images + doins * + fi +} + +pkg_preinst() { + if ! use guionly; then + enewuser ${MLUSER} -1 /bin/bash /home/p2p users + fi +} + +pkg_postinst() { + if ! use guionly; then + echo + einfo "Running \`mldonkey' will start the server inside ~/.mldonkey/" + einfo "If you want to start mldonkey in a particular working directory," + einfo "use the \`mlnet' command." + einfo "If you want to start mldonkey as a system service, use" + einfo "the /etc/init.d/mldonkey script. To control bandwidth, use" + einfo "the 'slow' and 'fast' arguments. Be sure to have a look at" + einfo "/etc/conf.d/mldonkey also." + echo + einfo "Attention: 2.6 has changed the inifiles structure, so downgrading" + einfo "will be problematic." + einfo "User settings (admin) are transferred to users.ini from " + einfo "downloads.ini" + einfo "Old ini files are automatically converted to the new format" + echo + else + echo + einfo "Simply run mlgui to start the chosen modonkey gui." + einfo "It puts its config files into ~/.mldonkey" + fi +} -- 2.26.2