Subversion Repositories DevTools

Rev

Rev 4688 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
#! perl
2
########################################################################
3
# Copyright (C) 1998-2004 ERG Limited, All rights reserved
4
#
5
# Module name   : cache_dpkg
6
# Module type   : Makefile system
7
# Compiler(s)   : n/a
8
# Environment(s): jats
9
#
10
# Description:
335 dpurdie 11
#       Maintain a local cache of dpkg_Archive
227 dpurdie 12
#
13
# Notes:
335 dpurdie 14
#       Stopped using the JATS "cp.exe" utility as there was a weird problem under
227 dpurdie 15
#       windows. The package orahops-ssw-install/1.0.1000.ssw could not be installed
335 dpurdie 16
#       correctly. It appears that the 'cp' could not process the subdir pair
227 dpurdie 17
#       "DBMGR/DBMGR". Change the name it was OK.
18
#
19
#       Solution: Avoid system functions
20
#
21
#......................................................................#
22
 
23
use strict;
24
use warnings;
25
use JatsError;
26
use FileUtils;
27
use File::Find;
28
use File::Path;
29
use File::Copy;
30
 
31
use Getopt::Long;
32
use Pod::Usage;                             # required for help support
33
 
34
my $VERSION = "1.4.0";
35
 
36
 
37
#
38
#   Options
39
#
40
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
41
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
42
my $opt_help = 0;
43
my $opt_clear;
44
my $opt_flush;
45
my $opt_refresh;
46
my $opt_refresh_all;
47
my $opt_list;
48
my $opt_list_short;
49
my $opt_export;
50
my $opt_quiet;
51
my $opt_update_all;
52
my $opt_age;
361 dpurdie 53
my $opt_test;
227 dpurdie 54
 
55
#
56
#   Global Variables
57
#
4688 dpurdie 58
my $GBE_DPKG            = $ENV{'GBE_DPKG'};                     # The Master repository
59
my $GBE_DPKG_CACHE      = $ENV{'GBE_DPKG_CACHE'} || "";         # Caches
60
my $GBE_DPKG_LOCAL      = $ENV{'GBE_DPKG_LOCAL'} || "";         # Local scratch
61
my $GBE_DPKG_STORE      = $ENV{'GBE_DPKG_STORE'} || "";         # Global Store
62
my $GBE_DPKG_REPLICA    = $ENV{'GBE_DPKG_REPLICA'} || "";       # Site Local Replica
63
my $GBE_BIN             = $ENV{'GBE_BIN'};
227 dpurdie 64
 
4688 dpurdie 65
my $istore;
227 dpurdie 66
my $gstore;
67
my $archive;
68
my $cache;
69
my $parchive;
70
my $local = '';
71
my $local_pkg;
72
my @package_list;
73
my @refresh_list;
74
#
75
#   Globals for recursive copy
76
#
77
my $copyFind_dst;
78
my $copyFind_src;
79
my $copyFind_src_len;
80
 
81
#
82
#   Globals for error recovery
83
#
84
my  $remove_on_error;
85
 
86
#-------------------------------------------------------------------------------
87
# Function        : Mainline Entry Point
88
#
89
# Description     :
90
#
91
# Inputs          :
92
#
93
my $result = GetOptions (
337 dpurdie 94
                "help|h:+"                  => \$opt_help,
95
                "manual:3"                  => \$opt_help,
96
                "verbose:+"                 => \$opt_verbose,           # flag, multiple use allowed
97
                "debug:+"                   => \$opt_debug,             # flag, multiple use allowed
227 dpurdie 98
                "flush"                     => \$opt_flush,             # flag
99
                "clear"                     => \$opt_clear,             # flag
100
                "refresh!"                  => \$opt_refresh,           # flag
101
                "refresh_all|refresh-all"   => \$opt_refresh_all,       # flag
102
                "update_all|update-all"     => \$opt_update_all,        # flag
103
                "list"                      => \$opt_list,              # flag
104
                "dir"                       => \$opt_list_short,        # flag
105
                "export"                    => \$opt_export,            # flag
106
                "quiet"                     => \$opt_quiet,             # flag
107
                "age=i"                     => \$opt_age,               # integer
361 dpurdie 108
                "test"                      => \$opt_test,              # flag
227 dpurdie 109
                );
110
 
111
                #
112
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
113
                #
114
 
115
#
116
#   Process help and manual options
117
#
118
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
119
pod2usage(-verbose => 1)  if ($opt_help == 2 );
337 dpurdie 120
pod2usage(-verbose => 2)  if ($opt_help > 2);
227 dpurdie 121
 
122
#
123
#   Configure the error reporting process now that we have the user options
124
#
125
ErrorConfig( 'name'    =>'CACHE',
126
             'verbose' => $opt_verbose,
127
             'debug'   => $opt_debug );
128
 
129
#
130
#   Validate user options
131
#
132
Error( "GBE_BIN not defined in the environment" ) unless ( defined($GBE_BIN) );
133
Error( "GBE_DPKG not defined in the environment" ) unless ( defined($GBE_DPKG) );
134
 
135
#
136
#   No cache - nothing to do
137
#   Generate a status message and exit
138
#
139
unless ( defined($GBE_DPKG_CACHE) )
140
{
141
    Warning ( "GBE_DPKG_CACHE not defined in the environment" );
142
    return 0;
143
}
144
 
145
 
146
$opt_refresh = 1
147
    if ( $opt_refresh_all );
148
 
149
#
150
#   Locate the archive cache
151
#
152
#   Determine the archive to work on
153
#   Search the cache archive list for one with the keyword "_cache"
154
#   or use the last one.
155
#
156
$GBE_DPKG =~ tr~\\/~/~s;
157
$GBE_DPKG =~ s~/$~~;
158
 
159
my @pkg_list = split ( ';', $GBE_DPKG_CACHE );
160
for (@pkg_list)
161
{
162
    $cache = $_
163
        if ( m/_cache/ );
164
}
165
$cache = pop @pkg_list unless ( $cache );
166
$archive = $GBE_DPKG;
167
$local = $GBE_DPKG_LOCAL;
168
$gstore = $GBE_DPKG_STORE;
4688 dpurdie 169
$istore = $GBE_DPKG_REPLICA;
227 dpurdie 170
 
171
Error ("No dpkg_archive_cache found") unless ( $cache );
172
Error ("dpkg_archive_cache is the main archive") if ( $cache eq $archive );
4688 dpurdie 173
Error ("dpkg_archive_image is the main archive") if ( $istore && $istore eq $archive );
227 dpurdie 174
Error ("main archive is local archive" )         if ( $local && $local eq $archive );
175
Warning  ("dpkg_archive_cache is local_archive" )   if ( $local && $local eq $cache );
176
 
177
#
178
#   Export the list of cache entries
179
#
180
if ( $opt_export or $opt_refresh_all or $opt_list_short or $opt_update_all )
181
{
182
    opendir (DIR, $cache) || die "Cannot open $cache\n";
183
    my @dir_list = readdir(DIR);
184
    closedir DIR;
185
 
186
    for my $fn ( @dir_list)
187
    {
188
        my $count = 0;
189
        next if ( $fn =~ m/^\./ );
190
        next unless ( -d "$cache/$fn" );
191
 
192
        opendir( DIR, "$cache/$fn" ) || die "Cannot open $cache/$fn\n";
193
        while ( my $fn1 = readdir(DIR) )
194
        {
195
            next if ( $fn1 =~ m/^\./ );
196
            push @package_list, "$fn/$fn1";
197
        }
198
        closedir DIR;
199
    }
200
 
201
    if ( $opt_refresh_all or $opt_update_all )
202
    {
203
        @refresh_list = @package_list
204
    }
205
 
206
    #
207
    #   Simply export a list of packages in the cache
208
    #   Used by other programs
209
    #
210
    if ( $opt_export )
211
    {
212
        print join ' ', @package_list;
213
        exit 0;
214
    }
215
}
216
 
