Commit 2f44af02 authored by Ed Reel's avatar Ed Reel Committed by Casey Strouse

Add generate_binaries.sh script (#1473)

Add needs_binaries.sh and needs_binaries.sh scripts
parent e8b57abc
#!/bin/bash
#
# Usage: yes | bash generate_binaries.sh [directory] [start]
#
# [directory] Optional directory where the binaries will be stored.
# If not provided, a directory relative to the current
# directory will be created using the current date.
#
# [start] Optional package name of the first binary build.
# Useful if you want to continue where you left off
# if the script aborts on a previous attempt.
#
# Search for required commands
cmds="crew git"
for c in $cmds; do
command -v $c > /dev/null && continue || { echo "$c command not found."; exit 1; }
done
# Determine if a packages directory exists from the cloned repository
packages_dir=$(echo $(git rev-parse --git-dir 2> /dev/null) | sed -e 's,.git,packages,')
if [ ! -d "$packages_dir" ]; then
echo "Not a valid Chromebrew repository."
exit 1
fi
# Generate working directory
if test $1; then
workdir=$1
if [ ! -d "$workdir" ]; then
mkdir -p $workdir
fi
else
workdir=$(date +%Y%m%d%H%M)
mkdir $workdir
fi
# Get architecture
arch=$(uname -m)
# Exclude fake packages
exclusions="buildessential glibc parallel wayland xorg_proto"
# Exclude packages without architecture support
if [[ "$arch" == "aarch64" || "$arch" == "armv7l" ]]; then
exclusions="$exclusions cbase dropbox freebasic google_cloud_sdk lldb mesa misctools"
fi
# Packages that need binary builds
packages=$(grep -L "$arch:" $packages_dir/*.rb | sed -e "s,$packages_dir/,,g" | cut -d'.' -f1 | xargs)
# Determine the starting package, if necessary
start=
if test $2; then
for p in $packages; do
if [[ "$2" == "$p" ]]; then
start=$2
break
fi
done
fi
# Continue unless there is a starting package
continue=1
if test $start; then
continue=
fi
# Change to the working directory
cd $workdir
# Loop through packages that need a binary build
for p in $packages; do
package=$(ls $p-*.xz 2> /dev/null)
# Operate only on packages that don't already have a build
if [ ! -f "$package" ]; then
if [[ "$start" == "$p" ]]; then
continue=1
fi
# Determine if the package should be excluded
exclude=
for e in $exclusions; do
if [[ "$e" == "$p" ]]; then
exclude=1
break
fi
done
# Build only if necessary
if test $continue; then
if ! test $exclude; then
crew build $p
fi
fi
fi
done
#!/bin/bash
if [ ! -d ../packages ]; then
echo "Unable to locate packages directory."
exit 1
fi
cd ../packages
arch=$(uname -m)
exclusions=""
if [[ "$arch" == "aarch64" || "$arch" == "armv7l" ]]; then
exclusions="cbase.rb dropbox.rb freebasic.rb google_cloud_sdk.rb lldb.rb mesa.rb misctools.rb"
fi
packages=$(grep -L "$arch:" *.rb)
for p in $packages; do
include=1
for e in $exclusions; do
if [ "$e" == "$p" ]; then
include=
break
fi
done
if test $include; then
grep -L is_fake $p
fi
done
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