LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 968|回复: 3

去除aria2中的5条线程的限制

[复制链接]
发表于 2007-4-1 23:48:55 | 显示全部楼层 |阅读模式
小鬼子的aria2作的非常不错,但有着5条线程的限制,在其Feature requests页面上的相关呼吁似乎也没啥作用。 新的aria2-0.10.2+1有所改动,不象0.10.1在src/main.cc里很明显,下面简单写下deb打包过程,利用了cdbs,只简单启用了dpatch,因为没多余的doc等要复制,cdbs也就没啥特別要注意的地方,希望对用得着的有所参考。另外,没去管相应的man和po中的5条线程的信息

1 到其主站下载 aria2-0.10.2+1
http://aria2.sourceforge.net/
2 移至临时目录开始打包

  1. cd /dev/shm
  2. tar xvf /tmp/aria2-0.10.2+1.tar.bz2
  3. cd aria2-0.10.2+1
  4. dh_make -e test@test.org -b -n
复制代码

3 进入 debian 目录下,删除*.ex等不用的东东,删除dirs文件中usr/sbin的行,最后只保留
changelog  compat  control  dirs  docs  rules
同时为提高打完后包的优先级,来修改下changelog

  1. aria2 (1:0.10.2+2) unstable; urgency=low

  2.   * Initial Release.

  3. -- test <test@test.org>  Sun,  1 Apr 2007 22:42:23 +0800
复制代码


修改下control

  1. Source: aria2
  2. Section: utils
  3. Priority: extra
  4. Maintainer: test <test@test.org>
  5. Build-Depends: cdbs, cdbs, debhelper (>= 5), autotools-dev
  6. Standards-Version: 3.7.2

  7. Package: aria2
  8. Architecture: any
  9. Depends: ${shlibs:Depends}
  10. Description: High speed download utility
  11. Aria2 is a command line download client with resuming and segmented
  12. downloading. Supported protocols are HTTP/HTTPS/FTP/BitTorrent and it also
  13. supports Metalink.
  14. .
  15. Homepage: <http://aria2.sourceforge.net/>
复制代码


修改下rules,启用dpatch

  1. #!/usr/bin/make -f
  2.   
  3. include /usr/share/cdbs/1/rules/debhelper.mk
  4. include /usr/share/cdbs/1/class/autotools.mk

  5. # Add here any variable or target overrides you need.
  6. include /usr/share/cdbs/1/rules/dpatch.mk
  7. build: build-stamp patch
复制代码

利用dpatch-edit-patch创建10_fix-split-number.dpatch

  1. dpatch-edit-patch 10_fix-split-number
复制代码

这样就会自动进入/tmp下的临时目录,进入其下的src目录,分別修改main.cc和OptionHandlerFactory.cc,相应的diff如下

  1. --- main.cc-ori
  2. +++ main.cc
  3. @@ -120,7 +120,7 @@
  4.             "                              log is written to stdout.") << endl;
  5.    cout << _(" -D, --daemon                 Run as daemon.") << endl;
  6.    cout << _(" -s, --split=N                Download a file using N connections. N must be\n"
  7. -            "                              between 1 and 5. This option affects all URLs.\n"
  8. +            "                              between 1 and 100. This option affects all URLs.\n"
  9.             "                              Thus, aria2 connects to each URL with\n"
  10.             "                              N connections.\n"
  11.             "                              Default: 1") << endl;
  12. --- OptionHandlerFactory.cc-ori
  13. +++ OptionHandlerFactory.cc
  14. @@ -77,7 +77,7 @@
  15.    handlers.push_back(new DefaultOptionHandler(PREF_DIR));
  16.    handlers.push_back(new DefaultOptionHandler(PREF_OUT));
  17.    handlers.push_back(new LogOptionHandler(PREF_LOG));
  18. -  handlers.push_back(new NumberOptionHandler(PREF_SPLIT, 1, 5));
  19. +  handlers.push_back(new NumberOptionHandler(PREF_SPLIT, 1, 100));
  20.    handlers.push_back(new NumberOptionHandler(PREF_TIMEOUT, 1, 600));
  21.    handlers.push_back(new NumberOptionHandler(PREF_MAX_TRIES, 0));
  22.    handlers.push_back(new BooleanOptionHandler(PREF_FTP_PASV));
复制代码

改完后,exit退出后会自动建立debian/patches/10_fix-split-number.dpatch
将 10_fix-split-number.dpatch 加入00list

  1. echo 10_fix-split-number.dpatch > debian/patches/00list
复制代码


OK,开始打包

  1. fakeroot debian/rules binary
复制代码


完了后
sudo dpkg -i aria2_0.10.2+1-2_i386.deb

最后,测试下
aria2c -s 8 http://...
发表于 2007-4-2 17:10:36 | 显示全部楼层
不错,aria2挺好用的。
回复 支持 反对

使用道具 举报

发表于 2007-4-2 18:09:55 | 显示全部楼层
这是干啥的呀?
回复 支持 反对

使用道具 举报

发表于 2007-4-3 08:52:23 | 显示全部楼层
Post by 12345678abc
这是干啥的呀?

命令行下的多线程下载工具。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表