217
#
218
#   Display cache information
219
#   This is done AFTER the export - since the export command does not
220
#   need this header.
221
if ( $opt_verbose || $#ARGV < 0 )
222
{
223
    print  "dpkg_store        : $gstore\n" if ($gstore);
224
    print  "dpkg_archive      : $archive\n";
4688 dpurdie 225
    print  "dpkg_archive image: $istore\n";
227 dpurdie 226
    print  "dpkg_archive cache: $cache\n";
227
    print  "dpkg_archive local: $local\n";
228
    Verbose ("args:               @ARGV");
229
}
230
 
231
#
232
#   List the contents of the cache
233
#
234
if ( $opt_list_short )
235
{
236
    print join "\n", @package_list;
237
}
238
 
239
if ( $opt_list )
240
{
241
    #
242
    #   Process user commands
243
    #   List: A nice pretty display of the cache
244
    #
245
    opendir (DIR, $cache) || die "Cannot open $cache\n";
246
    my @dir_list = readdir(DIR);
247
    closedir DIR;
248
 
249
    #
250
    #   Determine max length of a name so that the display is nicely aligned
251
    #
252
    my $nl = 10;
253
    for my $fn ( @dir_list)
254
    {
255
        my $ns = length($fn);
256
        $nl = $ns if ( $ns > $nl )
257
    }
258
 
259
    #
260
    #   Display information by package
261
    #   A nicely formatted list with line wrapping
262
    #
263
    for my $fn ( @dir_list)
264
    {
265
        my $count = 0;
266
        next if ( $fn =~ m/^\./ );
267
        next unless ( -d "$cache/$fn" );
268
 
269
        opendir( DIR, "$cache/$fn" ) || die "Cannot open $cache/$fn\n";
270
        printf "%-*s :", $nl, $fn;
271
        while ( my $fn1 = readdir(DIR) )
272
        {
273
            next if ( $fn1 =~ m/^\./ );
274
            if ( $count++ >= 4 )
275
            {
276
                $count = 1;
277
                printf "\n%*s  ", $nl, "";
278
            }
279
            printf " %14.14s", $fn1;
280
        }
281
        closedir DIR;
282
        print "\n";
283
    }
284
}
285
 
286
#
287
#   Clear the cache
288
#
289
if ( $opt_clear )
290
{
291
    Warning   ( "Deleting the ENTIRE cache");
292
    rmtree( $cache, $opt_debug );
293
    mkpath( $cache, $opt_debug, 0777);
294
}
295
 
296
#
297
#   Perform cache aging
298
#
299
if ( $opt_age )
300
{
301
    Error ("Age parameter cannot be negative") if ( $opt_age < 0 );
302
    age_the_cache();
303
}
304
 
305
#
306
#   Process the command line arguments
307
#   These MUST be of the form
308
#       packagename
309
#       packagename/version
310
#
311
 
312
for (@ARGV, @refresh_list)
313
{
314
    $remove_on_error = undef;
315
    if ( $opt_flush )
316
    {
317
        unless ( -d "$cache/$_" )
318
        {
319
            Warning ("Package not in cache: $_")
320
                unless ( $opt_quiet );
321
        }
322
        else
323
        {
324
            rmtree( "$cache/$_", $opt_debug );
325
            print "Package removed: $_\n"
326
                unless ( $opt_quiet );
327
        }
328
    }
329
    else
330
    {
331
        #
332
        #   Speed up - for remote access
333
        #   If the package is found in the local archive and we aren't doing
334
        #   anything fancy then don't access the remote archive
335
        #
336
        my $local_pkg = ( -d "$local/$_" || -f "$local/$_.lnk" );
337
        if ( $local_pkg )
338
        {
339
            if ( !$opt_refresh )
340
            {
341
                print "Cache SkipLocal: $_ Local copy found\n";
342
 
343
                #
344
                # Delete the cache copy
345
                # The user is playing with local copy
346
                #
347
                if ( -d "$cache/$_" )
348
                {
349
                    print  "Cache SkipLocalDelete: $_ -> $cache\n";
350
                    Verbose ( "Remove: $_" );
351
                    rmtree( "$cache/$_", $opt_debug );
352
                    Verbose ( "Remove Complete: $_" );
353
                }
354
                next;
355
            }
356
        }
357
 
358
        #
359
        #   Locate package.
4688 dpurdie 360
        #   It may be in GBE_DPKG_REPLICA, GBE_DPKG or GBE_DPKG_STORE
227 dpurdie 361
        #
4688 dpurdie 362
        my $pkg_found;
363
        foreach my $store ( $istore, $archive, $gstore)
227 dpurdie 364
        {
4688 dpurdie 365
            $parchive = "$store/$_";
366
            if ( -d $parchive )
227 dpurdie 367
            {
4688 dpurdie 368
                $pkg_found = 1;
369
                last;
227 dpurdie 370
            }
371
        }
4688 dpurdie 372
 
373
        unless ($pkg_found )
374
        {
375
            Warning ("Package not in archive: $_")
376
                unless ( $opt_quiet );
377
            next;
378
        }
227 dpurdie 379
 
380
        ########################################################################
381
        #   We have a package to process
382
        #
383
 
384
        my $dir_found = ( -d "$cache/$_" ) ;
385
        my $force_update = 0;
386
        my $opr = "Update";
387
 
388
 
389
        #
390
        #   Setup error recovery
335 dpurdie 391
        #       1) Tag the directory to be deleted on error
227 dpurdie 392
        #
393
        $remove_on_error = "$cache/$_";
394
        ErrorConfig( 'on_exit' => \&error_recovery );
395
 
396
        #
335 dpurdie 397
        #   Not a forced refresh. Ensure that the cached copy is
227 dpurdie 398
        #   up to date. Examine descpkg
399
        #
400
        if ( $dir_found )
401
        {
402
            if ( -f "$cache/$_/built.cache" )
403
            {
404
                $force_update = 1;
405
                $opr = "Incomplete";
406
                Verbose ("Cache Copy Incomplete: $_");
407
            }
408
            elsif ( FileIsNewer( "$parchive/descpkg", "$cache/$_/descpkg" ) )
409
            {
410
                $force_update = 1;
411
                $opr = "OutOfDate";
412
                Verbose ("Cache out-of-date: $_");
413
            }
414
        }
415
 
416
        #
417
        #   If we need to refresh the cache copy - delete it first
418
        #
419
        if ( ($opt_refresh || $force_update) && $dir_found )
420
        {
421
            print  "Cache $opr: $_ -> $cache\n";
422
            Verbose ( "Remove: $_" );
423
            rmtree( "$cache/$_", $opt_debug );
424
            Verbose ( "Remove Complete: $_" );
229 dpurdie 425
 
426
            #
427
            #   Force transfer, but without the status message
428
            #
227 dpurdie 429
            $dir_found = 0;
229 dpurdie 430
            $opr = '';
227 dpurdie 431
        }
432
 
433
        #
434
        #   If its not in the cache then copy it in
435
        #
436
        unless ( $dir_found )
437
        {
229 dpurdie 438
            print "Cache $opr: $_ -> $cache\n" if $opr;
227 dpurdie 439
            mkpath( "$cache/$_", $opt_debug, 0777);
440
            TouchFile ( "$cache/$_/built.cache", "Marks the cache copy as incomplete");
441
            Verbose ( "Copy in: $_" );
442
            $copyFind_dst = "$cache/$_";
443
            $copyFind_src = $parchive;
444
            $copyFind_src_len = length( $copyFind_src );
445
            File::Find::find( \&copyFind, $parchive );
446
            rmtree( "$cache/$_/built.cache", $opt_debug );  # Works on files too !!
447
        }
448
        else
449
        {
450
            $opr = "Skip";
451
            print "Cache $opr: $_ -> $cache\n";
452
        }
453
    }
454
}
455
 
456
#-------------------------------------------------------------------------------
457
# Function        : copyFind
458
#
459
# Description     : File:Find:find callback function to transfer files
460
#
461
# Inputs          : None
462
#                   Global: $copyFind_dst       : Target directory
463
#                   Global: $copyFind_src       : Source directory
464
#                   Global: $copyFind_src_len   : Length of Source dir
465
#
466
# Returns         : 
467
#
468
 
469
sub copyFind
470
{
471
    my $item = $File::Find::name;
472
 
473
    #
474
    #   Calculate the target directory name
475
    #
476
    my $target = $copyFind_dst . substr($item, $copyFind_src_len );
477
    if ( -d $item )
478
    {
479
        #
480
        #   Directories are handled differently
481
        #       - Directories are created with nice permissions
482
        #
483
        if ( ! -d $target )
484
        {
485
            mkpath( $target, $opt_debug, 0755);
486
        }
487
    }
488
    else
489
    {
490
        #
491
        #   File copy
492
        #
493
        #
494
        #   Copy file to destination
495
        #   If the file is a link, then duplicate the link contents
496
        #   Use: Unix libraries are created as two files:
497
        #        lib.xxxx.so -> libxxxx.so.vv.vv.vv
498
        #
499
        if ( -l $item )
500
        {
501
            Debug("Clone Link: $target");
502
            my $link = readlink $item;
503
            Debug( "Link: $item, $link");
504
            symlink ($link, $target );
505
            unless ( $link && -l $target )
506
            {
507
                Error("Failed to copy link [$item] to [$target]: $!");
508
            }
509
        }
510
        elsif (File::Copy::copy($item, $target))
511
        {
512
            Debug("Copying File: $target");
513
 
514
            #   Make the file ReadOnly
515
            my $perm = (stat $item)[2] & 07777;
516
            CORE::chmod $perm & 0555, $target;
517
        }
518
        else
519
        {
520
            Error("Failed to copy file [$item] to [$target]: $!");
521
        }
522
    }
523
}
524
 
525
#-------------------------------------------------------------------------------
526
# Function        : error_recovery
527
#
528
# Description     : Error recovery routine
529
#                   Delete the cached entry
530
#
531
# Inputs          :  Globals
532
#
533
# Returns         : None
534
#
535
sub error_recovery
536
{
537
    if ( $remove_on_error )
538
    {
345 dpurdie 539
        ReportError ("Error cleanup. Delete cache entry: $remove_on_error");
227 dpurdie 540
        rmtree( $remove_on_error, $opt_debug );
541
        $remove_on_error = undef;
542
    }
543
}
544
 
545
 
546
#-------------------------------------------------------------------------------
547
# Function        : age_the_cache
548
#
549
# Description     : Age cache entries
550
#                   Determine the age by:
551
#                       Use used.cache file if present
552
#                       Use descpkg file
553
#                       Not a proper entry - delete
554
#
555
# Inputs          : opt_age         - Delete packages older than XX days
556
#
557
# Returns         : Nothing
558
#
559
sub age_the_cache
560
{
561
    my $now = time;
562
 
563
    opendir (DIR, $cache) || die "Cannot open $cache\n";
564
    my @dir_list = readdir(DIR);
565
    closedir DIR;
566
 
567
    for my $fn ( @dir_list)
568
    {
569
        my $keep_dir = 0;
570
        next if ( $fn =~ m/^\./ );
571
        next unless ( -d "$cache/$fn" );
361 dpurdie 572
        next if ( $fn eq "core_devl" );
227 dpurdie 573
 
574
        opendir( DIR, "$cache/$fn" ) || die "Cannot open $cache/$fn\n";
575
        while ( my $fn1 = readdir(DIR) )
576
        {
577
            next if ( $fn1 =~ m/^\./ );
578
            my $dir = "$cache/$fn/$fn1";
579
            my $file = "$dir/used.cache" ;
580
            $file = "$dir/descpkg" unless ( -f $file );
581
 
582
            if ( ! -f $file )
583
            {
584
                #
585
                #   No descpkg file
586
                #   This is a badly formed entry - so delete it
587
                #
361 dpurdie 588
                if ( $opt_test )
589
                {
590
                    Message("Would Purge: $fn/$fn1" );
591
                    $keep_dir = 1;
592
                }
593
                else
594
                {
595
                    Message("Purging: $fn/$fn1" );
596
                    rmtree( $dir, $opt_debug );
597
                }
227 dpurdie 598
            }
599
            else
600
            {
601
                #
602
                #   used.cache or descpkg file found
603
                #   How old is it
604
                #
605
                my $timestamp = (stat($file))[9] || 0;
606
                my $age = int( ($now - $timestamp) / (60 * 60 * 24));
607
 
608
                if ( $age > $opt_age )
609
                {
361 dpurdie 610
                    if ( $opt_test )
611
                    {
612
                        Message("Could Age: $fn/$fn1, $age" );
613
                        $keep_dir = 1;
614
                    } else {
615
                        Message("Aging: $fn/$fn1, $age" );
616
                        rmtree( $dir, $opt_debug );
617
                    }
227 dpurdie 618
                }
619
                else
620
                {
621
                    Verbose("Age of: $fn/$fn1, $age" );
622
                    $keep_dir = 1;
623
                }
624
            }
625
        }
626
        closedir DIR;
627
 
628
        #
629
        #   Delete the entire directory if is is empty
630
        #
631
        unless ( $keep_dir )
632
        {
633
            Message("Remove Empty Dir: $cache/$fn"  );
634
            rmtree( "$cache/$fn", $opt_debug );
635
        }
636
    }
637
}
638
 
639
#-------------------------------------------------------------------------------
640
#   Documentation
641
#
642
 
643
=pod
644
 
361 dpurdie 645
=for htmltoc    SYSUTIL::
646
 
227 dpurdie 647
=head1 NAME
648
 
649
cache_dpkg - Maintain a local cache of packages
650
 
651
=head1 SYNOPSIS
652
 
653
 jats cache_dpkg.pl [options] package/version ...
654
 
655
 Options:
656
    -help              - brief help message
657
    -help -help        - Detailed help message
658
    -man               - Full documentation
659
    -clear             - Delete the entire cache
660
    -flush             - Flush all named packages
661
    -[no]refresh       - Refresh package in cache
662
    -list              - List cache contents with nice format
663
    -dir               - List cache contents
664
    -export            - Generate a list of cached packages
665
    -refresh_all       - Refresh all packages within the cache
666
    -update_all        - Update all packages within the cache as required
667
    -quiet             - Suppress warnings
361 dpurdie 668
    -age=nn            - Remove all packages older than nn days
669
    -test              - Use with -age to report ages
227 dpurdie 670
 
671
=head1 OPTIONS
672
 
673
=over 8
674
 
675
=item B<-help>
676
 
677
Print a brief help message and exits.
678
 
679
=item B<-help -help>
680
 
681
Print a detailed help message with an explanation for each option.
682
 
683
=item B<-man>
684
 
685
Prints the manual page and exits.
686
 
687
=item B<-clear>
688
 
689
Delete the B<entire> contents of the dpkg_archive cache. This will occur before
690
any new packages are copied into the cache.
691
 
692
=item B<-flush>
693
 
694
If set then the utility will delete the named packages from the cache. All named
695
packaged will be deleted. This option affects all named packages. It is not
696
possible to flush and copy packages with the same command.
697
 
698
=item B<-[no]refresh>
699
 
700
If the B<refresh> option has been specified then packages will be deleted, from
701
the cache and then a new copy will be copied in. If not specified then no copy
702
will occur if the package is present in the cache.
703
 
704
=item B<-list>
705
 
706
Display a list of all packages in the cache. A formatted display is generated.
707
 
708
This will be done before any packages are transferred.
709
 
710
=item B<-dir>
711
 
712
Display a list of all packages in the cache. This is a raw directory like
713
listing of the cache.
714
 
715
This will be done before any packages are transferred.
716
 
717
=item B<-export>
718
 
719
Generate a space separated list of cached packages as a single line. This is
720
intended to allow a list be exported for later import.
721
 
722
=item B<-refresh_all>
723
 
724
This option will force the program to refresh all the packages in the cache.
725
This forces a B<-refresh> and may be combined with other packages specified
726
on the command line.
727
 
728
=item B<-update_all>
729
 
730
This option will force the program to examine all packages within the cache and
731
refresh packages that are out of date. This option may be combined with other
732
packages specified on the command line.
733
 
734
A package is deemed to be out-of-date if the modification time of the package's
335 dpurdie 735
descpkg file in the cache is older than the one in the archive.
227 dpurdie 736
 
737
=item B<-quiet>
738
 
739
This option will suppress almost all of the progress messages, except for a single
740
copy message. It is intended to be used when the program is called from another
741
script.
742
 
743
=item B<-age=nn>
744
 
745
This option will delete all package versions that are older than the nn days.
746
The age of a package is calculated from the timestamp of the descpkg file.
747
 
361 dpurdie 748
=item B<-test>
749
 
750
This option modifies the operation of the B<-age=nn> option such that it will not
751
delete old package-versions. It will simply report what would be deleted.
752
 
227 dpurdie 753
=back
754
 
755
=head1 DESCRIPTION
756
 
757
This program simplifies the operation of maintaining a local copy of
758
used packages from the maintaining dpkg_archive store. The cache should be
759
stored on your local disk for speed.
760
 
761
=head2 Location of the cache
762
 
4688 dpurdie 763
The local cache is specified with the EnvVar GBE_DPKG_CACHE
227 dpurdie 764
 
4688 dpurdie 765
=head2 Location of the maintaining archive
227 dpurdie 766
 
4688 dpurdie 767
The required pacjage version can be found in three archives. These are:
227 dpurdie 768
 
4688 dpurdie 769
=over 4
227 dpurdie 770
 
4688 dpurdie 771
=item *
227 dpurdie 772
 
4688 dpurdie 773
GBE_DPKG_REPLICA. A local image of the main dpkg_archive. This is used when dpkg_archive is synced locally and is expected to be faster than GBE_DPKG
774
 
775
=item *
776
 
777
GBE_DPKG. The main dpkg_archive
778
 
779
=item *
780
 
781
GBE_DPKG_STORE. A global package archive. The search repository of last choice.
782
 
783
=back
784
 
227 dpurdie 785
=head2 Interaction with local_dpkg_archive
786
 
787
If a package is located in the users local_dpkg_archive and we are doing a
788
simple cache update then the package will be deleted from the cache. This is
789
done to speed use on slow remote links and ensure cache consistency.
790
 
791
=head1 EXAMPLE
792
 
793
=head2 jats dpkg_cache -list
794
 
795
This will list the current contents of the cache.
796
 
797
=head2 jats dpkg_cache -refresh crc/1.0.4.cr
798
 
799
This will delete any cached copy of the package crc/1.0.4.cr, if one exists,
800
and then copy in a new version.
801
 
802
=head2 jats dpkg_cache crc
803
 
804
This will copy in all versions of the crc package. This may not be desirable.
805
 
806
=head2 jats dpkg_cache -update_all
807
 
808
This will examine all packages in the cache and refresh those packages that are
809
out of date.
810
 
811
=cut
812