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: 19-Jul-2006 20:12:57
Branch: HEAD Handle: 2006071919125700
Modified files:
openpkg-tools/cmd build.pl
Log:
make script even more stand-alone: allows easier debugging/development
and later could easy the the integration into the bootstrap, etc.
Summary:
Revision Changes Path
1.30 +21 -5 openpkg-tools/cmd/build.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/build.pl
============================================================================
$ cvs diff -u -r1.29 -r1.30 build.pl
--- openpkg-tools/cmd/build.pl 19 Jul 2006 17:56:17 -0000 1.29
+++ openpkg-tools/cmd/build.pl 19 Jul 2006 18:12:57 -0000 1.30
@@ -37,13 +37,11 @@
$opt_D $opt_p $opt_q $opt_s $opt_S $opt_X $opt_M
$opt_L $opt_W $opt_K $opt_e $opt_b $opt_B $opt_g
};
-use OpenPKG::Ctx;
$| = 1; # autoflush STDOUT
# global context variables
my $prg = "openpkg build";
-my $ctx = new OpenPKG::Ctx;
my %env = ('' => {});
##
@@ -344,15 +342,33 @@
# determine RPM run-time information
sub rpm_runtime_info () {
- # determine OpenPKG instance prefix
- my $l_prefix = $ctx->prefix();
+ # determine OpenPKG instance prefix via
+ # 1. the environment of the "openpkg build" framework
+ # 2. the installation path of the script
+ # 3. the installation path of the Perl interpreter
+ # 4. the path of the "openpkg" command in $PATH
+ my $l_prefix = $ENV{'OPENPKG_PREFIX'};
+ if (not $l_prefix) {
+ ($l_prefix) = ($0 =~
m/^(.+)\/lib(exec)?\/openpkg(-tools)?\/build(\.pl)?$/);
+ }
+ if (not $l_prefix) {
+ ($l_prefix) = ($^X =~ m/^(.+)\/bin\/perl.*$/);
+ }
+ if (not $l_prefix) {
+ $l_prefix = (`(which openpkg) 2>/dev/null` =~
m/^(.+)\/bin\/openpkg$/);
+ }
+ if (not -x "$l_prefix/bin/openpkg") {
+ die "openpkg:build:FATAL: cannot determine OpenPKG instance prefix";
+ }
+ print "# operating with OpenPKG instance $l_prefix\n";
# determine OpenPKG RPM command
my $rpm = $opt_R || $env{''}->{'R'} ||
((-f "$l_prefix/bin/openpkg" && -f "$l_prefix/libexec/openpkg/rpm") ?
"$l_prefix/bin/openpkg rpm" : "$l_prefix/bin/rpm");
- $rpm = (`which $rpm` =~ m{^(/.*)})[0] if ($rpm !~ m|^/|);
+ $rpm = (`(which $rpm) 2>/dev/null` =~ m{^(/.*)})[0] if ($rpm !~ m|^/|);
die "openpkg:build:FATAL: cannot locate OpenPKG RPM in path" unless
($rpm =~ m{^/});
+ print "# operating with OpenPKG RPM $rpm\n";
# determine additional tools
my $mkp = "$l_prefix/bin/openpkg makeproxy";
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]