OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-tools                    Date:   23-Aug-2006 21:24:19
  Branch: HEAD                             Handle: 2006082320241900

  Modified files:
    openpkg-tools/cmd       makeproxy.pl

  Log:
    complete work-off makeproxy command by cleaning up and fixing
    implementation

  Summary:
    Revision    Changes     Path
    1.6         +268 -241   openpkg-tools/cmd/makeproxy.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/makeproxy.pl
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 makeproxy.pl
  --- openpkg-tools/cmd/makeproxy.pl    8 Jun 2006 19:20:57 -0000       1.5
  +++ openpkg-tools/cmd/makeproxy.pl    23 Aug 2006 19:24:19 -0000      1.6
  @@ -26,26 +26,26 @@
   use strict;
   use Getopt::Long;
   use IO;
  -use OpenPKG::Ctx;
  -
  -my $progname = "makeproxy";
  -my $progvers = "0.9.5";
  -
  -my $ctx = new OpenPKG::Ctx;
   
  +#   OpenPKG instance prefix and RPM
  +my $my_prefix = $ENV{'OPENPKG_PREFIX'} || '@l_prefix@';
  +my $my_rpm    = "$my_prefix/bin/openpkg rpm";
  +delete $ENV{'OPENPKG_PREFIX'};
  +
  +#   program identification
  +my $progname  = "makeproxy";
  +my $progvers  = "2.0.0";
   
   #   parameters (defaults)
  -my $version = 0;
  -my $verbose = 0;
  -my $debug   = 0;
  -my $help    = 0;
  -my $rpm     = $ctx->prefix() . '/bin/openpkg rpm';
  -my $tmpdir  = ($ENV{TMPDIR} || "/tmp") . "/$progname";
  -my $output  = '.';
  -my $input   = '-';
  -my $prefix  = '';
  -my $masterrpm = '';
  -my $masteropt = '';
  +my $help          = 0;
  +my $version       = 0;
  +my $verbose       = 0;
  +my $debug         = 0;
  +my $slave_prefix  = $my_prefix;
  +my $master_prefix = '';
  +my $tmpdir        = ($ENV{TMPDIR} || "/tmp");
  +my $output        = '.';
  +my $input         = '-';
   
   #   cleanup support
   my @cleanup = ();
  @@ -54,8 +54,8 @@
       push(@cleanup, $cmd);
   }
   sub cleanup_perform {
  -    foreach my $cmd (@cleanup) {
  -        &runcmd($cmd);
  +    foreach my $cmd (reverse @cleanup) {
  +        runcmd($cmd);
       }
   }
   
  @@ -63,8 +63,9 @@
   $SIG{__DIE__} = sub {
       my ($err) = @_;
       $err =~ s|\s+at\s+.*||s if (not $verbose);
  -    print STDERR "$progname:ERROR: $err ". ($! ? "($!)" : "") . "\n";
  -    &cleanup_perform() if (not $verbose);
  +    $err =~ s/\n+$//s;
  +    print STDERR "openpkg:$progname:ERROR: $err\n";
  +    cleanup_perform() if (not $verbose);
       exit(1);
   };
   
  @@ -77,9 +78,15 @@
   #   execution of external commands
   sub runcmd {
       my ($cmd) = @_;
  -    print STDERR "\$ $cmd\n" if ($debug);
  -    $cmd = "($cmd) >/dev/null 2>&1" if (not $debug);
  -    return (system($cmd) == 0);
  +    if ($cmd =~ m/^(.+)\|$/s) {
  +        print STDERR "\$ $1\n" if ($debug);
  +        return `$1`;
  +    }
  +    else {
  +        print STDERR "\$ $cmd\n" if ($debug);
  +        $cmd = "($cmd) >/dev/null 2>&1" if (not $debug);
  +        return (system($cmd) == 0);
  +    }
   }
   
   #   expand into a full filesystem path
  @@ -118,10 +125,10 @@
       my $pdir = $dir;
       $pdir =~ s|/[^/]*$||s;
       if (not -d $pdir) {
  -        &mkdirp($pdir);
  +        mkdirp($pdir);
       }
       if (not -d $dir) {
  -        &runcmd("mkdir $dir");
  +        runcmd("mkdir $dir");
       }
   }
   
  @@ -132,20 +139,21 @@
       'h|help'        => \$help,
       'd|debug'       => \$debug,
       'v|verbose'     => \$verbose,
  -    'r|rpm=s'       => \$rpm,
  +    'm|master=s'    => \$master_prefix,
  +    's|slave=s'     => \$slave_prefix,
       't|tmpdir=s'    => \$tmpdir,
       'o|output=s'    => \$output,
  -    'p|prefix=s'    => \$prefix
   ) || die "option parsing failed";
   if ($help) {
  -    print "Usage: $progname [options] [FILE]\n" .
  -          "Available options:\n" .
  -          " -h,--help          print out this usage page\n" .
  -          " -v,--verbose       enable verbose run-time mode\n" .
  -          " -r,--rpm=FILE      filesystem path to RPM program\n" .
  -          " -t,--tmpdir=PATH   filesystem path to temporary directory\n" .
  -          " -o,--output=FILE   filesystem path to output RPM file\n";
  -          " -p,--prefix=PATH   filesystem path to referenced master 
hierarchy\n";
  +    print "Usage: openpkg $progname [options] master-package\n" .
  +          " -h,--help          print this usage page\n" .
  +          " -V,--version       print version\n" .
  +          " -v,--verbose       print verbose run-time information\n" .
  +          " -d,--debug         print debug information\n" .
  +          " -m,--master=DIR    filesystem path to master OpenPKG instance\n" 
.
  +          " -s,--slave=DIR     filesystem path to slave OpenPKG instance\n" .
  +          " -t,--tmpdir=DIR    filesystem path to temporary directory\n" .
  +          " -o,--output=FILE   filesystem path to output proxy OpenPKG RPM 
package\n";
       exit(0);
   }
   if ($version) {
  @@ -160,49 +168,52 @@
   }
   
   #   prepare temporary location
  -&verbose("++ prepare temporary directory");
  +verbose("++ prepare temporary directory");
  +$tmpdir = "$tmpdir/$progname.$$";
   if (not -d $tmpdir) {
  -    &runcmd("mkdir $tmpdir && chmod 0700 $tmpdir")
  -        || die "cannot create temporary directory '$tmpdir'";
  -    &cleanup_remember("rmdir $tmpdir");
  -}
  -&verbose("-- $tmpdir");
  -
  -if ($prefix ne '') {
  -    $masterrpm = $prefix . "/bin/openpkg --prefix=$prefix rpm";
  -} else {
  -    $masterrpm = $rpm;
  -}
  -&verbose("-- rpm $rpm");
  -&verbose("-- masterrpm $masterrpm");
  -
  -my $rpmvers = `$rpm --version 2>/dev/null`;
  -$rpmvers =~ s|^OpenPKG\s+RPM\s+([0-9.]+)\s*$|$1|s || die "program '$rpm' 
