Next Previous Contents

14. Appendix C - Munging your own RPMs into the distribution

Here is Eric's script for munging updated RPMs into the RedHat distribution area:


#!/usr/bin/perl
#
$redhatdir="/cdrom/i386";
$rpmdir="/cdrom/i386/RedHat/RPMS/";
$updatedir="/cdrom/updates/";
@OTHERDIR=($updatedir);
foreach $dir (@OTHERDIR)
        {
        print "update for $dir\n";
        system(" find $dir -name \"*.rpm\" -exec cp {} $rpmdir \\; ");
        }
chdir($contribdir) || die "peux pas aller dans $contribdir $!\n";
system("chmod -R 755 $redhatdir");
chdir($rpmdir) || die "problem to go in $rpmdir $!\n";
#
# remove the old file
#
opendir(DIR,'.');
@package=grep(/\.rpm$/,readdir(DIR));
foreach $file (@package)
        {
        $file =~ /(.*)\-([\d+|\.]+\w*)\-(\d+)\.[i386|noarch].*/;
        $nom=$1;
        $version=$2;
        $buildvers=$3;
        if ($NOM{$nom})
                {
                $version2=$VERSION{$nom};
                $buildver2=$BUILDVERS{$nom};
                $file2=$FILE{$nom};
                $nom2=$NOM{$nom};
                if ( $version2 gt $version )
                        {
                        print "$file2 is newer than $file\n";
                        unlink($file);
                        }
                else 
                        {
                        if ( $version2 lt $version )
                                {
                                print "$file is newer than $file2\n";
                                unlink($file2);
                                $VERSION{$nom}=$version;
                                $BUILDVERS{$nom}=$buildvers;
                                $FILE{$nom}=$file;
                                $NOM{$nom}=$nom;
                                }
                        else
                                {
                                if ( $buildver2 > $buildvers )
                                                {
                                           print "$file2 : $buildver2 est mieux que $file : $buildvers\n";
                                           unlink($file);
                                                }
                                else
                                                {
                                        print "$file2 : $buildver2 is older than $file : $buildvers\n";
                                            unlink($file2);
                                            $VERSION{$nom}=$version;
                                            $BUILDVERS{$nom}=$buildvers;
                                            $FILE{$nom}=$file;
                                            $NOM{$nom}=$nom;
                                                }
                                }
                        }
                }
        else
                {
                $VERSION{$nom}=$version;
                $BUILDVERS{$nom}=$buildvers;
                $FILE{$nom}=$file;
                $NOM{$nom}=$nom;
                }
        }

# we do the hard thing here
#
system("$redhatdir/misc/src/install/genhdlist $redhatdir");


Next Previous Contents