how to reference a parent folder from azure devops pipe? - azure-devops

I am getting the following error from my build:
'$/CCC/AAA/AAASchemas' cannot be cloaked because it does not have a mapped parent.
##[error]Exit code 100 returned from process: file name 'tf', arguments 'vc workfold /cloak /workspace:ws_26_26 $/CCC/AAA/AAASchemas /collection:https://usap-dev.visualstudio.com/ /loginType:OAuth /login:.,*** /noprompt'.
Here's how I've configured it:
How do I correctly add this folder?

The error message is very clear: You can't cloak that because you're not mapping anything in the hierarchy above it.
You're mapping $/CCC/AAA/FromHHHMethodist/DEV. The path $/CCC/AAA/AAASchemas isn't in that path. Thus, there's nothing to cloak, because it's not going to get downloaded in the first place. You'd only need to cloak it if you were mapping $/, $/CCC, or $/CCC/AAA.

Related

How to deploy the Sql files to Dedicated Server with Azure Devops Pipeline CI/CD

I am working on Azure DevOps CI CD Pipelines. The project's Backend is Dotnet Core, Frontend is Angular 8 and for Database, we used Entity Framework code-first approach. I was able to add Front and back end in pipelines. Now I am stuck with database deployment. since I was also unable to find any dedicated article.
The project is consists of Multi Context and Multi-Project. Reference folder structure
At local we usually run this command to generate migration and it works fine.
Add-Migration -Context ABCCompanyContext AddCompanyTable
Now, in Pipeline i have added the following command which I get from stackoverflow it self. but it didn't work. But from the error. it seems like I am really close
Pipeline Command
dotnet tool install --global dotnet-ef dotnet ef migrations script -i
-o $(Build.ArtifactStagingDirectory)\Migrations\migrate.sql --project **/ABC.Company.Data.csproj --startup-project **/ABC.Company.Api.csproj -i -o $(Build.ArtifactStagingDirectory)\Migrations\migrate.sql
Error Log
2020-12-24T06:49:27.0265041Z ========================== Starting
Command Output ===========================
2020-12-24T06:49:27.0688206Z ##[command]"C:\windows\system32\cmd.exe"
/D /E:ON /V:OFF /S /C "CALL
"D:\a_temp\f3a33029-4f61-404f-9b64-c73c5296123a.cmd""
2020-12-24T06:49:32.9358440Z You can invoke the tool using the
following command: dotnet-ef 2020-12-24T06:49:32.9359182Z Tool
'dotnet-ef' (version '5.0.1') was successfully installed.
2020-12-24T06:49:38.4701578Z System.IO.IOException: The filename,
directory name, or volume label syntax is incorrect. :
'D:\a\1\s*\obj' 2020-12-24T06:49:38.4702878Z at
System.IO.FileSystem.CreateDirectory(String fullPath, Byte[]
securityDescriptor) 2020-12-24T06:49:38.4703503Z at
System.IO.Directory.CreateDirectory(String path)
2020-12-24T06:49:38.4704199Z at
Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file,
String buildExtensionsDir, String framework, String configuration,
String runtime) 2020-12-24T06:49:38.4705029Z at
Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _)
2020-12-24T06:49:38.4705729Z at
Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[]
args) 2020-12-24T06:49:38.4706399Z at
Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[]
args) 2020-12-24T06:49:38.4707003Z at
Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
2020-12-24T06:49:38.4707626Z The filename, directory name, or volume
label syntax is incorrect. : 'D:\a\1\s*\obj'
2020-12-24T06:49:38.6646502Z ##[error]Cmd.exe exited with code '1'.
2020-12-24T06:49:38.7627325Z ##[section]Finishing: Build EfCore
Migrations
The error message,
System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'D:\a\1\s\*\obj'
The path string contains the character '*'. Normally this character is not available in file name and folder name.
As the introduction from the docs about .NET Core CLI, the values of the options '--project' and '--startup-project' are the relative paths to the project folders.
According to my test, in the 'dotnet ef' command, it seems does not support wildcard patterns.
When I use wildcard patterns to set the path values, it always return the same error message.
System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'D:\a\1\s\**\obj'
However, when I directly provide the complete relative paths instead of using wildcard patterns, the error disappears.
So, I recommend you directly use the complete relative paths to the project folders.

Why is my nuget package push filtered out in VSTS (Azure Devops)

