Results 1 to 4 of 4

Thread: Apt-tweak

  1. #1
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,187

    Apt-tweak

    Hey all, i came across this site-> http://www.sandaru1.com/2007/02/14/e...lprozillaaget/

    and it sounds very interesting, the problem is i don't know jack about code, but i'm reading. I would like to remove the wget feature and have it use the pipelining for any thing less than 1mb and axle for anything above that. So far i just made it computer independent, by moving everything to /usr/bin/. Also there's sometimes a problem at the end of "sudo apt-get update" were it seems to hang on "bzip2".

    So anyone want to take a look and see if we can improve apt some?
    Code attached:
    Last edited by kerry_s; March 26th, 2007 at 08:50 PM.

  2. #2
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,187

    Re: Apt-tweak

    Hey sorry had to step out.

    So what i think would be the easiest would be to have the "wget section" instead point back to the orginal /usr/lib/apt/methods/http.save.

    So any one can tell me what to put.

    Code:
    #!/usr/bin/python
    import httplib
    import urlparse
    import sys
    import os
    
    url=urlparse.urlsplit(sys.argv[1])
    
    conn = httplib.HTTP(url[1])
    conn.putrequest("HEAD", url[2])
    conn.putheader("HOST",url[1]);
    conn.endheaders();
    errcode,errmsg,headers = conn.getreply()
    
    #f = open("/tmp/test.log","a")
    #f.write("File : " + url[1] + " " + url[2] + "\n");
    #f.write("Status Code : " + str(errcode) + "\n")
    if (errcode!=200 and errcode!=301) :
    	if (errcode==404):
    		sys.exit(15)
    	sys.exit(errcode)
    try:
    	size = int(headers["Content-Length"])
    except KeyError:
    	size = 101*1024
    
    #f.write("Size : " + str(size) + "\n");
    
    if (size<=(100*1024)):
    #	f.write("wget " + url[2] + " " + str(size)+"\n")
    	os.system("wget -c -O " + sys.argv[2] + " " + sys.argv[1])
    else :
    	count = int(size)/(10*1024)
    	if (count>50): 
    		count=50
    #	f.write("axel " + url[2] + "\n" )
    	os.system("axel -n " + str(count) + " -o " + sys.argv[2] + " " + sys.argv[1])
    
    #f.close()

  3. #3
    Join Date
    Feb 2007
    Beans
    3

    Re: Apt-tweak

    I don't think you can call the original http file again, it doesn't accept any command line parameters.

  4. #4
    Join Date
    Oct 2007
    Location
    wrong planet
    Beans
    746
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Apt-tweak

    You could try this guide instead.

    http://www.sandaru1.com/2007/02/14/e...lprozillaaget/
    Linux Advanced Guides and News!
    http://linuxinnovations.blogspot.com/

    Green means go, Yellow means faster, Red means don't stop.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •