Re: Patches to splitdistro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed May 15 2002 at 21:03, Tru wrote:

> Some comments on your very helpfull patch :)

ditto :)

Additional comments follow below.

  Meanwhile, I have updated (for rh7.3) a web page I wrote a few
  months ago about how to use anaconda to build updated/customised
  install images for redhat 7.2.

  The new page can be found at the old URL, but it is now renamed
  and moved here:

	http://www.linuxworks.com.au/redhat-installer-howto.html

  The feedback that occasionally comes by is that it has been a
  great help for many people to get started in the right direction
  for using anaconda to build working customised installation disks.

  While the anaconda documentation is starting to get there, it is
  still very much (completely?) lacking in documenting this part of
  its magic.  My efforts are a modest attempt to fill this gap.  Any
  errors, omissions, flames or additions gratefully accepted.

> On Fri, May 10, 2002 at 03:17:21PM -0700, Taylor, ForrestX wrote:
> > I have a patch to splitdistro that fixes several things:
> >
> > - Remove the preview directory (not included in RH 7.3)
> 
> This causes one big problem for me:
> <...>
> Splitting tree...
> Creating disc1...
> Creating disc2...
> Creating disc3...
> Creating first source disc...
> Creating second source disc...
> Dropping remainder of sources on third disc...
> 1.5G    /var/ftp/pub/linux/th/i386-disc1 <-- ouch

ouch indeed :-)

> I had to patch a single line to have a proper i386-disc[123]
> directory split:
> 164c164
> < disc1used = totalsize - rpmsize - dirsize
> ---
> > disc1used = totalsize - rpmsize

Ahh.  Now, doing that does make it work.  But IMHO, not in the right
way since that's not where the problem really is.

The python code in splitdistro immediately before that line
determines the value of dirsize.  Here is the snip...

=======8<------cut------
[ ... ]
dirsize = 0
for dir in disc2dirs:
    what = distDir + "/" + dir
    if os.access(what, os.R_OK):
        dirsize = dirsize + spaceUsed(distDir + "/" + dir)

disc1used = totalsize - rpmsize - dirsize
[ ... ]
=======8<------cut------

The real problem is the for-in loop.  Reference to the now-missing
preview directory is gone, disc2dirs is an empty string, and the
value of dirsize does not evaluate to 0 as expected at the end of
the loop.  It appears that the loop is being entered at least once,
for the empty string.  Why, I'm not sure.  (What if it was
undefined?  Does python treat for-in loops like do-until constructs
that get executed at least once?)

  (RedHat must not have used this version of splitdisto to build
  their official redhat distribution disks, surely???!!! :)

I'm no python guru so I hesitate to offer a fix, apart from either
commenting out the 4 lines of the loop, or hacking the calculation
of disc2used as suggested by the patch above.

