1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
#!/bin/sh
set -e
# To just download from the sources listed in sources.list.deb and use
# the binary packages, use BUILD=0 ./fetch-and-build . Else, it will
# build all the sources.
BUILD=${BUILD:-0}
#DEBS="libgtk2.0-0 libatk1.0-0 libpango1.0-0 libxft2 libxcursor1 libxfixes3 gtk2-engines gtk2-engines-pixbuf"
DEBS="libgtk2.0-0 libatk1.0-0 libpango1.0-0 gtk2-engines libglib2.0-0 libglib2.0-data libart-2.0-2"
DEBS="$DEBS libgconf2-4 liborbit2 libidl0 libpcre3"
# add gnome accessability packages (libgnomecanvas2-0 is needed as a dependency)
DEBS="$DEBS libatspi1.0-0 libgail-common libgail18 at-spi libgnomecanvas2-0 libbonobo2-common libbonobo2-0 libglade2-0"
DEBS="$DEBS libqtcore4 libqt4-network libqt4-script libqt4-xml libqt4-dbus libqt4-test libqtgui4"
DEBS="$DEBS libpixman-1-0 libdbus-glib-1-2"
# those used to be in ia32-libs
DEBS="$DEBS gtk2-engines-pixbuf libglib1.2ldbl libgtk1.2 libgtk1.2-common"
export APTDIR=$(mktemp -d)
mkdir -p $APTDIR
if [ -d pkgs/.svn ]; then
mv pkgs/.svn pkgs.svn
fi
rm -rf pkgs
mkdir pkgs
if [ -d pkgs.svn ]; then
mv pkgs.svn pkgs/.svn
fi
if [ -d srcs/.svn ]; then
mv srcs/.svn srcs.svn
fi
rm -rf srcs
mkdir srcs
if [ -d srcs.svn ]; then
mv srcs.svn srcs/.svn
fi
rm -rf build
mkdir build
LIST=sources.list.deb
if [ -e sources.list.local ]; then
LIST=sources.list.local
fi
APT_GET="apt-get --assume-yes \
-o Dir::Etc::sourcelist=`pwd`/$LIST \
-o Dir::State=$APTDIR/state \
-o Debug::NoLocking=true \
-o Dir::Cache=$APTDIR/cache \
-o Acquire::Retries=3 \
-o Apt::Architecture=i386"
# Prepare APTDIR
mkdir -p $APTDIR/state/lists/partial
mkdir -p $APTDIR/cache/archives/partial
echo -n > $APTDIR/state/status
# Probe apt version for --allow-unauthenticated
APT_VER=$(apt-get --version | head --lines 1 | cut -d" " -f2)
if dpkg --compare-versions "$APT_VER" ">=" 0.6; then
# Sid apt needs authentication
APT_AUTH="--allow-unauthenticated"
fi
APT_GET="$APT_GET $APT_AUTH -o Dir::State::Status=$APTDIR/state/status"
$APT_GET update
APT_CACHE="apt-cache \
-o Dir::Etc::sourcelist=`pwd`/$LIST \
-o Dir::State=$APTDIR/state \
-o Debug::NoLocking=true \
-o Dir::Cache=$APTDIR/cache \
-o Acquire::Retries=3 \
-o Apt::Architecture=i386 \
-o Dir::State::Status=$APTDIR/state/status"
######################################################################
# Sources
# Fetch sources for all debs
for DEB in $DEBS; do
# Filter out debs in local/pkgs
if [ -e local/pkgs/${DEB}_*.deb ]; then
# Make sure we don't ship an old version
if VER=$($APT_CACHE 2>/dev/null show $DEB | grep-dctrl "" -n -s Version); then
VER2=$(dpkg -I local/pkgs/${DEB}_*.deb | grep "^ Version:" | cut -b11-)
if dpkg --compare-versions "$VER" ">=" "$VER2"; then
echo >&2 "$DEB has older version in local than in Debian!"
exit 1
fi
echo >&2 "$DEB has newer version in local than in Debian"
fi
else
# Deb needs fetching
echo $DEB
fi
done \
| xargs $APT_CACHE show \
| grep-dctrl "" -s Package,Version,Source \
| while read KEY VAL; do # ^ Get package information, needed fields and parse
# Source: is optional and may not contain a version
# Fill in missing information from Package and Version
case "$KEY" in
Package:) PKG="$VAL"; SRC="$VAL";;
Version:) VER=$(echo "$VAL" | sed 's/+b[0-9]*$//');;
Source:) case "$VAL" in
*\(*\)) SRC=$(echo "$VAL" | cut -d" " -f1)
VER=$(echo "$VAL" | sed 's/.*(\(.*\))/\1/' | sed 's/+b[0-9]*$//');;
"") ;;
*) SRC="$VAL";;
esac;;
"") echo >&2 "Fetching source $SRC $VER for $PKG"
echo "$SRC=$VER";;
esac
done \
| sort -u | (cd srcs; xargs $APT_GET -d source) || exit 1 # Fetch source
######################################################################
# Debs
if [ "$BUILD" = 1 ]; then
# Build all debs from source
cd build
for DSC in ../srcs/*.dsc; do
PKG=$(basename $DSC | cut -d_ -f1)
echo $PKG
dpkg-source -sn -x $DSC
cd $PKG-*
dpkg-buildpackage -rfakeroot -uc -us -B
cd ..
#rm -rf $PKG
done
cd ..
else
# Or fetch prebuild debs
for pkg in $DEBS; do
if [ -e local/pkgs/${pkg}_*.deb ]; then
(cd build; ln -s ../local/pkgs/${pkg}_*.deb .)
else
echo $pkg
fi
done | xargs $APT_GET --download-only install
cp $APTDIR/cache/archives/*.deb build/
fi
# Move only the wanted debs out of build and clean up
for pkg in $DEBS; do
mv build/${pkg}_*.deb pkgs/
done
rm -rf $APTDIR build
# Sanity check that we have _matching_ source for every deb.
# With debs in local this can happen.
dpkg-scanpackages pkgs /dev/null 2>/dev/null \
| grep-dctrl "" -s Package,Version,Source \
| while read KEY VAL; do
case "$KEY" in
Package:) PKG="$VAL"; SRC="$VAL";;
Version:) VER="$(echo "$VAL" | sed 's/+b[0-9]*$//')";;
Source:) case "$VAL" in
*\(*\)) SRC=$(echo "$VAL" | cut -d" " -f1)
VER=$(echo "$VAL" | sed 's/.*(\(.*\))/\1/' | sed 's/+b[0-9]*$//');;
"") ;;
*) SRC="$VAL";;
esac;;
"") echo "Testing source $SRC $VER for $PKG"
FVER=$(echo "$VER" | cut -d: -f2)
if [ ! -e "local/srcs/${SRC}_${FVER}.dsc" ]; then
if [ ! -e "srcs/${SRC}_${FVER}.dsc" ]; then
echo "Missing source $SRC $VER for $PKG!"
exit 1
fi
fi;;
esac
done || exit 1
echo All sources fetched, all packages build or fetched, all versions match.
echo Enjoy.
exit 0
|