Skip to content

Commit

Permalink
Required updates for supporting %{?dist} and various improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Nov 3, 2009
1 parent d4c60c7 commit 77157ca
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 50 deletions.
25 changes: 11 additions & 14 deletions dar-build
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ for arg in $PKGS; do
VERSION="$(rpmconf Version)"
RELEASE="$(rpmconf Release)"

NEWSPECFILE="$TEMPDIR/$app-$VERSION-$RELEASE.$TAG.spec"
RPMFILE="$app-$VERSION-$RELEASE.$DISTNAME.$TAG.$arch.rpm"
LOGFILE="$app-$VERSION-$RELEASE.$DISTNAME.$TAG.$arch"
LOGFILE_OK="$app-$VERSION-$RELEASE.$DISTNAME.$TAG.$arch.ok.log"
LOGFILE_KO="$app-$VERSION-$RELEASE.$DISTNAME.$TAG.$arch.ko.log"
NEWSPECFILE="$TEMPDIR/$app-$VERSION-$RELEASE.spec"
RPMFILE="$app-$VERSION-$RELEASE.$arch.rpm"
LOGFILE="$app-$VERSION-$RELEASE.$arch"
LOGFILE_OK="$app-$VERSION-$RELEASE.$arch.ok.log"
LOGFILE_KO="$app-$VERSION-$RELEASE.$arch.ko.log"
export MAKEFLAGS="%nil"