I have an azure DevOps pipeline who compile correctly and the log files indicate a successful "pack" into "D:\a\1\a\Packages\Rvi.LA.ObjetsMetiers.1.1.0.nupkg".
Concerning the nuget push step, I can see the following in the debug log :
2019-02-14T14:19:43.5995520Z ##[debug]pattern: 'D:\a\1\a\Packages\RVI.LA.ObjetsMetiers*.nupkg'
2019-02-14T14:19:44.9183973Z ##[debug]expanding braces
2019-02-14T14:19:44.9184020Z ##[debug]pattern: 'D:/a/1/a/Packages/RVI.LA.ObjetsMetiers*.nupkg'
2019-02-14T14:19:44.9209179Z ##[debug]findPath: 'D:\a\1\a\Packages'
2019-02-14T14:19:44.9209259Z ##[debug]statOnly: 'false'
2019-02-14T14:19:44.9212246Z ##[debug]findPath: 'D:\a\1\a\Packages'
2019-02-14T14:19:44.9212452Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'undefined'
2019-02-14T14:19:44.9212597Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'undefined'
2019-02-14T14:19:44.9212885Z ##[debug]findOptions.followSymbolicLinks: 'undefined'
2019-02-14T14:19:44.9223644Z ##[debug] D:\a\1\a\Packages (directory)
2019-02-14T14:19:44.9225732Z ##[debug] D:\a\1\a\Packages\Rvi.LA.ObjetsMetiers.1.1.0.nupkg (file)
2019-02-14T14:19:44.9225814Z ##[debug]2 results
2019-02-14T14:19:44.9225888Z ##[debug]found 2 paths
So, it finds two results but strangely indicates "found 2 paths" when one of them is a file. Anyway, it successfully finds the one who needs to be pushed and detect it is a file.
The problem is in the following part of the log :
2019-02-14T14:19:44.9225984Z ##[debug]applying include pattern
2019-02-14T14:19:44.9235322Z ##[debug]0 matches
2019-02-14T14:19:44.9235403Z ##[debug]0 final results
2019-02-14T14:19:44.9247396Z ##[warning]No packages matched the search pattern.
2019-02-14T14:19:44.9247569Z ##[debug]Processed: ##vso[task.issue type=warning;]No packages matched the search pattern.
It seems to exclude it with the include pattern who is "$(Build.ArtifactStagingDirectory)\Packages\$(NomNuspec)*.nupkg" and is translated to "D:\a\1\a\Packages\RVI.LA.ObjetsMetiers*.nupkg" in the log above.
I don't understand why it is not found. Is there something who should hit me in the eye even though two persons looked at it many times?
Got it.
The package was packed as "Rvi.LA.ObjetsMetiers.1.1.0.nupkg", but the filter was "RVI" in uppercase. I did see it, but thought "case sensitivity does not matter with a file name!", but it does. The last update told me this is a real possibility.
I modified my nuget file to pack with "RVI.LA.ObjetsMetiers", not "Rvi.LA.ObjetsMetiers" and the original path "$(Build.ArtifactStagingDirectory)\Packages\$(NomNuspec)*.nupkg" works as $(NomNuspec) is resolved with "RVI.LA.ObjetsMetiers" as stated above.
I will suggest to nuget to remove the "case-sensitiveness" as there is no way to have two files named "fileA.txt" and "FileA.txt" anyway.

How can I get "HelloWorld - BitBake Style" working on a newer version of Yocto?

In the book "Embedded Linux Systems with the Yocto Project", Chapter 4 contains a sample called "HelloWorld - BitBake style". I encountered a bunch of problems trying to get the old example working against the "Sumo" release 2.5.
If you're like me, the first error you encountered following the book's instructions was that you copied across bitbake.conf and got:
ERROR: ParseError at /tmp/bbhello/conf/bitbake.conf:749: Could not include required file conf/abi_version.conf
And after copying over abi_version.conf as well, you kept finding more and more cross-connected files that needed to be moved, and then some relative-path errors after that... Is there a better way?
Here's a series of steps which can allow you to bitbake nano based on the book's instructions.
Unless otherwise specified, these samples and instructions are all based on the online copy of the book's code-samples. While convenient for copy-pasting, the online resource is not totally consistent with the printed copy, and contains at least one extra bug.
Initial workspace setup
This guide assumes that you're working with Yocto release 2.5 ("sumo"), installed into /tmp/poky, and that the build environment will go into /tmp/bbhello. If you don't the Poky tools+libraries already, the easiest way is to clone it with:
$ git clone -b sumo git://git.yoctoproject.org/poky.git /tmp/poky
Then you can initialize the workspace with:
$ source /tmp/poky/oe-init-build-env /tmp/bbhello/
If you start a new terminal window, you'll need to repeat the previous command which will get get your shell environment set up again, but it should not replace any of the files created inside the workspace from the first time.
Wiring up the defaults
The oe-init-build-env script should have just created these files for you:
bbhello/conf/local.conf
bbhello/conf/templateconf.cfg
bbhello/conf/bblayers.conf
Keep these, they supersede some of the book-instructions, meaning that you should not create or have the files:
bbhello/classes/base.bbclass
bbhello/conf/bitbake.conf
Similarly, do not overwrite bbhello/conf/bblayers.conf with the book's sample. Instead, edit it to add a single line pointing to your own meta-hello folder, ex:
BBLAYERS ?= " \
${TOPDIR}/meta-hello \
/tmp/poky/meta \
/tmp/poky/meta-poky \
/tmp/poky/meta-yocto-bsp \
"
Creating the layer and recipe
Go ahead and create the following files from the book-samples:
meta-hello/conf/layer.conf
meta-hello/recipes-editor/nano/nano.bb
We'll edit these files gradually as we hit errors.
Can't find recipe error
The error:
ERROR: BBFILE_PATTERN_hello not defined
It is caused by the book-website's bbhello/meta-hello/conf/layer.conf being internally inconsistent. It uses the collection-name "hello" but on the next two lines uses _test suffixes. Just change them to _hello to match:
# Set layer search pattern and priority
BBFILE_COLLECTIONS += "hello"
BBFILE_PATTERN_hello := "^${LAYERDIR}/"
BBFILE_PRIORITY_hello = "5"
Interestingly, this error is not present in the printed copy of the book.
No license error
The error:
ERROR: /tmp/bbhello/meta-hello/recipes-editor/nano/nano.bb: This recipe does not have the LICENSE field set (nano)
ERROR: Failed to parse recipe: /tmp/bbhello/meta-hello/recipes-editor/nano/nano.bb
Can be fixed by adding a license setting with one of the values that bitbake recognizes. In this case, add a line onto nano.bb of:
LICENSE="GPLv3"
Recipe parse error
ERROR: ExpansionError during parsing /tmp/bbhello/meta-hello/recipes-editor/nano/nano.bb
[...]
bb.data_smart.ExpansionError: Failure expanding variable PV_MAJOR, expression was ${#bb.data.getVar('PV',d,1).split('.')[0]} which triggered exception AttributeError: module 'bb.data' has no attribute 'getVar'
This is fixed by updating the special python commands being used in the recipe, because #bb.data was deprecated and is now removed. Instead, replace it with #d, ex:
PV_MAJOR = "${#d.getVar('PV',d,1).split('.')[0]}"
PV_MINOR = "${#d.getVar('PV',d,1).split('.')[1]}"
License checksum failure
ERROR: nano-2.2.6-r0 do_populate_lic: QA Issue: nano: Recipe file fetches files and does not have license file information (LIC_FILES_CHKSUM) [license-checksum]
This can be fixed by adding a directive to the recipe telling it what license-info-containing file to grab, and what checksum we expect it to have.
We can follow the way the recipe generates the SRC_URI, and modify it slightly to point at the COPYING file in the same web-directory. Add this line to nano.bb:
LIC_FILES_CHKSUM = "${SITE}/v${PV_MAJOR}.${PV_MINOR}/COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
The MD5 checksum in this case came from manually downloading and inspecting the matching file.
Done!
Now bitbake nano ought to work, and when it is complete you should see it built nano:
/tmp/bbhello $ find ./tmp/deploy/ -name "*nano*.rpm*"
./tmp/deploy/rpm/i586/nano-dbg-2.2.6-r0.i586.rpm
./tmp/deploy/rpm/i586/nano-dev-2.2.6-r0.i586.rpm
I have recently worked on that hands-on hello world project. As far as I am concerned, I think that the source code in the book contains some bugs. Below there is a list of suggested fixes:
Inheriting native class
In fact, when you build with bitbake that you got from poky, it builds only for the target, unless you mention in your recipe that you are building for the host machine (native). You can do the latter by adding this line at the end of your recipe:
inherit native
Adding license information
It is worth mentioning that the variable LICENSE is important to be set in any recipe, otherwise bitbake rises an error. In our case, we try to build the version 2.2.6 of the nano editor, its current license is GPLv3, hence it should be mentioned as follow:
LICENSE = "GPLv3"
Using os.system calls
As the book states, you cannot dereference metadata directly from a python function. Which means it is mandatory to access metadata through the d dictionary. Bellow, there is a suggestion for the do_unpack python function, you can use its concept to code the next tasks (do_configure, do_compile):
python do_unpack() {
workdir = d.getVar("WORKDIR", True)
dl_dir = d.getVar("DL_DIR", True)
p = d.getVar("P", True)
tarball_name = os.path.join(dl_dir, p+".tar.gz")
bb.plain("Unpacking tarball")
os.system("tar -x -C " + workdir + " -f " + tarball_name)
bb.plain("tarball unpacked successfully")
}
Launching the nano editor
After successfully building your nano editor package, you can find your nano executable in the following directory in case you are using Ubuntu (arch x86_64):
./tmp/work/x86_64-linux/nano/2.2.6-r0/src/nano
Should you have any comments or questions, Don't hesitate !

opkg install error - wfopen no such file or directory

I have followed instructions to create an .ipk file, the Packages.gz and host them on a web server as a repo. I have set the opkg.conf in my other VM to point to this repo. The other VM is able to update and list the contents of repositories successfully.
But, when I try to install, I get this message. Can you please describe why I am getting this and what needs to be changed?
Collected errors:
* wfopen: /etc/repo/d1/something.py: No such file or directory
* wfopen: /etc/repo/d1/something-else.py: No such file or directory
While creating the .ipk, I had created a folder named data that had a file structure as /etc/repo/d1/ with the file something.py stored at d1 location. I zipped that folder to data.tar.gz. And, then together with control.tar.gz and 'debian-binary`, I created the .ipk.
I followed instructions from here:
http://bitsum.com/creating_ipk_packages.htm
http://www.jumpnowtek.com/yocto/Managing-a-private-opkg-repository.html
http://www.jumpnowtek.com/yocto/Using-your-build-workstation-as-a-remote-package-repository.html
It is very likely that the directory called /etc/repo/d1/ does not exist on the target system. If you create the folder manually, and try installing again, it probably will not fail. I'm not sure how to force opkg to create the empty directory by itself :/
Update:
You can solve this problem using a preinst script. Just create the missing directories on it, like this:
#!/bin/sh
mkdir -p /etc/repo/d1/
# always return 0 if success
exit 0

Copy all files with given extension to output directory using CMake

I've seen that I can use this command in order to copy a directory using cmake:
file(COPY "myDir" DESTINATION "myDestination")
(from this post)
My problem is that I don't want to copy all of myDir, but only the .h files that are in there. I've tried with
file(COPY "myDir/*.h" DESTINATION "myDestination")
but I obtain the following error:
CMake Error at CMakeLists.txt:23 (file):
file COPY cannot find
"/full/path/to/myDIR/*.h".
How can I filter the files that I want to copy to a destination folder?
I've found the solution by myself:
file(GLOB MY_PUBLIC_HEADERS
"myDir/*.h"
)
file(COPY ${MY_PUBLIC_HEADERS} DESTINATION myDestination)
this also works for me:
install(DIRECTORY "myDir/"
DESTINATION "myDestination"
FILES_MATCHING PATTERN "*.h" )
The alternative approach provided by jepessen does not take into account the fact that sometimes the number of files to be copied is too high. I encountered the issue when doing such thing (more than 110 files)
Due to a limitation on Windows on the number of characters (2047 or 8191) in a single command line, this approach may randomly fail depending on the number of headers that are in the folder. More info here https://support.microsoft.com/en-gb/help/830473/command-prompt-cmd-exe-command-line-string-limitation
Here is my solution:
file(GLOB MY_HEADERS myDir/*.h)
foreach(CurrentHeaderFile IN LISTS MY_HEADERS)
add_custom_command(
TARGET MyTarget PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CurrentHeaderFile} ${myDestination}
COMMENT "Copying header: ${CurrentHeaderFile}")
endforeach()
This works like a charm on MacOS. However, if you have another target that depends on MyTarget and needs to use these headers, you may have some compile errors due to not found includes on Windows. Therefore you may want to prefer the following option that defines an intermediate target.
function (CopyFile ORIGINAL_TARGET FILE_PATH COPY_OUTPUT_DIRECTORY)
# Copy to the disk at build time so that when the header file changes, it is detected by the build system.
set(input ${FILE_PATH})
get_filename_component(file_name ${FILE_PATH} NAME)
set(output ${COPY_OUTPUT_DIRECTORY}/${file_name})
set(copyTarget ${ORIGINAL_TARGET}-${file_name})
add_custom_target(${copyTarget} DEPENDS ${output})
add_dependencies(${ORIGINAL_TARGET} ${copyTarget})
add_custom_command(
DEPENDS ${input}
OUTPUT ${output}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${input} ${output}
COMMENT "Copying file to ${output}."
)
endfunction ()
foreach(HeaderFile IN LISTS MY_HEADERS)
CopyFile(MyTarget ${HeaderFile} ${myDestination})
endforeach()
The downside indeed is that you end up with multiple target (one per copied file) but they should all end up together (alphabetically) since they start with the same prefix ORIGINAL_TARGET -> "MyTarget"