sup rev 44

Add support for downloads, tiny debug command and improve README (main doc)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Mar 10 00:00:36 2017 +0100 (2017-03-10)
parents 53527d66b446
children 66fa352226c4
files README libsup.sh sup
line diff
     1.1 --- a/README	Thu Mar 09 21:33:24 2017 +0100
     1.2 +++ b/README	Fri Mar 10 00:00:36 2017 +0100
     1.3 @@ -8,8 +8,8 @@
     1.4  etc. Sup is designed to handle software that can/should be installed in user
     1.5  space such as web frameworks.
     1.6  
     1.7 -This lets users get involved in the project without coding skills, sup provides a
     1.8 -cmdline tool and a GTK+ interface to install and build packages. The server
     1.9 +This lets users get involved in the project without coding skills, sup provides
    1.10 +a cmdline tool and a GTK+ interface to install and build packages. The server
    1.11  provides a CGI web interface to upload packages receipts and files. The build 
    1.12  is a simple pack without compilation since the idea is to provide custom 
    1.13  tools using scripting languages or precompiled packages such as Firefox.
    1.14 @@ -34,47 +34,25 @@
    1.15  
    1.16  Cook SUP packages to be uploaded to the server
    1.17  --------------------------------------------------------------------------------
    1.18 -Sup lets users upload packages to the server. To cook your first one you may want to
    1.19 -use the sup 'new' command:
    1.20 +Sup lets users upload packages to the server. To cook your first one you may want
    1.21 +to use the sup 'new' command:
    1.22  
    1.23    $ sup -n
    1.24  
    1.25  
    1.26 -What goes where ?
    1.27 +Packaging helpers
    1.28  --------------------------------------------------------------------------------
    1.29 +When creating packages you want to be sure everything goes well and for that you
    1.30 +need testing. Sup provides some helpers to test the package. The sup_install()
    1.31 +function in the receip is the one who will downlaod files, extract tarballs,
    1.32 +move files, etc. All commands MUST be run in the current directory. To run the
    1.33 +sup_install function without installing anything:
    1.34  
    1.35 -  * sup         Client side cmdline tool to install and cook packages
    1.36 -                --> /usr/bin/sup
    1.37 -  * sup-box     GTK+ Client side user interface to manage packages
    1.38 -                --> /usr/bin/sup-box
    1.39 -  * libsup.sh   Shared SHell function between sup tools
    1.40 -                --> /usr/lib/slitaz/libsup.sh
    1.41 -  * server      Server side web interface: TinyCM/SCN plugin
    1.42 -                --> http://scn.slitaz.org/?sup
    1.43 +  $ sup run [package]
    1.44  
    1.45  
    1.46 -Development environment
    1.47 ---------------------------------------------------------------------------------
    1.48 -It's easy to work on sup code, commands will talk by themselves:
    1.49 -
    1.50 -  --> Cmdline client
    1.51 -  $ hg clone http://hg.slitaz.org/sup
    1.52 -  $ cd sup && ./sup
    1.53 -  
    1.54 -  --> Server side needs lighttpd & TinyCM install
    1.55 -  $ make DESTDIR=/home/tux/Public/cgi-bin/tinycm server-install
    1.56 -  $ tazweb http://localhost/~tux/cgi-bin/tinycm/?sup
    1.57 -
    1.58 -
    1.59 -Developers coding style
    1.60 ---------------------------------------------------------------------------------
    1.61 -Keep sup simple, clean and fast. Sup tools are written in SHell script, they
    1.62 -use libtaz.sh and httphelper.sh functions. Sup uses XDG directories paths to 
    1.63 -store packages' information and build process:
    1.64 -	
    1.65 -  ~/.local         User data, executables and sup database
    1.66 -  ~/.cache         Non-essential data such as tmp and build files
    1.67 -  ~/.config        Peer user configuration files
    1.68 +If you download big files and want to keep the in cache, you can use in your
    1.69 +receip the variable: ${downloads} wich is set to: ~/.cache/sup/downloads
    1.70  
    1.71  
    1.72  Packages format and max size
    1.73 @@ -99,16 +77,18 @@
    1.74    |- local/bin                 For executable binaries and scripts
    1.75    |- local/share/XXX           Where XXX is the name of the package
    1.76    |- local/share/applications  All .desktop files for menu entry
    1.77 -   ` config/                   For any configuration file in ~/.config
    1.78 +  |- config/                   For any configuration file in ~/.config
    1.79 +   ` icons/                    Applications icons folder
    1.80  
    1.81  More directories into files/ can be added according to the needs and goals
    1.82 -of the packages.
    1.83 +of the packages. The packages you can upload are limited to a few MB, please
    1.84 +download big files on installation.
    1.85  
    1.86  
    1.87  Receipt variables and function
    1.88  --------------------------------------------------------------------------------
    1.89 -Here are the variables used or usable in a sup receip as well as the uniq function.
    1.90 -Check out the sup-demo package for a receip example.
    1.91 +Here are the variables used or usable in a sup receip as well as the uniq 
    1.92 +function. Check out the sup-demo package for a receip example.
    1.93  
    1.94    * $build_date     Auto added by 'sup cook' to get the build date
    1.95    * $sup_size       Auto added by 'sup cook' to get installed size
    1.96 @@ -116,14 +96,55 @@
    1.97  
    1.98  Packages dependencies
    1.99  --------------------------------------------------------------------------------
   1.100 -Since sup is not run as root, less deps is better - but some precompiled packages
   1.101 -will need some system wide tools/libraries, sup will not install any system wide
   1.102 -packages but warns if dependencies are not installed if DEPENDS is set. 
   1.103 +Since sup is not run as root, less deps is better - but some precompiled 
   1.104 +packages will need some system wide tools/libraries, sup will not install any
   1.105 +system wide packages but warns if dependencies are not installed if DEPENDS is
   1.106 +set. 
   1.107  
   1.108  Sup packages can be very simple but also very complex, so feel free to use the 
   1.109  receip to warn or prompt users to make an action.
   1.110  
   1.111  
   1.112 +Development environment
   1.113 +--------------------------------------------------------------------------------
   1.114 +It's easy to work on sup code, commands will talk by themselves:
   1.115 +
   1.116 +  --> Cmdline client
   1.117 +  
   1.118 +  $ hg clone http://hg.slitaz.org/sup
   1.119 +  $ cd sup && ./sup
   1.120 +  
   1.121 +  --> Server side needs lighttpd & TinyCM install
   1.122 +  
   1.123 +  $ make DESTDIR=/home/tux/Public/cgi-bin/tinycm server-install
   1.124 +  $ tazweb http://localhost/~tux/cgi-bin/tinycm/?sup
   1.125 +
   1.126 +
   1.127 +Source tree: What goes where ?
   1.128 +--------------------------------------------------------------------------------
   1.129 +
   1.130 +  * sup         Client side cmdline tool to install and cook packages
   1.131 +                --> /usr/bin/sup
   1.132 +  * sup-box     GTK+ Client side user interface to manage packages
   1.133 +                --> /usr/bin/sup-box
   1.134 +  * libsup.sh   Shared SHell function between sup tools
   1.135 +                --> /usr/lib/slitaz/libsup.sh
   1.136 +  * server      Server side web interface: TinyCM/SCN plugin
   1.137 +                --> http://scn.slitaz.org/?sup
   1.138 +
   1.139 +
   1.140 +Developers coding style
   1.141 +--------------------------------------------------------------------------------
   1.142 +Keep sup simple, clean and fast. Sup tools are written in SHell script, they
   1.143 +use libtaz.sh and httphelper.sh functions. Sup uses XDG directories paths to 
   1.144 +store packages' information and build process:
   1.145 +	
   1.146 +  ~/.local         User data, executables and sup database
   1.147 +  ~/.cache         Non-essential data such as tmp and build files
   1.148 +  ~/.config        Peer user configuration files
   1.149 +  ~/.icons         Applications icons used by XDG *.desktop files
   1.150 +
   1.151 +
   1.152  Colors shems for sup tools
   1.153  --------------------------------------------------------------------------------
   1.154  Here are the colors guide line used in the cmdline tool:
     2.1 --- a/libsup.sh	Thu Mar 09 21:33:24 2017 +0100
     2.2 +++ b/libsup.sh	Fri Mar 10 00:00:36 2017 +0100
     2.3 @@ -9,11 +9,11 @@
     2.4  
     2.5  config="$HOME/.config"
     2.6  cache="$HOME/.cache/sup"
     2.7 -local="$HOME/.local"
     2.8 -data="$local/share"
     2.9 -supdb="$local/share/sup"
    2.10 +data="$HOME/.local/share"
    2.11 +supdb="$data/sup"
    2.12  installed="$supdb/installed"
    2.13  activity="$cache/activity.log"
    2.14 +downloads="$cache/downloads"
    2.15  
    2.16  server="http://scn.slitaz.org/"
    2.17  mirror="${server}content/sup/packages"
     3.1 --- a/sup	Thu Mar 09 21:33:24 2017 +0100
     3.2 +++ b/sup	Fri Mar 10 00:00:36 2017 +0100
     3.3 @@ -18,7 +18,7 @@
     3.4  if ! [ -d "/home/$(id -un)" ]; then
     3.5  	gettext "Not a valid user:"; colorize 31 " $(id -un)" && exit 1
     3.6  fi
     3.7 -mkdir -p ${cache} ${installed}
     3.8 +mkdir -p ${cache} ${installed} ${downloads}
     3.9  
    3.10  #
    3.11  # Functions
    3.12 @@ -35,9 +35,11 @@
    3.13    -e  extract        $(gettext "Extract a package to current dir")
    3.14    -i  install        $(gettext "Install a new package")
    3.15    -u  update         $(gettext "Update installed package")
    3.16 -  -r  remove         $(gettext "Remove package files")
    3.17 +  -r  remove         $(gettext "Remove an installed package")
    3.18    -n  new            $(gettext "Create a new SUP package :-)")
    3.19 -  -l  list           $(gettext "List installed packages in your wok")
    3.20 +  -l  list           $(gettext "List packages: installed/wok/db")
    3.21 +  -s  search         $(gettext "Search for packages in the database")
    3.22 +  -d  debug          $(gettext "Debug info and sup environment")
    3.23  
    3.24  $(boldify $(gettext "Options:"))
    3.25    --install  update  $(gettext "Install all updates from mirror")
    3.26 @@ -424,12 +426,26 @@
    3.27  				. ${wok}/${pkg}/receip
    3.28  				echo "$pkg $(indent 26 $VERSION) $(indent 42 $MAINTAINER)"
    3.29  			done
    3.30 -			newline 
    3.31 +			newline
    3.32 +		fi
    3.33 +		if [ -d "$cooked" ]; then
    3.34 +			echo -n "$(colorize 33 $(gettext 'Cooked packages:'))"
    3.35 +			boldify " $(ls $cooked | wc -l)"
    3.36  		fi
    3.37  		echo -n "$(colorize 33 $(gettext 'SUP packages in database:'))"
    3.38  		boldify " $(sqlite3 ${pkgsdb} 'SELECT COUNT(name) FROM pkgs')"
    3.39  		newline ;;
    3.40  	
    3.41 +	-d|debug)
    3.42 +		# Packaging environment and debugger
    3.43 +		newline
    3.44 +		echo "$(colorize 35 $(gettext "Cooked packages:")) $cooked"
    3.45 +		separator  "-"
    3.46 +		ls -1 ${cooked}; newline
    3.47 +		echo "$(colorize 35 $(gettext "Downloads::")) $downloads"
    3.48 +		separator  "-"
    3.49 +		ls -1 ${downloads}; newline ;;
    3.50 +	
    3.51  	""|-h|help) help ;;
    3.52  		
    3.53  	*)