I have this layer configuration file in poky/meta-test/conf directory
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb"
${LAYERDIR}/recipes-*/*/*.bbappend
${LAYERDIR}/recipes-*/*.bb
${LAYERDIR}/recipes-*/*.bbappend ”
BBFILE_COLLECTIONS += “test”
BBFILE_PATTERN_test = “^${LAYERDIR}/”
BBFILE_PRIORITY_test = “13”
LAYERVERSION_test = “13”
And when I do
source oe-init-build-env build
bitbake core-image-minimal //error at this
error
ERROR: ParseError at /home/ubuntu/Desktop/embedded_Emdevor/my/my/poky/meta-test/conf/layer.conf:5: unparsed line: '${LAYERDIR}/recipes-*/*/*.bbappend'
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend \
${LAYERDIR}/recipes-*/*.bb \
${LAYERDIR}/recipes-*/*.bbappend ”
Related
So I have a few files with spaces in them, I first remove spaces and put the "new names" in a list, then I construct a command to take old file name, which I put in quotes, and then the new file-name and rename them using mv and subprocess.run - but python is spitting out errors:
Here's the code:
import os
import subprocess
file_path = "/home/emil/import/"
files = os.listdir(file_path)
new_files = []
#Create new names
for each in files:
print ("Taking file: ", each)
new_name = each.replace(" ", "")
final_name = file_path + new_name
new_files.append(final_name)
cmd = "mv \"" + file_path + each + "\" " + final_name
print (cmd)
subprocess.run([cmd])
And here is the output:
emil#TITAN:~/programmering$ ./call.py
Taking file: test file1.pdf
mv "/home/emil/import/test file1.pdf" /home/emil/import/testfile1.pdf
Traceback (most recent call last):
File "./call.py", line 22, in <module>
subprocess.run([cmd])
File "/usr/lib/python3.7/subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'mv "/home/emil/import/test file1.pdf" /home/emil/import/testfile1.pdf': 'mv "/home/emil/import/test file1.pdf" /home/emil/import/testfile1.pdf'
As you can see I print the variable cmd which I am sending to subprocess, and if I run that command individually it works great:
emil#TITAN:~/programmering$ mv "/home/emil/import/test file1.pdf" /home/emil/import/testfile1.pdf
emil#TITAN:~/programmering$ ls /home/emil/import/
'test file2.pdf' 'test file3.pdf' testfile1.pdf
So where am I going wrong?
I'm trying to run Qt5 framework through eglfs instead of X11 or wayland.
I'm trying to install Qt5 for qemuarm emualting Raspberry pi 3 based on yocto Rocko.
This is my bblayers.conf:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
SRCPATH = "/home/yocto/yocto"
BBFILES ?= ""
BBLAYERS ?= " \
${SRCPATH}/meta \
${SRCPATH}/meta-poky \
${SRCPATH}/meta-openembedded/meta-oe \
${SRCPATH}/meta-openembedded/meta-multimedia \
${SRCPATH}/meta-openembedded/meta-networking \
${SRCPATH}/meta-openembedded/meta-perl \
${SRCPATH}/meta-openembedded/meta-python \
${SRCPATH}/meta-qt5 \
${SRCPATH}/meta-raspberrypi \
${SRCPATH}/meta-security \
and this is my local.conf:
MACHINE ??= "qemuarm"
DL_DIR ?= "${TOPDIR}/../downloads"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
LICENSE_FLAGS_WHITELIST = "commercial"
CONF_VERSION = "1"
PREFERRED_VERSION_linux-raspberrypi = "4.%"
DISTRO_FEATURES_remove = "x11 wayland"
DISTRO_FEATURES_append = " systemd opengl pam ${DISTRO_FEATURES_LIBC}"
VIRTUAL-RUNTIME_init_manager = "systemd"
EXTRA_IMAGE_FEATURES += "package-management splash"
INHERIT+="toaster buildhistory"
CORE_IMAGE_EXTRA_INSTALL += "openssh"
ENABLE_UART="1"
#PACKAGECONFIG_append_qtbase = " accessibility eglfs fontconfig gles2 linuxfb"
################### QT ######################
QT_DEV_TOOLS = " \
qtbase-dev \
qtbase-mkspecs \
qtbase-plugins \
qtbase-tools \
qtserialport-dev \
qtserialport-mkspecs \
"
QT_TOOLS = " \
qtbase \
qtserialport \
"
FONTS = " \
fontconfig \
fontconfig-utils \
ttf-bitstream-vera \
"
TSLIB = " \
tslib \
tslib-conf \
tslib-calibrate \
tslib-tests \
tspress \
"
QT5_PKGS = " \
qt3d \
qtcharts \
qtdeclarative \
qtdeclarative-plugins \
qtdeclarative-qmlplugins \
qtgraphicaleffects \
qtlocation-plugins \
qtmultimedia \
qtquickcontrols2 \
qtsensors-plugins \
qtserialbus \
qtsvg \
qtwebsockets-qmlplugins \
qtvirtualkeyboard \
qtxmlpatterns \
"
QML_APPS = " \
qqtest \
"
CORE_IMAGE_EXTRA_INSTALL += " \
${FONTS} \
${QT_TOOLS} \
${QT5_PKGS} \
cinematicexperience \
"
I'm trying to build this image bitbake rpi-hwup-image
the problem is with qtbase, it fails with this error:
| ERROR: Feature 'opengl-desktop' was enabled, but the pre-condition '(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
| || (!config.watchos && !config.win32 && libs.opengl)' failed.
|
| ERROR: The OpenGL functionality tests failed!
| You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
| QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.
Update
This problem is solved by uncommenting PACKAGECONFIG_append_qtbase and it has a typo so, it's been updated to be PACKAGECONFIG_append_pn-qtbase.
I added those lines too:
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl".
I comment out this line LICENSE_FLAGS_WHITELIST = "commercial".
but it fails again at qtbase build by this error (this is the tail of the log file) (I deleted the tmp folder and started bitbake rpi-hwup-image again but it went to the same error)
| cd windowflags/ && ( test -e Makefile || /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/recipe-sysroot-native/usr/bin/qt5/qmake -o Makefile /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/windowflags.pro -qtconf /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/bin/qt.conf ) && make -f Makefile
| make[4]: Entering directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets/widgets/windowflags'
| compiling /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/controllerwindow.cpp
| compiling /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/previewwindow.cpp
| linking wiggly
| make[4]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets/widgets/wiggly'
| compiling /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/main.cpp
| linking validators
| generating .moc/moc_predefs.h
| moc /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/controllerwindow.h
| make[4]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets/widgets/validators'
| moc /home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/git/examples/widgets/widgets/windowflags/previewwindow.h
| compiling .moc/moc_controllerwindow.cpp
| compiling .moc/moc_previewwindow.cpp
| linking windowflags
| make[4]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets/widgets/windowflags'
| make[3]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets/widgets'
| make[2]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples/widgets'
| make[1]: Leaving directory '/home/yocto/yocto/build/RP3_Qt/tmp/work/armv5e-poky-linux-gnueabi/qtbase/5.9.3+gitAUTOINC+4d8ae444c2-r0/build/examples'
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
I found the solution according to this page.
The configuration part -at this page- says something about ommiting the tests part at this option -nomake tests, it's the same part that fails at the compiling stage of qtbase.
so after cleaning qtbase and adding this part to my local.conf
PACKAGECONFIG_remove_pn-qtbase = " tests gl"
gl is omitted too because we want to build qtbase for eglfs not for desktop.
I need to build a simple script in python3 that opens more files inside a directory and see if inside these files is a keyword.
All the files inside the directory are like this: "f*.formatoffile" (* stays for a casual number)
Example:
f9993546.txt
f10916138.txt
f6325802.txt
Obviusly i just need to open the txt files ones.
Thanks in advance!
Final script:
import os
Path = "path of files"
filelist = os.listdir(Path)
for x in filelist:
if x.endswith(".txt"):
try:
with open(Path + x, "r", encoding="ascii") as y:
for line in y:
if "firefox" in line:
print ("Found in %s !" % (x))
except:
pass
This should do the trick:
import os
Path = "path of the txt files"
filelist = os.listdir(Path)
for i in filelist:
if i.endswith(".txt"): # You could also add "and i.startswith('f')
with open(Path + i, 'r') as f:
for line in f:
# Here you can check (with regex, if, or whatever if the keyword is in the document.)
NagiosQL creates a file called servicetemplates.cfg.
For easier distribution of some selected templates I' d like to split any service definition into one seperate file.
Sample servicetemplates.cfg
define service {
name imap_service
use generic_service
check_command check_service_imap
register 0
}
define service {
name ldapserver_ldap_service
service_description LDAP
use generic_service
check_command check_service_ldap
icon_image ldapserver.png
register 0
}
What I like to have is some kind of parser, which create files like the "name" of the template, e. g. imap_service.cfg and ldapserver_ldap_service.cfg.
Every file have to include the whole definition (define service { ... } )
The following code is a solution for me, it might not be perfect as it expects a certain syntax of the Nagios object configuration.
The first parameter has to be the file name of the Nagios configuration file.
<?php
if (empty($argv[1])) {
echo "First parameter: File to Nagios object configuration\n";
exit(1);
}
$starttag=0;
$outfile='';
$outtext='';
$inputfile=$argv[1];
$cfgfile = file($inputfile) or exit(2);
foreach ($cfgfile as $line_num => $line) {
# $outtext will be reset if define ... { is found
$outtext.=$line;
# Start tag of a new section "define ... {"
if (preg_match("/.*define.*{/i", $line)) {
$starttag=1;
$outtext=$line;
}
# Split the line with name. The parameter after name is the later filename
if (preg_match("/name[\s]+[\w]+/", $line) && $starttag=1) {
$keywords=preg_split("/[\s]+/", $line);
$outfile=$keywords[2];
$outfile.=".cfg";
$outfile=str_replace(' ', '_', $outfile);
}
# End tag of a new section "}"
if (preg_match("/.*}/", $line) && $starttag=1) {
$starttag=0;
echo "Writing {$outfile}\n";
file_put_contents($outfile, $outtext);
}
}
echo "Read lines {$line_num} from {$inputfile}\n";
?>
I am using the file module to get some files from a form locally and upload to another server. When i try to upload large files it gives me timeout error (i have tried changing php.ini but that's not how i want it to work). That's why I am trying to upload the files via ftp functions. However, i cannot get the source path of the file that i just selected to upload (e.g filepath, not uri). I want to pass this filepath into fopen() function as a source. But i keep getting the error: *ftp_nb_fput() [function.ftp-nb-fput]: Can't open that file: No such file or directory in assets_managed_file_form_upload_submit() (line 303 of FILE_DIRECTORY).*
function assets_managed_file_form_upload_submit($form, &$form_state) {
for ($i = 0; $i < $form_state['num_files']; $i++) {
if ($form_state['values']['files_fieldset']['managed_field'][$i] != 0) {
// Make the file permanent.
$file = file_load($form_state['values']['files_fieldset']['managed_field'][$i]);
$local_path = file_create_url($file->uri);
//drupal_set_message(t("file->uri: " . $file->uri . " local path: " . $local_path));
$file->status = FILE_STATUS_PERMANENT;
$directory = 'private://cubbyhouse/'. $form_state['values']['allowed_user'];
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
$source = fopen($local_path,"r");
$conn = ftp_connect("FTP SERVER") or die("Could not connect");
ftp_login($conn,"USERNAME", "PASS");
$ftp_directory = TheDirectoryIwantToPutTheFile . $form_state['values']['allowed_user'];
$uri_parts = explode("/",$file->uri);
$filename = $uri_parts[sizeof($uri_parts)-1];
$target = $ftp_directory . "/" . $filename;
//drupal_set_message(t($target . " " . $file->uri));
$ret = ftp_nb_fput($conn,$target,$source,FTP_ASCII);
while ($ret == FTP_MOREDATA)
{
// Do whatever you want
//echo ".";
// Continue upload...
$ret = ftp_nb_continue($conn);
}
ftp_close($conn);
//$file->uri = file_unmanaged_copy($file->uri, $directory, FILE_EXISTS_REPLACE);
$file->uid = $form_state['values']['allowed_user'];
drupal_chmod($file->uri);
file_save($file);
// Need to add an entry in the file_usage table.
file_usage_add($file, 'assets', 'image', 1);
drupal_set_message(t("Your file has been uploaded!"));
}
}
}
I solved the problem. The problem was mainly because I gave the wrong path as the target. it had to be /public_html/...... instead of /home/our_name/public_html