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

Luckybackup, new recipe #3183

Merged
merged 61 commits into from Oct 17, 2018
Merged

Luckybackup, new recipe #3183

merged 61 commits into from Oct 17, 2018

Conversation

mazbrili
Copy link
Contributor

@mazbrili mazbrili commented Oct 4, 2018

icon is not good.. i'm not artist

Copy link
Contributor Author

@mazbrili mazbrili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..i think all request have been apply..

anymore suggestion welcome

app-backup/luckybackup/luckybackup-0.4.9.recipe Outdated Show resolved Hide resolved
@Begasus
Copy link
Contributor

Begasus commented Oct 11, 2018

LGTM, as reported the issues comming up are mostly gone when launched from Terminal in $appsDir, Maybe you could open an issue for the remaining ones?
1 When launched from the Deskbar Menu it doesn't show the license, you can't switch languages, manual isn't launching (those work fine when launched in Terminal
2 The missing Icon in the About box
What do you think @fbrosson?
PS, checked to see if I could localy create a backup from a folder to the Desktop, halted with an error "Empty line passed to function"

@fbrosson
Copy link
Member

Sorry @mazbrili and @Begasus for this late reply. Well, I don't really know what to do with the missing icon. Someone would have to dig this topic...
Regarding the other issues, e.g. the license not being shown in the about box in some cases, or the Empty line passed to function error, I believe we should fix them before merging.
Hmm, if we can't fix these issues then we can probably still merge if we replace x86 by ?x86 and x86_64 by ?x86_64 in ARCHITECTURES and SECONDARY_ARCHITECTURES.

Shall we add a "help-wanted" label to this PR?

@scottmc
Copy link
Member

scottmc commented Oct 13, 2018

Wrap it up best you can. Create a new issues for the open issues, and merge it. We can make the open issues into GCI tasks.

Copy link
Contributor

@alaviss alaviss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issues comming up are mostly gone when launched from Terminal in $appsDir

This is because the program looks for it's resources in the current working folder which is a huge bug and have to be fixed.

If we wanted to merge this, please disable the recipe on all architecture, then open an issue to fix it.

@mazbrili
Copy link
Contributor Author

image

i'm found path is hardcoded on source .. need assist to fix it

@fbrosson
Copy link
Member

@mazbrili, in #3183 (comment) I was suggesting to patch the file luckybackup.pro with sed in PATCH to fix the issue about the license not being found.
There are many other hard-coded paths in that file, and I think digging in this direction might help.

Have you noticed that haikuporter generates a wrapper-script file in /boot/home/haikuports/app-backup/luckybackup/work-0.4.9 (or /boot/home/haikuports/app-backup/luckybackup/work-x86-0.4.9 if you're building for x86 secondary arch on x86_gcc2 hybrid) when you kick a build? That file defines lots of variables. There will certainly be some in relation with the translations directory. If you wish I can make a few suggestions of sed commands for patching luckybackup.pro, but I'll let you investigate first ;)

@mazbrili
Copy link
Contributor Author

@mazbrili, in #3183 (comment) I was suggesting to patch the file luckybackup.pro with sed in PATCH to fix the issue about the license not being found.
There are many other hard-coded paths in that file, and I think digging in this direction might help.

Have you noticed that haikuporter generates a wrapper-script file in /boot/home/haikuports/app-backup/luckybackup/work-0.4.9 (or /boot/home/haikuports/app-backup/luckybackup/work-x86-0.4.9 if you're building for x86 secondary arch on x86_gcc2 hybrid) when you kick a build? That file defines lots of variables. There will certainly be some in relation with the translations directory. If you wish I can make a few suggestions of sed commands for patching luckybackup.pro, but I'll let you investigate first ;)

..thank you for your suggestion... i'm sure it can be done.. but need time to do that..
i'll try to fix it when time available..

set current dir to app dir
add patch set currentdir to application dir
@mazbrili
Copy link
Contributor Author

i've been make patch.. tested.. ok
please retest again

@Begasus
Copy link
Contributor

Begasus commented Oct 17, 2018

Confirmed and working! 2 issues remain but maybe they could be added as a task for GCI
1 Icon doesn't show in the about box (at least I think there should be something in the square box) :)
2 LuckyBacky saved it's settings in ~/.luckybackup
What do you think @fbrosson @scottmc

@fbrosson
Copy link
Member

