Update of /cvsroot/fink/fink/perlmod/Fink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30196/perlmod/Fink
Modified Files: Engine.pm Log Message: Added a new Fink command: snapshot Creates a .info file in /tmp that has a Depends for every non-virtual package you have installed. Inspired by the CPAN.pm autobundle feature, this lets you replicate your Fink setup on a new machine by simply copying and installing the generated .info file. This feature was discussed in the SF tracker: http://sf.net/tracker/?func=detail&atid=317203&aid=1111210&group_id=17203 Index: Engine.pm =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v retrieving revision 1.228 retrieving revision 1.229 diff -u -d -r1.228 -r1.229 --- Engine.pm 3 Feb 2005 00:36:11 -0000 1.228 +++ Engine.pm 4 Feb 2005 19:16:11 -0000 1.229 @@ -97,6 +97,7 @@ 'showparent' => [\&cmd_showparent, 1, 0, 0], 'dumpinfo' => [\&cmd_dumpinfo, 1, 0, 0], 'show-deps' => [\&cmd_show_deps, 1, 0, 0], + 'snapshot' => [\&cmd_snapshot, 1, 0, 0], ); END { } # module clean-up code here (global destructor) @@ -2332,6 +2333,51 @@ } } +sub cmd_snapshot { + my ($pname, $package, @installed, $snapdir, $outfile, @time, + $snappkg, $snapver, $snaprev, $snapdep); + + eval "use POSIX qw(strftime);"; + $snappkg = "fink-snapshot"; + $snapver = strftime("%Y.%m.%d.%H", localtime); + $snaprev = "1"; + $snapdir = "/tmp"; + foreach $pname (Fink::Package->list_packages()) { + next if ($pname eq $snappkg); + $package = Fink::Package->package_by_name($pname); + if ($package->is_any_installed() && + !$package->is_virtual()) { + push @installed, $pname; + } + } + $snapdep = join(",\n ", sort(@installed)); + $outfile = sprintf("$snapdir/snap-%s-%s.info", + $snapver, $snaprev); + my @user = getpwnam($ENV{SUDO_USER} || $ENV{USER}); + local *SNAP; + open(SNAP, "> $outfile") or die "can't create file $outfile\n"; + print SNAP <<"EOF"; +Package: $snappkg +Version: $snapver +Revision: $snaprev +Type: bundle +License: Restrictive +Description: Snapshot of Fink packages for $user[6] +Maintainer: $user[6] <[EMAIL PROTECTED]> +Homepage: http://fink.sourceforge.net/ +Depends: << + $snapdep +<< +EOF + close(SNAP) or die "can't create file $outfile\n"; + print <<"EOF"; +Wrote $outfile +To use this file: + copy to /sw/fink/dists/local/main/finkinfo + run "fink build fink-snapshot" +EOF +} + # pretty-print a set of PkgVersion::pkglist (each "or" group on its own line) # pass: # ref to list of field names ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-commits