Skip to content
Snippets Groups Projects
Commit 9b6c546b authored by Arnaud Ferraris's avatar Arnaud Ferraris
Browse files

Provide option for running without fakeroot


While building an application Flatpak from .deb packages, the
`collect-app-source-code` is executed, running `fakeroot` for executing
apt commands. However, when building for a foreign architecture this
gets executed through `qemu-user-static`, which fails to run `fakeroot`.

As we're running as root inside the build containers, we can simply get
rid of `fakeroot`. This commit therefore adds a `--no-fakeroot`
command-line option for (optionally) running apt commands without
relying on `fakeroot`.

Signed-off-by: default avatarArnaud Ferraris <arnaud.ferraris@collabora.com>
parent ffda0fc2
No related branches found
No related tags found
1 merge request!15Fix build issues for arm64 applications
......@@ -48,6 +48,9 @@ def main():
)
parser.add_argument('--strip-source-version-suffix', default='')
parser.add_argument('--export', default=os.getcwd())
parser.add_argument('--no-fakeroot', dest='fakeroot',
action='store_false')
parser.add_argument('--fakeroot', action='store_true')
parser.add_argument('packages', nargs='*')
args = parser.parse_args()
......@@ -60,10 +63,14 @@ def main():
subprocess.check_call(['cp', '-PRp', '/usr/var', '/'])
subprocess.check_call(['install', '-d', '/var/cache/apt/archives/partial'])
subprocess.check_call(['fakeroot', 'apt-get', 'update'])
subprocess.check_call(['fakeroot', 'apt-get', '-y', '--download-only',
'--no-install-recommends', 'install'] +
args.packages)
fakeroot = []
if args.fakeroot:
fakeroot.append('fakeroot')
subprocess.check_call(fakeroot + ['apt-get', 'update'])
subprocess.check_call(fakeroot + ['apt-get', '-y', '--download-only',
'--no-install-recommends', 'install'] +
args.packages)
for file in glob.glob("/var/cache/apt/archives/*.deb"):
debian_control = DebFile(file).control.debcontrol()
......
......@@ -256,6 +256,7 @@ class Builder:
self.do_sdk = False
self.sign_key = None
self.sign_type = 'ed25519'
self.fakeroot = True
self.metadata = GLib.KeyFile()
self.metadata_debug = GLib.KeyFile()
......@@ -571,6 +572,9 @@ class Builder:
help='Build an app',
)
subparser.add_argument('--app-branch', default=self.app_branch)
subparser.add_argument('--no-fakeroot', dest='fakeroot',
action='store_false')
subparser.add_argument('--fakeroot', action='store_true')
subparser.add_argument('yaml_manifest')
subparser = subparsers.add_parser(
......@@ -620,6 +624,7 @@ class Builder:
self.strict = args.strict
self.sign_key = args.sign
self.sign_type = args.sign_type
self.fakeroot = args.fakeroot
if args.platform is None and args.sdk is None:
self.do_platform = True
......@@ -1944,7 +1949,7 @@ class Builder:
),
packages
)
subprocess.check_call([
cmd = [
'env',
'XDG_DATA_HOME={}/home'.format(scratch),
'flatpak', 'run',
......@@ -1961,10 +1966,11 @@ class Builder:
'--export={}'.format(packages),
'--strip-source-version-suffix={}'.format(
self.strip_source_version_suffix),
] + module['x-flatdeb-apt-packages'])
os.remove(
os.path.join(packages, 'collect-app-source-code')
)
]
if not self.fakeroot:
cmd.append('--no-fakeroot')
subprocess.check_call(cmd + module['x-flatdeb-apt-packages'])
obtained = subprocess.check_output([
'sh', '-euc',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment