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

Add possibility to add a backup rules xml file #2208

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

tcdude
Copy link
Contributor

@tcdude tcdude commented May 19, 2020

This PR enables users to pass a new argument to p4a to enable
custom backup rules through the means of an XML file as documented
in the official Android docs.

I also noticed that the "allowBackup" flag would do nothing when userd
with either webview or service_only bootstraps, where the
AndroidManifest.tmpl.xml would set it to a hardcoded "true" instead of
the user-defined value.

@Jorilx
Copy link

Jorilx commented Aug 5, 2020

This would be very nice to have, thanks!
I had to specify the filename as ../../../../../../backup_rules.xml though, is this expected? Thanks again!

@tcdude
Copy link
Contributor Author

tcdude commented Aug 7, 2020

It is expected, since I duplicated behavior from an existing command line argument. I copied the help text, advising that the path needs to be relative to python-for-android. You can also use absolute paths though, which would make it probably easier to read...

I have too little insight into the inner workings of p4a to implement a better way, but I'm happy to update this PR if someone tells me how to make this relative to the project root or similar.

@tshirtman
Copy link
Member

tshirtman commented Aug 14, 2020

I do think it would be better to make it relative to either the current working directory (os.getcwd()) when the p4a command is called, or from the source directory we tell p4a to package (should be args.private?). using either os.path.join(path, args.backup_rules) or pathlib.Path(path) / args.backup_rules.

@Jorilx
Copy link

Jorilx commented Aug 16, 2020

I have a PR ready to be submitted for adding support for --backup-rules to buildozer :)

tcdude added 2 commits August 27, 2020 22:36
Also enables the "allowBackup" flag for webview and service_only
bootstraps, where the AndroidManifest.tmpl.xml would set it to a
hardcoded "true".
Instead of relative to p4a, use path relative to the private
directory.
@tcdude
Copy link
Contributor Author

tcdude commented Aug 27, 2020

I went for args.private... Looks like I've made a little mess with my latest commit... hope that doesn't create too much trouble to the maintainers when merging this PR...

Sorry

Edit:
Please let me know if (and how...) I can fix the mess I made. I'm happy to force push if necessary, since I really only have a fork to make this PR.

@Jorilx
Copy link

Jorilx commented Aug 30, 2020

I'm not an expert by any means, but maybe it would be easier to just close this PR and open another "clean" one?

@tshirtman
Copy link
Member

tshirtman commented Aug 30, 2020

nothing wrong with force pushing if you rebased/reset the branch to clean up, the PR will update itself if you push to the same branch.

the way i would go about it:

git remote add upstream https://github.com/kivy/python-for-android.git
git fetch upstream
git rebase -i upstream/develop

this will open vim, or whatever EDITOR you have configured.
you want to detele every line that is not a commit by you, in the case of vim, you can do it by typing
V (this will start line selection mode)
} this will jump to the last line of the paragraph, selecting everything
4k this will go up 4 times, so your last 4 commits are not selected, if you need, use j or k to go down/up (well, your keyboard arrows works too, but that's a sin to use them in vim :D), when the selection is of all commits that are not yours press d to delete.

then press :x then enter to save/exit.

Then the rebasing will start, hopefuly it'll complete without issues, if you get conflicts, it's going to be a bit more painful, so let's hit that wall when we get there, if all goes well, just use git push -f to update your branch.

@tcdude tcdude force-pushed the android-backup-rules branch from d5ee322 to db7168f Compare August 30, 2020 18:58
@tcdude
Copy link
Contributor Author

tcdude commented Aug 30, 2020

thanks @tshirtman that seems to have done the trick then :)

Let me know if there are further changes to be included, before this can be merged

Copy link
Member

@tshirtman tshirtman left a comment

Choose a reason for hiding this comment

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

LGTM

@tshirtman tshirtman merged commit b3ac38a into kivy:develop Aug 31, 2020
@tcdude tcdude deleted the android-backup-rules branch September 1, 2020 00:03
vesellov pushed a commit to vesellov/python-for-android that referenced this pull request Feb 10, 2021
* Add possibility to add a backup rules xml file

Also enables the "allowBackup" flag for webview and service_only
bootstraps, where the AndroidManifest.tmpl.xml would set it to a
hardcoded "true". Use path relative to the private directory.
germn pushed a commit to germn/python-for-android that referenced this pull request Mar 20, 2021
* Add possibility to add a backup rules xml file

Also enables the "allowBackup" flag for webview and service_only
bootstraps, where the AndroidManifest.tmpl.xml would set it to a
hardcoded "true". Use path relative to the private directory.
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

Successfully merging this pull request may close these issues.

3 participants