Commit 9451958b authored by Matthias Putz's avatar Matthias Putz

smaller bugfix in gpg setup

parent 2b4037ae
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* enable debugging: -d * enable debugging: -d
* set debug host: --debug-host=172.31.0.250 * set debug host: --debug-host=172.31.0.250
* (used port is 19499) * (used port is 19499)
* using local git-repo (in $GIT_REPO; branch 'dev') and local git repositories (in $REPOS)
$GIT_REPO/repo init -u $REPOS/manifest/ --no-repo-verify --repo-branch=dev
# repo functionality # repo functionality
......
...@@ -150,10 +150,10 @@ class _Repo(object): ...@@ -150,10 +150,10 @@ class _Repo(object):
try: try:
result = cmd.Execute(copts, cargs) result = cmd.Execute(copts, cargs)
except DownloadError as e: except DownloadError as e:
print('error: %s' % str(e), file=sys.stderr) print('error: DownloadError: %s' % str(e), file=sys.stderr)
result = 1 result = 1
except ManifestInvalidRevisionError as e: except ManifestInvalidRevisionError as e:
print('error: %s' % str(e), file=sys.stderr) print('error: ManifestInvalidRevisionError: %s' % str(e), file=sys.stderr)
result = 1 result = 1
except NoManifestException as e: except NoManifestException as e:
print('error: manifest required for this command -- please run init', print('error: manifest required for this command -- please run init',
......
...@@ -130,10 +130,7 @@ class XmlManifest(object): ...@@ -130,10 +130,7 @@ class XmlManifest(object):
try: try:
if os.path.lexists(self.manifestFile): if os.path.lexists(self.manifestFile):
os.remove(self.manifestFile) os.remove(self.manifestFile)
#if portable.isLinux():
src = 'manifests/%s' % name src = 'manifests/%s' % name
#else:
# src = self.manifestProject.relpath + '/%s' % name
portable.os_link('./.repo/%s' % src, self.manifestFile) portable.os_link('./.repo/%s' % src, self.manifestFile)
except OSError as e: except OSError as e:
raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e))) raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e)))
......
...@@ -8,6 +8,7 @@ import os ...@@ -8,6 +8,7 @@ import os
import platform import platform
import subprocess import subprocess
import sys import sys
import stat
SYNC_REPO_PROGRAM = False SYNC_REPO_PROGRAM = False
SUBPROCESSES = [] SUBPROCESSES = []
...@@ -57,3 +58,13 @@ def os_link(src, dst): ...@@ -57,3 +58,13 @@ def os_link(src, dst):
# requires paths in relation to current dir (not in relation to target file) # requires paths in relation to current dir (not in relation to target file)
src = toUnixPath(src) src = toUnixPath(src)
os.link(src, dst) os.link(src, dst)
def removeReadOnlyFilesHandler(fn, path, excinfo):
removeReadOnlyFiles(fn, path)
def removeReadOnlyFiles(fn, path):
if not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
fn(path)
else:
raise Exception("Could not delete %s" % path)
\ No newline at end of file
...@@ -54,7 +54,7 @@ def _lwrite(path, content): ...@@ -54,7 +54,7 @@ def _lwrite(path, content):
def _error(fmt, *args): def _error(fmt, *args):
msg = fmt % args msg = fmt % args
print('error: %s' % msg, file=sys.stderr) print('error in project: %s' % msg, file=sys.stderr)
def not_rev(r): def not_rev(r):
return '^' + r return '^' + r
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
import sys import sys
# copied from portable # copied from portable
import portable
def stream2str(stream): def stream2str(stream):
return str(stream, encoding='UTF-8') return str(stream, encoding='UTF-8')
...@@ -239,6 +241,7 @@ def _Init(args): ...@@ -239,6 +241,7 @@ def _Init(args):
dst = os.path.abspath(os.path.join(repodir, S_repo)) dst = os.path.abspath(os.path.join(repodir, S_repo))
_Clone(url, dst, opt.quiet) _Clone(url, dst, opt.quiet)
print(opt.no_repo_verify)
if can_verify and not opt.no_repo_verify: if can_verify and not opt.no_repo_verify:
rev = _Verify(dst, branch, opt.quiet) rev = _Verify(dst, branch, opt.quiet)
else: else:
...@@ -331,7 +334,7 @@ def SetupGnuPG(quiet): ...@@ -331,7 +334,7 @@ def SetupGnuPG(quiet):
print(file=sys.stderr) print(file=sys.stderr)
return False return False
proc.stdin.write(MAINTAINER_KEYS) proc.stdin.write(MAINTAINER_KEYS.encode())
proc.stdin.close() proc.stdin.close()
if proc.wait() != 0: if proc.wait() != 0:
...@@ -519,7 +522,7 @@ def _Verify(cwd, branch, quiet): ...@@ -519,7 +522,7 @@ def _Verify(cwd, branch, quiet):
print(file=sys.stderr) print(file=sys.stderr)
env = os.environ.copy() env = os.environ.copy()
env['GNUPGHOME'] = gpg_dir.encode() env['GNUPGHOME'] = gpg_dir
cmd = [GIT, 'tag', '-v', cur] cmd = [GIT, 'tag', '-v', cur]
proc = subprocess.Popen(cmd, proc = subprocess.Popen(cmd,
...@@ -704,7 +707,7 @@ def main(orig_args): ...@@ -704,7 +707,7 @@ def main(orig_args):
except CloneFailure: except CloneFailure:
for root, dirs, files in os.walk(repodir, topdown=False): for root, dirs, files in os.walk(repodir, topdown=False):
for name in files: for name in files:
os.remove(os.path.join(root, name)) portable.removeReadOnlyFiles(os.remove, os.path.join(root, name))
for name in dirs: for name in dirs:
os.rmdir(os.path.join(root, name)) os.rmdir(os.path.join(root, name))
os.rmdir(repodir) os.rmdir(repodir)
......
...@@ -23,6 +23,7 @@ import sys ...@@ -23,6 +23,7 @@ import sys
from color import Coloring from color import Coloring
from command import InteractiveCommand, MirrorSafeCommand from command import InteractiveCommand, MirrorSafeCommand
from error import ManifestParseError from error import ManifestParseError
import portable
from project import SyncBuffer from project import SyncBuffer
from git_config import GitConfig from git_config import GitConfig
from git_command import git_require, MIN_GIT_VERSION from git_command import git_require, MIN_GIT_VERSION
...@@ -193,7 +194,7 @@ to update the working directory files. ...@@ -193,7 +194,7 @@ to update the working directory files.
# Better delete the manifest git dir if we created it; otherwise next # Better delete the manifest git dir if we created it; otherwise next
# time (when user fixes problems) we won't go through the "is_new" logic. # time (when user fixes problems) we won't go through the "is_new" logic.
if is_new: if is_new:
shutil.rmtree(m.gitdir) shutil.rmtree(m.gitdir, onerror=portable.removeReadOnlyFilesHandler)
sys.exit(1) sys.exit(1)
if opt.manifest_branch: if opt.manifest_branch:
......
...@@ -412,7 +412,7 @@ later is required to fix a server side protocol bug. ...@@ -412,7 +412,7 @@ later is required to fix a server side protocol bug.
else: else:
print('Deleting obsolete path %s' % project.worktree, print('Deleting obsolete path %s' % project.worktree,
file=sys.stderr) file=sys.stderr)
shutil.rmtree(project.worktree) shutil.rmtree(project.worktree, onerror=portable.removeReadOnlyFilesHandler)
# Try deleting parent subdirs if they are empty # Try deleting parent subdirs if they are empty
project_dir = os.path.dirname(project.worktree) project_dir = os.path.dirname(project.worktree)
while project_dir != self.manifest.topdir: while project_dir != self.manifest.topdir:
...@@ -496,7 +496,7 @@ later is required to fix a server side protocol bug. ...@@ -496,7 +496,7 @@ later is required to fix a server side protocol bug.
except netrc.NetrcParseError as e: except netrc.NetrcParseError as e:
print('Error parsing .netrc file: %s' % e, file=sys.stderr) print('Error parsing .netrc file: %s' % e, file=sys.stderr)
if (username and password): if username and password:
manifest_server = manifest_server.replace('://', '://%s:%s@' % manifest_server = manifest_server.replace('://', '://%s:%s@' %
(username, password), (username, password),
1) 1)
...@@ -538,7 +538,7 @@ later is required to fix a server side protocol bug. ...@@ -538,7 +538,7 @@ later is required to fix a server side protocol bug.
sys.exit(1) sys.exit(1)
self.manifest.Override(manifest_name) self.manifest.Override(manifest_name)
else: else:
print('error: %s' % manifest_str, file=sys.stderr) print('error in getting manifest: %s' % manifest_str, file=sys.stderr)
sys.exit(1) sys.exit(1)
except (socket.error, IOError, xmlrpc.client.Fault) as e: except (socket.error, IOError, xmlrpc.client.Fault) as e:
print('error: cannot connect to manifest server %s:\n%s' print('error: cannot connect to manifest server %s:\n%s'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment