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: 27-Jun-2006 15:15:33 Branch: HEAD Handle: 2006062714153300 Modified files: openpkg-tools/cmd build.pl Log: SPECIAL CASE: -Z (ignore installed packages) and -a (operate for all installed packages) This allows one to correctly upgrade an existing OpenPKG instance to a newer major version by querying all installed packages and their options (-a) but then ignore them (-Z) during the later processing and instead perform more or less a fresh rebuild from scratch. This ensures that during the process the installed packages are effectively picked up as dependencies only after they in turn were already updated. Summary: Revision Changes Path 1.20 +31 -2 openpkg-tools/cmd/build.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-tools/cmd/build.pl ============================================================================ $ cvs diff -u -r1.19 -r1.20 build.pl --- openpkg-tools/cmd/build.pl 27 Jun 2006 12:13:13 -0000 1.19 +++ openpkg-tools/cmd/build.pl 27 Jun 2006 13:15:33 -0000 1.20 @@ -2404,7 +2404,37 @@ $url .= 'SRC/'; } -$installed = $opt_Z ? {} : get_installed(); +my $installed = get_installed(); + +if ($opt_a and $opt_Z) { + # SPECIAL CASE: -Z (ignore installed packages) + # -a (operate for all installed packages) + # This allows one to correctly upgrade an existing OpenPKG + # instance to a newer major version by querying all installed + # packages and their options (-a) but then ignore them (-Z) during + # the later processing and instead perform more or less a fresh + # rebuild from scratch. This ensures that during the process the + # installed packages are effectively picked up as dependencies + # only after they in turn were already updated. + foreach my $package (keys(%{$installed})) { + next if ($package =~ m/::/ or $package =~ m/^[A-Z][A-Z0-9]+$/); + $pattern .= " $package"; + foreach my $version (keys(%{$installed->{$package}})) { + foreach my $rec (@{$installed->{$package}->{$version}}) { + if (defined($rec->{"OPTIONS"})) { + my $options = $rec->{"OPTIONS"}; + foreach my $option (keys(%{$options})) { + $with{$package."::".$option} = $options->{$option}; + } + } + } + } + } +} +if ($opt_Z) { + $installed = {}; +} + $repository = get_index( $url.'00INDEX.rdf', $opt_f, @@ -2567,7 +2597,6 @@ B<openpkg build> ignores all installed packages, the script will rebuild all selected packages from scratch. -Note that this doesn't work together with the B<-a> option. =item B<-i> @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org