How to enable/disable a particular bbappend for a specific MACHINE in Yocto - layer

I'm trying to understand the mechanism Yocto provides to enable/disable a particular bbappend for a specific MACHINE. I read this link (Modifying Variables to Support a Different Machine):
https://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers
And also found some information related here on stack overflow:
Machine specific layers in yocto
I have tried putting all this information into practice without any success. This is my particular problem:
A BSP layer for an "x" platform provides a qtbase_%.bbappend that modifies qtbase recipe from meta-qt5. I need this qtbase_%.bbappend only applying when building for MACHINE="x", but not for other different machines.
This is the content of the original qtbase_%.bbappend defined on the x-bsp-layer:
PACKAGECONFIG_GL = "gles2"
PACKAGECONFIG_FONTS = "fontconfig"
PACKAGECONFIG_APPEND = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove = "evdev"
Whenever I try to build an image for a MACHINE different from "x", the compilation is broken:
| ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.
| ERROR: Feature 'eglfs' was enabled, but the pre-condition '!config.android && !config.darwin && !config.win32 && features.egl' failed.
| ERROR: Feature 'gbm' was enabled, but the pre-condition 'libs.gbm' failed.
Removing the x-BSP-layer from bblayers.conf solves the problem, but that's not the kind of solution I am looking for.
I tried fixing this using information provided in previous links. I modified qtbase_%.bbappend recipe in this way:
PACKAGECONFIG_GL_x = "gles2"
PACKAGECONFIG_FONTS_x = "fontconfig"
PACKAGECONFIG_APPEND_x = " \
${#bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append_x = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend_x := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove_x = "evdev"
As you can see, I appended the "_x" suffix to all recipe variables. It's supposed (at least that it's what I understand) those "_x" make the variable being assigned just in case the PLATFORM="x" is defined. Right? But it doesn't work as expected, it generates the same problem. So, in practice, this means I don't understand even the basics of this mechanism.
Can some of you provide a good explanation for this? I think it should be helpful for others with the same issue out there. Thanks a lot for your time! :-)

Just add COMPATIBLE_MACHINE = "x" in .bbappend file.
As you can see, I appended "_x" suffix to all recipe variables
Remove all "_x" suffix in .bbappend file.

Note adding COMPATIBLE_MACHINE as suggested would change the signatures of the original recipe, which is bad practice, and would result in your layer failing the compatibility test carried out by the yocto-check-layer script. Consult this for details.
The correct way of making a .bbappend file machine-specific is through overrides, as you're already doing in your proposal. Why it still fails is a different question. I suggest you to inspect the variables of the recipe through bitbake, and switch machines to verify they change accordingly.

Related

Compilation of contract with include