seems to be not RPM";
  -&verbose("++ determining RPM program");
  -&verbose("-- $rpm ($rpmvers)");
  +    runcmd("umask 077 && mkdir $tmpdir")
  +        or die "cannot create temporary directory \"$tmpdir\"";
  +    cleanup_remember("rm -rf $tmpdir");
  +}
  +verbose("-- temporary directory: $tmpdir");
   
   #   determine input and output RPM
  -&verbose("++ determining RPM package files");
  -&verbose("-- input/original RPM: $input");
  -&verbose("-- output/proxy RPM: $output");
  +verbose("++ determining OpenPKG RPM package files");
  +verbose("-- input/master/regular RPM package: $input");
  +verbose("-- output/slave/proxy   RPM package: $output");
  +
  +#   ensure input RPM package is available on the filesystem
   if ($input eq '-') {
       $input = "$tmpdir/input.rpm";
  -    &runcmd("cat >$input");
  +    runcmd("cat >$input");
   }
   
  -if (($masterrpm eq $rpm) && (not -f $input)) {
  -    die "input RPM does not exist: '$input'";
  +#   determine master and slave OpenPKG instance and RPM commands
  +if ($master_prefix eq '') {
  +    if (not -f $input) {
  +        die "input/master/regular RPM package does not exist: \"$input\"";
  +    }
  +    $master_prefix = runcmd("($my_rpm -qp --qf '%{PREFIXES}' $input 
2>/dev/null || true) |");
  +    $master_prefix =~ s/\r?\n$//s;
  +    if ($master_prefix eq '') {
  +        die "unable to determine master OpenPKG instance";
  +    }
   }
  +if ($master_prefix eq $slave_prefix) {
  +    die "master and slave OpenPKG instances have to be different";
  +}
  +my $slave_rpm  = (-f "$slave_prefix/bin/openpkg"  ? 
"$slave_prefix/bin/openpkg rpm"  : $my_rpm);
  +my $master_rpm = (-f "$master_prefix/bin/openpkg" ? 
"$master_prefix/bin/openpkg rpm" : $my_rpm);
  +verbose("-- tool   OpenPKG instance:    $my_prefix");
  +verbose("-- tool   OpenPKG RPM command: $my_rpm");
  +verbose("-- master OpenPKG instance:    $master_prefix");
  +verbose("-- master OpenPKG RPM command: $master_rpm");
  +verbose("-- slave  OpenPKG instance:    $slave_prefix");
  +verbose("-- slave  OpenPKG RPM command: $slave_rpm");
   
  -if (-f $input) {
  -    $masteropt="-p";
  -}  
  -
  -
  -#   helper function for parsing the query outputs
  +#   helper function for parsing RPM query outputs
   sub parseresponse {
       my ($r, $o) = @_;
  -    $o =~ s|([SM])-([^:]+):<(.*?)>\n|&parseline($r, $1, $2, $3, '')|egs;
       sub parseline {
           my ($r, $t, $k, $v) = @_;
           $v =~ s|^\s+||s;
  @@ -215,29 +226,29 @@
               push(@{$r->{$k}}, $v);
           }
       }
  +    $o =~ s|([SM])-([^:]+):<(.*?)>\n|parseline($r, $1, $2, $3, '')|egs;
       return $r;
   }
   
  -#   query input RPM package
  -&verbose("++ query information from input RPM");
  +#   query master OpenPKG RPM package
  +verbose("++ query information from master OpenPKG RPM package");
   my $q = '';
   foreach my $t (qw(
  -    NAME SUMMARY URL VENDOR PACKAGER DISTRIBUTION GROUP LICENSE VERSION 
RELEASE
  +    NAME SUMMARY URL VENDOR PACKAGER DISTRIBUTION CLASS GROUP LICENSE 
VERSION RELEASE
       DESCRIPTION
   )) {
  -    $q .= "S-$t:<%{$t}>\n";
  +    $q .= "S-$t:<%{$t}>\\n";
   }
  -$q .= "[M-PREREQ:<%{REQUIRENAME} %|REQUIREFLAGS?{%{REQUIREFLAGS:depflags} 
%{REQUIREVERSION}}:{}|>\n]";
  -$q .= "[M-PREFIXES:<%{PREFIXES}>\n]";
  -&verbose("--  $masterrpm -q $masteropt --qf \"$q\" $input");
  -my $o = `$masterrpm -q $masteropt --qf "$q" $input`;
  -if ($o =~ /package .* is not installed/) {
  -    die "input package $input is not installed in $prefix"
  +$q .= '[M-PREREQ:<%{REQUIRENAME} %|REQUIREFLAGS?{%{REQUIREFLAGS:depflags} 
%{REQUIREVERSION}}:{}|>\n]';
  +$q .= '[M-PREFIXES:<%{PREFIXES}>\n]';
  +my $cmd = sprintf("%s -q %s --qf '$q' %s", $master_rpm, (-f $input ? "-p" : 
""), $input);
  +my $o = runcmd("$cmd|");
  +if ($o =~ m/package .* is not installed/s) {
  +    die "master package \"$input\" not installed in master OpenPKG instance 
\"$master_prefix\"";
   }
  -&verbose("-- $o");
   $o =~ s|M-PREREQ:<rpmlib\(.*?\).*?>\n||gs;
   my $r = {};
  -$r = &parseresponse($r, $o);
  +$r = parseresponse($r, $o);
   my $BD = '';
   my $ID = '';
   foreach my $d (@{$r->{PREREQ}}) {
  @@ -248,47 +259,34 @@
       $ID .= ", " if ($ID ne '');
       $ID .= $d;
   }
  -my $rprefix = ${$r->{PREFIXES}}[0];
  -$rprefix =~ s|/+$||s;
  -&verbose("-- remote OpenPKG prefix: $rprefix");
  -&verbose("++ query information from target OpenPKG");
  -$q = '';
  -foreach my $t (qw(
  -    l_prefix
  -)) {
  -    $q .= "S-$t:<%{$t}>\n";
  -}
  -$o = `$rpm --eval "$q"`;
  -$r = &parseresponse($r, $o);
  -my $lprefix = $r->{l_prefix};
  -$lprefix =~ s|/+$||s;
  -&verbose("-- local OpenPKG prefix: $lprefix");
   
   #   prepare build environment
  -&verbose("++ establishing temporary RPM environment");
  -&runcmd("rm -rf $tmpdir/src; mkdir $tmpdir/src");
  -&runcmd("rm -rf $tmpdir/tmp; mkdir $tmpdir/tmp");
  -&runcmd("rm -rf $tmpdir/bld; mkdir $tmpdir/bld");
  -&runcmd("rm -rf $tmpdir/pkg; mkdir $tmpdir/pkg");
  -&cleanup_remember("rm -rf $tmpdir/src");
  -&cleanup_remember("rm -rf $tmpdir/tmp");
  -&cleanup_remember("rm -rf $tmpdir/bld");
  -&cleanup_remember("rm -rf $tmpdir/pkg");
  -my $macro = new IO::File (">$tmpdir/.rpmmacros");
  -$macro->print("%_sourcedir $tmpdir/src\n" .
  -              "%_specdir   $tmpdir/src\n" .
  -              "%_builddir  $tmpdir/tmp\n" .
  -              "%_tmppath   $tmpdir/tmp\n" .
  -              "%_rpmdir    $tmpdir/pkg\n" .
  -              "%_srcrpmdir $tmpdir/pkg\n");
  -$macro->close;
  +verbose("++ establishing temporary OpenPKG RPM environment");
  +verbose("-- directory: $tmpdir");
  +runcmd("rm -rf $tmpdir/src; mkdir $tmpdir/src");
  +runcmd("rm -rf $tmpdir/tmp; mkdir $tmpdir/tmp");
  +runcmd("rm -rf $tmpdir/bld; mkdir $tmpdir/bld");
  +runcmd("rm -rf $tmpdir/pkg; mkdir $tmpdir/pkg");
  +cleanup_remember("rm -rf $tmpdir/src");
  +cleanup_remember("rm -rf $tmpdir/tmp");
  +cleanup_remember("rm -rf $tmpdir/bld");
  +cleanup_remember("rm -rf $tmpdir/pkg");
  +my $macro = new IO::File ">$tmpdir/.rpmmacros"
  +    or die "unable to write file \"$tmpdir/.rpmmacros\": $!";
  +$macro->print(
  +    "\%_sourcedir $tmpdir/src\n" .
  +    "\%_specdir   $tmpdir/src\n" .
  +    "\%_builddir  $tmpdir/tmp\n" .
  +    "\%_tmppath   $tmpdir/tmp\n" .
  +    "\%_rpmdir    $tmpdir/pkg\n" .
  +    "\%_srcrpmdir $tmpdir/pkg\n"
  +);
  +$macro->close();
   $ENV{HOME} = $tmpdir;
  -&verbose("-- temporary sourcedir/specdir: $tmpdir/src");
  -&verbose("-- temporary builddir/tmppath:  $tmpdir/tmp");
  -&verbose("-- temporary rpmdir/srcrpmdir:  $tmpdir/pkg");
   
  -#   generate .spec file for proxy RPM package
  -&verbose("++ generating RPM specification for proxy RPM");
  +#   generate OpenPKG RPM .spec file for proxy OpenPKG RPM package
  +verbose("++ generating OpenPKG RPM package specification for proxy package");
  +verbose("-- file: $tmpdir/src/".$r->{NAME}.".spec");
   my $S = '';
   $S .= "Name:         ".$r->{NAME}."\n";
   $S .= "Summary:      ".$r->{SUMMARY}."\n";
  @@ -296,73 +294,74 @@
   $S .= "Vendor:       ".$r->{VENDOR}."\n";
   $S .= "Packager:     ".$r->{PACKAGER}."\n";
   $S .= "Distribution: ".$r->{DISTRIBUTION}."\n";
  +$S .= "Class:        ".$r->{CLASS}."\n";
   $S .= "Group:        ".$r->{GROUP}."\n";
   $S .= "License:      ".$r->{LICENSE}."\n";
   $S .= "Version:      ".$r->{VERSION}."\n";
   $S .= "Release:      ".$r->{RELEASE}."+PROXY\n";
   $S .= "\n";
  -$S .= "Prefix:       %{l_prefix}\n";
  +$S .= "Prefix:       \%{l_prefix}\n";
   $S .= "BuildRoot:    $tmpdir/bld\n";
  -$S .= "BuildPreReq:  $BD\n";
  -$S .= "PreReq:       $ID\n";
  +$S .= "BuildPreReq:  $BD\n" if ($BD ne '');
  +$S .= "PreReq:       $ID\n" if ($ID ne '');
   $S .= "AutoReq:      no\n";
   $S .= "AutoReqProv:  no\n";
  -#$S .= "Provides:     ".$r->{NAME}.", 
".$r->{NAME}."-".$r->{VERSION}."-".$r->{RELEASE}."\n";
  +$S .= "Provides:     ".$r->{NAME}." = ".$r->{VERSION}."-".$r->{RELEASE}."\n";
   $S .= "\n";
  -$S .= "%description\n";
  +$S .= "\%description\n";
   $S .= "    ".$r->{DESCRIPTION}."\n";
   $S .= "\n";
  -$S .= "%install\n";
  -$S .= "    %{l_rpmtool} files -v -ofiles -r\$RPM_BUILD_ROOT 
%{l_files_std}\n";
  +$S .= "\%install\n";
  +$S .= "    \%{l_rpmtool} files -v -ofiles -r\$RPM_BUILD_ROOT 
\%{l_files_std}\n";
   $S .= "\n";
  -$S .= "%files -f files\n";
  +$S .= "\%files -f files\n";
   $S .= "\n";
  -my $spec = new IO::File (">$tmpdir/src/".$r->{NAME}.".spec");
  +my $spec = new IO::File ">$tmpdir/src/".$r->{NAME}.".spec"
  +   or die "unable to write file \"$tmpdir/src/".$r->{NAME}."\": $!";
   $spec->print($S);
   $spec->close;
  -&verbose("-- $tmpdir/src/".$r->{NAME}.".spec");
   
   #   creating shadow tree of original contents
  -&verbose("++ creating shadow tree from original contents");
  -my @FL = `$masterrpm -q $masteropt --qf '[%{FILEMODES:perms} 
%{FILENAMES}\n]' $input`;
  +verbose("++ creating shadow tree from original package contents");
  +$q = '[%{FILEMODES:perms} %{FILENAMES}\n]';
  +$cmd = sprintf("%s -q %s --qf '$q' %s", $master_rpm, (-f $input ? "-p" : 
""), $input);
  +my @FL = runcmd("$cmd|");
   my $FD = [];
   my $FR = [];
   foreach my $fl (@FL) {
       $fl =~ s|\n$||s;
  -    if ($fl =~ m|^(d\S+)\s+$rprefix(.*)$|) {
  -        &mkdirp("$tmpdir/bld$lprefix$2");
  -        &verbose("-- | PHYS $1 $lprefix$2");
  +    if ($fl =~ m|^(d\S+)\s+$master_prefix(.*)$|) {
  +        mkdirp("$tmpdir/bld$slave_prefix$2");
  +        verbose("-- | PHYS $1 $slave_prefix$2");
       }
  -    elsif ($fl =~ m|^(\S+)\s+$rprefix(.*?)([^/\s]+)$|) {
  +    elsif ($fl =~ m|^(\S+)\s+$master_prefix(.*?)([^/\s]+)$|) {
           my ($subdir, $file) = ($2, $3);
           my $target = sub2rev($subdir)."/.prefix-".$r->{NAME}.$subdir.$file;
  -        &mkdirp("$tmpdir/bld$lprefix$subdir");
  -        &runcmd("ln -s $target $tmpdir/bld$lprefix$subdir$file");
  -        &verbose("-- | VIRT $1 $lprefix$subdir$file");
  +        mkdirp("$tmpdir/bld$slave_prefix$subdir");
  +        runcmd("ln -s $target $tmpdir/bld$slave_prefix$subdir$file");
  +        verbose("-- | VIRT $1 $slave_prefix$subdir$file");
       }
   }
   
   #   create master-reference symbolic link
  -my $xprefix = $rprefix;
  -$xprefix = $prefix if ($prefix ne '');
  -&runcmd("ln -s $xprefix $tmpdir/bld$lprefix/.prefix-".$r->{NAME});
  +runcmd("ln -s $master_prefix $tmpdir/bld$slave_prefix/.prefix-".$r->{NAME});
   
   #   rolling output proxy RPM package
  -&verbose("++ rolling output proxy RPM package");
  -&runcmd("cd $tmpdir/src && $rpm -bb --nodeps ".$r->{NAME}.".spec");
  +verbose("++ rolling output proxy RPM package");
  +runcmd("cd $tmpdir/src && $slave_rpm -bb --nodeps ".$r->{NAME}.".spec");
   
   #   providing output
  -&verbose("++ providing output");
  +verbose("++ providing output: $output");
   if ($output eq '-') {
  -    &runcmd("cat $tmpdir/pkg/*.rpm");
  +    runcmd("cat $tmpdir/pkg/*.rpm");
   }
   else {
  -    &runcmd("cp $tmpdir/pkg/*.rpm $output");
  +    runcmd("cp $tmpdir/pkg/*.rpm $output");
   }
   
   #   die gracefully...
  -&verbose("++ cleaning up environment");
  -&cleanup_perform();
  +verbose("++ cleaning up environment");
  +cleanup_perform();
   exit(0);
   
   __END__
  @@ -371,64 +370,80 @@
   
   =head1 NAME
   
  -B<openpkg makeproxy> -- Make OpenPKG Proxy RPM Package
  +B<openpkg makeproxy> -- Make Proxy OpenPKG RPM Package
   
   =head1 SYNOPSIS
   
   B<openpkg makeproxy>
  -[B<--verbose>]
  -[B<--debug>]
  -[B<--help>]
  -[B<--rpm>=I<FILE>]
  -[B<--tmpdir>=I<DIR>]
  -[B<--output>=I<DIR>|I<FILE>|C<->]
  -[B<--prefix>=I<RPREFIX>]
  -[I<FILE>|C<->]
  +[B<-h>|B<--help>]
  +[B<-V>|B<--version>]
  +[B<-d>|B<--debug>]
  +[B<-v>|B<--verbose>]
  +[B<-m>|B<--master> I<master-prefix>]
  +[B<-s>|B<--slave> I<slave-prefix>]
  +[B<-t>|B<--tmpdir> I<directory>]
  +[B<-o>|B<--output> I<directory>|I<slave-package-file>|C<->]
  +[I<master-package-name>|I<master-package-file>|C<->]
   
   =head1 DESCRIPTION
   
  -B<openpkg makeproxy> creates an B<OpenPKG> proxy package by translating a
  -binary RPM file into a proxy binary RPM file. A proxy package contains
  -(virtually) the same contents as the original package in the form
  -of a shadow tree. Such a shadow tree consists of the same physical
  -directories as the original tree but with all other files replaced by
  -symbolic links pointing to the original files in the remote B<OpenPKG>
  +B<openpkg makeproxy> creates a I<proxy> binary B<OpenPKG> RPM package
  +for a I<slave> B<OpenPKG> instance by emulating a regular binary
  +B<OpenPKG> RPM package from a I<master> B<OpenPKG> instance.
  +
  +A proxy package contains (virtually) the same contents as the regular
  +package, but in the form of a shadow tree. Such a shadow tree consists
  +of the same physical directory structure but with all files replaced by
  +symbolic links pointing to the regular files in the master B<OpenPKG>
   instance.
   
  -A proxy package is useful if multiple B<OpenPKG> instances are installed on
  -the same system. In this case lots of dependent (and this way required,
  -although not explicitly wanted) packages have to be installed in every
  -instance. Think about packages like B<openssl>, B<perl>, B<gcc>, etc. This 
can
  -be both very time-consuming and can become a maintainance nightmare.
  -Instead, you can select a master (or remote) B<OpenPKG> instance,
  -install those packages physically there only and install a simple proxy
  -packages for them in all other (local) B<OpenPKG> instances.
  -
  -Keep in mind that this obviously works correctly for packages which do not
  -have hard-coded dependencies to their B<OpenPKG> instance (like configuration
  -files, etc.). For other packages it might also work, but be at least warned
  -about side-effects. Additionally, make sure you always keep (local) proxy
  -packages in sync with the (remote) master package.
  +A proxy package is useful if multiple closely related B<OpenPKG>
  +instances are installed on the same system. In this case lots of
  +dependent (and this way required, although not explicitly wanted)
  +packages have to be installed in I<every> B<OpenPKG> instance. Think
  +about packages like B<openssl>, B<perl>, B<gcc>, etc. This can be both
  +very time-consuming and become a maintenance nightmare on upgrades.
  +Instead, you can select a master B<OpenPKG> instance, install those
  +regular packages physically there only and install simple proxy packages
  +for them in all other slave B<OpenPKG> instances.
  +
  +Keep in mind that this obviously works correctly for packages which
  +do I<not> have hard-coded dependencies to their B<OpenPKG> instance
  +(configuration files, etc). For other packages it might also work,
  +but be at least be warned about side-effects! Additionally, make sure
  +you always keep proxy packages in sync with the regular package by
  +recreating the proxy packages after the regular packages have changed.
   
   =head1 SHADOW TREE
   
  -The symbolic links in the shadow tree of the proxy package B<foo> are of
  -the form:
  +The shadow tree of a proxy package B<name> contain the following three
  +types of paths:
  +
  +=over 4
  +
  +=item I<slave-prefix>[/I<dir>]
  +
  +This is a physical directory for the slave B<OpenPKG> instance, exactly
  +as it exists in the regular package of the master B<OpenPKG> instance.
   
  -I<lprefix>[/I<dir>]/I<file> -> I<revdir>C</.prefix->B<foo>[/I<dir>]/I<file>
  +=item I<slave-prefix>[/I<dir>]/I<file> -> 
I<revdir>C</.prefix->B<foo>[/I<dir>]/I<file>
   
  -And to make them working, there is the following additional symbolic
  -link installed:
  +This is a virtual file (symbolic link) for the slave B<OpenPKG>
  +instance, indirectly pointing to the corresponding file of the regular
  +package in the master B<OpenPKG> instance. The I<revdir> is a reverse
  +path corresponding to I<dir>, i.e., for each sub-directory step in
  +I<dir> it contains a "C<../>" parent directory step.
  +
  +=item I<slave-prefix>C</.prefix->B<foo> -> I<master-prefix>
  +
  +This is a virtual file (symbolic link) for the slave B<OpenPKG>
  +instance, directly pointing to the prefix of the master B<OpenPKG>
  +instance. This allows one to redirect a whole package to
  +a different B<OpenPKG> instance by manually changing the
  +I<slave-prefix>C</.prefix->B<foo> symbolic link. The idea is that this
  +link even could be automatically controlled by a higher-level facility.
   
  -I<lprefix>C</.prefix->B<foo> -> I<rprefix>
  -
  -Here I<lprefix> is the prefix of the local B<OpenPKG> instance and
  -I<rprefix> is the prefix of the remote B<OpenPKG> instance. This allows
  -one to redirect a whole package to a different B<OpenPKG> instance by
  -just changing the I<lprefix>C</.prefix->B<foo> symbolic link. The idea
  -is that later this link even could be automatically controlled by a
  -higher-level facility. The I<rprefix> target of the symbolic link can be
  -overridden at build-time with the B<--prefix>=I<RPREFIX> option.
  +=back
   
   =head1 OPTIONS
   
  @@ -436,86 +451,98 @@
   
   =over 4
   
  -=item B<--verbose>
  +=item B<-h>, B<--help>
  +
  +Print the usage message and immediately exit.
   
  -Enable verbose messages on F<stderr> summarizing the internal processing.
  +=item B<-V>, B<--version>
   
  -=item B<--debug>
  +Print program version.
   
  -Enable debugging messages on F<stderr> showing the executed shell commands.
  +=item B<-v>, B<--verbose>
   
  -=item B<--help>
  +Enable printing of verbose messages on F<stderr> summarizing the internal 
processing.
   
  -Print the usage message and immediately exit.
  +=item B<-d>, B<--debug>
  +
  +Enable printing of debug messages on F<stderr> showing the executed shell 
commands.
  +
  +=item B<-m>, B<--master> I<master-prefix>
   
  -=item B<--rpm>=I<FILE>
  +Set the filesystem path prefix of the I<master> B<OpenPKG> instance.
  +If not specified, the prefix is determined from the master package.
   
  -Set a particular B<RPM> program to use. The default is the program
  -"C<rpm>" in C<$PATH>. This has to be the C<rpm> of the target B<OpenPKG>
  -instance where the proxy package will be installed later.
  -
  -=item B<--tmpdir>=I<DIR>
  -
  -Set a particular temporary directory. The default is determined from
  -C<$TMPDIR>, or C</tmp> (in that order).
  -
  -=item B<--output>=I<DIR>|I<FILE>|C<->
  -
  -Set the location where to write the output
  -proxy RPM package. If the input RPM is named
  -"I<name>C<->I<version>C<->I<release>C<.>I<arch>C<->I<os>C<->I<id1>C<.rpm
  ->" the output RPM is named
  -"I<name>C<->I<version>C<->I<release>C<+PROXY>C<.>I<arch>C<->I<os>C<->I<i
  -d2>C<.rpm>" (I<id1> is the identification of the master B<OpenPKG>
  -instance, I<id2> is the identification of the B<OpenPKG> instance for
  -which the proxy package is built). The special argument "C<->" indicates
  -that the output RPM is written to F<stdout>. The default is "C<.>" (the
  -current working directory).
  -
  -=item I<FILE>|C<->
  -
  -Set the location where to read the input RPM package. The special
  -argument "C<->" indicates that the input RPM is read from F<stdin> (the
  -default).
  +=item B<-s>, B<--slave> I<slave-prefix>
  +
  +Set the filesystem path prefix of the I<slave> B<OpenPKG> instance.
  +If not specified, the prefix defaults to the prefix of
  +the B<OpenPKG> instance the C<openpkg makeproxy> command is run from.
  +
  +=item B<-t>, B<--tmpdir> I<directory>
  +
  +Set a particular temporary directory. The default is C<$TMPDIR> or
  +C</tmp> (in that order).
  +
  +=item B<-o>, B<--output> I<directory>|I<slave-package-file>|C<->
  +
  +Set the location where to write the output proxy RPM package for the
  +slave B<OpenPKG> instance. The argument "C<->" indicates that the output
  +proxy RPM package is written to F<stdout>. The default is "C<.>" (the
  +current working directory). If the output location is a directory and
  +the regular RPM package of the master B<OpenPKG> instance is named
  +"I<name>C<->I<version>C<->I<release>C<.>I<arch>C<->I<os>C<->I<tag1>C<.rp
  +m>", then the output proxy RPM package is named
  +"I<name>C<->I<version>C<->I<release>C<+PROXY>C<.>I<arch>C<->I<os>C<->I<t
  +ag2>C<.rpm>" in the output directory (I<tag1> and I<tag2> are the tags
  +of the master and slave B<OpenPKG> instances).
  +
  +=item I<master-package-file>|C<->
  +
  +Set the location where to read the input regular RPM package. The
  +special argument "C<->" indicates that the input regular RPM package is
  +read from F<stdin> (the default).
   
   =back
   
   =head1 EXAMPLE
   
   Assume you have three B<OpenPKG> instances on a system: C</usr/opkg>
  -(the master instance), C</e/foo/sw> (a project instance), and C</e/bar/sw>
  -(another project instance). Now let us install the C<bash> package in
  +(the master instance), C</v/foo/sw> (a project instance) and C</v/bar/sw>
  +(another project instance). Now let us install the B<OpenPKG> B<bash> 
