Commit 0af190ad authored by Dan Johansen's avatar Dan Johansen

Add branch support to [buildarmpkg] and [buildarmoem]

Our new mirror structure supports multiple barnches. Stable, Testing and Unstable.
Make the tools that create things, like buildarmpkg and buildarmoem, able to utilize these.
Signed-off-by: Dan Johansen's avatarDan Johansen <strit@manjaro.org>
parent b9731087
......@@ -53,13 +53,13 @@ Options inside [] are optional. Use `-h` to see what the defaults are.
**Syntax**
```
sudo buildarmpkg -p package [-a architecture] [-k] [-i package file]
sudo buildarmpkg -p package [-a architecture] [-k] [-i package file] [-b branch]
```
To build an aarch64 package use the following command:
To build an aarch64 package against unstable branch use the following command:
```
sudo buildarmpkg -p package -a aarch64
sudo buildarmpkg -p package -a aarch64 -b unstable
```
You can also build `any` packages, which will use the aarch64 architecture to build from.
......@@ -72,7 +72,7 @@ The built packages will be copied to `$PKGDIR` as specified in `/usr/share/manja
Default package destination is `/var/cache/manjaro-arm-tools/pkg/`.
## deployarmpkg
## deployarmpkg (depricated, use boxit instead)
This script is only for package maintainers of Manjaro-ARM.
It will gpg sign and upload the package(s) you mention to the Manjaro-ARM main server.
......@@ -139,13 +139,13 @@ Profiles that gets used are on the [Gitlab.com](https://gitlab.com/Strit/arm-pro
**Syntax**
```
sudo buildarmoem [-d device] [-e edition] [-v version] [-n] [-x] [-i package-file.pkg.tar.xz]
sudo buildarmoem [-d device] [-e edition] [-v version] [-n] [-x] [-i package-file.pkg.tar.xz] [-b branch]
```
To build a minimal image version 18.07 for the raspberry pi 3:
To build a minimal image version 18.07 for the raspberry pi 3 on unstable branch:
```
sudo buildarmoem -d rpi3 -e minimal -v 18.07
sudo buildarmoem -d rpi3 -e minimal -v 18.07 -b unstable
```
To build a minimal version 18.08 RC1 for the odroid-c2 with a new rootfs downloaded:
......
......@@ -15,7 +15,7 @@ if [ "$EUID" -ne 0 ]
fi
#Arguments
opt=":e:d:v:i:nxh"
opt=":e:d:v:i:b:nxh"
while getopts "${opt}" arg; do
case $arg in
......@@ -37,6 +37,9 @@ while getopts "${opt}" arg; do
i)
ADD_PACKAGE="${OPTARG}"
;;
b)
BRANCH="${OPTARG}"
;;
\?)
echo "Invalid option: -${OPTARG}"
exit 1
......@@ -62,6 +65,12 @@ if [ ! -d "$PROFILES/arm-profiles" ]; then
getarmprofiles
fi
#Make sure only a known branch is used
if [[ "$BRANCH" != "stable" && "$BRANCH" != "testing" && "$BRANCH" != "unstable" ]]; then
msg "Unknown branch. Please use either, stable, testing or unstable!"
exit 1
fi
# start the timer
timer_start=$(get_timer)
......
......@@ -57,6 +57,7 @@ usage_build_pkg() {
echo " -a <arch> Architecture. [Default = aarch64. Options = any or aarch64]"
echo " -p <pkg> Package to build"
echo " -k Keep the previous rootfs for this build"
echo " -b <branch> Set the branch used for the build. [Default = stable. Options = stable, testing or unstable]"
echo " -i <package> Install local package into rootfs."
echo ' -h This help'
echo ''
......@@ -86,6 +87,7 @@ usage_build_oem() {
echo " -e <edition> Edition of the image. [Default = minimal. Options = $(ls -m --width=0 "$PROFILES/arm-profiles/editions/")]"
echo " -v <version> Define the version the resulting image should be named. [Default is current YY.MM]"
echo " -i <package> Install local package into image rootfs."
echo " -b <branch> Set the branch used in the image. [Default = stable. Options = stable, testing or unstable]"
echo " -n Force download of new rootfs."
echo " -x Don't compress the image."
echo ' -h This help'
......@@ -191,22 +193,6 @@ pkg_upload() {
pkg=$(find_pkg $p)
pkg_up+=($pkg{,.sig})
# msg "Adding [$p] to repo..."
# info "Please use your server login details..."
# ssh $SERVER 1> /dev/null 2>&1 <<ENDSSH
# sudo systemd-nspawn -D /opt/repo/ repo-add -q -n -R /mirror/stable/$ARCH/$REPO/$REPO.db.tar.gz /mirror/stable/$ARCH/$REPO/$p
#if [[ "$ARCH" = "any" ]]; then
# cd /opt/repo/mirror/stable/any/$REPO/ &&
# for f in *
# do
# ln -s ../../any/$REPO/"$f" ../../aarch64/$REPO/"$f"
# done
# cd /opt/repo/mirror/stable/aarch64/$REPO/ &&
# for x in * .[!.]* ..?*; do if [ -L "$x" ] && ! [ -e "$x" ]; then rm -- "$x"; fi; done
# sudo systemd-nspawn -D /opt/repo/ repo-add -q -n -R /mirror/stable/aarch64/$REPO/$REPO.db.tar.gz /mirror/stable/aarch64/$REPO/$p
#fi
#ENDSSH
done
scp ${pkg_up[@]} "$SERVER:/opt/repo/mirror/stable/$ARCH/$REPO/"
}
......@@ -243,10 +229,8 @@ create_rootfs_pkg() {
# cd to root_fs
mkdir -p $BUILDDIR/$ARCH
# basescrap the rootfs filesystem
#sed -i s/"Server = https://manjaro-arm.moson.eu/stable/\$repo/\$arch"/"Server = https://manjaro-arm.moson.eu/$BRANCH/\$repo/\$arch"/g $LIBDIR/pacman.conf.$ARCH
basestrap -G -C $LIBDIR/pacman.conf.$ARCH $BUILDDIR/$ARCH base-devel
#sed -i s/"# Branch = stable"/"Branch = $BRANCH"/g $BUILDDIR/$ARCH/etc/pacman-mirrors.conf
#sed -i s/"Server = https://manjaro-arm.moson.eu/$BRANCH/\$repo/\$arch"/"Server = https://manjaro-arm.moson.eu/stable/\$repo/\$arch"/g $LIBDIR/pacman.conf.$ARCH
sed -i s/"# Branch = stable"/"Branch = $BRANCH"/g $BUILDDIR/$ARCH/etc/pacman-mirrors.conf
# Enable cross architecture Chrooting
cp /usr/bin/qemu-aarch64-static $BUILDDIR/$ARCH/usr/bin/
......@@ -261,6 +245,7 @@ create_rootfs_pkg() {
cp -a /etc/ca-certificates/extracted/tls-ca-bundle.pem $BUILDDIR/$ARCH/etc/ca-certificates/extracted/
sed -i s/'#PACKAGER="John Doe <john@doe.com>"'/"$PACKAGER"/ $BUILDDIR/$ARCH/etc/makepkg.conf
sed -i s/'#MAKEFLAGS="-j2"'/'MAKEFLAGS="-j$(nproc)"'/ $BUILDDIR/$ARCH/etc/makepkg.conf
$NSPAWN $BUILDDIR/$ARCH pacman-mirrors -g
}
create_rootfs_img() {
......@@ -415,6 +400,10 @@ create_rootfs_oem() {
$NSPAWN $ROOTFS_IMG/rootfs_$ARCH pacman-key --init 1> /dev/null 2>&1
$NSPAWN $ROOTFS_IMG/rootfs_$ARCH pacman-key --populate archlinux archlinuxarm manjaro manjaro-arm 1> /dev/null 2>&1
info "Setting branch to $BRANCH..."
sed -i s/"# Branch = stable"/"Branch = $BRANCH"/g $ROOTFS_IMG/rootfs_$ARCH/etc/pacman-mirrors.conf
$NSPAWN $ROOTFS_IMG/rootfs_$ARCH pacman-mirrors -g
msg "Installing packages for $EDITION edition on $DEVICE..."
# Install device and editions specific packages
mount -o bind /var/cache/manjaro-arm-tools/pkg/pkg-cache $ROOTFS_IMG/rootfs_$ARCH/var/cache/pacman/pkg
......
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