pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: A stupid bash function to check for missing dependencies



On Mon, 23 Sep 2019 at 15:12, Jason Bacon <outpaddling%yahoo.com@localhost> wrote:
>
> On 2019-09-22 04:16, Ottavio Caruso wrote:
> > [was:  Re: How to check which dependencies are missing?}

> > A slightly better version. This one takes account of package versions:
> >
> > check-depends() {
> >          for DEP in  $(bmake show-depends|cut -f1 -d":");
> >          do
> >                  pkg_info -qE   $DEP && echo $DEP found: $(pkg_info -E   $DEP)\
> >                          ||  echo "$DEP: not installed";
> >          done
> >
> > }
> >
> > $ cd pkgsrc/current/pkgsrc/www/liferea/
> > $ check-depends
> > sqlite3>=3.27.2nb1 found: sqlite3-3.28.0
> > glib2>=2.34.0 found: glib2-2.60.2nb1
> > libpeas>=1.20.0nb7: not installed
> > gobject-introspection>=1.34.0: not installed
> > gtk3+>=3.24.8nb2: not installed
> > hicolor-icon-theme>=0.9nb1 found: hicolor-icon-theme-0.17
> > desktop-file-utils>=0.10nb1 found: desktop-file-utils-0.23nb1
> > libnotify>=0.7.7nb6: not installed
> > gsettings-desktop-schemas>=3.4.2: not installed
> > libxml2>=2.8.0nb2 found: libxml2-2.9.9
> > libxslt>=1.1.28nb2 found: libxslt-1.1.33
> > webkit-gtk>=2.26.0: not installed
> > libSM>=0.99.2 found: libSM-1.2.3
> > json-glib>=0.14.2nb3: not installed
> >
> >
> > I'm trying to make it work in sh/dash but it won't.
> >
> >
> Nice work...

Credit due to Robert Elz for providing a way better version:

check_depends() {
        for DEP in  $( bmake show-depends|cut -f1 -d: )
        do
                pkg_info -qE "${DEP}" &&
                printf '%s found: %s\n' "${DEP}" "$(pkg_info -E "${DEP}")" ||
                printf '%s: not installed\n' "${DEP}"
        done
}



> Have you thought about making this available as part of a
> package, or perhaps a new make target like "missing-depends"?

It's in my TODO, but the mk.* syntax and mechanisms are still arcane to me.

It would also be nice to have something similar to Debian's "apt-get
-s", where you can have a dry-run of the whole process. It might be
there already, but I'm not aware of it.

Something like:

cd <package>
bmake -s install

-- 
Ottavio Caruso


Home | Main Index | Thread Index | Old Index