I’m currently struggling to compile a contract (on aeternity's Sophia language) with include of a custom library “Library.aes” which resides in a separate file at the same level of the filesystem as the using contract.
The library looks like
namespace Library =
type number = int
function inc(x : number) : number = x + 1
The contract is using it like this
include "Library.aes"
When I compile (locally using compiler node) the contract, I always get
"Couldn't find include file 'Library.aes'\n"
also tried to pass the full path to the include, same result.
Is there a need to define the attribute options.file_system somehow?
let’s use the same example:
~/Quviq/Aeternity/aesophia_http [git:master]: FOO="include \\\"Bar.aes\\\"\\n\\ncontract Foo =\\n entrypoint foo() = Bar.bar()"
~/Quviq/Aeternity/aesophia_http [git:master]: BAR="namespace Bar =\\n function bar() = 42"
~/Quviq/Aeternity/aesophia_http [git:master]: curl -H "Content-Type: application/json" -d "{\"code\":\"$FOO\",\"options\":{\"backend\":\"fate\",\"file_system\":{\"Bar.aes\":\"$BAR\"}}}" -X POST http://localhost:3080/compile
{"bytecode":"cb_+IJGA6AANCB3UsSiP2HGHRML0dG95vNT9JsqZQMjPYAfEG1w6cC4Va3+RNZEHwA3ADcAGg6CPwEDP/5sbA2iAjcABwEDVP64/p9/ADcABwQDEWxsDaKjLwMRRNZEHxFpbml0EWxsDaIhLkJhci5iYXIRuP6ffw1mb2+CLwCFNC4yLjAAfreb3w=="}
Beware the quoting of strings, but apart from that it is rather straightforward.
This post is pretty old but thought on responding anyway.
Did you tried this by using aeproject?
https://github.com/aeternity/aepp-aeproject-js
Try to put your contract code under the file structure and use the deploy script so you can work it out locally first and the deploy to testnet or mainnet.
If you have Erlang installed you may use aesophia_cli instead of hosting a local node. Then it should search for include files in the same directory as your main .aes file.

Issues pulling change log using python

I am trying to query and pull changelog details using python.
The below code returns the list of issues in the project.
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
I am trying to pass values obtained in the issue above
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
I get the below error on trying the above:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Could anyone advise as to where am I going wrong or what permissions do I need.
Please note, if I pass a specific issue_id in the above code it works just fine but I am trying to pass a list of issue_id
You can already receive all the changelog data in the search_issues() method so you don't have to get the changelog by iterating over each issue and making another API call for each issue. Check out the code below for examples on how to work with the changelog.
issues = jira.search_issues('project= proj_a', maxResults=5, expand='changelog')
for issue in issues:
print(f"Changes from issue: {issue.key} {issue.fields.summary}")
print(f"Number of Changelog entries found: {issue.changelog.total}") # number of changelog entries (careful, each entry can have multiple field changes)
for history in issue.changelog.histories:
print(f"Author: {history.author}") # person who did the change
print(f"Timestamp: {history.created}") # when did the change happen?
print("\nListing all items that changed:")
for item in history.items:
print(f"Field name: {item.field}") # field to which the change happened
print(f"Changed to: {item.toString}") # new value, item.to might be better in some cases depending on your needs.
print(f"Changed from: {item.fromString}") # old value, item.from might be better in some cases depending on your needs.
print()
print()
Just to explain what you did wrong before when iterating over each issue: you have to use the issue.key, not the issue-resource itself. When you simply pass the issue, it won't be handled correctly as a parameter in jira.issue(). Instead, pass issue.key:
for issue in issues:
print(issue.key)
myIssue = jira.issue(issue.key, expand='changelog')

Using the TFS API, filetypes with extensions like .svnExe get ignored

I'm working on a tool which migrates from SVN to TFS using the TFS API.
workspace.CheckIn(
pendingChanges,
currentUser.TfsUser,
set.LogMessage + " on " + String.Format("{0:d/M/yyyy HH:mm:ss}", set.TimeStamp) + " by " + currentUser.SvnUser,
(CheckinNote)null,
(WorkItemCheckinInfo[])null,
(PolicyOverrideInfo)null
);
This is the way i check my revision in, but sometimes it ignores files like .svnExe, or other "unknown" file types.
Is there a way to check ALL filetypes in TFS?
There are two possibilities that I can think of:
Possibility 1: Something is causing the PendAdd() to fail.
For example, if the path already exists in Version Control, you have to use a PendEdit() instead.
To diagnose this possibility, you should subscribe to the VersionControlServer.NonFatalError event.
Possibility 2: You could have a corrupt workspace cache
You can refresh the cache by calling Workstation.Current.EnsureUpdateWorkspaceInfoCache() or by following the steps in this answer (run tf workspaces /collection:http://yourserver:8080/tfs/DefaultCollection, or delete the directories manually).

undefined method 'path' for nil:NilClass using chargify_api_ares gem

I feel like this should be a simple problem, but I'm pulling my hair out trying to track it down. I'm installed the chargify_api_ares gem, but can't do even basic things such as
Chargify::Subscription.create
As I get this path error. I feel like this must be a gem issue somehow but don't know where to go from here.
UPDATE: bundle show chargify_api_ares shows the correct path, I just somehow can't access it. Still trying random environment related things.
Looks like this is the source of the problem, in active_resource\base.rb:
# Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>)
# This method is regenerated at runtime based on what the \prefix is set to.
def prefix(options={})
default = site.path
default << '/' unless default[-1..-1] == '/'
# generate the actual method based on the current site path
self.prefix = default
prefix(options)
end
As I understand it, Chargify.subdomain should be setting the site.path, but I don't understand activeresource well enough yet to know what's happening and will continue to dig.
I too had the same issue.
I executed the following on the console
Chargify.configure do |c|
c.api_key = "<<api_key>>"
c.subdomain = "<<subdomain>>"
end
After that performing any Chargify console commands went through fine.

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.