maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [python] deb maker code fix cleanup help with? (https://talk.maemo.org/showthread.php?t=86508)

wook_sf 2012-09-01 15:50

[python] deb maker code fix cleanup help with?
 
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("..")


Khertan 2012-09-03 14:46

Re: [python] deb maker code fix cleanup help with?
 
http://khertan.net/pypackager

wook_sf 2012-09-03 15:36

Re: [python] deb maker code fix cleanup help with?
 
Quote:

Originally Posted by Khertan (Post 1260213)

not very useful with windows, unless edited...i think
or you've made changes?


All times are GMT. The time now is 09:20.

vBulletin® Version 3.8.8