1""" 

2Put descriptions into sections table 

3 

4@contact: Debian FTP Master <ftpmaster@debian.org> 

5@copyright: 2020, Joerg Jaspert <joerg@debian.org> 

6@license: GNU General Public License version 2 or later 

7""" 

8 

9# This program is free software; you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation; either version 2 of the License, or 

12# (at your option) any later version. 

13 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18 

19# You should have received a copy of the GNU General Public License 

20# along with this program; if not, write to the Free Software 

21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 

22 

23################################################################################ 

24 

25import psycopg2 

26from daklib.dak_exceptions import DBUpdateError 

27 

28################################################################################ 

29 

30sections = { 

31 'admin': {'desc': 'Administration Utilities"', 'longdesc': 'Utilities to administer system resources, manage user accounts, etc.'}, 

32 'cli-mono': {'desc': 'Mono/CLI', 'longdesc': 'Everything about Mono and the Common Language Infrastructure.'}, 

33 'comm': {'desc': 'Communication Programs', 'longdesc': 'Software to use your modem in the old fashioned style.'}, 

34 'database': {'desc': 'Databases', 'longdesc': 'Database Servers and Clients.'}, 

35 'debian-installer': {'desc': 'debian-installer udeb packages', 'longdesc': 'Special packages for building customized debian-installer variants. Do not install them on a normal system!'}, 

36 'debug': {'desc': 'Debug packages', 'longdesc': 'Packages providing debugging information for executables and shared libraries.'}, 

37 'devel': {'desc': 'Development', 'longdesc': 'Development utilities, compilers, development environments, libraries, etc.'}, 

38 'doc': {'desc': 'Documentation', 'longdesc': 'FAQs, HOWTOs and other documents trying to explain everything related to Debian, and software needed to browse documentation (man, info, etc).'}, 

39 'editors': {'desc': 'Editors', 'longdesc': 'Software to edit files. Programming environments.'}, 

40 'education': {'desc': 'Education', 'longdesc': 'Software for learning and teaching'}, 

41 'electronics': {'desc': 'Electronics', 'longdesc': 'Electronics utilities.'}, 

42 'embedded': {'desc': 'Embedded software', 'longdesc': 'Software suitable for use in embedded applications.'}, 

43 'fonts': {'desc': 'Fonts', 'longdesc': 'Font packages.'}, 

44 'games': {'desc': 'Games', 'longdesc': 'Programs to spend a nice time with after all this setting up.'}, 

45 'gnome': {'desc': 'GNOME', 'longdesc': 'The GNOME desktop environment, a powerful, easy to use set of integrated applications.'}, 

46 'gnu-r': {'desc': 'GNU R', 'longdesc': 'Everything about GNU R, a statistical computation and graphics system.'}, 

47 'gnustep': {'desc': 'GNUstep', 'longdesc': 'The GNUstep environment.'}, 

48 'golang': {'desc': 'Go', 'longdesc': 'Go programming language, libraries, and development tools.'}, 

49 'graphics': {'desc': 'Graphics', 'longdesc': 'Editors, viewers, converters... Everything to become/be an artist.'}, 

50 'hamradio': {'desc': 'Ham Radio', 'longdesc': 'Software for ham radio.'}, 

51 'haskell': {'desc': 'Haskell', 'longdesc': 'Everything about Haskell.'}, 

52 'httpd': {'desc': 'Web Servers', 'longdesc': 'Web servers and their modules.'}, 

53 'interpreters': {'desc': 'Interpreters', 'longdesc': 'All kind of interpreters for interpreted languages. Macro processors.'}, 

54 'introspection': {'desc': 'Introspection', 'longdesc': 'Machine readable introspection data for use by development tools.'}, 

55 'java': {'desc': 'Java', 'longdesc': 'Everything about Java.'}, 

56 'javascript': {'desc': 'JavaScript', 'longdesc': 'JavaScript programming language, libraries, and development tools.'}, 

57 'kde': {'desc': 'KDE', 'longdesc': 'The K Desktop Environment, a powerful, easy to use set of integrated applications.'}, 

58 'kernel': {'desc': 'Kernels', 'longdesc': 'Operating System Kernels and related modules.'}, 

59 'libdevel': {'desc': 'Library development', 'longdesc': 'Libraries necessary for developers to write programs that use them.'}, 

60 'libs': {'desc': 'Libraries', 'longdesc': 'Libraries to make other programs work. They provide special features to developers.'}, 

61 'lisp': {'desc': 'Lisp', 'longdesc': 'Everything about Lisp.'}, 

62 'localization': {'desc': 'Language packs', 'longdesc': 'Localization support for big software packages.'}, 

63 'mail': {'desc': 'Mail', 'longdesc': 'Programs to route, read, and compose E-mail messages.'}, 

64 'math': {'desc': 'Mathematics', 'longdesc': 'Math software.'}, 

65 'metapackages': {'desc': 'Meta Packages', 'longdesc': 'Packages that mainly provide dependencies on other packages.'}, 

66 'misc': {'desc': 'Miscellaneous', 'longdesc': "Miscellaneous utilities that didn't fit well anywhere else."}, 

67 'net': {'desc': 'Network', 'longdesc': 'Daemons and clients to connect your system to the world.'}, 

68 'news': {'desc': 'Newsgroups', 'longdesc': 'Software to access Usenet, to set up news servers, etc.'}, 

69 'ocaml': {'desc': 'OCaml', 'longdesc': 'Everything about OCaml, an ML language implementation.'}, 

70 'oldlibs': {'desc': 'Old Libraries', 'longdesc': 'Old versions of libraries, kept for backward compatibility with old applications.'}, 

71 'otherosfs': {'desc': "Other OS's and file systems", 'longdesc': 'Software to run programs compiled for other operating systems, and to use their filesystems.'}, 

72 'perl': {'desc': 'Perl', 'longdesc': 'Everything about Perl, an interpreted scripting language.'}, 

73 'php': {'desc': 'PHP', 'longdesc': 'Everything about PHP.'}, 

74 'python': {'desc': 'Python', 'longdesc': 'Everything about Python, an interpreted, interactive object oriented language.'}, 

75 'raku': {'desc': 'Raku', 'longdesc': 'Everything about Raku, an interpreted scripting language.'}, 

76 'ruby': {'desc': 'Ruby', 'longdesc': 'Everything about Ruby, an interpreted object oriented language.'}, 

77 'rust': {'desc': 'Rust', 'longdesc': 'Rust programming language, library crates, and development tools.'}, 

78 'science': {'desc': 'Science', 'longdesc': 'Basic tools for scientific work'}, 

79 'shells': {'desc': 'Shells', 'longdesc': 'Command shells. Friendly user interfaces for beginners.'}, 

80 'sound': {'desc': 'Sound', 'longdesc': 'Utilities to deal with sound: mixers, players, recorders, CD players, etc.'}, 

81 'tasks': {'desc': 'Tasks', 'longdesc': "Packages that are used by 'tasksel', a simple interface for users who want to configure their system to perform a specific task."}, 

82 'tex': {'desc': 'TeX', 'longdesc': 'The famous typesetting software and related programs.'}, 

83 'text': {'desc': 'Text Processing', 'longdesc': 'Utilities to format and print text documents.'}, 

84 'utils': {'desc': 'Utilities', 'longdesc': 'Utilities for file/disk manipulation, backup and archive tools, system monitoring, input systems, etc.'}, 

85 'vcs': {'desc': 'Version Control Systems', 'longdesc': 'Version control systems and related utilities.'}, 

86 'video': {'desc': 'Video', 'longdesc': 'Video viewers, editors, recording, streaming.'}, 

87 'web': {'desc': 'Web Software', 'longdesc': 'Web servers, browsers, proxies, download tools etc.'}, 

88 'x11': {'desc': 'X Window System software', 'longdesc': 'X servers, libraries, window managers, terminal emulators and many related applications.'}, 

89 'xfce': {'desc': 'Xfce', 'longdesc': 'Xfce, a fast and lightweight Desktop Environment.'}, 

90 'zope': {'desc': 'Zope/Plone Framework', 'longdesc': 'Zope Application Server and Plone Content Managment System.'}, 

91} 

92 

93 

94def do_update(self): 

95 """ 

96 Update default settings for suites 

97 """ 

98 print(__doc__) 

99 try: 

100 c = self.db.cursor() 

101 

102 c.execute(""" 

103 ALTER TABLE section 

104 ADD COLUMN description TEXT NOT NULL DEFAULT 'Missing shortdesc', 

105 ADD COLUMN longdesc TEXT NOT NULL DEFAULT 'Missing longdesc' 

106 """) 

107 

108 for section in sections: 

109 c.execute("UPDATE section SET description=%s, longdesc=%s WHERE section=%s", (section, sections[section]["desc"], sections[section]["longdesc"])) 

110 c.execute("UPDATE section SET description=%s, longdesc=%s WHERE section=CONCAT('contrib/', %s)", (section, sections[section]["desc"], sections[section]["longdesc"])) 

111 c.execute("UPDATE section SET description=%s, longdesc=%s WHERE section=CONCAT('non-free-firmware/', %s)", (section, sections[section]["desc"], sections[section]["longdesc"])) 

112 c.execute("UPDATE section SET description=%s, longdesc=%s WHERE section=CONCAT('non-free/', %s)", (section, sections[section]["desc"], sections[section]["longdesc"])) 

113 

114 c.execute("UPDATE config SET value = '124' WHERE name = 'db_revision'") 

115 self.db.commit() 

116 

117 except psycopg2.ProgrammingError as msg: 

118 self.db.rollback() 

119 raise DBUpdateError('Unable to apply sick update 124, rollback issued. Error message : %s' % (str(msg)))