Active Topics

 


Reply
Thread Tools
wook_sf's Avatar
Posts: 640 | Thanked: 435 times | Joined on Oct 2011 @ rajvoSa BA
#1
well, i've been using python to develop app that will pack deb files, but, issue is that i want to do it on my way:
create digisigsums and md5sums in control/ then pack control/ and data/ into control.tar.gz & data.tar.gz and then assemble all into .ar

but seems like making tgz's is not as it should be...:S
so, i would really need someone's help here

here's raw code:

Code:
import os, time
import tarfile as tf

print "tar.gz-ing :D"


tmp = "temp/"

if os.path.exists(tmp):
    pass
else:
    os.mkdir(tmp)

datafle = "data.tar.gz"
controlfle = "control.tar.gz"

blacklist = ["Thumbs.db", "desktop.ini"]
blacklistlnk = ".lnk"


def getfiles(a, dirx, files):
    for inn in files:
        if len(dirx) >= 1: # this part is created because we need to chdir into data and into control to collect files into archive
            pth=dirx+"/"
        else:
            pth = dirx +"/"
        if os.path.isfile(pth+inn):
            if inn in blacklist:
                print "skipping " + pth+inn
            else:
                if inn.endswith(blacklistlnk):
                    print "skipping " + pth+inn
                else:
                    print pth+inn
                    tar.add(pth+inn)


# create data.tar.bz
os.chdir("temp")
tar = tf.open(datafle, "w:gz")
os.chdir("../data/")
# tar.add("") #should do job?, but there's .db and .ini files that's hidden, under win32 so we'll do my way :D
os.path.walk("", getfiles, None)
tar.close()
os.chdir("..")

# create control.tar.bz
os.chdir("temp")
tar = tf.open(controlfle, "w:gz")
os.chdir("../control/")
os.path.walk("", getfiles, None)
tar.close()
os.chdir("..")
__________________
~ # mv /usr/bin/smartsearch /usr/bin/stupidsearch
 
Khertan's Avatar
Posts: 1,012 | Thanked: 817 times | Joined on Jul 2007 @ France
#2
 

The Following 2 Users Say Thank You to Khertan For This Useful Post:
wook_sf's Avatar
Posts: 640 | Thanked: 435 times | Joined on Oct 2011 @ rajvoSa BA
#3
Originally Posted by Khertan View Post
http://khertan.net/pypackager
not very useful with windows, unless edited...i think
or you've made changes?
__________________
~ # mv /usr/bin/smartsearch /usr/bin/stupidsearch
 
Reply


 
Forum Jump


All times are GMT. The time now is 15:08.