#!/bin/bash # # Copyright (C) 2006 Brian Brazil # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # set -ex . config function ensure_updated { # Parameters: # $1 Upstream binary package name # $2 Our binary package name # $3 Release # $4 Build script # $5 Version in ./config UPSTREAM_VERSION=$(reprepro -b $REPODST -T deb list $3 $1 | cut -f 3 -d ' ' | fgrep -v $DISTRONAME_L) || true OUR_VERSION=$(reprepro -b $REPODST -T deb list $3 $2 | cut -f 3 -d ' ' | fgrep $DISTRONAME_L) || true # Get the version per the config file CONFIG_VERSION=${OUR_VERSION#*$DISTRONAME_L} if ! [ -z "$UPSTREAM_VERSION" -a -z "$OUR_VERSION" ]; then FOUND=1 # Found a kernel fi if [ -n "$UPSTREAM_VERSION" ]; then # We have something to build from # We haven't built yet, or are out of date if [ -z "$OUR_VERSION" ] || dpkg --compare-versions $UPSTREAM_VERSION gt $OUR_VERSION; then add_package "$2" "$5" "$UPSTREAM_VERSION" "$3" "$4" return fi # Has the version in the config file changed? if [ -n "$OUR_VERSION" ]; then if [ "$CONFIG_VERSION" -lt "$5" ]; then add_package "$2" "$5" "$UPSTREAM_VERSION" "$3" "$4" return fi; fi else # Has the version in the config file changed? echo $1 Version:"$OUR_VERSION" Package:$CONFIG_VERSION Config:$5 if [ -n "$OUR_VERSION" ]; then if [ "$CONFIG_VERSION" -lt "$5" ]; then # Remove our version in the repo RELEASE=$3 ./remove-package $2 REDO=1 fi; fi fi } function add_package { # Parametes: # $1 Our binary package name # $2 Version in ./config # $3 Upstream version # $4 Release # $5 Build script # Check if some other release already has it, remove epoch NEW_VERSION="${3#*:}${DISTRONAME_L}$2" DIR=$(reprepro -b $REPODST dumpreferences | fgrep "/$1_${NEW_VERSION}_" | cut -d/ -f 2-4 | head -1) if [ -n "$DIR" ]; then # In another component - use that for i in $REPODST/pool/$DIR/*_"${NEW_VERSION}"_*.deb; do reprepro -b $REPODST includedeb $4 $i done else # Build it if [ 1 == "$DONT_CHROOT" ]; then # Some things need to manipulate the repo itself CHROOTDIR=$CHROOTDIR RELEASE=$4 VERSION="=$3" $5 || exit 1 else chroot $CHROOTDIR bash -c "cd /builder && RELEASE=$4 VERSION='=$3' $5" || exit 1 reprepro -Vb $REPODST include $4 $CHROOTDIR/$WORKINGDIR/*.changes fi fi } if [ 1 == $BACKPORTS ]; then EXTRAS="-backports"; fi if [ 1 == $UPDATES ]; then EXTRAS="$EXTRAS -updates"; fi REDO=1 while [ $REDO -eq 1 ]; do #If versions in the config change, we could need to redo the lot REDO=0 reprepro --noskipold -Vb $REPODST update for i in '' -security $EXTRAS; do ./update-chroot $i CHROOTDIR=$WORKINGDIR/$MIRRORDIST$i # General ensure_updated base-files base-files $RELEASE$i ./gen-base-files $BASE_FILES_VERSION ensure_updated ubiquity ubiquity $RELEASE$i ./gen-ubiquity $UBIQUITY_VERSION ensure_updated example-content example-content $RELEASE$i ./gen-example-content $EXAMPLE_CONTENT_VERSION ensure_updated launchpad-integration launchpad-integration $RELEASE$i ./gen-launchpad-integration $LAUNCHPAD_INTEGRATION_VERSION ensure_updated python-apt python-apt $RELEASE$i ./gen-python-apt $PYTHON_APT_VERSION ensure_updated module-init-tools module-init-tools $RELEASE$i ./gen-module-init-tools $MODULE_INIT_TOOLS_VERSION # Gnome ensure_updated ubuntu-artwork $DISTRONAME_L-artwork $RELEASE$i ./gen-artwork $ARTWORK_VERSION DONT_CHROOT=1 ensure_updated ubuntu-artwork ubuntu-artwork $RELEASE$i "./remove-package ubuntu-artwork" '' ensure_updated ubuntu-desktop $DISTRONAME_L-desktop $RELEASE$i ./gen-meta $META_VERSION DONT_CHROOT=1 ensure_updated ubuntu-desktop ubuntu-desktop $RELEASE$i "./remove-package ubuntu-desktop" '' ensure_updated human-icon-theme human-icon-theme $RELEASE$i ./gen-human-icon-theme $HUMAN_ICON_THEME_VERSION #ensure_updated firefox firefox $RELEASE$i ./gen-firefox $FIREFOX_VERSION ensure_updated gnome-about gnome-about $RELEASE$i ./gen-gnome-desktop $GNOME_DESKTOP_VERSION ensure_updated gnome-panel gnome-panel $RELEASE$i ./gen-gnome-panel $GNOME_PANEL_VERSION ensure_updated epiphany-browser epiphany-browser $RELEASE$i ./gen-epiphany-browser $EPIPHANY_BROWSER_VERSION ensure_updated yelp yelp $RELEASE$i ./gen-yelp $YELP_VERSION ensure_updated app-install-data app-install-data $RELEASE$i ./gen-app-install-data-ubuntu $APP_INSTALL_DATA_UBUNTU_VERSION # KDE #ensure_updated kubuntu-default-settings k$DISTRONAME_L-default-settings $RELEASE$i ./gen-kdefault-settings $KDEFAULT_SETTINGS_VERSION #ensure_updated kubuntu-desktop k$DISTRONAME_L-desktop $RELEASE$i ./gen-kmeta $KMETA_VERSION #DONT_CHROOT=1 ensure_updated kubuntu-desktop kubuntu-desktop $RELEASE$i "./remove-package kubuntu-desktop" '' # GLX is non-free ensure_updated xserver-xorg-core xserver-xorg-core $RELEASE$i ./gen-xorg-server $XORG_SERVER_VERSION DONT_CHROOT=1 ensure_updated libgl1-mesa-dev libgl1-mesa-dev $RELEASE$i ./gen-mesa $MESA_VERSION # Non-Free, or no valid use in gNewSense DONT_CHROOT=1 ensure_updated linuxsampler linuxsampler $RELEASE$i "./remove-package linuxsampler" '' DONT_CHROOT=1 ensure_updated nvidia-xconfig nvidia-xconfig $RELEASE$i "./remove-package nvidia-xconfig" '' DONT_CHROOT=1 ensure_updated linux-wlan-ng-firmware linux-wlan-ng-firmware $RELEASE$i "./remove-package linux-wlan-ng-firmware" '' DONT_CHROOT=1 ensure_updated bcm43xx-fwcutter bcm43xx-fwcutter $RELEASE$i "./remove-package bcm43xx-fwcutter" '' DONT_CHROOT=1 ensure_updated b43-fwcutter b43-fwcutter $RELEASE$i "./remove-package b43-fwcutter" '' DONT_CHROOT=1 ensure_updated isdnactivecards isdnactivecards $RELEASE$i "./remove-package isdnactivecards" '' DONT_CHROOT=1 ensure_updated bind bind $RELEASE$i "./remove-package bind" '' DONT_CHROOT=1 ensure_updated helix-player helix-player $RELEASE$i "./remove-package helix-player" '' DONT_CHROOT=1 ensure_updated x11proto-gl-dev x11proto-gl-dev $RELEASE$i "./remove-package x11proto-gl-dev" '' DONT_CHROOT=1 ensure_updated nikto nikto $RELEASE$i "./remove-package nikto" '' DONT_CHROOT=1 ensure_updated firefox-3.0 firefox-3.0 $RELEASE$i "./remove-package firefox-3.0" '' DONT_CHROOT=1 ensure_updated firefox-2.0 firefox-2.0 $RELEASE$i "./remove-package firefox-2.0" '' DONT_CHROOT=1 ensure_updated jockey-common jockey-common $RELEASE$i "./remove-package jockey-common" '' DONT_CHROOT=1 ensure_updated vrms vrms $RELEASE$i "./remove-package vrms" '' FOUND=0 for n in `seq 50 -1 12`; do export KERNEL_VERSIONPART=$n #Used by ./gen-kernel if [ $FOUND -eq 0 ]; then ensure_updated linux-image-2.6.24-$n-386 linux-image-2.6.24-$n-386 $RELEASE$i ./gen-kernel $KERNEL_VERSION ensure_updated linux-ubuntu-modules-2.6.24-$KERNEL_VERSIONPART-386 linux-ubuntu-modules-2.6.24-$KERNEL_VERSIONPART-386 $RELEASE$i ./gen-linux-ubuntu-modules $LINUX_UBUNTU_MODULES_VERSION else #Only keep one RELEASE=$RELEASE$i ./remove-kernel linux 2.6.24 RELEASE=$RELEASE$i ./remove-kernel linux-ubuntu-modules-2.6.24 2.6.24 fi done # User-defined packages if [ -d packages/$RELEASE$i ]; then for PKG in packages/$RELEASE$i/*; do PKGNAME=${PKG##*/} PKG_VERSION=$(sed '1{s/.*(\(.*\)).*/\1/;q}' $PKG/debian/changelog) REPO_VERSION=$(reprepro -b $REPODST -T deb list $RELEASE$i $PKGNAME | cut -f 3 -d ' ') || true if [ -z "$REPO_VERSION" ] || dpkg --compare-versions $PKG_VERSION gt $REPO_VERSION; then rm -rf $CHROOTDIR/$WORKINGDIR mkdir -p $CHROOTDIR/$WORKINGDIR cp -r $PKG $CHROOTDIR/$WORKINGDIR chroot $CHROOTDIR bash -c "cd $WORKINGDIR/$PKGNAME && dpkg-buildpackage -rfakeroot -us -uc" reprepro -Vb $REPODST include $RELEASE$i $CHROOTDIR/$WORKINGDIR/*.changes fi done fi done done # Extra meta packages ./gen-emeta echo "do-update completed"