<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3769</bug_id>
          
          <creation_ts>2013-01-22 09:22:52 +0000</creation_ts>
          <short_desc>smart: some packages can not be reinstalled</short_desc>
          <delta_ts>2013-02-22 13:23:48 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>11</classification_id>
          <classification>Runtime</classification>
          <product>Package Management Issues</product>
          <component>package-management-issues</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yi Zhao">yi.zhao</reporter>
          <assigned_to name="Bogdan Marinescu">bogdan.a.marinescu</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>bogdan.a.marinescu</cc>
    
    <cc>corneliux.stoicescu</cc>
    
    <cc>hongxu.jia</cc>
    
    <cc>liang.li2</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>Qi.Chen</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>29022</commentid>
    <comment_count>0</comment_count>
    <who name="Yi Zhao">yi.zhao</who>
    <bug_when>2013-01-22 09:22:52 +0000</bug_when>
    <thetext>Image location: http://autobuilder.yoctoproject.org/pub/nightly/20130115-2/
Tree/Branch: poky/master
Git Rev: 9eb88ceb39b7d0b8ddc6487e61ce8edadef10ec4

I found if some packages are pre-installed in rootfs, then run smart reinstall command can not reinstall them.

For example:
The package less is already installed in sato-sdk rootfs:
##########
root@beagleboard:~# smart channel --show
[rpmsys]
type = rpm-sys


root@beagleboard:~# 
root@beagleboard:~# smart query less --show-channels
Updating cache...               ######################################## [100%]

less-457-r0@armv7a_vfp_neon [rpmsys]

Saving cache... 
############

Then add a remote repo and reinstall it, would get the following message:
###########
root@beagleboard:~# smart channel --add myrpmmd type=rpm-md baseurl=http://140.211.169.59/nightly/20130115-2/rpm
Alias: myrpmmd
Type: rpm-md
Base URL: http://140.211.169.59/nightly/20130115-2/rpm

Include this channel? (y/N): y


root@beagleboard:~# 
root@beagleboard:~# smart update
Loading cache...
Updating cache...               ######################################## [100%]

Fetching information for &apos;myrpmmd&apos;...                                          
-&gt; http://140.211.169.59/nightly/20130115-2/rpm/repodata/repomd.xml            
repomd.xml                      ######################################## [ 50%]
-&gt; http://140.211.169.59/nightly/20130115-2/rpm/repodata/primary.xml.gz        
-&gt; http://140.211.169.59/nightly/20130115-2/rpm/repodata/filelists.xml.gz      
filelists.xml.gz                ######################################## [ 75%]
primary.xml.gz                  ######################################## [100%]

Updating cache...               ######################################## [100%]

Channels have 6324 new packages.
Saving cache...

root@beagleboard:~# 
root@beagleboard:~# smart query less --show-channels
Loading cache...
Updating cache...               ######################################## [100%]

less-457-r0@armv7a_vfp_neon [myrpmmd]
less-457-r0@armv7a_vfp_neon [rpmsys]


root@beagleboard:~# smart reinstall less
Loading cache...
Updating cache...               ######################################## [100%]

error: &apos;less-457-r0@armv7a_vfp_neon&apos; is not available for reinstallation       

root@beagleboard:~# 
##############

But if I remove it by smart remove and install it again. Then the reinstall command could work.
##############
root@beagleboard:~# smart remove less
Loading cache...
Updating cache...               ######################################## [100%]

Computing transaction...

Removing packages (3):
  less-457-r0@armv7a_vfp_neon            packagegroup-core-sdk-1.0-r9@all       
  less-dev-457-r0@armv7a_vfp_neon        

134.6kB will be freed.

Confirm changes? (Y/n): y

Committing transaction...                                                      
Preparing...                    ######################################## [  0%]
   1:Removing less-dev          ######################################## [ 33%]
   2:Removing packagegroup-co.. ######################################## [ 66%]

   3:Removing less              ######################################## [100%]


update-alternatives: Linking //usr/bin/less to /bin/busybox                                


root@beagleboard:~# 
root@beagleboard:~# 
root@beagleboard:~# 
root@beagleboard:~# smart install less
Loading cache...
Updating cache...               ######################################## [100%]

Computing transaction...

Installing packages (1):
  less-457-r0@armv7a_vfp_neon            

71.0kB of package files are needed. 134.6kB will be used.

Confirm changes? (Y/n): y

Fetching packages...                                                           
-&gt; http://140.211.169.59/nightly/20130115-2/.../less-457-r0.armv7a_vfp_neon.rpm
less-457-r0.armv7a_vfp_neon.rpm ######################################## [100%]

                                                                               
Committing transaction...
Preparing...                    ######################################## [  0%]
   1:Installing less            ######################################## [100%]
Output from less-457-r0@armv7a_vfp_neon:                                                                 
update-alternatives: Linking //usr/bin/less to /usr/bin/less.less              

Saving cache...

root@beagleboard:~# smart reinstall less
Loading cache...
Updating cache...               ######################################## [100%]

Computing transaction...

Installing packages (1):
  less-457-r0@armv7a_vfp_neon            

71.0kB of package files are needed. 134.6kB will be used.

Confirm changes? (Y/n): y

Fetching packages...                                                           
-&gt; http://140.211.169.59/nightly/20130115-2/.../less-457-r0.armv7a_vfp_neon.rpm
less-457-r0.armv7a_vfp_neon.rpm ######################################## [100%]

                                                                               
Committing transaction...
Preparing...                    ######################################## [  0%]
   1:Installing less            ######################################## [100%]
Output from less-457-r0@armv7a_vfp_neon:                                       
update-alternatives: Linking //usr/bin/less to /usr/bin/less.less              


root@beagleboard:~# 
###########</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29297</commentid>
    <comment_count>1</comment_count>
    <who name="Bogdan Marinescu">bogdan.a.marinescu</who>
    <bug_when>2013-01-29 15:01:18 +0000</bug_when>
    <thetext>This is indeed a bit weird, but it seems to be the correct behaviour as far as smart is concerned. The error comes from here (commands/reinstall.py):

    found = False
    for pkg in pkgs:
        if pkg.installed:
            found = True
            trans.enqueue(pkg, REINSTALL)
            for loader in pkg.loaders:
                if not loader.getInstalled():
                    break
            else:
                raise Error, _(&quot;&apos;%s&apos; is not available for &quot;
                               &quot;reinstallation&quot;) % pkg

smart will consider a package for reinstallation if it has at least one loader that reports it as not being installed. This behaviour is consistent with other parts of the smart code; for exampe, the code below can be found in control.py in a number of places:

loaders = [x for x in pkg.loaders if not x.getInstalled()]

Again, only the loaders that report the package as &quot;not installed&quot; are considered by smart. This behaviour might have something to do with this (check section &quot;Smart transactions&quot;):

http://zorked.net/smart/doc/README.html

(in particular this phrase: &quot;Packages may even be reinstalled, IF different packages with the same name-version pair have different relations, and the one not installed is a considered better option.&quot;)
What I can gather from this is that smart works a bit differently than other package managers when it comes to reinstalling a package, but that&apos;s not necessarily an error, so I&apos;m closing this bug. If you don&apos;t agree with this, please reopen it and add your comments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30038</commentid>
    <comment_count>2</comment_count>
    <who name="Stoicescu Cornel">corneliux.stoicescu</who>
    <bug_when>2013-02-22 13:23:48 +0000</bug_when>
    <thetext>Verified as per above comment.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>