Merge lp:~nikwen/ubuntu-filemanager-app/compressed-tars into lp:ubuntu-filemanager-app

Proposed by Niklas Wenzel
Status: Merged
Approved by: Niklas Wenzel
Approved revision: 373
Merged at revision: 385
Proposed branch: lp:~nikwen/ubuntu-filemanager-app/compressed-tars
Merge into: lp:ubuntu-filemanager-app
Diff against target: 124 lines (+58/-1)
4 files modified
src/app/qml/ui/FolderListPage.qml (+22/-1)
src/plugin/archives/archives.cpp (+18/-0)
src/plugin/archives/archives.h (+2/-0)
tests/autopilot/filemanager/tests/test_filemanager.py (+16/-0)
To merge this branch: bzr merge lp:~nikwen/ubuntu-filemanager-app/compressed-tars
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Arto Jalkanen Approve
Review via email: mp+249250@code.launchpad.net

Commit message

Added support for compressed tar archive extraction

Thanks to Carla Sella for fixing the failing autopilot tests before I even had the chance to look at the results. :)

Description of the change

Added support for compressed tar archive extraction

To post a comment you must log in.
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Let's see whether the autopilot test changes work. :D

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Carla Sella (carla-sella) wrote :
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I'll just note tests in trunk do pass:

http://91.189.93.70:8080/job/ubuntu-filemanager-app-ci/453/

That said, there might need to be some changes made to tests in trunk.

Revision history for this message
Carla Sella (carla-sella) wrote :

I found the problem, the tar.bz2 and tar.gz files in the content directory are wrong, the content must be the same as the .tar and .zip ones otherwise the tests fail.
I tried to push my changes, but I do not have permission.

Revision history for this message
Carla Sella (carla-sella) wrote :
Revision history for this message
Carla Sella (carla-sella) wrote :
Revision history for this message
Carla Sella (carla-sella) wrote :
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Just give me some time to look into it myself! :D :p

You're right, of course. I got the command for producing the archives wrong. Embarassing!

I'll happily merge your changes. ;)

Revision history for this message
Carla Sella (carla-sella) wrote :

:-) no worries, four eyes are better than two ;).

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Let's wait for someone to review it now. Thanks again. ;)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote :

Looks good to me.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

This looks like an error with resolving dependencies in the chroot.
I'll push a no-change commit to trigger automatic tests again.

373. By Niklas Wenzel

No-change commit to trigger autopilot tests again

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

