Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on tar from msys2 #143

Closed
nacho opened this issue Apr 15, 2017 · 3 comments
Closed

Remove dependency on tar from msys2 #143

nacho opened this issue Apr 15, 2017 · 3 comments

Comments

@nacho
Copy link
Contributor

nacho commented Apr 15, 2017

Since now we use Python 3 we could perfectly use the tarfile module to decompress the tarballs.

@guruDanny67
Copy link
Contributor

guruDanny67 commented Apr 15, 2017

I make a small test program to see if all the files will be extracted ok:

import tarfile
import os

def ex_all(base_dir):
    lf = os.listdir(base_dir)
    for i in lf:
        full = os.path.join(base_dir, i)
        if os.path.isfile(full):
            if i.endswith('.zip'):
                print('--- Zip file %s ...' % (i, ))
            elif i.endswith('.exe'):
                print('--- Exe file %s ...' % (i, ))
            else:
                print(i)
                tf = tarfile.open(full)
                ext_dir = os.path.join('c:/temp/u', i)
                tf.extractall(path = ext_dir)

ex_all('c:/gtk-build/src')

and every file present in my src dir (sometime with multiple versions, for gtk3 I have tarballs for 3.22.5, .6, .7, .8, .9, .11 & .12) it's been correcty extracted without error but probably to handle the --drop conponent of the tar file we need to extract all the single files.

Another thing that is different from the tar utility is that the tar utility overwrite, silently, all the file, even the read only one, while python gives an exception (I found it when I restart the script because I don't test for the .exe extension of nuget).

This should be no problem for us because, if I understand correctly, if the extraction directory exist the unpack part is simply skipped.

This lead me to a note: when we change version of some package (say, gtk3 from 3.22.6 o 3.22.12) to get the update data we need to delete the directory first or pass a --clean option ?

If it's the case we can put a marker file (wingtk-extracted-version.txt or something like this) and check this file to see if we already extracted the tarball and, if the version change, clean up the directory and extract the new one ?

@nacho
Copy link
Contributor Author

nacho commented Apr 20, 2017

Sorry for the late response, I would say, let's check what jhbuild does on this regard and copy the behavior

@nacho
Copy link
Contributor Author

nacho commented Apr 29, 2017

Closing this now. Thanks

@nacho nacho closed this as completed Apr 29, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants