bugGNU Octave - Bugs: bug #60053, package: dependency may also be...

 
 

bug #60053: package: dependency may also be octave itself.

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Sun 14 Feb 2021 05:30:30 PM UTC
   
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Fixed Assigned to:  None
Originator Name:  Reissner Open/Closed:  * Closed
Release:  * 6.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 21 Feb 2021 12:45:40 PM UTC, comment #11: 

I pushed the change to the documentation here:
https://hg.savannah.gnu.org/hgweb/octave/rev/2aa23c8f3ef3

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Tue 16 Feb 2021 09:16:39 AM UTC, comment #10: 

Ok i learned something! thank you .

Ernst Reissner <ernstreissner>
Tue 16 Feb 2021 09:07:14 AM UTC, comment #9: 

I'm not sure how you come to the conclusion that `OCTAVE_VERSION` is a variable:

>> which OCTAVE_VERSION
'OCTAVE_VERSION' is a built-in function from the file libinterp/corefcn/defaults.cc


Maybe you created a variable with the same name? You can shadow any function with a variable of the same name:

>> version
ans = 6.1.90
>> version = 'Hello World';
>> version
version = Hello World


The documentation also is correct in stating that `version()` (without input arguments!) is just an alias for `OCTAVE_VERSION`.

Markus Mützel <mmuetzel>
Group administrator
Tue 16 Feb 2021 08:54:15 AM UTC, comment #8: 

I face a small bug: OCTAVE_VERSION is a variable
and could be modified by the user.
Better to use version() instead.

By the way, documentation is wrong: version() is not an alias
for OCTAVE_VERSION, maybe the other way round:
OCTAVE_VERSION, provided for compatibility
may be initialized with version().


@philip: As implemented for 'octave'
one could also do for java:

    ## Is the current dependency java?
    if (strcmp (dep.package, "java"))
      if (! compare_versions (version('-java'), dep.version, dep.operator))
        bad_deps{end+1} = dep;
      endif

But we need additional:
It could be java without explicit version
and java may not be provided at all.

I tested:
octave:1> version
ans = 6.1.0
octave:2> version('-java')
ans = no usable Java Runtime Environment (x86_64) found:
/usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so: failed to load: Error loading shared library /usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so: No such file or directory

Well, 'no usable Java Runtime Environment' seems to signify
no installation.
What makes me feel worried: is java 6.1.0 tied to java 11?

The same way could be done for fftw, blas and lapack.

Note that documentation tell about not being reliable.
Shall be fixed, right?

Ernst Reissner <ernstreissner>
Mon 15 Feb 2021 08:47:18 PM UTC, comment #7: 

@Ernst:
Sorry I misunderstood it was about the docs.

BTW I'm not a package developer but package maintainer. Admittedly I did develop a few functions, perhaps that's where the confusion comes from :-)

As to comment #5, package dependencies are checked in private function "get_unsatisfied_dependencies.m" and that does invoke compare_versions.m ...

function bad_deps = get_unsatisfied_deps (desc, installed_pkgs_lst,
                                          uninstall_flag = false)

  bad_deps = {};

  ## For each dependency.
  for i = 1:length (desc.depends)
    dep = desc.depends{i};

    ## Is the current dependency Octave?
    if (strcmp (dep.package, "octave"))
      if (! compare_versions (OCTAVE_VERSION, dep.version, dep.operator))
        bad_deps{end+1} = dep;
      endif
      ## Is the current dependency not Octave?
    else
      ok = xor (false, uninstall_flag);
      for i = 1:length (installed_pkgs_lst)
        cur_name = installed_pkgs_lst{i}.name;
        cur_version = installed_pkgs_lst{i}.version;
        if (strcmp (dep.package, cur_name)
            && compare_versions (cur_version, dep.version, dep.operator))
          ok = xor (true, uninstall_flag);
          break;
        endif
      endfor
      if (! ok)
        bad_deps{end+1} = dep;
      endif
    endif
  endfor


It's rather compare_versions that supports a limited set of comparison operators.  As you can see above, "!=" is supported invoking compare_versions with an "=" operator and then negating compare_version's output.

Philip Nienhuis <philipnienhuis>
Group Member
Mon 15 Feb 2021 05:59:05 PM UTC, comment #6: 

philip nienhuis is a package developer.
Well i developed a single package.. i am not a package developer.

Ernst Reissner <ernstreissner>
Mon 15 Feb 2021 05:35:11 PM UTC, comment #5: 

Sounds very good.
What I wonder is, why ~= and != are not possible.
Seemingly not based on compare_versions.

Ernst Reissner <ernstreissner>
Mon 15 Feb 2021 05:12:48 PM UTC, comment #4: 

Missed to add the patch. Here it is.

(file #50865)

Markus Mützel <mmuetzel>
Group administrator
Mon 15 Feb 2021 05:12:03 PM UTC, comment #3: 

The attached patch adds some more examples to the description of the "Depends" keyword in the DESCRIPTION file.

I'm not a package developer. So, I hope I correctly distilled the necessary information from the discussion here.
It would be nice if a package developer could check if the changes in the description are correct.

Markus Mützel <mmuetzel>
Group administrator
Mon 15 Feb 2021 04:54:42 PM UTC, comment #2: 

No wait, the issue is documentation:
According to documentation, depencencies may only be packages.
This is not true as octave itself may also be specified
with version.

Ernst Reissner <ernstreissner>
Mon 15 Feb 2021 02:25:14 PM UTC, comment #1: 

All of this already works.
E.g., signal package:

---
Package name:
        signal
Version:
        1.4.1
Short description:
        Signal processing tools, including filtering, windowing and display functions.
Depends on:
        octave >= 3.8
        control >= 2.4
Depended on by:
        communications
        tisean
Status:
        Loaded
>>


... and pkg.m checks this, also for ranges but AFAIK they need to be entered separately like "Octave >= 3.0", "Octave < 4.4", etc.

Closing as "invalid" (sorry :-)  )

Philip Nienhuis <philipnienhuis>
Group Member
Sun 14 Feb 2021 05:30:30 PM UTC, original submission:  

In the manual Section 37.4.1,
the description file is documented
and in particular the Depends entry.
It is said, that one may add here a list of dependencies
to octave packages.
This is true, but also octave itself may be seen as a package.

Also, it is possible to give not only a list of packages
but more than that a list of conditions,
so as e.g. octave <= 6.1.0, octave >= 5.2.1
Of course this works for true packages also.

Ernst Reissner <ernstreissner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-21 mmuetzel StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2021-02-15 mmuetzel Attached File- Added bug60053_doc_DESCRIPTION_depends.patch, #50865
    2021-02-15 mmuetzel StatusInvalid / Not an Octave Bug Patch Submitted
        Open/ClosedClosed Open
        Release5.2.0 6.1.0
    2021-02-15 philipnienhuis StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2021-02-14 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code