package in
   all three locations, but only once physically.
   
  - # build and install binary RPM for /usr/opkg instance
  + # build and install regular binary RPM package for /usr/opkg
    $ /usr/opkg/bin/openpkg rpm --rebuild \
  -   ftp://ftp.openpkg.org/release/1.0/SRC/bash-2.05a-2.5.0.src.rpm
  +    bash-3.1.17-2.20060622.src.rpm
    $ /usr/opkg/bin/openpkg rpm -Uvh \
  -   /usr/opkg/RPM/PKG/bash-2.05a-2.5.0.*.rpm
  -
  - # build and install proxy RPM for /e/foo/sw instance
  - $ /e/foo/sw/bin/openpkg makeproxy --rpm=/e/foo/sw/bin/rpm 
--output=/e/foo/RPM/PKG/ \
  -   /usr/opkg/RPM/PKG/bash-2.05a-2.5.0.*.rpm
  - $ /e/foo/sw/bin/rpm -Uvh \
  -   /e/foo/RPM/PKG/bash-2.05a-2.5.0+PROXY.*.rpm
  -
  - # build and install proxy RPM for /e/bar/sw instance from the master RPM 
database
  - $ /e/bar/sw/bin/openpkg makeproxy --prefix=/usr/opkg 
--output=/e/bar/RPM/PKG/ bash
  - $ /e/bar/sw/bin/openpkg rpm -Uvh \
  -   /e/bar/RPM/PKG/bash-2.05a-2.5.0+PROXY.*.rpm
  +   /usr/opkg/RPM/PKG/bash-3.1.17-2.20060622.*.rpm
   
  + # build and install proxy RPM package for /v/foo/sw
  + # (using the regular binary RPM package of /usr/opkg)
  + $ /v/foo/sw/bin/openpkg makeproxy --output=/v/foo/RPM/PKG/ \
  +   /usr/opkg/RPM/PKG/bash-3.1.17-2.20060622.*.rpm
  + $ /v/foo/sw/bin/openpkg rpm -Uvh \
  +   /v/foo/RPM/PKG/bash-3.1.17-2.20060622+PROXY.*.rpm
  +
  + # build and install proxy RPM package for /v/bar/sw
  + # (using the installed package of /usr/opkg)
  + $ /v/bar/sw/bin/openpkg makeproxy --output=/v/bar/RPM/PKG/ \
  +   --master=/usr/opkg bash
  + $ /v/bar/sw/bin/openpkg rpm -Uvh \
  +   /v/bar/RPM/PKG/bash-3.1.17-2.20060622+PROXY.*.rpm
   
   =head1 SEE ALSO
   
   B<OpenPKG> http://www.openpkg.org/,
  -rpm(3), ln(1).
  +B<openpkg rpm>, ln(1).
   
   =head1 HISTORY
   
   B<openpkg makeproxy> was developed in February 2002 by Ralf S.
   Engelschall E<lt>[EMAIL PROTECTED]<gt> for the B<OpenPKG>
   project after an idea for virtual packages by Thomas Lotterer
  -E<lt>[EMAIL PROTECTED]<gt>.
  +E<lt>[EMAIL PROTECTED]<gt>. The implementation was completely
  +worked off in August 2006.
   
   =head1 AUTHOR
   
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to