This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Local file tracking class for setup.exe


On Mon, 22 Apr 2002 10:36:09 +1000 Robert Collins <robert.collins@itdomain.com.au> wrote:

> > I've tried to look into this, but it's slow going because I'm 
> > having trouble following the process flow.  
> 
> Feel free to ask questions :}. I don't bite.... much.
> . . .  
> > Perhaps a separate class should be defined for tracking files 
> > found and their possible package associations.  This could be 
> > used later for removing obsolete versions of package archive files.
> 
> Hmmm. Could you enlarge on this idea? One of long term goals is to only
> download setup.ini if it's changed. This in turn allows us to leverage
> more mirror sites more quickly, so there should be no reason to change
> mirrors once one is happy with the selection. (Compare with apt-get). 

This class tracks the files in the local cache so other parts of setup.exe
can ask it if a file is present or not instead of having to look for
themselves.  As files are downloaded they can be added to the list.

I see this being especially useful in choose.cc or packagedb when only
downloading.  It would also make installing simpler since there would be a
single source for tracking which file to use for a given package version.

localfile Instance Data
// Borrowed partly from cygpackage
   String package
   //     vendor       // I don't think this is being used by any current packages
   String packagev
   enum   type         // Source or Binary
   String fn
   size_t filesize
   //     md5          // for future use

localfile Class Methods
   // Create object by parsing filename and getting size from filesystem
   localfile ( full_file_name )
   // Create object by parsing filename with file size already known
   localfile ( full_file_name, size )

localfile Instance Methods
   String package ()
   String version ()
   enum   type ()
   String filename ()
   size_t size ()

localfiles Instance Data
   localfile[] files

localfiles Class Methods
   // Load list of files found under local directory
   localfiles ( local_directory )

localfiles Instance Methods
   // Add one file to the list
   bool add ( full_file_name )
   bool add ( full_file_name, size )
      Return true if successful
      Return false if
         File doesn't exist or is 0 length (N/A if size given)
         File name didn't parse
         Duplicate Package + Version + Type (complain in setup.log)

   // Add to the localfiles list all parseable files under local_directory
   int load ( local_directory )
      Return number of files added

   // Get localfile instance that matches package, version, and type
   localfile file ( package, version, type )
      Return localfiles entry that matches
      Return 0 if not found

   // Get localfile instances that match package and type
   localfile[] versions ( package, type )
      Return array of localfiles entries that match
      Return 0 if none

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.htm
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]