Ejemplo n.º 1
0
def unpack(name):
    print("Unpack " + name + " archive package ... ", end='')
    shutil.unpack_archive("build-packs/" + name + ".pa",
                          "app/cache/archives/build", "zip")
    shutil.unpack_archive("app/cache/archives/build/data.tar.xz",
                          "app/cache/archives/data", "xztar")
    shutil.unpack_archive("app/cache/archives/build/code.tar.xz",
                          "app/cache/archives/code", "xztar")
    shutil.unpack_archive("app/cache/archives/build/control.tar.xz",
                          "app/cache/archives/control", "xztar")

    ## Unpack database only ##

    name = control.read_record("name", "app/cache/archives/control/manifest")
    unpack = control.read_record("unpack",
                                 "app/cache/archives/control/manifest")

    ## Setting up ##

    if os.path.isfile("app/cache/archives/control/manifest"):
        shutil.copyfile("app/cache/archives/control/manifest",
                        "stor/app/packages/" + name + ".manifest")
    if os.path.isfile("app/cache/archives/control/compile"):
        shutil.copyfile("app/cache/archives/control/compile",
                        "stor/app/packages/" + name + ".compile")
    if os.path.isfile("app/cache/archives/control/list"):
        shutil.copyfile("app/cache/archives/control/list",
                        "stor/app/packages/" + name + ".list")

    ## Compile codes ##
    if os.path.isfile("app/cache/archives/control/compile"):
        listcodes = control.read_list("app/cache/archives/control/compile")
        for i in listcodes:
            i = i.split(":")
            compile(i[0], i[1])

    ## Archive data again ##
    shutil.make_archive("app/cache/archives/build/data", "xztar",
                        "app/cache/archives/data")

    ## Save source codes ##

    if os.path.isfile("app/cache/archives/control/compile"):
        shutil.unpack_archive("app/cache/archives/build/code.tar.xz",
                              "stor/usr/src/" + name, "xztar")

    ## Unpack data again ##
    shutil.unpack_archive("app/cache/archives/build/data.tar.xz",
                          "stor/" + unpack, "xztar")
    print("Done")
    clean()
Ejemplo n.º 2
0
def unpack(name):
    shutil.unpack_archive("build-packs/" + name + ".pa",
                          "app/cache/archives/build", "zip")
    shutil.unpack_archive("app/cache/archives/build/data.zip",
                          "app/cache/archives/data", "zip")
    shutil.unpack_archive("app/cache/archives/build/code.zip",
                          "app/cache/archives/code", "zip")
    shutil.unpack_archive("app/cache/archives/build/control.zip",
                          "app/cache/archives/control", "zip")

    ## Unpack database only ##

    name = control.read_record("name", "app/cache/archives/control/manifest")
    unpack = control.read_record("unpack",
                                 "app/cache/archives/control/manifest")

    ## Setting up ##

    if os.path.isfile("app/cache/archives/control/manifest"):
        shutil.copyfile("app/cache/archives/control/manifest",
                        "stor/app/packages/" + name + ".manifest")
    if os.path.isfile("app/cache/archives/control/list"):
        shutil.copyfile("app/cache/archives/control/list",
                        "stor/app/packages/" + name + ".list")
    if os.path.isfile("app/cache/archives/control/compile"):
        shutil.copyfile("app/cache/archives/control/compile",
                        "stor/app/packages/" + name + ".compile")

    ## Compile codes ##
    if os.path.isfile("app/cache/archives/control/compile"):
        listcodes = control.read_list("app/cache/archives/control/compile")
        for i in listcodes:
            i = i.split(":")

            compile('app/cache/archives/code/' + i[0],
                    'app/cache/archives/data/' + i[1])

    ## Archive data again ##
    shutil.make_archive("app/cache/archives/build/data", "zip",
                        "app/cache/archives/data")

    ## Unpack data again ##
    shutil.unpack_archive("app/cache/archives/build/data.zip",
                          "stor/" + unpack, "zip")

    ## Save source code ##
    shutil.unpack_archive('app/cache/archives/build/code.zip',
                          'stor/usr/src/' + name, 'zip')
    clean()
Ejemplo n.º 3
0
def unpack (name):
    shutil.unpack_archive("build-packs/"+name+".pa","app/cache/archives/build","zip")
    shutil.unpack_archive("app/cache/archives/build/data.zip","app/cache/archives/data","zip")
    shutil.unpack_archive("app/cache/archives/build/code.zip","app/cache/archives/code", "zip")
    shutil.unpack_archive("app/cache/archives/build/control.zip","app/cache/archives/control", "zip")

    name = control.read_record ("name","app/cache/archives/control/manifest")
    unpack = control.read_record ("unpack","app/cache/archives/control/manifest")

    ## Setting up ##

    if os.path.isfile ("app/cache/archives/control/manifest"): shutil.copyfile("app/cache/archives/control/manifest","stor/app/packages/"+name+".manifest")
    if os.path.isfile("app/cache/archives/control/list"): shutil.copyfile("app/cache/archives/control/list","stor/app/packages/" + name + ".list")
    if os.path.isfile("app/cache/archives/control/compile"): shutil.copyfile("app/cache/archives/control/compile","stor/app/packages/" + name + ".compile")
    if os.path.isfile("app/cache/archives/control/preremove.sa"): shutil.copyfile("app/cache/archives/control/preremove.sa",
                                                                             "stor/app/packages/" + name + ".preremove")
    if os.path.isfile("app/cache/archives/control/postremove.sa"): shutil.copyfile("app/cache/archives/control/postremove.sa",
                                                                             "stor/app/packages/" + name + ".postremove")
    if os.path.isfile("app/cache/archives/control/preinstall.sa"): shutil.copyfile("app/cache/archives/control/preinstall.sa",
                                                                             "stor/app/packages/" + name + ".preinstall")
    if os.path.isfile("app/cache/archives/control/postinstall.sa"): shutil.copyfile("app/cache/archives/control/postinstall.sa",
                                                                             "stor/app/packages/" + name + ".postinstall.sa")

    ## Compile codes ##
    if os.path.isfile ("app/cache/archives/control/compile"):
        listcodes = control.read_list("app/cache/archives/control/compile")
        for i in listcodes:
            i = i.split(":")

            compile('app/cache/archives/code/'+i[0], 'app/cache/archives/data/'+i[1])


    ## Archive data again ##
    shutil.make_archive("app/cache/archives/build/data","zip","app/cache/archives/data")

    ## Unpack data again ##
    shutil.unpack_archive("app/cache/archives/build/data.zip","stor/"+unpack,"zip")
Ejemplo n.º 4
0
#######################################################################################
#  In the name of God, the Compassionate, the Merciful
#  Pyabr (c) 2020 Mani Jamali. GNU General Public License v3.0
#
#  Programmer & Creator:    Mani Jamali <*****@*****.**>
#  Telegram or Gap channel: @pyabr
#  Telegram or Gap group:   @pyabr_community
#  Git source:              github.com/manijamali2003/pyabr
#
#######################################################################################
import os, shutil
from buildlibs import control

name = control.read_record('name', 'packs/pyabr/data/etc/distro')
version = control.read_record('version', 'packs/pyabr/data/etc/distro')
build = control.read_record('build', 'packs/pyabr/data/etc/distro')


def clean():
    if os.path.isdir('app'): shutil.rmtree('app')
    if os.path.isdir('build-packs'): shutil.rmtree('build-packs')
    if os.path.isdir('stor'): shutil.rmtree('stor')
    if os.path.isdir('pack-release'): shutil.rmtree('pack-release')
    if os.path.isdir('wheel/src'): shutil.rmtree('wheel/src')
    if os.path.isdir('wheel/setup'): shutil.rmtree('wheel/setup')
    if os.path.isfile('pyabr.zip'): os.remove('pyabr.zip')
    if os.path.isfile('Pyabr-' + version + '-' + build + '.zip'):
        os.remove('Pyabr-' + version + '-' + build + '.zip')


clean()
Ejemplo n.º 5
0
# Test !

from buildlibs import control, pack_archives as pack
import os, shutil, subprocess as sub, sys

## Write Datas ##
control.write_record('username', control.read_record('username', 'debug.db'),
                     'packs/rachel/data/etc/rachel')
control.write_record('firstname', control.read_record('firstname', 'debug.db'),
                     'packs/rachel/data/etc/rachel')
control.write_record('lastname', control.read_record('lastname', 'debug.db'),
                     'packs/rachel/data/etc/rachel')
control.write_record('email', control.read_record('email', 'debug.db'),
                     'packs/rachel/data/etc/rachel')
control.write_record('phone', control.read_record('phone', 'debug.db'),
                     'packs/rachel/data/etc/rachel')

## create compile files ##
## pre build ##
if os.path.isdir("stor"): shutil.rmtree("stor")

if not os.path.isdir("app"):
    os.mkdir("app")
    os.mkdir("app/cache")
    os.mkdir("app/cache/archives")
    os.mkdir("app/cache/archives/data")
    os.mkdir("app/cache/archives/control")
    os.mkdir("app/cache/archives/code")
    os.mkdir("app/cache/archives/build")
    os.mkdir("app/cache/gets")