@mazbrili, I just pushed a tiny commit to remove a few unneeded lines in the patchset.
I also moved PATCHES before ADDITIONAL_FILES, as recommended by the HaikuPorter-Guidelines#ordering.

Regarding the icon not being shown, this is a minor issue which can be fixed later. That said, there is no urgency, so if you would like to try to fix this before the merge, you are welcome. I think we'll probably merge before next tuesday in order to create a task for the Google Code-in contest it if the issue is not fixed yet.

Regarding the ~/.luckybackup file, if you can find it in the sources and hardcoded it to ~/config/settings/luckybackup then that would allow us to mark the recipe as tested. Otherwise we need to mark it as untested.
(I did not dive into the source code yet, but I guess @Begasus already did :) So maybe he can point you to the interesting files.)

Finally, regarding the installation directories, I'd like to suggest a few neutral changes. But I'll do so in a separate comment.

@Begasus
Copy link
Contributor

Begasus commented Oct 17, 2018

I did some checking, but haven't found a sollution yet also (ps, not familiar with the wrapper.script yet, so I need some investigation on that part) :)

@fbrosson
Copy link
Member

fbrosson commented Oct 17, 2018

Here are the changes I have in mind:

  • apps/LuckyBackup/LuckyBackup ➡️ apps/LuckyBackup
  • apps/LuckyBackup/license/➡️ data/luckybackup/
  • apps/LuckyBackup/manual/➡️ data/luckybackup/manual/
  • apps/LuckyBackup/translations/➡️ data/luckybackup/translations/

I believe these changes can be obtained by patching the luckybackup.pro file.
And at the end of INSTALL we would change

-	addResourcesToBinaries luckybackup.rdef "$appsDir"/LuckyBackup/LuckyBackup
+	addResourcesToBinaries luckybackup.rdef "$appsDir"/LuckyBackup
-	addAppDeskbarSymlink "$appsDir"/LuckyBackup/LuckyBackup
+	addAppDeskbarSymlink "$appsDir"/LuckyBackup

The advantages of this layout are that:

  1. The only file we create in $appsDir (i.e. /system/apps/) will be the app itself, and we won't need to create any other directory in that tree because we'll be creating them in $dataDir/luckybackup/ (i.e. /system/data/luckybackup/)
  2. Typing LuckyBackup from the command line will launch the app because /boot/system/apps is in the PATH, while with the current layout, typing LuckyBackup won't work because /boot/system/LuckyBackup is not in the PATH. To launch the app from the command line with the current layout one needs to type the full path: /system/apps/LuckyBackup/LuckyBackup.

That's why I think we should try to use the installation directories described above.

EDIT: Updated comment to have "LuckyBackup" instead of "luckybackup".

@diversys
Copy link
Member

Please use LuckyBackup as a binary name.

@fbrosson

This comment has been minimized.

@Begasus
Copy link
Contributor

Begasus commented Oct 17, 2018

If the binary would end up in $binDir I would be ok to leave as is and only rename it in the DeskbarMenu, if it ends up in $appsDir I'm for using LuckyBackup

@mazbrili
Copy link
Contributor Author

@fbrosson your explanation is very good.. i'm not yet familiar with haiku system hierarchy.. that change is most suitable i think.. but right now i'm still learning to achieve like that..