So it worked this time. :)
Since I haven't changed anything since Arto's approval, I'll do a top-level approval myself now. Thank you to all who were involved. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app/qml/ui/FolderListPage.qml'
--- src/app/qml/ui/FolderListPage.qml 2015-01-06 23:24:33 +0000
+++ src/app/qml/ui/FolderListPage.qml 2015-02-22 10:24:24 +0000
@@ -383,11 +383,28 @@
383383
384 function getArchiveType(fileName) {384 function getArchiveType(fileName) {
385 var splitName = fileName.split(".")385 var splitName = fileName.split(".")
386
387 if (splitName.length <= 1) { // To sort out files simply named "zip" or "tar"
388 return ""
389 }
390
386 var fileExtension = splitName[splitName.length - 1]391 var fileExtension = splitName[splitName.length - 1]
387 if (fileExtension === "zip") {392 if (fileExtension === "zip") {
388 return "zip"393 return "zip"
389 } else if (fileExtension === "tar") {394 } else if (fileExtension === "tar") {
390 return "tar"395 return "tar"
396 } else if (fileExtension === "gz") {
397 if (splitName.length > 2 && splitName[splitName.length - 2] === "tar") {
398 return "tar.gz"
399 } else {
400 return ""
401 }
402 } else if (fileExtension === "bz2") {
403 if (splitName.length > 2 && splitName[splitName.length - 2] === "tar") {
404 return "tar.bz2"
405 } else {
406 return ""
407 }
391 } else {408 } else {
392 return ""409 return ""
393 }410 }
@@ -938,7 +955,7 @@
938 console.log("Extracting...")955 console.log("Extracting...")
939956
940 var parentDirectory = filePath.substring(0, filePath.lastIndexOf("/"))957 var parentDirectory = filePath.substring(0, filePath.lastIndexOf("/"))
941 var fileNameWithoutExtension = fileName.substring(0, fileName.lastIndexOf("."))958 var fileNameWithoutExtension = fileName.substring(0, fileName.lastIndexOf(archiveType) - 1)
942 var extractDirectory = parentDirectory + "/" + fileNameWithoutExtension959 var extractDirectory = parentDirectory + "/" + fileNameWithoutExtension
943960
944 // Add numbers if the directory already exist: myfile, myfile-1, myfile-2, etc.961 // Add numbers if the directory already exist: myfile, myfile-1, myfile-2, etc.
@@ -960,6 +977,10 @@
960 archives.extractZip(filePath, extractDirectory)977 archives.extractZip(filePath, extractDirectory)
961 } else if (archiveType === "tar") {978 } else if (archiveType === "tar") {
962 archives.extractTar(filePath, extractDirectory)979 archives.extractTar(filePath, extractDirectory)
980 } else if (archiveType === "tar.gz") {
981 archives.extractGzipTar(filePath, extractDirectory)
982 } else if (archiveType === "tar.bz2") {
983 archives.extractBzipTar(filePath, extractDirectory)
963 }984 }
964 }985 }
965986
966987
=== modified file 'src/plugin/archives/archives.cpp'
--- src/plugin/archives/archives.cpp 2014-12-26 10:44:19 +0000
+++ src/plugin/archives/archives.cpp 2015-02-22 10:24:24 +0000
@@ -37,6 +37,24 @@
37 extractArchive(program, arguments);37 extractArchive(program, arguments);
38}38}
3939
40void Archives::extractGzipTar(const QString path, const QString destination)
41{
42 QString program = "tar";
43 QStringList arguments;
44 arguments << "xzf" << path << "-C" << destination;
45
46 extractArchive(program, arguments);
47}
48
49void Archives::extractBzipTar(const QString path, const QString destination)
50{
51 QString program = "tar";
52 QStringList arguments;
53 arguments << "xjf" << path << "-C" << destination;
54
55 extractArchive(program, arguments);
56}
57
40void Archives::extractArchive(const QString program, const QStringList arguments)58void Archives::extractArchive(const QString program, const QStringList arguments)
41{59{
42 if (_process != nullptr && _process->state() == QProcess::ProcessState::Running) {60 if (_process != nullptr && _process->state() == QProcess::ProcessState::Running) {
4361
=== modified file 'src/plugin/archives/archives.h'
--- src/plugin/archives/archives.h 2014-12-26 10:44:19 +0000
+++ src/plugin/archives/archives.h 2015-02-22 10:24:24 +0000
@@ -29,6 +29,8 @@
29public:29public:
30 Q_INVOKABLE void extractZip(const QString path, const QString destination);30 Q_INVOKABLE void extractZip(const QString path, const QString destination);
31 Q_INVOKABLE void extractTar(const QString path, const QString destination);31 Q_INVOKABLE void extractTar(const QString path, const QString destination);
32 Q_INVOKABLE void extractGzipTar(const QString path, const QString destination);
33 Q_INVOKABLE void extractBzipTar(const QString path, const QString destination);
32 Q_INVOKABLE void cancelArchiveExtraction();34 Q_INVOKABLE void cancelArchiveExtraction();
3335
34signals:36signals:
3537
=== added file 'tests/autopilot/filemanager/content/Test.tar.bz2'
36Binary files tests/autopilot/filemanager/content/Test.tar.bz2 1970-01-01 00:00:00 +0000 and tests/autopilot/filemanager/content/Test.tar.bz2 2015-02-22 10:24:24 +0000 differ38Binary files tests/autopilot/filemanager/content/Test.tar.bz2 1970-01-01 00:00:00 +0000 and tests/autopilot/filemanager/content/Test.tar.bz2 2015-02-22 10:24:24 +0000 differ
=== added file 'tests/autopilot/filemanager/content/Test.tar.gz'
37Binary files tests/autopilot/filemanager/content/Test.tar.gz 1970-01-01 00:00:00 +0000 and tests/autopilot/filemanager/content/Test.tar.gz 2015-02-22 10:24:24 +0000 differ39Binary files tests/autopilot/filemanager/content/Test.tar.gz 1970-01-01 00:00:00 +0000 and tests/autopilot/filemanager/content/Test.tar.gz 2015-02-22 10:24:24 +0000 differ
=== modified file 'tests/autopilot/filemanager/tests/test_filemanager.py'
--- tests/autopilot/filemanager/tests/test_filemanager.py 2014-12-11 20:16:40 +0000
+++ tests/autopilot/filemanager/tests/test_filemanager.py 2015-02-22 10:24:24 +0000
@@ -50,6 +50,22 @@
50 'extracted_text_file_name': 'CodeOfConduct.txt',50 'extracted_text_file_name': 'CodeOfConduct.txt',
51 'extracted_image_dir_name': 'images',51 'extracted_image_dir_name': 'images',
52 'extracted_image_name': 'ubuntu.jpg'52 'extracted_image_name': 'ubuntu.jpg'
53 }),
54
55 ('tar_gz',
56 {'file_to_extract': 'Test.tar.gz',
57 'extracted_dir_name': 'Test',
58 'extracted_text_file_name': 'CodeOfConduct.txt',
59 'extracted_image_dir_name': 'images',
60 'extracted_image_name': 'ubuntu.jpg'
61 }),
62
63 ('tar_bz2',
64 {'file_to_extract': 'Test.tar.bz2',
65 'extracted_dir_name': 'Test',
66 'extracted_text_file_name': 'CodeOfConduct.txt',
67 'extracted_image_dir_name': 'images',
68 'extracted_image_name': 'ubuntu.jpg'
53 })69 })
54 ]70 ]
5571

Subscribers

People subscribed via source and target branches