Closed GoogleCodeExporter closed 8 years ago
Hi there, sorry but this will never work. Android API doesn't provide with grp
support on the base libraries (there's no group/user management in bionic)
You will have to hack Mercurial or use a different source manager.
Original comment by naranjo....@gmail.com
on 17 May 2011 at 1:04
Original comment by naranjo....@gmail.com
on 17 May 2011 at 1:04
I see. I guess that makes sense. I'll see if I can hack a fake replacement
then. I'm not sure what hg is using the module for, but it can't be very
important on a single user system.
Original comment by kitsu...@gmail.com
on 17 May 2011 at 3:35
Just for anyone who finds this, I did get hg working somewhat after some
hacking.
Mercurial is checking the user/group ownership of files against its own trusted
list (in Mercurial/ui.py). On Linux the code it uses for the check is in
'$PYTHON_PATH/Mercurial/posix.py'. It first checks if user isowner(file) before
checking groups etc. By adding a try block that imports android and returns
True to the top of the function you can short-circuit all the other tests.
I also built a dummy module replacing grp, but with the above change I think it
could have been empty and still worked.
I still had a problem 'commit'ing but it looks like now it's just a problem
finding an editor(did you know hg has a --traceback flag?). Using the -m
MESSAGE flag let me commit and push successfully pushed my changeset to
bitbucket!
Original comment by kitsu...@gmail.com
on 17 May 2011 at 10:03
Can you provide your Mercurial/ui.py changes so I can ignore grp module checks?
Original comment by yuk...@gmail.com
on 23 Aug 2012 at 8:10
for comment 5 above, try providing an empty grp.py file instead. I.e. Leave the
Mercurial code alone.
Original comment by clac...@gmail.com
on 24 Aug 2012 at 1:17
Took me a while to re-find it.
In file ui.py from line 41:
def _is_trusted(self, fp, f):
try:
import android
return True
except ImportError:
pass
...
In file posix.py from line 10
import os, sys, errno, stat, getpass, pwd
try:
import android
except ImportError:
import grp
The first skips the grp check, the second avoids the import exception for
non-existent grp module.
Original comment by kitsu...@gmail.com
on 25 Aug 2012 at 4:41
Which files did you copy over manually? Is it obvious? In
mercurial-2.x.x/mercurial I see several .c files as well as folders. There is
also mercurial-2.x.x/pure which had .py versions. Soobvipusly replacing those
does the trick. But any others? Thx. PS see my post on
poquitopicante.blogspot.com on installing distribute.
Original comment by bwanama...@gmail.com
on 5 Apr 2013 at 9:37
* I used the blank grp.py module, that worked fine. I actually put it in my
scripts folder - ha!
* I copied the entire mercurial/ folder into site-packages. I already had add
site-packages to path by using sitecustomize.py in
com.googlecode.pythonforandroid/extras/python/.
* The actual commit I used was #5b7175377bab
(http://selenic.com/hg/rev/5b7175377bab) which is tagged as 2.5.2 stable.
* I copied everything from mercurial/pure/ into mercurial/, and I left the *.c
files (base85.c, bdiff.c, diffhelpers.c, mpatch.c, osutil.c and parsers.c). The
__init__.py files are both empty so it makes no difference. (note: I tried
putting `from pure import *` in mercurial/__init__.py and `__all__=['base85',
'bdiff', 'diffhelpers', 'mpatch', 'osutil', 'parsers'] in
mercurial/pure/__init__.py, but that did not work)
* I also copied hgext/ to site-packages
* I copied hg to $EXTERNAL_STORAGE/sl4a/scripts and renamed it hg.py so it
shows in the sl4a app script browser. Running it returns the help. yay!
* using standalone python script called python.sh and shell interpreter, I can
also do hg init
sh python.sh hg.py init <target>
* clone gives me issues in mercurial/util.py (780) calls copymode in posix.py
(122) which uses os.chmod, but I am sdcard mounted with fuse fs and I can't
change permissions - so I add:
try:
os.chmod(...)
except OSError:
print 'blah'
to pass it. The same exact thing happens in journal.py (817) which calls
transaction.py (61). Again in util.py (856) and again in setflags again
posix.py (104) and (109). I use the same try-except block to pass the errors.
This will probably cause issues later. There is another os.chmod() in posix
near line 159, but it already has a try-except block around it and if it fails
it doesn't care.
* I can clone remote repositories now. Now pushing will be another matter.
* use hg --traceback <command> to troubleshoot issues.
Original comment by bwanama...@gmail.com
on 9 Apr 2013 at 12:00
btw: if you don't want to deal with the stoopid sdcard fs, and you do NOT have
root, just create a folder called files in
/data/data/com.googlecode.android_scripting/ and put your repos there. As long
as you use the sl4a shell interpreter you always have full permissions there
because you are the owner of that folder. You can also make executables there,
if you should so desire, e.g.: `chmod 755 <file>` without root. true.
Original comment by bwanama...@gmail.com
on 9 Apr 2013 at 12:04
Original issue reported on code.google.com by
kitsu...@gmail.com
on 16 May 2011 at 10:53