# copy translation
cp -rd ./translations/*.qm "$appsDir"/LuckyBackup/translations/
# copy license
cp -rd ./license/* "$appsDir"/LuckyBackup/license/
Copy link
Member

@fbrosson fbrosson Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we could use make install and it turns out that we can do that if we patch the luckybackup.pro. I tried something and it allows to simplify INSTALL and switch to the layout I was suggesting... but the bad news is that the issue about the license not being displayed (Could not locate the license file!) is back...
And the "Help" > "LuckyBackup Handbook" menu displays an error:

ERROR
Could not locate the file: manual/index.html

(I did not check if it was OK without my changes.)
Anyway, this would require more digging...
So I don't know if this is worth the trouble.
Maybe we should just investigate about the settings file.

 	cmd:qmake$secondaryArchSuffix >= 5
 	"
 
+PATCH()
+{
+	sed -i \
+		-e "s|^\(documentation\.path =\).*|\1 $docDir|" \
+		-e "s|^\(translations\.path =\).*|\1 $dataDir/luckybackup|" \
+		-e "s|^\(manpage\.path =\).*|\1 $manDir/man8|" \
+		-e "s|^\(license\.path =\).*|\1 $docDir|" \
+		luckybackup.pro
+}
+
 BUILD()
 {
 	qmake luckybackup.pro
 	make $jobArgs
 }
 
 INSTALL()
 {
-	#create directories
-	mkdir -p "$appsDir"/LuckyBackup/{manual,translations,license}
-	#install
-	install -T ./luckybackup "$appsDir"/LuckyBackup/LuckyBackup
-
-	# copy manpages
-	mkdir -p "$manDir"/man8
-	cp -r ./manpage/*.8 "$manDir"/man8/
-
-	# copy html documentation
-	cp -r ./manual/* "$appsDir"/LuckyBackup/manual/
-	# copy translation
-	cp -rd ./translations/*.qm "$appsDir"/LuckyBackup/translations/
-	# copy license
-	cp -rd ./license/* "$appsDir"/LuckyBackup/license/
+	make install
+	install -d "$appsDir"
+	install -T luckybackup "$appsDir"/LuckyBackup
+	gunzip "$manDir"/man8/luckybackup.8.gz
 
 	local APP_SIGNATURE="application/x-vnd.LuckyBackup"
 	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
 	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
 	local MINOR="`echo "$portVersion" | cut -d. -f3`"
 	local LONG_INFO="$SUMMARY"
 	sed \
 		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
 		-e "s|@MAJOR@|$MAJOR|" \
 		-e "s|@MIDDLE@|$MIDDLE|" \
 		-e "s|@MINOR@|$MINOR|" \
 		-e "s|@LONG_INFO@|$LONG_INFO|" \
 		"$portDir"/additional-files/luckybackup.rdef.in > luckybackup.rdef
 
-	addResourcesToBinaries luckybackup.rdef "$appsDir"/LuckyBackup/LuckyBackup
-	addAppDeskbarSymlink "$appsDir"/LuckyBackup/LuckyBackup
+	addResourcesToBinaries luckybackup.rdef "$appsDir"/LuckyBackup
+	addAppDeskbarSymlink "$appsDir"/LuckyBackup
 }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change:

  • apps/LuckyBackup/license/➡️ data/luckybackup/
    into ?
  • apps/LuckyBackup/license/➡️ data/luckybackup/license/
    Also with sed you used $docDir?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/global.cpp had everything we needed to fix most issues. 😄

Copy link
Member

@fbrosson fbrosson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mazbrili for your contribution!

@fbrosson
Copy link
Member

The only remaining issue is the icon which is not being displayed.
For the default config, I've pushed a dirty "fix" with hard-coded paths.

@fbrosson fbrosson merged commit f80b741 into haikuports:master Oct 17, 2018
-QString relativeManual = "manual/index.html";
-QString systemManual = "/usr/share/doc/luckybackup/manual/index.html";
+QString relativeManual = "../data/luckybackup/manual/index.html";
+QString systemManual = "/boot/system/data/luckybackup/manual/index.html";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbrosson

Are there any reasons why these can't be changed into @Template@ which then you can sed in the recipe?

I'm a bit concerned about the "relative" paths, what exactly are they relative to? As seen last time, they might be relative to the current working dir, which may causes unintended content injection. I'd like to get rid of these relative paths instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could use patterns and have INSTALL replace them with sed commands, but since this recipe will sooner or later get a much nicer patch using find_directory(), I thought that a few extra hard-coded paths were OK for now. (Adding a sed command that would probably go away during GCI 2018 would have been worse, imho, than using hard-coded paths, but I'm ok with anyone willing to rework this :)

Regarding the relative paths, I believe they are relative to /boot/system/apps/ because that's where the app "changes dir" at start-up (thanks to @mazbrili's patch.)
Regarding the unintended risk of injection, although I did not review the code to see if the app changes dir later, I'm confident that it does not, so the users are probably safe here. BTW, if the app did change dir after start-up to any directory other than that of argv[0] then all the relative paths present in global.cpp would be unusable. That's why I believe the app does not change dir.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All apps will have to tolerate relative paths eventually, as they can get installed in HOME as well as /system/.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, /package/name-version/.self/ stay the same regardless of installation location. Also, there's find_path if you want the fancy /boot/{home,system} paths.

@mazbrili
Copy link
Contributor Author

thanks all @alaviss @fbrosson @Begasus @scottmc @diversys

@mazbrili mazbrili deleted the luckybackup branch October 18, 2018 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants