Skip to content

ubinux/smart2

 
 

Repository files navigation

1. Overview

    Smart2 is a package manager that based on smart. Smart2 supports all the 
    funtions of smart. In addition, smart2 has some new features.
  
    --------------
    New Features
    --------------

    - A new interface named "tgui" can show you a GUI on your character terminal.
    - Support for custom target rootfs on host development machine.
   
    Note
      More information about smart, refer to doc/ or http://labix.org/smart/howto.
   
2. How to get smart2
  
    Smart2 now is managed on Github. You can get smart2 from there.
    https://github.com/ubinux/smart2.git

3. Installation

    3.1 Dependencies

      1) The dependencies are same as smart
         Smart2 is based on smart, so please make sure the prerequisites for smart have been installed.
         Refre to http://labix.org/smart/howto to obtain details.

      2) Dependencies for smart2 new features.
         - python-newt:  the snack module depended by "tgui" graphic interface.

      Note
        In some cases (e.g. Cross-Platform), maybe you can not use the above command
        which belongs to host directly. You should build a special one for your target-platform,
        and make sure it's available in your toolchain for Cross-Platform.

        E.g, for Yocto user, you should install the toolchain firstly

    3.2 Installation

      cd into smart2 directory and execute the following commands as root:
      -------------------------------------------------------------------
       # python setup.py build
       # python setup.py install
      -------------------------------------------------------------------
      Or you can use the supplied Makefile:
      -------------------------------------------------------------------
       # make
       # make install
      -------------------------------------------------------------------

      Note
        After installation, you have to change the interpreter from "#!/usr/bin/python" to 
        "#!/usr/bin/env python" in your smart2 command.
        -----------------------------------------------------------------
         $ whereis smart
           smart: /opt/bin/smart
         $ cat /opt/bin/smart
           #!/usr/bin/env python
           ......
        -----------------------------------------------------------------

    3.3 Global Settings

      1) In Cross-Platform case, make sure the required commands can be invoked preferentially.
         For example, you can do it by the following command for Yocto-User
         -----------------------------------------------------------------------
          $ source TOOLCHAIN/environment-setup-i586-poky-linux
         -----------------------------------------------------------------------

      2) Make sure the following environment variable point to correct path.
         -----------------------------------------------------------------------
          $ export RPM_USRLIBRPM=/usr/lib/rpm
          $ export RPM_ETCRPM=/etc/rpm
          $ export RPM_LOCALEDIR=/usr/share/locale
         -----------------------------------------------------------------------

        Note
          In Cross-Platform case, maybe you should customize these variable.
          E.g. for Yocto user, you should set them as following.
          -------------------------------------------------------------------
           $ export RPM_USRLIBRPM=${OECORE_NATIVE_SYSROOT}/usr/lib/rpm
           $ export RPM_ETCRPM=${SDKTARGETSYSROOT}/etc/rpm
           $ export RPM_LOCALEDIR=${OECORE_NATIVE_SYSROOT}/usr/share/locale
          -------------------------------------------------------------------

4. How to manage packages

    4.1 Prepare

      You should construct the environment before doing install/remove/search operations. 

      Smart2 provides a script named environment-smart.sh to do it automatically.
      It can help you to complete the following jobs:
        - Build pseudo environment.
        - Configure DB settings for packages sources (e.g. rpm, deb).
        - Configure smart2 settings for packages sources (e.g. rpm, deb).
        - Add channels for each packages source.
   
      You can configure your smart2 environment as the following: 
      -------------------------------------------------------------------
       $ . environment-smart.sh ROOTFS_DIR PACKAGES_DIR
      -------------------------------------------------------------------
      There must be two parameters for environment-smart.sh:

      1) ROOTFS_DIR: The rootfs directory where you want to install packages.

         Note
           * ROOTFS_DIR must be absolute path.
           * If it doesn't exist, it will be created.

      2) PACKAGES_DIR: The packages sources directory. There can be multiple packages sources
                       in this directory.
           
      For example:
        If you build x86 by Yocto, there will be three packages sources for x86.
        And there is a repodata in each packages sources:
        -------------------------------------------------------------------
         # tree /home/test/x86_rpm/ | grep -v "\.rpm"
           /home/test/x86_rpm/
           |-- all
           |   |-- repodata
           |   |   |-- filelists.xml.gz
           |   |   |-- other.xml.gz
           |   |   |-- primary.xml.gz
           |   |   |-- repomd.xml
           |-- i586
           |   |-- repodata
           |   |   |-- filelists.xml.gz
           |   |   |-- other.xml.gz
           |   |   |-- primary.xml.gz
           |   |   |-- repomd.xml
           |-- qemux86
           |   |-- repodata
           |   |   |-- filelists.xml.gz
           |   |   |-- other.xml.gz
           |   |   |-- primary.xml.gz
           |   |   |-- repomd.xml
        -------------------------------------------------------------------

        You can configure your smart2 environment for x86 by the following:
        -------------------------------------------------------------------
         $ . environment-smart.sh /home/test/x86_rootfs /home/test/x86_rpm
        -------------------------------------------------------------------

         Note
           Smart2 manage packages by repodata, make sure there is repodata in every sources
           directory under PACKAGES_DIR.
           If the rpm package is added, deleted or updated, the repodata needs to be updated to
           reflect the newest infomation.
           -------------------------------------------------------------------
           $ rm -rf repodata
           $ createrepo ./
           -------------------------------------------------------------------

    4.2 Create rootfs for Target-Platform
        
      Smart2 supports a new interface named "tgui" which can 
      help you to customize your rootfs under character terminal in your development machine.
	  
      You will enter the tgui insterface with the option "--interface=tgui".
      For example:
      -------------------------------------------------------------------
       $ smart --rootfs-dir=$ROOTFS_DIR  --interface=tgui
      -------------------------------------------------------------------
      Note
        --rootfs-dir: rootfs directory that specified by environment-smart.sh.

      After execute the above command, you can enter the interface of tgui:
      
      1) Select install type
         Smart2 supports three kinds of install type:
         - install all
           By default, all pacakges will be selected.
         - Busybox base
           By default, only busybox packages will be selected.
         - customize
           By default, no packages will be selected.

 
      2) Smart2 can help you filter GPLv3.
         If you select "install all" or "customize" in above, smart2 will ask you whether 
         you want to install packages which license is GPLv3.
         - No  : GPLv3 packages will not be selected and not display in the next step.
         - Yes : GPLv3 packages can be selected as same as the other packages.
        
      3) customize packages
        
        ------------------------------- Select package -----------------------------------
         |                                                                                |
         | [ ] acl                                                                        |
         | [ ] acpid                                                                      |
         | [ ] adwaita-icon-theme                                                         |
         | [ ] adwaita-icon-theme-cursors                                                 |
         | [ ] adwaita-icon-theme-hires                                                   |
         | [ ] adwaita-icon-theme-symbolic                                                |
         | [ ] alsa-conf                                                                  |
         | [ ] alsa-conf-base                                                             |
         | [ ] alsa-lib                                                                   |
         | [ ] alsa-plugins                                                               |
         | [ ] alsa-plugins-pulseaudio-conf                                               |
         | [ ] alsa-server                                                                |
         | [I] alsa-state                                                                 |
         | [ ] alsa-states                                                                |
         | [ ] alsa-utils                                                                 |
         | [ ] alsa-utils-aconnect                                                        |
         | [ ] alsa-utils-alsactl                                                         |
         | [ ] alsa-utils-alsaloop                                                        |
         | [ ] alsa-utils-alsamixer                                                       |
         | [I] alsa-utils-alsaucm                                                         |
         | [*] alsa-utils-amixer                                                          |
         | ------------------------------------------------------------------------------ |
         | All Packages [2503]    Installed Packages [2]    Selected Packages [1]         |
         | ------------------------------------------------------------------------------ |
         | SPACE/ENTER:select/unselect R:seaRch N:Next  B:Back  I:Info  X:eXit            |
         ----------------------------------------------------------------------------------

        Note
          -  [] Means the package has not been selected and installed. If you want to install it, you can 
                select it by pressing enter.
          - [*] Means the package has been selcted and will be installed. If you don't want to install it,
                you can cancel by pressing enter.
          - [I] Means the package has been installed in your rootfs. You can't select/unselect it in tgui.
                If you want to uninstall it.Please use the following command after exiting tgui.
                $ smart --rootfs-dir=/home/test/x86-rootfs remove pkgname

          - Next: If you press "N" or "n" in the interface, it will go to the next step.
		   
      4) customize packages type
         You can select the package type that you want to install into rootfs.
        
        ---------------------------- customize special type packages ----------------------------  
        |                                                                                        |
        | locale [ ]                                                                             |
        | dev [ ]                                                                                |
        | doc [ ]                                                                                |
        | dbg [ ]                                                                                |
        | staticdev [ ]                                                                          |
        | ptest [ ]                                                                              |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        |                                                                                        |
        | -------------------------------------------------------------------------------------- |
        | SPACE/ENTER:select/unselect  N:Next  B:Back  I:Info  X:eXit                            |
        ------------------------------------------------------------------------------------------

        Note
          You can get details about the package type by pressing "I" or "i".
	
      5) Confirm selection

         After you confirming your customization, the installation will begin.

      6) Confirm installation

         To make sure the files in rootfs have correct uid and gid, notice that:
          * When rootfs is finished, please compress it into a tarball in the
            current terminal to keep the pseudo environment.
          * When unpack rootfs, please use sudo command with "--numeric-owner" option.

            For example:
            -------------------------------------------------------------------
             $ . environment-smart.sh /home/test/x86_rootfs /home/test/x86_rpm
             $ smart --rootfs-dir=/home/test/x86_rootfs  --interface=tgui
             $ cd /home/test/
             $ tar cvf - x86-rootfs | (cd $DEST_DIR ;sudo tar xvf - --numeric-owner)
            -------------------------------------------------------------------
  
    4.3 Smart2 Commands
	 
      Besides "tgui", you also can manage packages by command line with the option 
      "--rootfs-dir".
      For example:
      -------------------------------------------------------------------
       $ smart --rootfs-dir=/home/test/x86-rootfs install pkgname
       $ smart --rootfs-dir=/home/test/x86-rootfs remove pkgname
       $ smart --rootfs-dir=/home/test/x86-rootfs query '*kgnam*'
      -------------------------------------------------------------------
      More commands please reference to doc/ or http://labix.org/smart/howto.
  		

Packages

No packages published

Languages

  • Python 61.6%
  • C 18.6%
  • Shell 8.8%
  • M4 5.2%
  • Perl 3.5%
  • C++ 2.0%
  • Other 0.3%