if [ "$arch" == "nosrc" ]; then
Expand Down Expand Up @@ -192,7 +192,7 @@ for arg in $PKGS; do
( echo "----- Build information -----"
echo "Package name: $app"
echo "Package version: $VERSION"
echo "Package release: $RELEASE.$DISTNAME.$TAG"
echo "Package release: $RELEASE"
echo "Packager: $(logname)"
echo "Distribution: $DISTNAME/$DISTARCH"
echo "Package arch: $arch"
Expand Down Expand Up @@ -309,7 +309,7 @@ for arg in $PKGS; do
--define \"_buildroot $TEMPDIR/$app-$VERSION-$RELEASE-root\" \
--define \"debug_package %nil\" \
--define \"dtag $DISTNAME\" \
--define \"disttag $DISTNAME\" \
--define \"dist .$DISTNAME.$TAG\" \
--define \"$DISTNAME 1\" \
--define \"$DISTNICK 1\" \"$NEWSPECFILE\""

Expand All @@ -321,7 +321,7 @@ for arg in $PKGS; do
cat "$NEWSPECFILE"

echo -e "\n----- Expanded spec file -----"
rpmdb -D "dtag $DISTNAME" -D "disttag $DISTNAME" -D "$DISTNICK 1" -D "$DISTNAME 1" -D "_smp_mflags $MAKEFLAGS" -E "%{expand:%(cat $SPECFILE)}"
rpmdb -D "dtag $DISTNAME" -D "dist .$DISTNAME.$TAG" -D "$DISTNICK 1" -D "$DISTNAME 1" -D "_smp_mflags $MAKEFLAGS" -E "%{expand:%(cat $SPECFILE)}"

echo -e "\n----- Build log -----"

Expand Down Expand Up @@ -429,20 +429,17 @@ for arg in $PKGS; do
--define \"_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm\" \
--define \"_srcrpmdir $PACKAGEDIR/$app\" \
--define \"_sourcedir $SPECDIR\" \
--define \"$dist 1\" \
--define \"dist $DISTNAME\" \
--define \"disttag $DISTNAME\" \
--define \"$DISTNAME 1\" \
--define \"dist \" \
\"$NEWSPECFILE\""
echo "$BUILDCMD" | setarch $DISTARCH /usr/sbin/chroot "$CHROOTDIR/$dist" /bin/su -lm $BUILD_USER -c "/bin/bash --login -s" &>/dev/null
RC=$?
if [ $RC -eq 0 ]; then
if [ "$FORCE_VERBOSE" == "yes" ]; then
echo -e "${_GR}Success${_DE} $app [$dist/src], file in [$PACKAGEDIR/$app/]"
echo -e "${_BELL}${_GR}Success${_DE} $app [$dist/src], file in [$PACKAGEDIR/$app/]"
fi
echo "$app [$dist/src] ${SPECFILE/*\/}" >>/dar/log/dar-build-success.log
else
error "${_RE}Failed${_DE} $app [$dist/src], see log [$SPECDIR/_buildlogs/$LOGFILE]"
error "${_BELL}${_RE}Failed${_DE} $app [$dist/src], see log [$SPECDIR/_buildlogs/$LOGFILE]"
echo "$app [$dist/src] ${SPECFILE/*\/}" >>/dar/log/dar-build-failed.log
fi

Expand Down
4 changes: 3 additions & 1 deletion dar-functions
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ _RE_="\033[41m" # Red BG
_BL_="\033[44m" # Blue BG
_WH_="\033[47m" # White BG

_BELL=""

### Cleans environment
function clean_env {
:
Expand Down Expand Up @@ -97,7 +99,7 @@ function rpmconf {

(
# if [ -z "$DISTNICK" ] || [ "$RPMVER" \< "4.1" ] || ! chroot "$CHROOTDIR/$DISTNICK" /bin/su -lm $BUILD_USER -c "rpmdb -D \"dtag $DISTNAME\" -D \"disttag $DISTNAME\" -D \"$DISTNICK 1\" -D \"$DISTNAME 1\" -E \"%{expand:%(head -n128 $SPECFILE)}\"" | grep -i "^ *$CONFIG *:" | sed -e "s/^ *$CONFIG *: *//i" | head -1; then
if [ -z "$DISTNICK" ] || [ "$RPMVER" \< "4.1" ] || ! chroot "$CHROOTDIR/$DISTNICK" /bin/su -lm $BUILD_USER -c "rpmdb -D \"dtag $DISTNAME\" -D \"disttag $DISTNAME\" -D \"$DISTNICK 1\" -D \"$DISTNAME 1\" -E \"%{expand:%(head -n128 $SPECFILE)}\"" | grep -i "^ *$CONFIG *:" | sed -e "s/^ *$CONFIG *: *//i" | head -1; then
if [ -z "$DISTNICK" ] || [ "$RPMVER" \< "4.1" ] || ! rpmdb -D "dtag $DISTNAME" -D "dist .$DISTNAME.$TAG" -D "$DISTNICK 1" -D "$DISTNAME 1" -E "%{expand:%(head -n192 $SPECFILE)}" | grep -i "^ *$CONFIG *:" | sed -e "s/^ *$CONFIG *: *//i" | head -1; then
if ! grep -i "^ *$CONFIG *:" $SPECFILE | sed -e "s/^ *$CONFIG *: *//i" | head -1; then
debug "Config $CONFIG not found in $SPECFILE"
fi
Expand Down
18 changes: 10 additions & 8 deletions dar-perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### perl-Tree-Simple tests META.yml
### perl-Tree-Simple-Visitor tests sub-modules
### perl-Kwiki tests perl Buildrequires epoch
### perl-ExtUtils-FakeConfig tests zip files (unsupported yet)

### More documentation about:
### META.yml http://module-build.sourceforge.net/META-spec-current.html
Expand Down Expand Up @@ -88,8 +89,8 @@ def download(url):
try:
req = urllib2.Request(url)
fdin = urllib2.urlopen(req)
except:
# print >>sys.stderr, "Failed to download file from %s" % url
except Exception, e:
print >>sys.stderr, "Failed to download file from %s, %s" % (url, e)
return False
fdout = open(filename, 'w')
fdout.write(fdin.read())
Expand Down Expand Up @@ -229,7 +230,6 @@ def parse_makefile(data):
location = path

#print >>sys.stderr, 'We found package %s with version %s with modules:' % (package, version)
#print >>sys.stderr, pkgmodules

ppath = path.split('/')
mnemo = ppath[2]
Expand Down Expand Up @@ -275,14 +275,16 @@ def parse_makefile(data):

### Try to download distribution
archive = os.path.join(tmppath, cdistname)
if os.path.isfile(archive):
os.remove(archive)
#if os.path.isfile(archive):
# os.remove(archive)
source = "http://www.cpan.org/modules/by-module/%s/%s" % (modparts[0], cdistname)
#if not os.path.isfile(archive):
if not download(source):
source = "http://www.cpan.org/authors/id/%s" % location
if not download(source):
print >>sys.stderr, "Error: Failed to download %s" % (source)
source = "http://search.cpan.org/CPAN/authors/id/%s" % location
if not download(source):
print >>sys.stderr, "Error: Failed to download %s" % (source)

### Add %{version} and %{real_version} to source
source = source.replace(version, '%{version}')
Expand Down Expand Up @@ -380,8 +382,8 @@ def parse_makefile(data):
basedir = basedir.replace(realversion, '%{real_version}')
basedir = rcut(basedir, '/')

if os.path.isfile(archive):
os.remove(archive)
#if os.path.isfile(archive):
# os.remove(archive)

### Compare deducted information with META.yml
if meta.has_key('name') and meta['name'] != package:
Expand Down
2 changes: 1 addition & 1 deletion dar-prepare
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for distname in $DEFAULT_DISTS; do

# rm -rf $CHROOTDIR/$distname{$RPMTMPPATH}/*
mkdir -p $CHROOTDIR/$distname/$ROOT/
mount -o bind $ROOT $CHROOTDIR/$distname/$ROOT/
mount -o bind,noatime $ROOT $CHROOTDIR/$distname/$ROOT/

mkdir -p $CHROOTDIR/$distname/proc/
mount -t proc proc $CHROOTDIR/$distname/proc/
Expand Down
5 changes: 3 additions & 2 deletions dar.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ BUILDDIR="$ROOT/build"
TEMPDIR="$ROOT/tmp"

#DEFAULT_DISTS="el4a el4i fc3a fc3i fc2a fc2i fc1i el3a el3i rh9i rh7i el2i"
DEFAULT_DISTS="el5a el5i el4a el4i el3a el3i rh9i rh7i el2i"
#DEFAULT_DISTS="el5a el5i el4a el4i el3a el3i rh9i rh7i el2i"
DEFAULT_DISTS="el5a el5i el4a el4i el3a el3i"
DEFAULT_SOURCE_DISTS="el5i"
DEFAULT_ARCHS="i386"
DEFAULT_TAGS="rf dag"
Expand All @@ -35,6 +36,6 @@ DISTCC_HOSTS="emyn localhost"
RSYNC_OPTIONS="-avHl --progress --delete-after --exclude /arrfab/ --exclude /bert/ --exclude /dries/ --exclude /redhat/6.2/ --exclude /redhat/8.0/ --include /rpmforge/persona/dag/ --exclude /rpmforge/persona/* --delay-updates"
RSYNC_TARGET="dag@rsync.sw.be:dag.wieers.com/pub/"
### Use wondershaper
RSYNC_LIMIT="32"
RSYNC_LIMIT="64"
GPG_PATH="/home/dag/.gnupg"
GPG_NAME="Dag Wieers (Dag Apt Repository v1.0)"
2 changes: 1 addition & 1 deletion dists/el2i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-2.96"
DISTCC_CXX="i386-redhat-linux-g++-2.96"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el3a/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="x86_64-redhat-linux-gcc-3.2.3"
DISTCC_CXX="x86_64-redhat-linux-g++-3.2.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el3i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.2.3"
DISTCC_CXX="i386-redhat-linux-g++-3.2.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el4a/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="x86_64-redhat-linux-gcc-3.4.3"
DISTCC_CXX="x86_64-redhat-linux-g++-3.4.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el4i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.4.3"
DISTCC_CXX="i386-redhat-linux-g++-3.4.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el5a/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="x86_64-redhat-linux-gcc-3.4.3"
DISTCC_CXX="x86_64-redhat-linux-g++-3.4.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/el5i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.4.3"
DISTCC_CXX="i386-redhat-linux-g++-3.4.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc1i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.3.2"
DISTCC_CXX="i386-redhat-linux-g++-3.3.2"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc2a/config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DISTCC_CXX="x86_64-redhat-linux-g++-3.3.3"
#UPDATECMD="yum -y update"
#INSTALLCMD="yum -y install %p"
UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc2i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.3.3"
DISTCC_CXX="i386-redhat-linux-g++-3.3.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc3a/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="x86_64-redhat-linux-gcc-3.3.3"
DISTCC_CXX="x86_64-redhat-linux-g++-3.3.3"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc3i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.4.2"
DISTCC_CXX="i386-redhat-linux-g++-3.4.2"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/fc4i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-4.0.0"
DISTCC_CXX="i386-redhat-linux-g++-4.0.0"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"
#UPDATECMD="yum -y update"
Expand Down
2 changes: 1 addition & 1 deletion dists/nodist/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="echo 'NODIST: ' "
DISTCC_CXX="echo 'NODIST: ' "

#UPDATECMD="apt-get -qq update"
#UPGRADECMD="apt-get -qq -f -y upgrade"
#UPGRADECMD="apt-get -qq -f -y dist-upgrade"
#INSTALLCMD="apt-get -qq -y -m install %p"
#UPDATECMD="up2date -u"
#INSTALLCMD="up2date -if"
Expand Down
2 changes: 1 addition & 1 deletion dists/rh6i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-2.91.6"
DISTCC_CXX="i386-redhat-linux-g++-2.91.6"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/rh7i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-2.96"
DISTCC_CXX="i386-redhat-linux-g++-2.96"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/rh8i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.2"
DISTCC_CXX="i386-redhat-linux-g++-3.2"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"

Expand Down
2 changes: 1 addition & 1 deletion dists/rh9i/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DISTCC_CC="i386-redhat-linux-gcc-3.2.2"
DISTCC_CXX="i386-redhat-linux-g++-3.2.2"

UPDATECMD="apt-get -qq update"
UPGRADECMD="apt-get -qq -f -y upgrade"
UPGRADECMD="apt-get -qq -f -y dist-upgrade"
INSTALLCMD="apt-get -qq -y -m install %p"
CLEANCMD="apt-get clean"
#UPDATECMD="yum -y update"
Expand Down
14 changes: 8 additions & 6 deletions scripts/pre-brand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ author="$(grep '^# Authority: ' $specfile | sed -e 's|^# Authority: ||')"
vendor="Dag Apt Repository, http://dag.wieers.com/apt/"

case "$author" in
(dries)
packager="Dries Verachtert <dries\@ulyssis.org>" ;;
(bert)
packager="Bert de Bruijn <bert\@debruijn.be>" ;;
(dries)
packager="Dries Verachtert <dries\@ulyssis.org>" ;;
(bert)
packager="Bert de Bruijn <bert\@debruijn.be>" ;;
(hadams)
packager="Heiko Adams <info\@fedora-blog.de>" ;;
(dag|thias|matthias|*)
packager="Dag Wieers <dag\@wieers.com>" ;;
(cmr)
packager="Christoph Maser <cmr\@financial.com>" ;;
(dag|thias|matthias|*)
packager="Dag Wieers <dag\@wieers.com>" ;;
esac

### Removing existing branding and add own branding
Expand Down
2 changes: 2 additions & 0 deletions scripts/pre-disttag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### This script add a disttag to the SPEC file so packages can be
### identified easier, are unique and don't have the macro clutter.

return 0

script="pre-disttag"

if [ -z "$buildarch" -o -z "$repotag" -o -z "$specfile" -o -z "$disttag" ]; then
Expand Down

0 comments on commit 77157ca

Please sign in to comment.