qi.texi 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184
  1. \input texinfo @c -*-texinfo-*-
  2. @comment $Id@w{$}
  3. @comment %**start of header
  4. @setfilename qi.info
  5. @settitle Qi user guide
  6. @documentencoding ISO-8859-1
  7. @syncodeindex pg cp
  8. @comment %**end of header
  9. @set VERSION 1.3
  10. @set UPDATED 10 Sep 2019
  11. @copying
  12. This user guide is for Qi (version @value{VERSION},
  13. @value{UPDATED}), which is a simple but well-integrated package manager.
  14. Copyright @copyright{} 2019 Matias Andres Fonzo, Santiago del Estero,
  15. Argentina.
  16. @quotation
  17. Permission is granted to copy, distribute and/or modify this document
  18. under the terms of the GNU Free Documentation License, Version 1.3 or
  19. any later version published by the Free Software Foundation; with no
  20. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  21. Texts. A copy of the license is included in the section entitled
  22. ``GNU Free Documentation License''.
  23. @end quotation
  24. @end copying
  25. @dircategory Package management
  26. @direntry
  27. * Qi: (qi). A user-friendly package manager.
  28. @end direntry
  29. @titlepage
  30. @finalout
  31. @title Qi
  32. @subtitle for version @value{VERSION}, @value{UPDATED}
  33. @author Matias Fonzo (@email{selk@@dragora.org})
  34. @page
  35. @vskip 0pt plus 1filll
  36. @insertcopying
  37. @end titlepage
  38. @contents
  39. @ifnottex
  40. @node Top
  41. @top
  42. This user guide is for Qi (version @value{VERSION},
  43. @value{UPDATED}).
  44. @end ifnottex
  45. @menu
  46. * Introduction:: Description and features of qi
  47. * Invoking qi:: Command-line options
  48. * The qirc file:: Configuration file
  49. * Packages:: Managing packages
  50. * Recipes:: Building packages
  51. * Order files:: Handling build order
  52. * Creating packages:: Making Qi packages
  53. * Examining packages:: Debugging purposes
  54. * Exit status:: Exit codes
  55. * Index::
  56. @end menu
  57. @sp 1
  58. Copyright (C) 2019 Matias Fonzo.
  59. Qi's home page can be found at @uref{http://www.dragora.org}.
  60. @w{Send bug reports or suggestions to @email{dragora-users@@nongnu.org}.}
  61. @node Introduction
  62. @chapter Introduction
  63. @cindex introduction
  64. Qi is a simple but well-integrated package manager. It can create,
  65. install, remove, and upgrade software packages. Qi produces binary
  66. packages using recipes, which are files containing specific instructions
  67. to build each package from source. Qi can manage multiple packages
  68. under a single directory hierarchy. This method allows to maintain a set
  69. of packages and multiple versions of them. This means that Qi could be
  70. used as the main package manager or complement the existing one.
  71. Qi offers a friendly command line interface, a global configuration
  72. file, a simple recipe layout to deploy software packages; also works
  73. with binary packages in parallel, speeding up installations and packages
  74. in production. The format used for packages is a simplified but safe
  75. POSIX pax archive compressed with lzip.
  76. Qi is a modern (POSIX-compliant) shell script released under the
  77. terms of the GNU General Public License. There are only two major
  78. dependencies for the magic: graft(1) and tarlz(1), the rest is expected
  79. to be found in any Unix-like system.
  80. @node Invoking qi
  81. @chapter Invoking qi
  82. @cindex invocation
  83. This chapter describes the synopsis and command line options for
  84. invoke Qi.
  85. @example
  86. Usage: qi [@var{OPTION}]... [@var{FILE}]...
  87. @end example
  88. @noindent
  89. One mandatory option specifies the operation that @samp{qi} should
  90. perform, other options are meant to detail how this operation should be
  91. performed.
  92. @noindent
  93. qi supports the following options to operate:
  94. @table @code
  95. @item -b
  96. Build package using recipe names.
  97. @item -c
  98. Create .tlz package from directory.
  99. @item -d
  100. Delete packages.
  101. @item -i
  102. Install packages.
  103. @item -o
  104. Resolve build order through .order files.
  105. @item -u
  106. Update packages (implies -i, -d and -p options).
  107. @item -w
  108. Warn about files that will be linked.
  109. @item -x
  110. Extract a package for debugging purposes.
  111. @end table
  112. @noindent
  113. There are common options between modes:
  114. @table @code
  115. @item -N
  116. Do not read the configuration file.
  117. This will ignore any value in the qirc file.
  118. @item -P <DIR>
  119. Package directory for installations.
  120. This option sets @samp{$@{packagedir@}}.
  121. Only valid for -i, -d, or -u options.
  122. @item -f
  123. Force option.
  124. This option can force the build of a recipe, or force the update of a
  125. pre-existing package.
  126. Only valid for -b, -u options.
  127. @item -t <DIR>
  128. Target directory for symbolic links.
  129. This option sets @samp{$@{targetdir@}}.
  130. Only valid for -i, -d, or -u options.
  131. @item -k
  132. Keep (don't delete) @samp{$@{srcdir@}} or @samp{$@{destdir@}} in build
  133. mode, keep (don't delete) package directory in delete mode.
  134. Only valid for -b, -d or -u options.
  135. @item -p
  136. Prune conflicts on package installations.
  137. This option may proceed with the package installation if one or more
  138. conflicts occur.
  139. @item -r /rootdir
  140. Use the fully qualified named directory as the root directory for all qi
  141. operations. The target directory and package directory will be relative
  142. to the specified directory, including the log file for graft.
  143. @item -v
  144. Be verbose (a 2nd -v gives more).
  145. @end table
  146. @noindent
  147. Options for build mode (-b):
  148. @table @code
  149. @item -O <DIR>
  150. Where the packages produced are written.
  151. This option sets @samp{$@{outdir@}}.
  152. @item -W <DIR>
  153. Where archives, patches, and recipes are expected.
  154. This option sets @samp{$@{worktree@}}.
  155. @item -Z <DIR>
  156. Where (compressed) sources will be found.
  157. This option sets @samp{$@{tardir@}}.
  158. @item -a
  159. Architecture to use.
  160. Default value is obtained via uname(1) as @samp{uname -m}.
  161. @item -j
  162. Parallel jobs for the compiler.
  163. If not specified, default sets to 1.
  164. @item -1
  165. Increment release number (@samp{$@{release@}} + 1).
  166. It will be omitted if the -n option is being used.
  167. @item -n
  168. Don't create a .tlz package.
  169. @item -S
  170. Selects the option to skip completed recipes.
  171. This means, in interactive mode, when the dialog
  172. to summarize recipes is shown.
  173. @end table
  174. @noindent
  175. Informative options:
  176. @table @code
  177. @item -L
  178. Print default directory locations.
  179. This will print the target directory, package directory, working tree,
  180. the directory for tarballs, and the output directory for the packages
  181. produced.
  182. @item -h
  183. Display the help describing the options and then exit.
  184. @item -V
  185. Print the version number and license information.
  186. The version number should be included in all bug reports.
  187. @end table
  188. @noindent
  189. Expected non-option arguments are package directories and regular files:
  190. recipes or files ending in .tlz, .order. When FILE is -, qi can read from
  191. the standard input. See examples in @ref{Packages}.
  192. @node The qirc file
  193. @chapter The qirc file
  194. @cindex configuration file
  195. The global @file{qirc} file offers a way to define variables and tools
  196. (such as a download manager) for default use. This file is used by qi
  197. at runtime, e.g., to build, install, remove or upgrade packages.
  198. @noindent
  199. It has the following rules:
  200. @itemize @bullet
  201. @item Variables must be declared as @samp{name=value}.
  202. @item Declaration of values should only take one line, no line break.
  203. @item For security reasons, assignments like @samp{name=$var} are only
  204. interpreted as literal.
  205. @end itemize
  206. @noindent
  207. The command line options related to the package directory and target
  208. directory plus some of the options used for the build mode can override
  209. some values in @file{qirc}. See @ref{Invoking qi}.
  210. @noindent
  211. The order in which qi looks for this file is:
  212. @enumerate
  213. @item
  214. @env{$@{HOME@}/.qirc}
  215. @- Effective user.
  216. @item
  217. @samp{$@{sysconfdir@}/qirc}
  218. @- System-wide.
  219. @end enumerate
  220. If you intend to run qi as effective user, the file
  221. @samp{$@{sysconfdir@}/qirc} could be copied to @env{$@{HOME@}/.qirc}
  222. setting the paths for @samp{$@{packagedir@}} and @samp{$@{targetdir@}}
  223. according to the @env{$HOME}.
  224. @node Packages
  225. @chapter Packages
  226. @cindex managing packages
  227. A package is a suite of programs usually distributed in binary form
  228. which may also contain manual pages, documentation, or any other file
  229. associated to a specific software.
  230. The package format used by qi is a simplified POSIX pax archive
  231. compressed with lzip. The file extension for packages is @samp{.tlz}.
  232. @noindent
  233. Both package installation and package de-installation are managed using
  234. two important (internal) variables: @samp{$@{packagedir@}} and
  235. @samp{$@{targetdir@}}, these values can be changed in the
  236. configuration file or via options.
  237. @samp{$@{packagedir@}} is a common directory tree where the package
  238. contents will be decompressed (will reside).
  239. @samp{$@{targetdir@}} is a target directory where the links will be
  240. made by graft(1) taking @samp{$@{packagedir@}/package_name} into account.
  241. @noindent
  242. Packages are installed in self-contained directory trees and symbolic
  243. links from a common area are made to the package files. This allows
  244. multiple versions of the same package to coexist on the same system.
  245. @section Package conflicts
  246. @cindex package conflicts
  247. All the links to install or remove a package are handled by graft(1).
  248. Since multiple packages can be installed or removed at the same time,
  249. certain conflicts may arise between the packages.
  250. @noindent
  251. graft@footnote{The official guide for Graft can be found at
  252. @url{http://peters.gormand.com.au/Home/tools/graft/graft.html}.}
  253. defines a CONFLICT as one of the following conditions:
  254. @itemize @bullet
  255. @item
  256. If the package object is a directory and the target object exists but is
  257. not a directory.
  258. @item
  259. If the package object is not a directory and the target object exists
  260. and is not a symbolic link.
  261. @item
  262. If the package object is not a directory and the target object exists
  263. and is a symbolic link to something other than the package object.
  264. @end itemize
  265. @noindent
  266. The default behavior of qi for an incoming package is to ABORT if a
  267. conflict arises. When a package is going to be deleted, qi tells to
  268. graft(1) to remove those parts that are not in conflict, leaving the
  269. links to the belonging package. This behavior can be forced if the
  270. -p option is given.
  271. @section Installing packages
  272. @cindex package installation
  273. To install a single package, simply type:
  274. @example
  275. qi -i coreutils-8.30-i586+1.tlz
  276. @end example
  277. @noindent
  278. To install multiple packages at once, type:
  279. @example
  280. qi -i gcc-8.3.0-i586+1.tlz rafaela-2.2-i586+1.tlz ...
  281. @end example
  282. @noindent
  283. Warn about the files that will be linked:
  284. @example
  285. qi -w bash-5.0-i586+1.tlz
  286. @end example
  287. This is to verify the content of a package before installing it.
  288. @noindent
  289. See the process of an installation (very verbose):
  290. @example
  291. qi -i -v mariana-3.0-i586+1.tlz
  292. @end example
  293. A second -v gives more.
  294. @noindent
  295. Installing package in a different location:
  296. @example
  297. qi -r /media/floppy -i lzip-1.21-i586+1.tlz
  298. @end example
  299. The -r option assumes @samp{$@{targetdir@}} and @samp{$@{packagedir@}}.
  300. See:
  301. @example
  302. qi -r /home/selk -P /pkgs -t / -i lzip-1.21-i586+1.tlz
  303. @end example
  304. In this case the content of "lzip-1.21-i586+1.tlz" will be decompressed
  305. into @samp{/home/selk/pkgs/lzip-1.21-i586+1}. Assuming that the main
  306. binary for lzip is under @samp{/home/selk/pkgs/lzip-1.21-i586+1/usr/bin/}
  307. the target for "usr/bin" will be created at @samp{/home/selk}. Considering
  308. that you have exported the @env{PATH} as @samp{$@{HOME@}/usr/bin}, now the
  309. system is able to see the recent lzip.
  310. @noindent
  311. Installing from a list of packages using standard input:
  312. @example
  313. cat FILELIST.txt | qi -i -
  314. @end example
  315. The list of packages must contain full path names to be passed in the
  316. installation, e.g.:
  317. /var/cache/qi/packages/x86_64/devel/tcl-8.6.9-x86_64+1.tlz
  318. /var/cache/qi/packages/x86_64/devel/tk-8.6.9.1-x86_64+1.tlz
  319. /var/cache/qi/packages/x86_64/devel/vala-0.42.3-x86_64+1.tlz
  320. @section Removing packages
  321. @cindex package de-installation
  322. To remove a package, simply type:
  323. @example
  324. qi -d xz-5.2.4-i586+1.tlz
  325. @end example
  326. @noindent
  327. Delete mode will match the package name using @samp{$@{packagedir@}} as
  328. prefix. For example, if the value of @samp{$@{packagedir@}} is set to
  329. /usr/local/pkgs, this will be equal to:
  330. @example
  331. qi -d /usr/local/pkgs/xz-5.2.4-i586+1
  332. @end example
  333. @noindent
  334. Detailed output (very verbose):
  335. @example
  336. qi -d -v /usr/local/pkgs/xz-5.2.4-i586+1
  337. @end example
  338. A second -v gives more.
  339. @noindent
  340. By default the delete mode does not preserve a package directory after
  341. removing its links from @samp{$@{targetdir@}}, but this behavior can be
  342. changed if the -k option is passed:
  343. @example
  344. qi -d -k /usr/local/pkgs/lzip-1.21-i586+1
  345. @end example
  346. This means that the links to the package can be reactivated, later:
  347. @example
  348. cd /usr/local/pkgs && graft -i lzip-1.21-i586+1
  349. @end example
  350. @noindent
  351. Removing package from a different location:
  352. @example
  353. qi -r /home/cthulhu -P /pkgs -t / -d xz-5.2.4-i586+1
  354. @end example
  355. @noindent
  356. Removing a package using standard input:
  357. @example
  358. echo "vala-0.42.3-x86_64+1" | qi -d -
  359. @end example
  360. This will match with the package directory.
  361. @section Upgrading packages
  362. @cindex package upgrade
  363. The upgrade mode inherits the properties of the installation and removal
  364. process. To make sure that a package is updated, the package is installed
  365. in a temporary directory taking @samp{$@{packagedir@}} into account. Once
  366. the incoming package is pre-installed, qi can proceed to search and delete
  367. packages that have the same name (considered as previous ones). Finally,
  368. the package is re-installed at its final location and the temporary
  369. directory is removed.
  370. @noindent
  371. To upgrade a package, just type:
  372. @example
  373. qi -u gcc-9.0.1-i586+1.tlz
  374. @end example
  375. This will proceed to update "gcc-9.0.1-i586+1" removing other versions
  376. of "gcc" (if any).
  377. @noindent
  378. If you want to keep the package directories of versions found during the
  379. upgrade process, just pass:
  380. @example
  381. qi -u -k gcc-9.0.1-i586+1.tlz
  382. @end example
  383. @noindent
  384. To see the upgrade process (very verbose):
  385. @example
  386. qi -u -v gcc-9.0.1-i586+1.tlz
  387. @end example
  388. A second -v gives more.
  389. @noindent
  390. To force the upgrade of an existing package:
  391. @example
  392. qi -u -f gcc-9.0.1-i586+1.tlz
  393. @end example
  394. @subsection Package blacklist
  395. @cindex package blacklist
  396. To implement general package facilities, either to install, remove or
  397. maintain the hierarchy of packages in a clean manner, qi makes use of the
  398. pruning operation via graft(1):
  399. There is a risk if those are crucial packages for the proper functioning
  400. of the system, because it implies the deactivation of symbolic from the
  401. target directory, @emph{especially} when transitioning an incoming package
  402. into its final location during upgrade.
  403. @noindent
  404. A blacklist of package names has been devised for the case where
  405. a user decides to upgrade all packages in the system, or
  406. just the crucial ones, such as the C library.
  407. The blacklist is related to the upgrade mode only, consists in installing
  408. a package instead of updating it or removing previous versions of it;
  409. the content of the package will be updated over the existing content at
  410. @samp{$@{packagedir@}}, while the existing links from
  411. @samp{$@{targetdir@}} will be preserved. A pruning of links will be
  412. carried out in order to re-link possible differences with the recent
  413. content, this helps to avoid leaving dead links in the target directory.
  414. @noindent
  415. Since the upgrade mode is also used to install a new package, the mechanism
  416. for blacklist is to install a declared package if it does not already
  417. exist. If it already exists, it is verified that the binary package is
  418. newer than the package directory in order to perform an update.
  419. Package names for the blacklist can be set from the configuration file.
  420. @node Recipes
  421. @chapter Recipes
  422. @cindex recipes
  423. A recipe is a file telling qi what to do. Most often, the recipe tells
  424. qi how to build a binary package from a source tarball.
  425. A recipe has two parts: a list of variable definitions and a list of
  426. sections. By convention, the syntax of a section is:
  427. @example
  428. section_name()
  429. @{
  430. section lines
  431. @}
  432. @end example
  433. The section name is followed by parentheses, one newline and an opening
  434. brace. The line finishing the section contains just a closing brace.
  435. The section names or the function names currently recognized are
  436. @samp{build}.
  437. The @samp{build} section is an augmented shell script. This is the main
  438. section (or @strong{shell function}) which contains the instructions to
  439. build and produce a package.
  440. @section Variables
  441. @cindex variables
  442. A "variable" is a @strong{shell variable} defined either in @file{qirc}
  443. or in a recipe to represent a string of text, called the variable's
  444. "value". These values are substituted by explicit request in the
  445. definitions of other variables or in calls to external commands.
  446. Variables can represent lists of file names, options to pass to
  447. compilers, programs to run, directories to look in for source files,
  448. directories to write output to, or anything else you can imagine.
  449. Definitions of variables in qi have four levels of precedence.
  450. Options which define variables from the command-line override those
  451. specified in the @file{qirc} file, while variables defined in the recipe
  452. override those specified in @file{qirc}, taking priority over those
  453. variables set by command-line options. Finally, the variables have
  454. default values if they are not defined anywhere.
  455. Options that set variables through the command-line can only reference
  456. variables defined in @file{qirc} and variables with default values.
  457. Definitions of variables in @file{qirc} can only reference variables
  458. previously defined in @file{qirc} and variables with default values.
  459. Definitions of variables in the recipe can only reference variables
  460. set by the command-line, variables previously defined in the recipe,
  461. variables defined in @file{qirc}, and variables with default values.
  462. @section Special variables
  463. @cindex special variables
  464. There are variables which can only be set using the command line options or
  465. via @file{qirc}, there are other special variables which can be defined or
  466. redefined in a recipe. See the following definitions:
  467. @samp{outdir} is the directory where the packages produced are written.
  468. This variable can not be redefined in the recipe. Default sets to
  469. @samp{/var/cache/qi/packages}.
  470. @samp{worktree} is the working tree where archives, patches, and recipes
  471. are expected. This variable can not be redefined in the recipe. Default
  472. sets to @samp{/usr/src/qi}.
  473. @samp{tardir} is defined in the recipe to the directory where the tarball
  474. containing the source can be found. The full name of the tarball is
  475. composed as @samp{$@{tardir@}/$tarname}. Its value is available in the
  476. recipe as @samp{$@{tardir@}}; a value of . for @samp{tardir} sets it to
  477. the value of CWD (Current Working Directory), this is where the recipe
  478. lives.
  479. @samp{arch} is the architecture to compose the package name. Its value is
  480. available in the recipe as @samp{$@{arch@}}. Default value is the output
  481. of @samp{uname -m}.
  482. @samp{jobs} is the number of parallel jobs to pass to the compiler. Its
  483. value is available in the recipe as @samp{$@{jobs@}}. The default value
  484. is 1.
  485. The two variables @samp{$@{srcdir@}} and @samp{$@{destdir@}} can be
  486. set in the recipe, as any other variable, but if they are not, qi uses
  487. default values for them when building a package.
  488. @samp{srcdir} contains the source code to be compiled, and defaults to
  489. @samp{$@{program@}-$@{version@}}. @samp{destdir} is the place where the
  490. built package will be installed, and defaults to
  491. @samp{$@{TMPDIR@}/package-$@{program@}}.
  492. If @samp{pkgname} is left undefined, the special variable @samp{program}
  493. is assigned by default. If @samp{pkgversion} is left undefined, the
  494. special variable @samp{version} is assigned by default.
  495. @samp{pkgname} and @samp{pkgversion} along with: @samp{version}, @samp{arch},
  496. and @samp{release} are used to produce the name of the package in the form:
  497. @samp{$@{pkgname@}-$@{pkgversion@}-$@{arch@}+$@{release@}.tlz}
  498. A special variable called @samp{replace} can be used to declare package
  499. names that will be replaced at the time of installation.
  500. @noindent
  501. A typical recipe contains the following variables:
  502. @itemize @bullet
  503. @item @samp{program}: software name.
  504. It matches the source name. It is also used to compose the name of the
  505. package if @samp{$@{pkgname@}} is not specified.
  506. @item @samp{version}: software version.
  507. It matches the source name. It is also used to compose the version of the
  508. package if @samp{$@{pkgversion@}} is not specified.
  509. @item @samp{arch}: software architecture.
  510. It is used to compose the architecture of the package in which it is
  511. build.
  512. @item @samp{release}: release number.
  513. This is used to reflect the release number of the package. It is
  514. recommended to increase this number after any significant change in
  515. the recipe or post-install script.
  516. @end itemize
  517. @noindent
  518. Obtaining sources over the network must be declared in the recipe using
  519. the @samp{fetch} variable. Use double quotes for separated values.
  520. The variables @samp{netget} and @samp{rsync} can be defined in @file{qirc}
  521. to establish a network downloader in order to get the sources. If they
  522. are not defined, qi uses default values:
  523. @samp{netget} is the general network downloader tool, defaults sets to
  524. @samp{wget -c -w1 -t3 --no-check-certificate}.
  525. @samp{rsync} is the network tool for sources containing the prefix for
  526. the RSYNC protocol, default sets to
  527. @samp{rsync -v -a -L -z -i --progress}.
  528. The variable @samp{description} is used to print the package description
  529. when a package is installed.
  530. A description has two parts: a brief description, and a long description.
  531. By convention, the syntax of @samp{description} is:
  532. @example
  533. description="
  534. Brief description.
  535. Long description.
  536. "
  537. @end example
  538. The first line of the value represented is a brief description of the
  539. software (called "blurb"). A blank line separates the @emph{brief
  540. description} from the @emph{long description}, which should contain a more
  541. descriptive description of the software.
  542. @noindent
  543. An example looks like:
  544. @example
  545. description="
  546. The GNU core utilities.
  547. The GNU core utilities are the basic file, shell and text manipulation
  548. utilities of the GNU operating system. These are the core utilities
  549. which are expected to exist on every operating system.
  550. "
  551. @end example
  552. Please consider a length limit of 78 characters as maximum, because the same
  553. one would be used on the meta file creation. See
  554. @ref{Recipes, The meta file} section.
  555. The @samp{homepage} variable is used to declare the main site or home page:
  556. @example
  557. homepage=http://www.gnu.org/software/gcc
  558. @end example
  559. The variable @samp{license} is used for license information@footnote{
  560. The proposal for @samp{license} was made by Richard M. Stallman at
  561. @url{http://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html}.}.
  562. Some code in the program can be covered by license A, license B, or
  563. license C. For "separate licensing" or "heterogeneous licensing", we
  564. suggest using @strong{|} for a disjunction, @strong{&} for a conjunction
  565. (if that ever happens in a significant way), and comma for heterogeneous
  566. licensing. Comma would have lower precedence, plus added special terms.
  567. @example
  568. license="LGPL, GPL | Artistic + added permission"
  569. @end example
  570. @section Writing recipes
  571. @cindex writing recipes
  572. Originally, qi was designed for the version 3 of Dragora GNU/Linux (this
  573. does not mean that you can't use it in another distribution, just that
  574. if you do you will need to test it for your selves). To aid this here
  575. are some references to well written recipes:
  576. @noindent
  577. @url{http://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes}.
  578. @url{http://notabug.org/dragora/dragora/src/master/recipes}.
  579. You can also check the "doc" directory in the distribution sources of qi
  580. for some examples.
  581. @section Building packages
  582. @cindex package build
  583. A recipe is any valid regular file. Qi sets priorities for reading a
  584. recipe, the order in which qi looks for a recipe is:
  585. @enumerate
  586. @item
  587. Current working directory.
  588. @item
  589. If the specified path name does not contain "recipe" as the last
  590. component. Qi will complete it by adding "recipe" to the path name.
  591. @item
  592. If the recipe is not in the current working directory, it will be
  593. searched under @samp{$@{worktree@}/recipes}. The last component will be
  594. completed adding "recipe" to the specified path name.
  595. @end enumerate
  596. @noindent
  597. To build a single package, type:
  598. @example
  599. qi -b x-apps/xterm
  600. @end example
  601. @noindent
  602. Multiple jobs can be passed to the compiler to speed up the build process:
  603. @example
  604. qi -b -j3 x-apps/xterm
  605. @end example
  606. @noindent
  607. Update or install the package produced (if it is not already installed)
  608. when finish:
  609. @example
  610. qi -b -j3 -u x-apps/xterm
  611. @end example
  612. @noindent
  613. Only process a recipe but do not create the binary package:
  614. @example
  615. qi -b -n dict/aspell
  616. @end example
  617. The options -i or -u have no effect when -n is given.
  618. @noindent
  619. This can be useful to inspect the build process of recipe:
  620. qi -b -k -n dict/aspell 2>&1 | tee aspell-buildlog.txt
  621. The -k option could preserve the source directory and the destination
  622. directory for later inspection. A log file of the build process will be
  623. created redirecting both, standard error and standard output to tee(1).
  624. @section Variables from the environment
  625. @cindex environment variables
  626. Qi has environment variables which can be used at build time:
  627. The variable @env{TMPDIR} sets the temporary directory for sources, which is
  628. used for package extractions (see @ref{Examining packages}) and is
  629. prepended to the value of @samp{$@{srcdir@}} and @samp{$@{destdir@}} in
  630. build mode. By convention its default value is equal to
  631. @samp{/usr/src/qi/build}.
  632. The variables @env{QICFLAGS}, @env{QICXXFLAGS}, and @env{QILDFLAGS} have
  633. no effect by default. The environment variables such as @env{CFLAGS},
  634. @env{CXXFLAGS}, and @env{LDFLAGS} are unset at compile time:
  635. @noindent
  636. Recommended practice is to set variables in the command line of
  637. @samp{configure} or @emph{make(1)} instead of exporting to the
  638. environment. As follows:
  639. @quotation
  640. Variables not defined in a site shell script can be set in the environment
  641. passed to configure. However, some packages may run configure again
  642. during the build, and the customized values of these variables may be
  643. lost. In order to avoid this problem, you should set them in the
  644. configure command line, using @samp{VAR=value}. For example:
  645. @code{./configure CC=/usr/local2/bin/gcc}
  646. @url{http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html}
  647. @end quotation
  648. @quotation
  649. Indeed, while configure can notice the definition of CC in
  650. @samp{./configure CC=bizarre-cc}, it is impossible to notice it in
  651. @samp{CC=bizarre-cc ./configure}, which, unfortunately, is what most
  652. users do.
  653. [...]
  654. configure: error: changes in the environment can compromise the build.
  655. @url{http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html}
  656. @end quotation
  657. @quotation
  658. It is not wise for makefiles to depend for their functioning on
  659. environment variables set up outside their control, since this would cause
  660. different users to get different results from the same makefile. This is
  661. against the whole purpose of most makefiles.
  662. @url{http://gnu.org/software/make/manual/make.html#Environment}
  663. @end quotation
  664. @section The meta file
  665. @cindex the meta file
  666. The "meta file" is a regular file created during the build mode, it
  667. contains information about the package such as package name, package
  668. version, architecture, release, fetch address, description, and other
  669. minor data extracted from processed recipes. The name of the file is
  670. generated as @samp{$@{full_pkgname@}.tlz.txt}, and its purpose is to
  671. reflect essential information to the user without having to look inside
  672. the package content. The file format is also intended to be imported
  673. from other scripts.
  674. The content of a meta file looks like:
  675. @example
  676. #
  677. # The Bourne Again SHell.
  678. #
  679. # Bash is an sh-compatible shell that incorporates useful features from
  680. # the Korn shell (ksh) and C shell (csh). It is intended to conform to
  681. # the IEEE POSIX P1003.2/ISO 9945.2 shell and tools standard.
  682. #
  683. # It offers functional improvements over sh for both programming and
  684. # interactive use.
  685. #
  686. QICFLAGS="-g0 -Os -mtune=generic -pipe"
  687. QICXXFLAGS="-g0 -Os -mtune=generic -pipe"
  688. QILDFLAGS="-s"
  689. pkgname=bash
  690. pkgversion=5.0
  691. arch=x86_64
  692. release=1
  693. blurb="The Bourne Again SHell."
  694. homepage="http://www.gnu.org/software/bash"
  695. license="GPLv3+"
  696. fetch="ftp://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz"
  697. replace=""
  698. @end example
  699. Package descriptions are extracted from the variable @samp{description}
  700. where each line is interpreted literally and pre-formatted to fit in
  701. (exactly) @strong{80 columns}, plus the character @samp{#} and a space
  702. is prefixed to every line.
  703. @noindent
  704. In addition to the Special variables, there are implicit variables such as
  705. @samp{blurb}:
  706. The @samp{blurb} variable is related to the special variable
  707. @samp{description}. Its value is composed using the first (substantial)
  708. line of @samp{description}, mentioned as the "brief description".
  709. @node Order files
  710. @chapter Order files
  711. @cindex handling build order
  712. The order mode has the purpose of resolving the build order through
  713. .order files. An order file contains a list of recipe names, by default
  714. does not perform any action other than to print a resolved list in
  715. descending order. For example, if @strong{a} depends on @strong{b} and
  716. @strong{c}, and @strong{c} depends on @strong{b} as well, the file might
  717. look like:
  718. @example
  719. a: c b
  720. b:
  721. c: b
  722. @end example
  723. Each letter represents a recipe name, complete dependencies for
  724. the first recipe name are listed in descending order, which is
  725. printed from right to left, and removed from left to right:
  726. @sc{Output}
  727. @example
  728. b
  729. c
  730. a
  731. @end example
  732. Blank lines, colons and parentheses are simply ignored. Comment lines
  733. beginning with @samp{#} are allowed.
  734. @noindent
  735. An order file could be used to build a series of packages, for example,
  736. if the content is:
  737. @example
  738. # Image handling libraries
  739. libs/libjpeg-turbo: devel/nasm
  740. x-libs/jasper: libs/libjpeg-turbo
  741. libs/tiff: libs/libjpeg-turbo
  742. @end example
  743. To proceed with each recipe, we can type:
  744. @example
  745. qi -o imglibs.order | qi -b -i -
  746. @end example
  747. The output of @samp{qi -o imglibs.order} tells to qi in which order it
  748. should build the recipes:
  749. @example
  750. devel/nasm
  751. libs/libjpeg-turbo
  752. x-libs/jasper
  753. libs/tiff
  754. @end example
  755. @node Creating packages
  756. @chapter Creating packages
  757. @cindex package creation
  758. The "creation mode" is an internal function of qi to make new Qi compatible
  759. compatible packages, the creation mode is selected by the -c option.
  760. A package is produced using the contents of the Current Directory, and
  761. the package file is written out.
  762. @example
  763. Usage: qi -c [@var{OUTPUT/packagename.tlz}]...
  764. @end example
  765. The argument for the file name to be written must contain a fully
  766. qualified named directory as the output directory where the package
  767. produced will be written. The file name should be composed using the
  768. full name: name-version-architecture+release.tlz
  769. @sc{Example}
  770. @example
  771. cd /usr/local/pkgs
  772. cd claws-mail-3.17.1-x86_64+1
  773. qi -c /var/cache/qi/packages/x86_64/local/claws-mail-3.17.1-x86_64+1.tlz
  774. @end example
  775. In this case, the package "claws-mail-3.17.1-x86_64+1.tlz" will be written
  776. into @samp{/var/cache/qi/packages/x86_64/local/}.
  777. @noindent
  778. All packages produced are complemented by a checksum file (.sha256).
  779. @node Examining packages
  780. @chapter Examining packages
  781. @cindex package examination
  782. The "extraction mode" serves to examine binary packages for debugging
  783. purposes. The extraction mode is selected by the -x option. It
  784. decompresses a package into a single directory, verifying its integrity
  785. and preserving its properties.
  786. @example
  787. Usage: qi -x [@var{packagename.tlz}]...
  788. @end example
  789. @sc{Example}
  790. @example
  791. qi -x mksh-R56c-x86_64+1.tlz
  792. @end example
  793. This action will put the content of "mksh-R56c-x86_64+1.tlz" into a
  794. single directory, this will be a private directory for the user who
  795. requested the action, creation mode will be equal to @strong{u=rwx,g=,o=
  796. (0700)}. The package content will reside on this location, default
  797. mask to deploy the content will be equal to
  798. @strong{u=rwx,g=rwx,o=rwx (0000)}.
  799. @noindent
  800. The creation of the custom directory is influenced by the value of the
  801. @env{TMPDIR} variable.
  802. @node Exit status
  803. @chapter Exit status
  804. @cindex exit codes
  805. All the exit codes are described in this chapter.
  806. @table @samp
  807. @item 0
  808. Successful completion (no errors).
  809. @item 1
  810. Minor common errors:
  811. @itemize @minus
  812. @item Help usage on illegal options or required arguments.
  813. @item Program needed by qi (prerequisite) is not available.
  814. @end itemize
  815. @item 2
  816. Command execution error:
  817. This code is used to return the evaluation of external commands and shell
  818. arguments in case of error.
  819. @item 3
  820. Integrity check error for compressed files.
  821. Compressed files means:
  822. @itemize @minus
  823. @item Tarball files from tar(1).
  824. Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
  825. .tar.xz, .txz
  826. @item Tarball files from tarlz(1).
  827. Supported extensions: .tar.lz, .tlz
  828. @item Zip files from unzip(1).
  829. Supported extensions: .zip, .ZIP
  830. @item Gzip files from gzip(1).
  831. Supported extensions: .gz, .Z
  832. @item Bzip2 files from bzip2(1).
  833. Supported extensions: .bz2
  834. @item Lzip files from lzip(1).
  835. Supported extensions: .lz
  836. @item Xz files from xz(1).
  837. Supported extensions: .xz
  838. @end itemize
  839. @item 4
  840. File empty, not regular, or expected.
  841. Commonly, it is expected:
  842. @itemize @minus
  843. @item An argument for the mode of operation.
  844. @item A readable file or directory.
  845. @item A binary package (.tlz).
  846. @item A valid recipe.
  847. @item An order file (.order).
  848. @item A protocol supported by the network downloader tool.
  849. @item A checksum file (.sha256).
  850. @end itemize
  851. @item 5
  852. Empty or not defined variable:
  853. This code is used to report empty or undefined variables; usually,
  854. variables coming from a recipe or assigned arrays that are tested.
  855. @item 6
  856. Package already installed:
  857. The package directory for an incoming .tlz package already exists.
  858. @item 10
  859. Network manager error:
  860. This code is used if the network downloader tool fails for some reason.
  861. @end table
  862. @node Index
  863. @unnumbered Index
  864. @printindex cp
  865. @bye