summaryrefslogtreecommitdiffstats
path: root/perl-install/Makefile
Commit message (Expand)AuthorAgeFilesLines
* don't remove some po's from drakxtools, only from installPascal Rigaux2003-09-181-0/+4
* since XFree86-VGA16-3.3.6-29mdk is bad, insist on having XFree86-VGA16 28mdk ...Pascal Rigaux2003-08-301-0/+2
* Use busybox in stage2 on AMD64Gwenolé Beauchesne2003-08-201-0/+3
* Use bash in stage2 on IA-64Gwenolé Beauchesne2003-08-131-0/+4
* s/head -1/head -n 1/Pascal Rigaux2003-08-011-2/+2
* trying to follow the sucking of titi...Francois Pons2003-07-181-1/+1
* remove mkswap from commands.pm, so no need anymore to have mkswap_ (the drawb...Pascal Rigaux2003-07-161-1/+1
* make sure original mkswap is still living.Francois Pons2003-07-101-1/+1
* fix install crashed X server because /usr/bin/true was no moreGuillaume Cottenceau2003-06-051-1/+1
* move ugtk2 back in drakxtools on gc ideaThierry Vignaud2003-03-061-1/+1
* error out when a listed lang doesn't have a png lang fileGuillaume Cottenceau2003-02-271-0/+1
* removed dmidecode.Francois Pons2003-02-251-2/+2
* added dmidecodeFrancois Pons2003-02-251-2/+2
* not more xpm's in shareGuillaume Cottenceau2003-02-191-1/+1
* themes/* is gone, no need to copy those filesPascal Rigaux2003-02-141-1/+0
* fix typoPascal Rigaux2003-02-131-1/+1
* use PerlIO-gzipPascal Rigaux2003-02-131-0/+3
* language/country selection change:Guillaume Cottenceau2003-02-081-2/+2
* - building srpm only does not imply having the dependancies installedThierry Vignaud2003-02-051-2/+2
* add brltty help filePascal Rigaux2003-02-041-1/+1
* wildcard * in share/list allowed to match multiple files, but not multiple di...Pascal Rigaux2003-02-041-1/+1
* roll back (mcc!=gi)Thierry Vignaud2003-01-271-1/+1
* remove warnings in packageThierry Vignaud2003-01-271-1/+1
* when taking files from perl-GTK2, don't /usr/lib/libDrakX/ugtk2.pm since we d...Pascal Rigaux2003-01-061-1/+1
* list files changes for gtk2 (is that really optimal to have utf8.pm and utf8_...Guillaume Cottenceau2002-12-201-3/+5
* add "make test_pms_all"Pascal Rigaux2002-12-191-0/+3
* fix installation after pixel changesThierry Vignaud2002-12-131-1/+1
* adapt "make test_pms" to new perl_checkerPascal Rigaux2002-12-021-7/+3
* fix removing of pods when installing pmsPascal Rigaux2002-11-281-1/+1
* ugtk2.pm is temporarily not in drakxtools but in perl-GTK2Guillaume Cottenceau2002-11-261-1/+1
* group icons are not used, remove themPascal Rigaux2002-08-281-3/+0
* lib64 fixesGwenolé Beauchesne2002-08-051-1/+5
* - Move xf86Wacom.so modules to {i386,ppc}-specific filelistGwenolé Beauchesne2002-08-051-1/+1
* make new perl_checker happyPascal Rigaux2002-07-311-1/+1
* rename a few target:Thierry Vignaud2002-07-311-2/+2
* - consolidate duplicated 'use (warn|strict...' into nuke_perl targetThierry Vignaud2002-07-291-5/+6
* use spec_test rather than testThierry Vignaud2002-07-251-4/+3
* add PMS_DIRS in Makefile.config and use it everywherePascal Rigaux2002-07-241-1/+1
* check make got correct tag from spec fileThierry Vignaud2002-07-231-4/+9
* modparm.lst is not used anymore (modinfo -p)Pascal Rigaux2002-07-231-1/+0
* fast build: new target (fastsrpm = cvstag localsrpm)Thierry Vignaud2002-07-231-0/+2
* g Move 2: partition table: hierarchyThierry Vignaud2002-07-231-3/+3
* - Big Move 1: interactive::* hierarchyThierry Vignaud2002-07-231-3/+3
* faster startup: remove use (diagnostics|vars|strict) in srpm target asThierry Vignaud2002-07-181-0/+3
* (test_pms): exclude urpm from usesPascal Rigaux2002-07-171-1/+1
* don't display etags command (too long, not nice)Pascal Rigaux2002-07-161-1/+1
* updated to drop URPM... reference for test_pms.Francois Pons2002-07-151-1/+1
* remove all (use\s+(diagnostics|vars|strict)' instancesThierry Vignaud2002-07-101-0/+4
* have MDK::Common's in TAGSPascal Rigaux2002-07-091-1/+1
* create the list_modules symlinkPascal Rigaux2002-07-081-2/+4
######################################################################## sub new($) { my ($type) = @_; bless {}, ref $type || $type; } sub vnew { my ($_type, $su, $icon) = @_; $su = $su eq "su"; if ($ENV{INTERACTIVE_HTTP}) { require interactive::http; return interactive::http->new; } require c; if ($su) { $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; $su = '' if $::testing || $ENV{TESTING}; } require_root_capability() if $su; if (check_for_xserver()) { eval { require interactive::gtk }; if (!$@) { my $o = interactive::gtk->new; if ($icon && $icon ne 'default' && !$::isWizard) { $o->{icon} = $icon } else { undef $o->{icon} } return $o; } } require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function undef *log::l; *log::l = sub {}; # otherwise, it will bother us :( require interactive::newt; interactive::newt->new; } sub enter_console {} sub leave_console {} sub suspend {} sub resume {} sub end {} sub exit { exit($_[0]) } #-###################################################################################### #- Interactive functions #-###################################################################################### sub ask_warn { my ($o, $title, $message) = @_; local $::isWizard = 0; ask_from_listf_no_check($o, $title, $message, undef, [ N("Ok") ]); } sub ask_yesorno { my ($o, $title, $message, $def, $help) = @_; ask_from_list_($o, $title, $message, [ N_("Yes"), N_("No") ], $def ? "Yes" : "No", $help, 'nocancel') eq "Yes"; } sub ask_okcancel { my ($o, $title, $message, $def, $help) = @_; if ($::isWizard) { $::no_separator = 1; $o->ask_from_no_check({ title => $title, messages => $message, focus_cancel => !$def }, []); } else { ask_from_list_($o, $title, $message, [ N_("Ok"), N_("Cancel") ], $def ? "Ok" : "Cancel", $help, 'nocancel') eq "Ok"; } } sub ask_file { my ($o, $title, $dir) = @_; $o->ask_fileW($title, $dir); } sub ask_fileW { my ($o, $title, $_dir) = @_; $o->ask_from_entry($title, N("Choose a file")); } sub ask_from_list { my ($o, $title, $message, $l, $def, $help, $nocancel) = @_; ask_from_listf($o, $title, $message, undef, $l, $def, $help, $nocancel); } sub ask_from_list_ { my ($o, $title, $message, $l, $def, $help, $nocancel) = @_; ask_from_listf($o, $title, $message, sub { translate($_[0]) }, $l, $def, $help, $nocancel); } sub ask_from_listf_ { my ($o, $title, $message, $f, $l, $def, $help, $nocancel) = @_; ask_from_listf($o, $title, $message, sub { translate($f->(@_)) }, $l, $def, $help, $nocancel); } sub ask_from_listf { my ($_o, $_title, $_message, $_f, $l, $_def, $_help, $_nocancel) = @_; @$l == 0 and die "ask_from_list: empty list\n" . backtrace(); @$l == 1 and return $l->[0]; goto &ask_from_listf_no_check; } sub ask_from_listf_no_check { my ($o, $title, $message, $f, $l, $def, $help, $nocancel) = @_; if (@$l <= 2 && !$::isWizard) { my ($ok, $cancel) = map { $_ && may_apply($f, $_) } @$l; if (length "$ok$cancel" < 70) { my $ret = eval { ask_from_no_check($o, { title => $title, messages => $message, ok => $ok, if_($cancel, cancel => $cancel, focus_cancel => $def eq $l->[1]) }, [] ) ? $l->[0] : $l->[1]; }; die if $@ && $@ !~ /^wizcancel/; return $@ ? undef : $ret; } } ask_from_($o, { title => $title, messages => $message, if_($nocancel, cancel => ''), }, [ { val => \$def, type => 'list', list => $l, help => $help, format => $f } ]) && $def; } sub ask_from_treelist { my ($o, $title, $message, $separator, $l, $def) = @_; ask_from_treelistf($o, $title, $message, $separator, undef, $l, $def); } sub ask_from_treelist_ { my ($o, $title, $message, $separator, $l, $def) = @_; my $transl = sub { join '|', map { translate($_) } split(quotemeta($separator), $_[0]) }; ask_from_treelistf($o, $title, $message, $separator, $transl, $l, $def); } sub ask_from_treelistf { my ($o, $title, $message, $separator, $f, $l, $def) = @_; ask_from($o, $title, $message, [ { val => \$def, separator => $separator, list => $l, format => $f, sort => 1 } ]) or return; $def; } sub ask_many_from_list { my ($o, $title, $message, @l) = @_; @l = grep { @{$_->{list}} } @l or return ''; foreach my $h (@l) { $h->{e}{$_} = { text => may_apply($h->{label}, $_), val => $h->{val} ? $h->{val}->($_) : do { my $i = $h->{value} ? $h->{value}->($_) : $h->{values} ? member($_, @{$h->{values}}) : 0; \$i; }, type => 'bool', help => may_apply($h->{help}, $_, ''), icon => may_apply($h->{icon2f}, $_, ''), } foreach @{$h->{list}}; if ($h->{sort}) { $h->{list} = [ sort { $h->{e}{$a}{text} cmp $h->{e}{$b}{text} } @{$h->{list}} ]; } } $o->ask_from($title, $message, [ map { my $h = $_; map { $h->{e}{$_} } @{$h->{list}} } @l ]) or return; @l = map { my $h = $_; [ grep { ${$h->{e}{$_}{val}} } @{$h->{list}} ]; } @l; wantarray() ? @l : $l[0]; } sub ask_from_entry { my ($o, $title, $message, %callback) = @_; first(ask_from_entries($o, $title, $message, [''], %callback)); } sub ask_from_entries { my ($o, $title, $message, $l, %callback) = @_; my @l = map { my $i = ''; { label => $_, val => \$i } } @$l; $o->ask_from($title, $message, \@l, %callback) ? map { ${$_->{val}} } @l : undef; } sub ask_from__add_modify_remove { my ($o, $title, $message, $l, %callback) = @_; die "ask_from__add_modify_remove only handles one item" if @$l != 1; $callback{$_} or internal_error("missing callback $_") foreach qw(Add Modify Remove); if ($o->can('ask_from__add_modify_removeW')) { $o->ask_from__add_modify_removeW($title, $message, $l, %callback); } else { my $e = $l->[0]; my $chosen_element; put_in_hash($e, { allow_empty_list => 1, val => \$chosen_element, type => 'list' }); while (1) { my $continue; my @l = (@$l, map { my $s = $_; { val => translate($_), clicked_may_quit => sub { my $r = $callback{$s}->($chosen_element); defined $r or return; $continue = 1; } } } N_("Add"), if_(@{$e->{list}} > 0, N_("Modify"), N_("Remove"))); $o->ask_from_({ title => $title, messages => $message, callbacks => \%callback }, \@l) or return; return if !$continue; } } } #- can get a hash of callback: focus_out changed and complete #- moreove if you pass a hash with a field list -> combo #- if you pass a hash with a field hidden -> emulate stty -echo sub ask_from { my ($o, $title, $message, $l, %callback) = @_; ask_from_($o, { title => $title, messages => $message, callbacks => \%callback }, $l); } sub ask_from_normalize { my ($_o, $common, $l) = @_; ref($l) eq 'ARRAY' or internal_error('ask_from_normalize'); foreach my $e (@$l) { if (my $li = $e->{list}) { ref($e->{val}) =~ /SCALAR|REF/ or internal_error($e->{val} ? "field {val} must be a reference (it is $e->{val})" : "field {val} is mandatory"); #-# if ($e->{sort} || @$li > 10 && !exists $e->{sort}) { my @l2 = map { may_apply($e->{format}, $_) } @$li; my @places = sort { $l2[$a] cmp $l2[$b] } 0 .. $#l2; $e->{list} = $li = [ map { $li->[$_] } @places ]; } $e->{type} = 'iconlist' if $e->{icon2f}; $e->{type} = 'treelist' if $e->{separator}; add2hash_($e, { not_edit => 1 }); $e->{type} ||= 'combo'; if (!$e->{not_edit}) { die q(when using "not_edit" you must use strings, not a data structure) if ref ${$e->{val}} || any { ref $_ } @$li; } if ($e->{type} ne 'combo' || $e->{not_edit}) { ${$e->{val}} = $li->[0] if !member(may_apply($e->{format}, ${$e->{val}}), map { may_apply($e->{format}, $_) } @$li); } } elsif ($e->{type} eq 'range') { $e->{min} <= $e->{max} or die "bad range min $e->{min} > max $e->{max} (called from " . join(':', caller()) . ")"; ${$e->{val}} = max($e->{min}, min(${$e->{val}}, $e->{max})); } elsif ($e->{type} eq 'button' || $e->{clicked} || $e->{clicked_may_quit}) { $e->{type} = 'button'; $e->{clicked_may_quit} ||= $e->{clicked} ? sub { $e->{clicked}(); 0 } : sub {}; $e->{val} = \ (my $_v = $e->{val}) if !ref($e->{val}); } elsif ($e->{type} eq 'label' || !ref($e->{val})) { $e->{type} = 'label'; $e->{val} = \ (my $_v = $e->{val}) if !ref($e->{val}); } else { $e->{type} ||= 'entry'; } $e->{disabled} ||= sub { 0 }; } #- don't display empty lists and one element lists @$l = grep { if ($_->{list} && $_->{not_edit} && !$_->{allow_empty_list}) { if (@{$_->{list}} == ()) { eval { require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function log::l("ask_from_normalize: empty list for $_->{label}\n" . backtrace()); }; } @{$_->{list}} > 1; } else { 1; } } @$l; if (!$common->{title} && $::isStandalone) { ($common->{title} = $0) =~ s|.*/||; } $common->{advanced_label} ||= N("Advanced"); $common->{advanced_label_close} ||= N("Basic"); $common->{$_} = [ deref($common->{$_}) ] foreach qw(messages advanced_messages); add2hash_($common->{callbacks} ||= {}, { changed => sub {}, focus_out => sub {}, complete => sub { 0 }, canceled => sub { 0 }, advanced => sub {} }); } sub ask_from_ { my ($o, $common, $l) = @_; ask_from_normalize($o, $common, $l); @$l or return 1; $common->{cancel} = '' if !defined wantarray(); ask_from_real($o, $common, $l); } sub ask_from_no_check { my ($o, $common, $l) = @_; ask_from_normalize($o, $common, $l); $common->{cancel} = '' if !defined wantarray(); $o->ask_fromW($common, partition { !$_->{advanced} } @$l); } sub ask_from_real { my ($o, $common, $l) = @_; my $v = $o->ask_fromW($common, partition { !$_->{advanced} } @$l); %$common = (); $v; } sub ask_browse_tree_info { my ($o, $title, $message, $common) = @_; add2hash_($common, { ok => N("Ok"), cancel => N("Cancel") }); add2hash_($common, { title => $title, message => $message }); add2hash_($common, { grep_allowed_to_toggle => sub { @_ }, grep_unselected => sub { grep { $common->{node_state}($_) eq 'unselected' } @_ }, check_interactive_to_toggle => sub { 1 }, toggle_nodes => sub { my ($set_state, @nodes) = @_; my $new_state = !$common->{grep_unselected}($nodes[0]) ? 'selected' : 'unselected'; $set_state->($_, $new_state) foreach @nodes; }, }); $o->ask_browse_tree_info_refW($common); } sub ask_browse_tree_info_refW { #- default definition, do not use with too many items (memory consuming) my ($o, $common) = @_; my ($l, $v, $h) = ([], [], {}); $common->{build_tree}(sub { my ($node) = $common->{grep_allowed_to_toggle}(@_); if (my $state = $node && $common->{node_state}($node)) { push @$l, $node; $state eq 'selected' and push @$v, $node; $h->{$node} = $state eq 'selected'; } }, 'flat'); add2hash_($common, { list => $l, #- TODO interactivity of toggle is missing values => $v, help => sub { $common->{get_info}($_[0]) }, }); my ($new_v) = $o->ask_many_from_list($common->{title}, $common->{message}, $common) or return; $common->{toggle_nodes}(sub {}, grep { ! delete $h->{$_} } @$new_v); $common->{toggle_nodes}(sub {}, grep { $h->{$_} } keys %$h); 1; } sub wait_message { my ($o, $title, $message, $temp) = @_; my $w = $o->wait_messageW($title, [ N("Please wait"), deref($message) ]); push @tempory::objects, $w if $temp; my $b = before_leaving { $o->wait_message_endW($w) }; #- enable access through set MDK::Common::Func::add_f4before_leaving(sub { $o->wait_message_nextW([ deref($_[1]) ], $w) }, $b, 'set'); $b; } sub kill {} sub helper_separator_tree_to_tree { my ($separator, $list, $formatted_list) = @_; my $sep = quotemeta $separator; my $tree = {}; each_index { my @l = split $sep; my $leaf = pop @l; my $node = $tree; foreach (@l) { $node = $node->{$_} ||= do { my $r = {}; push @{$node->{_order_}}, $_; $r; }; } push @{$node->{_leaves_}}, [ $leaf, $list->[$::i] ]; (); } @$formatted_list; $tree; } 1;