(filepath, outpath)
| 142 | |
| 143 | |
| 144 | def downloadpackage(filepath, outpath): |
| 145 | # remove all files/folders |
| 146 | removeAll() |
| 147 | |
| 148 | if not wget(filepath): |
| 149 | print('Failed to download ' + filepath) |
| 150 | return |
| 151 | |
| 152 | filename = filepath[filepath.rfind('/') + 1:] |
| 153 | if filename[-3:] == '.gz': |
| 154 | # TODO: handle exitcode? |
| 155 | subprocess.call(['tar', 'xzf', filename]) |
| 156 | elif filename[-3:] == '.xz': |
| 157 | # TODO: handle exitcode? |
| 158 | subprocess.call(['tar', 'xJf', filename]) |
| 159 | elif filename[-4:] == '.bz2': |
| 160 | # TODO: handle exitcode? |
| 161 | subprocess.call(['tar', 'xjf', filename]) |
| 162 | else: |
| 163 | return |
| 164 | |
| 165 | removeLargeFiles('') |
| 166 | |
| 167 | for g in glob.glob('[#_A-Za-z0-9]*'): |
| 168 | if os.path.isdir(g): |
| 169 | # TODO: handle exitcode? |
| 170 | subprocess.call(['tar', '-cJf', outpath + filename[:filename.rfind('.')] + '.xz', g]) |
| 171 | break |
| 172 | |
| 173 | workdir = os.path.expanduser('~/daca2-packages/tmp/') |
| 174 | if not os.path.isdir(workdir): |
no test coverage detected