Commit 9aadd503 authored by Joey Hess's avatar Joey Hess

My changes:

  * Added support for task description files.
  * Read in /usr/share/tasksel/debian-tasks.desc as a task description
    file.
  * Added makedesc.pl, a program to generate a task description file from
    a set of task descriptions.
  * Got rid of all the name prettification code since it is no longer used
    anyway.
  * Killed filterdescription, the task packages in woody actually don't
    have that problem anymore.
  * Don't move cursor to the right after a task is selected.
  * Removed unused tasksel.man from source package (keep pod).
  * Fixed an obscure bug if a task package happened to be the last thing in
    the available file.
  * Enable debug mode by default, but turn it off when building from the
    rules file.

Aj's changes:
  * Use "Section:" fields to break tasks into different sections. Have a
    hardcoded list of default sections, with a defined order; remaining
    sections get added to the end, in alphabetical order. Sections that
    don't match "tasks-*" are ignored.
  * "tasksel install foo bar baz" as a replacement for "apt-get install
    task-foo task-bar task-baz"
  * Increase the size of the "apt-get install" command line buffer.
parent b76d82b6
PROGRAM=tasksel
VERSION=\"1.0\"
TASKDESC=debian-tasks.desc
DESCDIR=tasks/
VERSION=1.3
CC=gcc
CFLAGS=-g -Wall #-Os
DEFS=-DVERSION=$(VERSION) -DPACKAGE=\"$(PROGRAM)\" -DLOCALEDIR=\"/usr/share/locale\" -DDEBUG
DEBUG=1
ifeq (0,$(DEBUG))
DEFS=-DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PROGRAM)\" -DLOCALEDIR=\"/usr/share/locale\" \
-DTASKDESC=\"/usr/share/tasksel/$(TASKDESC)\"
else
DEFS=-DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PROGRAM)\" -DLOCALEDIR=\"/usr/share/locale\" \
-DTASKDESC=\"$(TASKDESC)\" -DDEBUG
endif
LIBS=-lslang #-lccmalloc -ldl
OBJS=tasksel.o slangui.o data.o util.o strutl.o
LANGS=cs de hu ja sv pl ru
......@@ -11,7 +20,10 @@ LOCALEDIR=$(DESTDIR)/usr/share/locale
COMPILE = $(CC) $(CFLAGS) $(DEFS) -c
LINK = $(CC) $(CFLAGS) $(DEFS) -o
all: $(PROGRAM)
all: $(PROGRAM) $(TASKDESC)
$(TASKDESC):
perl makedesc.pl $(DESCDIR) $(TASKDESC)
%.o: %.c
$(COMPILE) $<
......@@ -24,7 +36,8 @@ $(PROGRAM): $(OBJS) po/build_stamp
install:
install -m 755 tasksel $(DESTDIR)/usr/bin
pod2man --center "Debian specific manpage" tasksel.pod | gzip -9c > $(DESTDIR)/usr/share/man/man8/tasksel.8.gz
install -m 0644 $(TASKDESC) $(DESTDIR)/usr/share/tasksel
pod2man --center "Debian specific manpage" --release $(VERSION) tasksel.pod | gzip -9c > $(DESTDIR)/usr/share/man/man8/tasksel.8.gz
for lang in $(LANGS); do \
[ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \
install -m 644 po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PROGRAM).mo; \
......@@ -34,6 +47,6 @@ test:
$(MAKE) -C scratch
clean:
rm -f $(PROGRAM) *.o *~
rm -f $(PROGRAM) $(TASKDESC) *.o *~
$(MAKE) -C po clean
$Id: README,v 1.1 1999/11/21 22:01:04 tausq Exp $
$Id: README,v 1.2 2001/05/18 02:02:02 joeyh Rel $
Task Selection UI v0.1
Nov 20, 1999
Randolph Chung <tausq@debian.org>
......@@ -8,11 +8,17 @@ Here's a first cut at a task selection user interface.
The interface GUI is based on libslang. It has no other special library
dependencies.
On startup, the tasksel program will read /var/lib/dpkg/available to
identify task packages (matching "task-*"). These packages will be
presented in a simple list selection screen with their short descriptions.
Users can drill down into the task packages to see detailed descriptions and
some information about the packages in the task.
On startup, the tasksel program will read
/usr/share/tasksel/debian-tasks.desc for information about what tasks are
available and their descriptions and sections. Next it will read
/var/lib/dpkg/available. Task: fields in that file can be used to state
that a package belongs to a task or tasks. Also, the package names are used
to identify task packages (matching "task-*").
The tasks will be presented in a simple list selection screen with
their short descriptions. Users can drill down into the tasks to
see detailed descriptions and some information about the packages in the
task.
On exit, tasksel executes the appropriate apt-get command to install the
selected packages. If the -t option is given, then tasksel prints out the
......
$Id: TODO,v 1.6 2000/01/16 02:55:30 tausq Exp $
$Id: TODO,v 1.7 2001/05/18 02:02:02 joeyh Rel $
- fix screen resize code (in dialogs, it doesn't work right)
- figure out how to fix get the help text i18n'ized
- figure out how to properly install the i18n stuff
- show already installed task packages
- show already installed tasks
This diff is collapsed.
/* $Id: data.h,v 1.5 2001/04/24 06:35:07 tausq Exp $ */
/* $Id: data.h,v 1.6 2001/05/18 02:02:02 joeyh Exp $ */
#ifndef _DATA_H
#define _DATA_H
......@@ -13,7 +13,6 @@ typedef enum {
struct package_t {
char *name;
char *prettyname;
char *shortdesc;
char *longdesc;
int dependscount;
......@@ -22,19 +21,19 @@ struct package_t {
char **recommends;
int suggestscount;
char **suggests;
char *section;
priority_t priority;
int selected;
int pseudopackage;
};
struct packages_t {
int count;
int maxnamelen;
void *packages;
};
struct task_t {
char *name;
char *prettyname;
struct package_t *task_pkg;
char **packages;
int packagescount;
......@@ -44,16 +43,18 @@ struct task_t {
struct tasks_t {
int count;
int maxnamelen;
void *tasks;
};
/* Reads in a list of package and package descriptions */
/* Reads in a list of tasks from task description file */
void taskfile_read(char *fn, struct tasks_t *tasks, struct packages_t *pkgs);
/* Reads in a list of package and package descriptions from available file */
void packages_readlist(struct tasks_t *tasks, struct packages_t *packages);
/* free memory allocated to store packages */
void packages_free(struct tasks_t *tasks, struct packages_t *packages);
struct package_t *packages_find(const struct packages_t *packages, const char *name);
struct task_t *tasks_find(const struct tasks_t *tasks, const char *name);
struct package_t **packages_enumerate(const struct packages_t *packages);
struct task_t **tasks_enumerate(const struct tasks_t *tasks);
......
tasksel (1.3-1) unstable; urgency=low
* Added support for task description files.
* Read in /usr/share/tasksel/debian-tasks.desc as a task description
file.
* Added makedesc.pl, a program to generate a task description file from
a set of task descriptions.
* Got rid of all the name prettification code since it is no longer used
anyway.
* Killed filterdescription, the task packages in woody actually don't
have that problem anymore.
* Don't move cursor to the right after a task is selected.
* Removed unused tasksel.man from source package (keep pod).
* Fixed an obscure bug if a task package happened to be the last thing in
the available file.
* Enable debug mode by default, but turn it off when building from the
rules file.
-- Joey Hess <joeyh@debian.org> Thu, 17 May 2001 14:47:06 -0400
tasksel (1.2-1) unstable; urgency=low
* Use "Section:" fields to break tasks into different sections. Have a
hardcoded list of default sections, with a defined order; remaining
sections get added to the end, in alphabetical order. Sections that
don't match "tasks-*" are ignored.
* "tasksel install foo bar baz" as a replacement for "apt-get install
task-foo task-bar task-baz"
* Increase the size of the "apt-get install" command line buffer.
-- Anthony Towns <aj@azure.humbug.org.au> Tue, 15 May 2001 15:02:01 +1000
tasksel (1.1-1) unstable; urgency=low
* Support "Task:" headers to include a package in a task.
......
......@@ -2,7 +2,7 @@ Source: tasksel
Section: base
Priority: optional
Maintainer: Randolph Chung <tausq@debian.org>
Standards-Version: 3.0.1.1
Standards-Version: 3.5.4.0
Package: tasksel
Architecture: any
......
usr/bin
usr/share/man/man8
usr/share/locale
usr/share/tasksel
......@@ -21,7 +21,7 @@ build-stamp:
dh_testdir
# Add here commands to compile the package.
$(MAKE)
$(MAKE) DEBUG=0
touch build-stamp
......
#!/usr/bin/perl
#
# makedesc directory file
#
# Scan the directory for files, and use the files to generate a task
# description file. The format of the task description file is described in
# tata.c. The format of the input files is:
#
# Task: desktop
# Section: user
# Description: Provide a basic GUI system
# This task provides functionality for a basic desktop; whether Gnome
# based, KDE based or customised. With this task, your system will boot
# into a graphical login screen, at which point you can choose which of
# these desktops you wish to use on a per-user basis. You can further
# customise your desktop once installed.
# Packages:
# kdebase
# gdm
# ...
#
# Hash-comments are allowed in the files, but must be on their own lines.
my $dir=shift or die "no directory specified\n";
my $file=shift or die "no file specified\n";
open (OUT, ">$file") or die ">$file: $!";
use File::Find;
find(\&processfile, $dir);
sub processfile {
return unless /^[-_.A-Za-z0-9]+$/ and -f $_;
open (IN, $_) or die "$_: $!";
my %fields;
my $field="";
while (<IN>) {
chomp;
next if /^\s*#/;
if (/^\s/) {
$fields{$field}.="\n$_";
}
else {
($field, my $value)=split(/:\s*/, $_, 2);
$field=lc($field);
$fields{$field}=$value;
}
}
close IN;
print OUT map { ucfirst($_).": ".$fields{$_}."\n" }
qw{task section description};
print OUT "\n";
}
close OUT;
This diff is collapsed.
# Comment.
Task: demo
Section: misc
Description: demo new style task
This is a demo new style task. It is not intended to ship with debian,
# Let's make sure a comment can go here.
really.
Packages:
kdebase
gdm
# Comment.
Task: demo2
Section: misc
Description: another demo new style task
This is a demo new style task. It is not intended to ship with debian,
# Let's make sure a comment can go here.
really.
Packages:
kdebase
gdm
/* $Id: tasksel.c,v 1.10 2001/04/24 06:35:07 tausq Exp $ */
/* $Id: tasksel.c,v 1.11 2001/05/18 02:02:02 joeyh Exp $ */
#include "tasksel.h"
#include <stdio.h>
......@@ -45,7 +45,7 @@ int doinstall(struct task_t **tasklist, int taskcount,
{
int i, c = 0;
FILE *todpkg;
char buf[8192];
char buf[20480];
if (queueinstalls) {
if (testmode)
......@@ -63,7 +63,7 @@ int doinstall(struct task_t **tasklist, int taskcount,
for (i = 0; i < taskcount; i++) {
if (tasklist[i]->selected > 0) {
int j;
if (tasklist[i]->task_pkg) {
if (tasklist[i]->task_pkg && ! tasklist[i]->task_pkg->pseudopackage) {
fprintf(todpkg, "%s install\n", tasklist[i]->task_pkg->name);
}
for (j = 0; j < tasklist[i]->packagescount; j++) {
......@@ -92,7 +92,7 @@ int doinstall(struct task_t **tasklist, int taskcount,
if (tasklist[i]->selected > 0) {
int j;
/* TODO check buffer overflow; not likely, but still... */
if (tasklist[i]->task_pkg) {
if (tasklist[i]->task_pkg && ! tasklist[i]->task_pkg->pseudopackage) {
strcat(buf, tasklist[i]->task_pkg->name);
strcat(buf, " ");
}
......@@ -149,7 +149,15 @@ int main(int argc, char * const argv[])
}
}
/* Initialization */
memset(&packages, 0, sizeof(struct packages_t));
memset(&tasks, 0, sizeof(struct tasks_t));
/* Must read packages first. */
packages_readlist(&tasks, &packages);
/* TODO: should probably read in all files in a directory. */
taskfile_read(TASKDESC, &tasks, &packages);
if (tasks.count == 0) {
fprintf(stderr, _("No task packages found on this system.\nDid you update your available file?"));
......@@ -176,6 +184,23 @@ int main(int argc, char * const argv[])
}
tasklist = tasks_enumerate(&tasks);
if (noninteractive) {
if (optind + 1 < argc && strcmp(argv[optind], "install") == 0) {
for (optind++; optind < argc; optind++) {
/* mark task argv[optind] for install, if it exists */
int i;
for (i = 0; i < tasks.count; i++) {
if (strcmp(tasklist[i]->name, argv[optind]) == 0) break;
}
if (i == tasks.count) {
printf("E: %s: no such task\n", argv[optind]);
} else {
tasklist[i]->selected = 1;
}
}
}
}
if (r == 0) {
r = doinstall(tasklist, tasks.count,
pkglist, (installreqd || installimp || installstd
......
.rn '' }`
''' $RCSfile: tasksel.man,v $$Revision: 1.1 $$Date: 1999/12/29 16:10:01 $
'''
''' $Log: tasksel.man,v $
''' Revision 1.1 1999/12/29 16:10:01 tausq
''' man pages, debian packaging scripts
'''
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R
.fi
..
'''
'''
''' Set up \*(-- to give an unbreakable dash;
''' string Tr holds user defined translation string.
''' Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
''' \*(L" and \*(R", except that they are used on ".xx" lines,
''' such as .IP and .SH, which do another additional levels of
''' double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\" If the F register is turned on, we'll generate
.\" index entries out stderr for the following things:
.\" TH Title
.\" SH Header
.\" Sh Subsection
.\" Ip Item
.\" X<> Xref (embedded
.\" Of course, you have to process the output yourself
.\" in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH TASKSEL 1 "perl 5.005, patch 03" "15/Dec/1999" "User Contributed Perl Documentation"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
. \" AM - accent mark definitions
.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds ? ?
. ds ! !
. ds /
. ds q
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u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3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds v \h'-1'\o'\(aa\(ga'
. ds _ \h'-1'^
. ds . \h'-1'.
. ds 3 3
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
. ds oe oe
. ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
tasksel \- a user interface for installing task packages
.SH "SYNOPSIS"
tasksel
.SH "DESCRIPTION"
tasksel shows all available task packages and allows to user to select
ones to install
.SH "SEE ALSO"
\fIdpkg\fR\|(8), apt-\fIget\fR\|(8)
.SH "FILES"
\fI/var/lib/dpkg/available\fR
.SH "AUTHOR"
tasksel was written by Randolph Chung <tausq@debian.org>.
.SH "HISTORY"
This document first appeared with tasksel-1.0
.rn }` ''
.IX Title "TASKSEL 1"
.IX Name "tasksel - a user interface for installing task packages"
.IX Header "NAME"
.IX Header "SYNOPSIS"
.IX Header "DESCRIPTION"
.IX Header "SEE ALSO"
.IX Header "FILES"
.IX Header "AUTHOR"
.IX Header "HISTORY"
......@@ -8,7 +8,7 @@ tasksel
=head1 DESCRIPTION
tasksel shows all available task packages and allows to user to select
tasksel shows all available tasks and allows to user to select
ones to install
=head1 SEE ALSO
......@@ -17,6 +17,7 @@ dpkg(8), apt-get(8)
=head1 FILES
F</usr/share/tasksel/debian-tasks.desc>
F</var/lib/dpkg/available>
=head1 AUTHOR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment