Bug 383032 - Can't get installed package information when it's not in mirror
Summary: Can't get installed package information when it's not in mirror
Status: RESOLVED WORKSFORME
Alias: None
Product: libqapt
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-02 05:54 UTC by sbw
Modified: 2017-08-03 10:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sbw 2017-08-02 05:54:28 UTC
When install a .deb file which not in any mirror. there is no way to get this package installed information (even no way to test this package is installed or not).

because any package information is getting from Package class, if some package is installed but not in mirror, we can't get this Package object from Backend.
Comment 1 Harald Sitter 2017-08-02 08:26:28 UTC
works just fine.

$ cat src/main.cpp 
#include <QApplication>

#include <QApt/Backend>
#include <QDebug>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QApt::Backend backend;
    backend.init();
    auto pkg = backend.package("discord");
    Q_ASSERT(pkg);
    qDebug() << pkg->isInstalled();
    qDebug() << pkg->version();
}

$ ./build/src/test      
test(18175)/(default) main: true
test(18175)/(default) main: "0.0.1"


$ apt policy discord
discord:
  Installed: 0.0.1
  Candidate: 0.0.1
  Version table:
 *** 0.0.1 100
        100 /var/lib/dpkg/status
Comment 2 sbw 2017-08-03 10:24:48 UTC
Okey, I checked my code and find some reason.

I'm install a 32-bit deb file in 64-bit system, and call backend.package("somename") will return a null pointer, but backend.package("somename:i386") will get right info.