It would be good if someone more familar with python and anaconda
itself could offer a patch that cleanly fixes this (eg, disc2dirs
may or may not exist with multiple or empty values, and it will
still work as expected to calculate dirsize correctly).

  Aside:

  The reason why I'm looking at this is to make sure that my
  customisation plans will work ok with splitdistro, especially with
  the calculation of the image sizes.  I want to do different things
  to both the first and last install disks.

  The 55Mb valhalla-doc iso image could snuggle quite nicely onto
  the first installation disk as (imho) a logical customisation.
  That would push more of the binary RedHat/RPMS/* packages off the
  first image to spread out and occupy more of the last (third)
  disk.

  This last disk, as I'm sure others are quickly coming to realise,
  is where there is plenty of spare room -- once the SRPMS/
  directory is removed -- for all sorts of additional things to be
  put onto it.

  Let your imagination go wild... this could be very useful for
  anaconda or kickstart scripting.  The third (last) installation
  disk is very conveniently available, mounted in the cdrom drive at
  the end of the installation where customisation scripts and
  packages can be found quickly and easily.  But I digress...  :)

The rest of what the patch did was basically fine...

> > - Remove the beta.eula and replace with the real files
> ok
> > - Changes the max size of the discs from 640 to 650 (I live on the edge!)
> ok

I have found that 680 is good for preparing 700Mb images.
Experimentation (with 7.2) had shown me that once I specify more
than ~682, then the resulting image got blown out to no longer fit
onto a blank 700Mb cdrom.

> > - Remove the i386-disc3 directory (a must have if you run splitdistro
> > more than once)
> ok

Good catch that one :)  However, I can't see any reason why it
doesn't delete any and all the i386-disc?/ directories it finds,
that would solve the problem "forever" :)

   Again, I'm not so familar with python to know how to make it
   create an array of directory names to delete with a shell-like or
   regular expression glob.

> BTW I have added the creation of the SRPMS in i386-disc4 (aka disc1SrcDir)
> as a workaround of Jean Paul JP Robinson 's splitdistro error.

It would be quite easy to make changes to splitdistro so that
processing the SRPMS/ packages becomes an _automatic_ option.

The logic is that if you don't want to build installation images
with the SRPMS packages, then you simply don't create a SRPMS/
directory at the same (buildroot) level as the source i386/
directory.  Splitdistro can look for it, and if it is missing then
it can simply skip the code that would normally process the .src.rpm
packages.  The change is trivial.

My (totally ugly) temporary hack is to do it like this.  These are
the last few lines of splitdistro...

=======8<------cut------
...
moveFiles("%s/RedHat/RPMS" % disc2Dir, "%s/RedHat/RPMS" % disc3Dir, disc3pkgs);

## ugly temporary hack ##
if DoSRPMS:

    print "Creating first source disc..."
    os.system("cp -al %s/. %s" % (srcDir, disc1SrcDir))
    stamp(disc1SrcDir, releasestr, "disc4", arch, startedAt)

    print "Creating second source disc..."
    stamp(disc2SrcDir, releasestr, "disc5", arch, startedAt)
    srcPkgList = os.listdir("%s/SRPMS" % disc1SrcDir)
    srcPkgList.sort()
    disc2pkgs = excessFiles(srcDir + "/SRPMS", srcPkgList, targetSize - fudgeFactor)
    moveFiles("%s/SRPMS" % disc1SrcDir, "%s/SRPMS" % disc2SrcDir, disc2pkgs);
    srcDisc1Size = spaceUsed(disc1SrcDir)

    print "Dropping remainder of sources on third disc..."
    disc3pkgs = excessFiles(srcDir + "/SRPMS", srcPkgList, srcDisc1Size + targetSize - fudgeFactor)
    moveFiles("%s/SRPMS" % disc2SrcDir, "%s/SRPMS" % disc3SrcDir, disc3pkgs);

#sys.exit(0)

sys.stdout.flush()

os.system("du -sh %s %s %s %s %s" % (disc1Dir, disc2Dir, disc3Dir,
                                     disc1SrcDir, disc2SrcDir))
=======8<------cut------

My full hacked version of splitdistro can be found here:
	http://www.linuxworks.com.au/splitdistro.txt

  (For the python purists... apologies if my code reformatting is a
  little distasteful :)

The "if DoSRPMS:" condition needs to (logically) become "if
srcDir/SRPMS exists and is a read/writable directory".  Testing for
the existence of files is probably as trivial to do in python as it
is with shell or perl.  I guess I could do with a good python desk
reference guide :-)

> Hope that helps
> 
> Tru
> 
> full patch (including your modifications)
> 
> --- splitdistro.orig       Wed May 15 22:19:33 2002
> +++ splitdistro Wed May 15 22:50:29 2002
> @@ -1,10 +1,10 @@
>  #!/usr/bin/python
> 
>  # These dirs, along with RPMS, make up disc 2
> -disc2dirs = [ "preview" ]
> +disc2dirs = [ "" ]

The ramifications of that simple change was dramatic :)

>  # These files appear on all binary CDs
> -jointfiles = [ "beta_eula.txt", "RPM-GPG-KEY", "README", "autorun" ]
> +jointfiles = [ "EULA", "GPL", "RPM-GPG-KEY", "README", "autorun" ]
> 
>  targetSize = 650 * 1024.0 * 1024.0
> 
> @@ -161,11 +161,11 @@
>      if os.access(what, os.R_OK):
>          dirsize = dirsize + spaceUsed(distDir + "/" + dir)
 
> -disc1used = totalsize - rpmsize - dirsize
> +disc1used = totalsize - rpmsize

I would prefer to see dirsize calculated correctly, rather than
completely ignored :)

> Dr Tru Huynh          | http://www.pasteur.fr/recherche/unites/Binfs/
> mailto:tru@xxxxxxxxxx | tel/fax +33 1 45 68 87 37/19
> Institut Pasteur, 25-28 rue du Docteur Roux, 75724 Paris CEDEX 15 France

Cheers
Tony
---*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=---
  Tony Nugent <Tony@xxxxxxxxxxxxxxxxx>
  LinuxWorks - Gold Coast Qld Australia





[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux