2017-07-18 19:01:11 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
"""
|
2018-01-04 03:53:35 +00:00
|
|
|
Copyright 2018 Oliver Smith
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
This file is part of pmbootstrap.
|
|
|
|
|
|
|
|
pmbootstrap is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
pmbootstrap is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
|
|
|
|
2017-09-18 21:36:54 +00:00
|
|
|
import glob
|
2017-07-18 19:01:11 +00:00
|
|
|
import json
|
2017-09-18 21:36:54 +00:00
|
|
|
import logging
|
|
|
|
import os
|
2017-08-14 14:25:28 +00:00
|
|
|
import sys
|
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
import pmb.aportgen
|
|
|
|
import pmb.build
|
2017-11-28 19:12:16 +00:00
|
|
|
import pmb.build.autodetect
|
2017-07-18 19:01:11 +00:00
|
|
|
import pmb.config
|
|
|
|
import pmb.chroot
|
|
|
|
import pmb.chroot.initfs
|
|
|
|
import pmb.chroot.other
|
|
|
|
import pmb.flasher
|
|
|
|
import pmb.helpers.logging
|
|
|
|
import pmb.helpers.other
|
2018-01-14 01:26:42 +00:00
|
|
|
import pmb.helpers.pkgrel_bump
|
2017-11-19 15:04:08 +00:00
|
|
|
import pmb.helpers.repo
|
2017-07-18 19:01:11 +00:00
|
|
|
import pmb.helpers.run
|
|
|
|
import pmb.install
|
|
|
|
import pmb.parse
|
2017-08-09 20:26:40 +00:00
|
|
|
import pmb.qemu
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
def _build_device_depends_note(args, pkgname):
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
"""
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
Previously 'pmbootstrap build device-...' built the device package in the
|
|
|
|
native chroot without installing its dependencies (e.g. armhf kernel!) and
|
|
|
|
created a symlink to all supported architectures.
|
|
|
|
|
|
|
|
Not installing depends while building is incompatible with how Alpine's
|
|
|
|
abuild does it, so we changed the behavior. Now pmbootstrap reads the
|
|
|
|
device's architecture from the deviceinfo file and automatically builds
|
|
|
|
for that architecture, if you did not specify any architecture. And the
|
|
|
|
dependencies get installed correctly before the build.
|
|
|
|
|
|
|
|
To make migration easier for the users, we show a hint if building a device
|
|
|
|
package was requested.
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
"""
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
# Only relevant for device packages when -i is not set
|
|
|
|
if not pkgname.startswith("device-") or getattr(args, "ignore_depends"):
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
device = pkgname.split("-", 1)[1]
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
logging.info("NOTE: " + device + "'s kernel will be installed as dependency"
|
|
|
|
" before building (old behavior: 'pmbootstrap build -i')")
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
|
|
|
|
|
2017-09-02 03:53:58 +00:00
|
|
|
def _parse_flavor(args):
|
|
|
|
"""
|
|
|
|
Verify the flavor argument if specified, or return a default value.
|
|
|
|
"""
|
|
|
|
# Make sure, that at least one kernel is installed
|
|
|
|
suffix = "rootfs_" + args.device
|
|
|
|
pmb.chroot.apk.install(args, ["device-" + args.device], suffix)
|
|
|
|
|
|
|
|
# Parse and verify the flavor argument
|
|
|
|
flavor = args.flavor
|
|
|
|
flavors = pmb.chroot.other.kernel_flavors_installed(args, suffix)
|
|
|
|
if flavor:
|
|
|
|
if flavor not in flavors:
|
|
|
|
raise RuntimeError("No kernel installed with flavor " + flavor + "!" +
|
|
|
|
" Run 'pmbootstrap flasher list_flavors' to get a list.")
|
|
|
|
return flavor
|
|
|
|
if not len(flavors):
|
|
|
|
raise RuntimeError(
|
|
|
|
"No kernel flavors installed in chroot " + suffix + "! Please let"
|
|
|
|
" your device package depend on a package starting with 'linux-'.")
|
|
|
|
return flavors[0]
|
|
|
|
|
|
|
|
|
2017-07-26 18:59:11 +00:00
|
|
|
def _parse_suffix(args):
|
2017-10-25 22:54:17 +00:00
|
|
|
if "rootfs" in args and args.rootfs:
|
2017-07-26 18:59:11 +00:00
|
|
|
return "rootfs_" + args.device
|
|
|
|
elif args.buildroot:
|
2017-10-28 00:45:15 +00:00
|
|
|
if args.buildroot == "device":
|
|
|
|
return "buildroot_" + args.deviceinfo["arch"]
|
|
|
|
else:
|
|
|
|
return "buildroot_" + args.buildroot
|
2017-07-26 18:59:11 +00:00
|
|
|
elif args.suffix:
|
|
|
|
return args.suffix
|
|
|
|
else:
|
|
|
|
return "native"
|
|
|
|
|
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
def aportgen(args):
|
2017-07-26 18:59:11 +00:00
|
|
|
for package in args.packages:
|
2017-10-30 19:56:38 +00:00
|
|
|
logging.info("Generate aport: " + package)
|
2017-07-26 18:59:11 +00:00
|
|
|
pmb.aportgen.generate(args, package)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def build(args):
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
# Strict mode: zap everything
|
2017-09-08 23:50:59 +00:00
|
|
|
if args.strict:
|
|
|
|
pmb.chroot.zap(args, False)
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
# Detect old usage for device- packages
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
if not args.ignore_depends:
|
|
|
|
for package in args.packages:
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
_build_device_depends_note(args, package)
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
|
2018-02-19 22:04:01 +00:00
|
|
|
# Set src and force
|
|
|
|
src = os.path.realpath(os.path.expanduser(args.src[0])) if args.src else None
|
|
|
|
force = True if src else args.force
|
|
|
|
if src and not os.path.exists(src):
|
|
|
|
raise RuntimeError("Invalid path specified for --src: " + src)
|
|
|
|
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
# Build all packages
|
2017-07-26 18:59:11 +00:00
|
|
|
for package in args.packages:
|
2017-11-28 19:12:16 +00:00
|
|
|
arch_package = args.arch or pmb.build.autodetect.arch(args, package)
|
2018-02-19 22:04:01 +00:00
|
|
|
if not pmb.build.package(args, package, arch_package, force,
|
|
|
|
args.strict, src=src):
|
2018-01-28 23:27:33 +00:00
|
|
|
logging.info("NOTE: Package '" + package + "' is up to date. Use"
|
|
|
|
" 'pmbootstrap build " + package + " --force'"
|
|
|
|
" if needed.")
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def build_init(args):
|
2017-07-26 18:59:11 +00:00
|
|
|
suffix = _parse_suffix(args)
|
|
|
|
pmb.build.init(args, suffix)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def checksum(args):
|
2017-07-26 18:59:11 +00:00
|
|
|
for package in args.packages:
|
|
|
|
pmb.build.checksum(args, package)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def chroot(args):
|
2017-07-26 18:59:11 +00:00
|
|
|
suffix = _parse_suffix(args)
|
|
|
|
pmb.chroot.apk.check_min_version(args, suffix)
|
2018-02-20 19:52:28 +00:00
|
|
|
if args.add:
|
|
|
|
pmb.chroot.apk.install(args, args.add.split(","), suffix)
|
2017-07-26 18:59:11 +00:00
|
|
|
logging.info("(" + suffix + ") % " + " ".join(args.command))
|
|
|
|
pmb.chroot.root(args, args.command, suffix, log=False)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
2017-08-14 14:25:28 +00:00
|
|
|
def config(args):
|
2017-11-19 15:04:08 +00:00
|
|
|
keys = pmb.config.config_keys
|
|
|
|
if args.name and args.name not in keys:
|
|
|
|
logging.info("NOTE: Valid config keys: " + ", ".join(keys))
|
|
|
|
raise RuntimeError("Invalid config key: " + args.name)
|
2017-08-14 14:25:28 +00:00
|
|
|
|
|
|
|
cfg = pmb.config.load(args)
|
|
|
|
if args.value:
|
|
|
|
cfg["pmbootstrap"][args.name] = args.value
|
2017-11-19 15:04:08 +00:00
|
|
|
logging.info("Config changed: " + args.name + "='" + args.value + "'")
|
2017-08-14 14:25:28 +00:00
|
|
|
pmb.config.save(args, cfg)
|
|
|
|
elif args.name:
|
|
|
|
value = cfg["pmbootstrap"].get(args.name, "")
|
|
|
|
print(value)
|
|
|
|
else:
|
|
|
|
cfg.write(sys.stdout)
|
|
|
|
|
2017-11-19 15:04:08 +00:00
|
|
|
# Don't write the "Done" message
|
|
|
|
pmb.helpers.logging.disable()
|
|
|
|
|
2017-08-14 14:25:28 +00:00
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
def index(args):
|
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
access the functions it contains in testcases, and still use
pmb.build.package()
* Refactor the entire file. Instead of one big function that does
too many things, we have many small ones now, that are tested
in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
install the "makedepends" (like we did before), now it does the
same for the "depends". That's required to be compatible with
abuild. The old behavior can still be used with 'pmbootstrap
build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
the native chroot if we need them for a foreign chroot. A device-
package depending on a kernel would pull in the same kernel for
the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
and without a matching '--arch' displays a note that explains
this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
implemented for packages built in the native chroot, and now that
is not always the case anymore. Symlinking these packages creates
packages with broken dependencies anyway (e.g.
device-samsung-i9100 can't be installed in x86_64, because
linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
this feature.
* Removed the old "build" test case (which was disabled in
testcases_fast.sh) as the new "build_package" test case covers its
functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
|
|
|
pmb.build.index_repo(args)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def initfs(args):
|
|
|
|
pmb.chroot.initfs.frontend(args)
|
|
|
|
|
|
|
|
|
|
|
|
def install(args):
|
2018-01-28 23:25:21 +00:00
|
|
|
if args.rsync and args.full_disk_encryption:
|
|
|
|
raise ValueError("Installation using rsync is not compatible with full"
|
|
|
|
" disk encryption.")
|
|
|
|
if args.rsync and not args.sdcard:
|
|
|
|
raise ValueError("Installation using rsync only works on sdcard.")
|
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
pmb.install.install(args)
|
|
|
|
|
|
|
|
|
|
|
|
def flasher(args):
|
|
|
|
pmb.flasher.frontend(args)
|
|
|
|
|
|
|
|
|
2017-09-06 20:14:03 +00:00
|
|
|
def export(args):
|
|
|
|
pmb.export.frontend(args)
|
|
|
|
|
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
def menuconfig(args):
|
2017-10-24 16:18:42 +00:00
|
|
|
pmb.build.menuconfig(args, args.package)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
2017-11-19 15:04:08 +00:00
|
|
|
def update(args):
|
2018-03-04 13:44:27 +00:00
|
|
|
existing_only = not args.non_existing
|
|
|
|
if not pmb.helpers.repo.update(args, args.arch, True, existing_only):
|
|
|
|
logging.info("No APKINDEX files exist, so none have been updated."
|
|
|
|
" The pmbootstrap command downloads the APKINDEX files on"
|
|
|
|
" demand.")
|
|
|
|
logging.info("If you want to force downloading the APKINDEX files for"
|
|
|
|
" all architectures (not recommended), use:"
|
|
|
|
" pmbootstrap update --non-existing")
|
2017-11-19 15:04:08 +00:00
|
|
|
|
|
|
|
|
2018-01-15 22:00:11 +00:00
|
|
|
def newapkbuild(args):
|
|
|
|
if not len(args.args_passed):
|
|
|
|
logging.info("See 'pmbootstrap newapkbuild -h' for usage information.")
|
|
|
|
raise RuntimeError("No arguments to pass to newapkbuild specified!")
|
|
|
|
pmb.build.newapkbuild(args, args.folder, args.args_passed)
|
|
|
|
|
|
|
|
|
2017-09-18 21:36:54 +00:00
|
|
|
def kconfig_check(args):
|
|
|
|
# Default to all kernel packages
|
|
|
|
packages = args.packages
|
|
|
|
if not packages:
|
|
|
|
for aport in glob.glob(args.aports + "/*/linux-*"):
|
|
|
|
packages.append(os.path.basename(aport).split("linux-")[1])
|
|
|
|
|
|
|
|
# Iterate over all kernels
|
|
|
|
error = False
|
|
|
|
packages.sort()
|
|
|
|
for package in packages:
|
|
|
|
if not pmb.parse.kconfig.check(args, package, details=True):
|
|
|
|
error = True
|
|
|
|
|
|
|
|
# At least one failure
|
|
|
|
if error:
|
|
|
|
raise RuntimeError("kconfig_check failed!")
|
|
|
|
|
|
|
|
|
2018-01-18 22:05:27 +00:00
|
|
|
def apkbuild_parse(args):
|
|
|
|
# Default to all packages
|
|
|
|
packages = args.packages
|
|
|
|
if not packages:
|
|
|
|
for apkbuild in glob.glob(args.aports + "/*/*/APKBUILD"):
|
|
|
|
packages.append(os.path.basename(os.path.dirname(apkbuild)))
|
|
|
|
|
|
|
|
# Iterate over all packages
|
|
|
|
packages.sort()
|
|
|
|
for package in packages:
|
|
|
|
print(package + ":")
|
|
|
|
aport = pmb.build.other.find_aport(args, package)
|
|
|
|
path = aport + "/APKBUILD"
|
|
|
|
print(json.dumps(pmb.parse.apkbuild(args, path), indent=4,
|
|
|
|
sort_keys=True))
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
2018-01-18 22:05:27 +00:00
|
|
|
def apkindex_parse(args):
|
2017-07-18 19:01:11 +00:00
|
|
|
result = pmb.parse.apkindex.parse(args, args.apkindex_path)
|
2017-07-22 09:54:49 +00:00
|
|
|
if args.package:
|
|
|
|
if args.package not in result:
|
|
|
|
raise RuntimeError("Package not found in the APKINDEX: " +
|
|
|
|
args.package)
|
|
|
|
result = result[args.package]
|
2017-07-18 19:01:11 +00:00
|
|
|
print(json.dumps(result, indent=4))
|
|
|
|
|
|
|
|
|
2018-01-14 01:26:42 +00:00
|
|
|
def pkgrel_bump(args):
|
|
|
|
would_bump = True
|
|
|
|
if args.auto:
|
|
|
|
would_bump = pmb.helpers.pkgrel_bump.auto(args, args.dry)
|
|
|
|
else:
|
|
|
|
# Each package must exist
|
|
|
|
for package in args.packages:
|
|
|
|
pmb.build.other.find_aport(args, package)
|
|
|
|
|
|
|
|
# Increase pkgrel
|
|
|
|
for package in args.packages:
|
|
|
|
pmb.helpers.pkgrel_bump.package(args, package, dry=args.dry)
|
|
|
|
|
|
|
|
if args.dry and would_bump:
|
|
|
|
logging.info("Pkgrels of package(s) would have been bumped!")
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
2017-08-09 20:26:40 +00:00
|
|
|
def qemu(args):
|
|
|
|
pmb.qemu.run(args)
|
|
|
|
|
|
|
|
|
2017-07-18 19:01:11 +00:00
|
|
|
def shutdown(args):
|
|
|
|
pmb.chroot.shutdown(args)
|
|
|
|
|
|
|
|
|
|
|
|
def stats(args):
|
2017-12-21 16:42:29 +00:00
|
|
|
# Chroot suffix
|
|
|
|
suffix = "native"
|
|
|
|
if args.arch != args.arch_native:
|
|
|
|
suffix = "buildroot_" + args.arch
|
|
|
|
|
|
|
|
# Install ccache and display stats
|
|
|
|
pmb.chroot.apk.install(args, ["ccache"], suffix)
|
|
|
|
logging.info("(" + suffix + ") % ccache -s")
|
|
|
|
pmb.chroot.user(args, ["ccache", "-s"], suffix, log=False)
|
2017-07-18 19:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def log(args):
|
2017-08-07 18:56:35 +00:00
|
|
|
if args.clear_log:
|
2017-09-06 20:14:03 +00:00
|
|
|
pmb.helpers.run.user(args, ["truncate", "-s", "0", args.log],
|
|
|
|
log=False)
|
2017-07-18 19:01:11 +00:00
|
|
|
pmb.helpers.run.user(args, ["tail", "-f", args.log, "-n", args.lines],
|
|
|
|
log=False)
|
|
|
|
|
|
|
|
|
|
|
|
def log_distccd(args):
|
2017-10-12 20:08:10 +00:00
|
|
|
logpath = "/home/pmos/distccd.log"
|
2017-08-07 18:56:35 +00:00
|
|
|
if args.clear_log:
|
|
|
|
pmb.chroot.user(args, ["truncate", "-s", "0", logpath], log=False)
|
2017-07-18 19:01:11 +00:00
|
|
|
pmb.chroot.user(args, ["tail", "-f", logpath, "-n", args.lines], log=False)
|
|
|
|
|
|
|
|
|
|
|
|
def zap(args):
|
2018-01-31 19:34:02 +00:00
|
|
|
pmb.chroot.zap(args, dry=args.dry, packages=args.packages, http=args.http,
|
2017-11-02 17:33:14 +00:00
|
|
|
mismatch_bins=args.mismatch_bins, old_bins=args.old_bins,
|
|
|
|
distfiles=args.distfiles)
|
2017-11-19 14:35:23 +00:00
|
|
|
|
2018-01-31 19:34:02 +00:00
|
|
|
# Don't write the "Done" message
|
|
|
|
pmb.helpers.logging.disable()
|
|
|
|
|
2017-11-19 14:35:23 +00:00
|
|
|
|
|
|
|
def bootimg_analyze(args):
|
|
|
|
bootimg = pmb.parse.bootimg(args, args.path)
|
|
|
|
tmp_output = "Put these variables in the deviceinfo file of your device:\n"
|
|
|
|
for line in pmb.aportgen.device.generate_deviceinfo_fastboot_content(args, bootimg).split("\n"):
|
|
|
|
tmp_output += "\n" + line.lstrip()
|
|
|
|
logging.info(tmp_output)
|