Commit dc515cd4 authored by Antonio Terceiro's avatar Antonio Terceiro

major reorganization for reuse and consolidation

parent d5e0711c
/data
/public/doc
/public/jquery.js
/.whitelist
/config/whitelist
/chroots/*
Work chroots will be create in this directory by the setup script.
Files you may want to put in this directory:
- whitelist
- blacklist
#!/bin/sh
if [ -z "$dep8_base_dir" ]; then
if [ -f scripts/process-all-packages -a -f lib/environment.sh ]; then
dep8_base_dir="$(pwd)"
else
return 1
fi
fi
dep8_suite='unstable' # FIXME
dep8_data_dir="${dep8_base_dir}/data"
dep8_packages_dir="${dep8_data_dir}/packages"
dep8_config_dir="${dep8_base_dir}/config"
dep8_gnupg_dir="${dep8_base_dir}/gnupg"
dep8_chroots_dir="${dep8_base_dir}/chroots"
dep8_chroot_name="dep8-${dep8_suite}"
dep8_chroot_path="${dep8_chroots_dir}/${dep8_suite}"
#!/bin/sh
grep_packages() {
grep-dctrl "$@" "$dep8_chroot_path"/var/lib/apt/lists/*_debian_dists_${dep8_suite}_main_binary-`dpkg-architecture -qDEB_HOST_ARCH`_Packages
}
grep_sources() {
grep-dctrl "$@" "$dep8_chroot_path"/var/lib/apt/lists/*_debian_dists_${dep8_suite}_main_source_Sources
}
list_binaries() {
pkg="$1"
grep_packages -n -s Package -F Source,Package -X "$pkg"
}
check_version() {
# check source version for (available for this architecture) by looking at
# the first binary package built from that source package
local pkg="$1"
first_binary=$(list_binaries "$pkg" | head -n 1)
grep_packages -n -s Version -F Package -X "$first_binary"
}
......@@ -2,7 +2,8 @@
set -e
suite=unstable # FIXME should be an optional parameter
chroot_path="$(pwd)/data/chroots/${suite}"
base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
. $base/lib/functions.sh
grep-dctrl -n -s Package -F Testsuite autopkgtest "$chroot_path"/var/lib/apt/lists/*dists_${suite}_main_source_Sources | sort | uniq
grep_sources -n -s Package -F Testsuite -X autopkgtest | sort | uniq
......@@ -2,12 +2,10 @@
set -e
suite=unstable # FIXME
chroot_name="dep8-$suite"
root=$(pwd)
data_root=$(pwd)/data
packages_root=$(pwd)/data/packages
chroot_root=$(pwd)/data/chroots
base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
. $base/lib/functions.sh
date=$(date --rfc-3339=date)
global_tmp_dir=$(mktemp -d)
......@@ -27,7 +25,7 @@ process_package() {
mkdir "$tmp_dir"
# setup status "DB"
status_dir="${packages_root}/${pkg_dir}"
status_dir="${dep8_packages_dir}/${pkg_dir}"
mkdir -p "$status_dir"
# setup log
......@@ -65,7 +63,7 @@ do_process_package() {
}
needs_processing() {
whitelist="${root}/.whitelist"
local whitelist="${dep8_config_dir}/whitelist"
if [ -f "${whitelist}" ]; then
if ! grep -q "^$1\$" "${whitelist}"; then
return 1
......@@ -102,9 +100,9 @@ check_dependencies() {
pkg="$1"
binaries=$(list_binaries "$pkg")
{
if ! schroot -d / -c "$chroot_name" -u root -- apt-get install --quiet --assume-yes --simulate $binaries 2>&1; then
if ! schroot -d / -c "$dep8_chroot_name" -u root -- apt-get install --quiet --assume-yes --simulate $binaries 2>&1; then
for binary in $binaries; do
schroot -d / -c "$chroot_name" -u root -- apt-get -q -y --simulate install $binary 2>&1
schroot -d / -c "$dep8_chroot_name" -u root -- apt-get -q -y --simulate install $binary 2>&1
done
fi
} | \
......@@ -112,18 +110,6 @@ check_dependencies() {
sort | uniq
}
list_binaries() {
pkg="$1"
grep_packages -n -s Package -F Source,Package -X "$pkg"
}
grep_packages() {
grep-dctrl "$@" "$chroot_root"/"$suite"/var/lib/apt/lists/*_debian_dists_${suite}_main_binary-`dpkg-architecture -qDEB_HOST_ARCH`_Packages
}
grep_sources() {
grep-dctrl "$@" "$chroot_root"/"$suite"/var/lib/apt/lists/*_debian_dists_${suite}_main_source_Sources
}
first_banner=
banner() {
......@@ -137,14 +123,6 @@ banner() {
echo
}
check_version() {
# check source version for (available for this architecture) by looking at
# the first binary package built from that source package
local pkg="$1"
first_binary=$(list_binaries "$pkg" | head -n 1)
grep_packages -n -s Version -F Package -X "$first_binary"
}
record_status() {
pkg="$1"
status="$2"
......
......@@ -2,43 +2,43 @@
set -e
base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
if [ $(whoami) != root ]; then
echo "This script mus be run as root"
echo "This script must be run as root"
exit 1
fi
suite='unstable' # FIXME
data_root=$(pwd)/data
chroot_root=${data_root}/chroots
create_chroot() {
local suite="$1"
local path="$2"
echo "Creating $suite chroot (may take a while)"
echo "Creating $dep8_suite chroot (may take a while)"
# detect a local apt-cacher-ng cache running.
# 10.0.2.2 = default IP assigned to host system as seen from a kvm/virtualbox
# virtual machine
mirror=
local mirror=
for ip in 127.0.0.1 10.0.2.2; do
if nc -z -w 1 $ip 3142; then
mirror=http://$ip:3142/debian
fi
done
debootstrap "$suite" "$path" $mirror
debootstrap "$dep8_suite" "$dep8_chroot_path" $mirror
# do not download translations
echo 'Acquire::Languages "none";' > "${path}/etc/apt/apt.conf.d/99translations"
echo 'Acquire::Languages "none";' > "${dep8_chroot_path}/etc/apt/apt.conf.d/99translations"
# add APT Source URIs
sed -e 's/^deb\s/deb-src /' "${path}/etc/apt/sources.list" > "${path}/etc/apt/sources.list.d/sources.list"
sed -e 's/^deb\s/deb-src /' "${dep8_chroot_path}/etc/apt/sources.list" > "${dep8_chroot_path}/etc/apt/sources.list.d/sources.list"
chroot "$path" apt-get update
chroot "$dep8_chroot_path" apt-get update
echo 'debconf debconf/frontend select noninteractive' | chroot "$path" debconf-set-selections
echo 'debconf debconf/frontend select noninteractive' | chroot "$dep8_chroot_path" debconf-set-selections
}
update_chroot() {
......@@ -51,21 +51,17 @@ update_chroot() {
}
setup_schroot() {
local suite="$1"
local chroot_name="$2"
local chroot_path="$3"
local data_dir=$(readlink -f ${data_root})
local user=$(stat -c %U "${data_dir}")
if [ -z "$user" ]; then
user=dep8
fi
cat > /etc/schroot/chroot.d/"${chroot_name}" <<EOF
[$chroot_name]
cat > /etc/schroot/chroot.d/"${dep8_chroot_name}" <<EOF
[$dep8_chroot_name]
type=directory
description=DEP-8 $suite chroot
directory=${chroot_path}
description=DEP-8 $dep8_suite chroot
directory=${dep8_chroot_path}
users=$user
groups=$user
root-users=$user
......@@ -76,34 +72,29 @@ EOF
}
setup_suite() {
local suite="$1"
# create chroot directory
if [ ! -d "${chroot_root}" ]; then
mkdir "${chroot_root}"
if [ ! -d "${dep8_chroots_dir}" ]; then
mkdir "${dep8_chroots_dir}"
fi
chroot_name="dep8-${suite}"
chroot_path="${chroot_root}/${suite}"
if schroot --list --all | grep -q "^source:dep8-$suite\$"; then
echo "Suite ${suite} already set up, skipping"
if schroot --list --all | grep -q "^source:${dep8_chroot_name}\$"; then
echo "schroot setup for ${dep8_suite} already done, skipping"
else
setup_schroot "$suite" "$chroot_name" "$chroot_path"
setup_schroot
fi
local actual_chroot_path=$(schroot --config --chroot "$chroot_name" | grep '^directory=' | cut -d = -f 2)
local actual_chroot_path=$(schroot --config --chroot "$dep8_chroot_name" | grep '^directory=' | cut -d = -f 2)
if [ -d "${actual_chroot_path}" ]; then
update_chroot "$actual_chroot_path"
else
if [ "$actual_chroot_path" = "${chroot_path}" ]; then
create_chroot "$suite" "$chroot_path"
if [ "$actual_chroot_path" = "${dep8_chroot_path}" ]; then
create_chroot
else
echo "Chroot ${chroot_name} does not exit in custom location ${actual_chroot_path}. Please create it first."
echo "Chroot ${dep8_chroot_name} does not exit in custom location ${actual_chroot_path}. Please create it first."
exit 1
fi
fi
}
# FIXME turn this into a loop when more than one suite is supported
setup_suite "$suite"
setup_suite
......@@ -2,6 +2,9 @@
set -e
base=$(readlink -f $(dirname $(readlink -f $0))/..)
. $base/lib/environment.sh
if [ $# -ne 1 ]; then
echo "usage: $0 PACKAGE"
exit 1
......@@ -16,11 +19,9 @@ cleanup() {
}
trap cleanup INT TERM EXIT
suite=unstable # FIXME this should be a parameter (?)
cd $tmpdir
schroot --chroot dep8-$suite -- apt-get source --download-only $package
schroot --chroot "${dep8_chroot_name}" -- apt-get source --download-only $package
dpkg-source -x *.dsc
source=$(find . -mindepth 1 -maxdepth 1 -type d)
cd "$source"
adt-run --built-tree . --- adt-virt-schroot "dep8-$suite"
adt-run --built-tree . --- adt-virt-schroot "${dep8_chroot_name}"
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