what is the function of unzip-native? - yocto

In a yocto bb, I see this:
DEPENDS += "unzip-native"
I can't find an introduction in:
https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html
What's the purpose to add this?

The recipe, presumably, uses unzip to unpack archives at some point.

Related

Yocto - exclude files from -dev package

I have a great problem moving some header files from FILES_${PN}-dev to a custom dev-internal package.
In OpenEmbedded documentation there is explicitly stated that there is "no actual support for explicitly excluding files from packaging".
I tried this:
FILES_${PN}-dev = ""
PACKAGES += "${PN}-dev-internal"
FILES_${PN}-dev-internal = "${includedir}/<my-pattern>.h"
FILES_${PN}-dev = "<original-content>"
but it seems that the first defined package captures first anyway.
Is there any known workaround for this? Except of naming everything explicitly in both packages content which is highly, really undesirable.
but it seems that the first defined package captures first anyway.
Yes. So put PN-dev-internal before PN-dev in PACKAGES. This might work:
PACKAGES =+ "${PN}-dev-internal"
If not, PACKAGE_BEFORE_PN is useful.
You can probably change the component installation config to better separate the headers (e.g. place them in different directories).

How set mpv2 for MATLAB?

I'm trying to run these from Karl Skretting for dictionary learning in MATLAB. It is mentioned that mpv2 java package is needed to run these scripts for sparse approximation. where can I find this package and how can i install it so that MATLAB can use its method?
Thanks for your help.
You can find it here:
http://www.ux.uis.no/~karlsk/dle/mpv2-class.zip
Extract all files to folder named 'mpv2' (so folder structure is: C:\Some\Folder\mpv2)
javaaddpath('C:\Some\Folder\')
And to test for success:
exist('mpv2.SimpleMatrix') %should return 8 indicating class.

Stubs in Matlab Toolbox Testing

As a follow up to my previous question, I run into a new obstacle: how to generate stubs for functions in a toolbox?
I found Andy Campbell's solution for the non toolbox case. This does not work in my case because Matlab complains: package directories are not allowed in MATLAB path in Pathfixtures!
I also don't see how this concept will overwrite the import statements within the toolbox, e.g. in file2.
This is my setup:
+folder1/file1.m
+folder1/runtestsuite.m
+folder1/unittest_data/file1_testdata.mat
+folder1/+folder2/file2.m
+folder1/+folder2/unittest_data/overloads/file1.m
...
Let's say I want to stub file1 in file2. And file2 has as a first statement: import folder1.file1.
With
methods(Access=private)
function inject_file1_stub(testCase, answer)
import matlab.unittest.fixtures.PathFixture;
testCase.applyFixture(PathFixture(fullfile(testCase.path,'overloads')));
file1('', answer);
end
end
So currently I believe this concept is not applicable in my case, so how is this done correctly with matlab?
I know one can shadow an implementation of a function in a toolbox, if one adds another path with the same toolboxname and function to the path. For this I would have to recreate a subset of the current folder setup:
So my current idea for a fixture is
create temporary folder with tempdir
use mfilename to check what subset of the toolbox directories I have to recreate
generate folder structure
copy from the overload folder to the new toolbox system
Add this to path
Run tests
In teardown
remove the temporary folder
remove the entry from path
I have not implemented this yet, and seems a bit redundant knowing that there is a Pathfixture in matlab already.
Pointers to other toolboxes which show how they have solved these kind of problems are also welcome.
It is true that you can't add subfolders of packages to the path, but that doesn't mean you can't shadow these path functions. To do this you need to separate the test related content out of your source location. For example, if your source looks like:
<source-home>/+folder1/file1.m
<source-home>/+folder1/+folder2/file2.m
Then you can put your tests somewhere else so your structure would look something like:
<test-home>/file1Test.m
<test-home>/file2Test.m % could also put tests into packages if you want
<test-home>/overloads/+folder1/file1.m
<test-home>/overloads/+folder1/+folder2/file2.m
Then inside of file1Test and/or file2Test you would use a PathFixture to add:
<test-home>/overloads/
to the path.
Also, another thing to consider is defining an interface in your source code for these dependencies and leveraging dependency injection (with or without a DI framework) in order to get test specific behavior into your tests.

unbless implementation in Perl?

As many Perl developers know, unbless is used to remove the blessing from objects. I am trying to understand how does it internally work by investigating its implementation. I tried to check its implementation in its package Data::Structure::Util. Here's the Source:
sub unbless {
unbless_xs( $_[0] );
}
Where may I find unbless_xs sub implementation/source ?
If you look for Data::Structure::Util on metacpan.org you will see a Browse link to the left that will let you explore the contents of the distribution
The same applies to any CPAN module: there is no need for a download to examine the source code. In this case you will find Util.xs at the root of the structure
If you prefer, you can do the same thing on the CPAN site search.cpan.org but you must ascend to the (currently) Data-Structure-Util-0.16 distribution to find the browse link
It's implemented in C, you can check the source of the function at https://metacpan.org/source/ANDYA/Data-Structure-Util-0.16/Util.xs#L239

Erlang erlIDE: what are the -compile options supported?

I've been trying to get erlIDE to work with -compile options e.g.
-compile('S'). % Generate 'assembler' listing
to no avail. What I am doing wrong?
NOTE: I have also tried setting 'project specific' options for the compiler with no success.
EDIT: could it be that 'erlc' is invoked and forced to generate a 'beam' and thus disregards orders to generate 'assembler' output?
This is badly supported, currently, sorry about that. With recent releases of erlide, the .S files are created in the workspace directory instead of project/ebin. This is caused by the fact that the compiler uses the current directory, ignoring the outdir option, in this case.
regards,
Vlad