How to fix Conflicting distribution for my local apt repo? - repository

I was trying to make an apt repo. I have this deb which is not architecture dependant and this is the structure of my repo:
.
├── dists
│ └── testing
│ ├── InRelease
│ ├── main
│ │ ├── Packages
│ │ └── Packages.gz
│ ├── Release
│ └── Release.gpg
├── KEY.gpg
└── pool
└── testing
└── main
└── s
└── savcli
└── savcli_0.0.1_all.deb
I add deb <uri-to-repo> testing main to my sources.list. I also add the key, But when I apt update I get these errors:
W: Conflicting distribution: <uri-to-repo> testing InRelease (expected testing but got )
W: Skipping acquire of configured file 'main/binary-amd64/Packages' as repository '<uri-to-repo> testing InRelease' does not seem to provide it (sources.list entry misspelt?)
W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository '<uri-to-repo> testing InRelease' does not seem to provide it (sources.list entry misspelt?)
I'm not sure what's wrong and how I can fix this. I don't want to make a flat repo and add [trusted=yes]. So what have I done wrong?

It seems that you are missing configuration details in the release and in release files some examples of how a Release File should look like are. You can see more examples here https://lists.debian.org/debian-mentors/2006/04/msg00294.html and Configuring reprepro https://wiki.debian.org/DebianRepository/SetupWithReprepro#Generating_OpenPGP_keys
I used apt-ftparchive to genereate my release file and so I used the following CLI command
apt-ftparchive \
-o APT::FTPArchive::Release::Origin="my app" \
-o APT::FTPArchive::Release::Label="my app" \
-o APT::FTPArchive::Release::Architectures="arm64" \
-o APT::FTPArchive::Release::Components="main" \
-o APT::FTPArchive::Release::Description="Apt repository for my app" \
-o APT::FTPArchive::Release::Codename="stable" \
-o APT::FTPArchive::Release::Suite="main" \
release ./dists/stable/ > ./dists/stable/Release
The Release File output will look somthing similar too
Architectures: arm64
Codename: stable
Components: main
Date: Tue, 27 Dec 2022 14:53:28 +0000
Description: Apt repository for my app
Label: My App
Origin: My App
Suite: main
MD5Sum:
f948e3b9ecc3ee1bb89490eec5a897e8 197 Release
50101e65a457f7adfdb11be49f36e2e4 600 main/binary-arm64/Packages
ff153fcc8b9f9f49d0c917afd97bff72 454 main/binary-arm64/Packages.gz
SHA1:
3f9bdf152d1060d28faef385f22e2b3a39bdba95 197 Release
5648155184dabe68f8b01f09d4c70afee215f289 600 main/binary-arm64/Packages
7582505ccae55b2d624f8d3ae42ec5104ddad057 454 main/binary-arm64/Packages.gz
SHA256:
1abb7494951bbdeb04a5e0fc8124b35144a7d22b16c6716e18a140135328fa82 197 Release
afbb25d8792a6377c8b63b8fe3754419337eed319cfb546945cecc95d3207f3b 600 main/binary-arm64/Packages
7cfc6394fc938e0824c82ea15a03dfa1e72c5d344e8d85abeb4d317b0b643fc3 454 main/binary-arm64/Packages.gz
SHA512:
d8c327407e2eca79a58db5934ebbe617198778fa34b9a506dc6c9ac57f3f680658e8c069f15af58eb75a27596166b6e2ee6991861e05f5346ea503874ab2aa88 197 Release
e275bdc954cfbf05d525c0a1c94c709411caf84bc5dd8c9e888b78d6108c4d93f7a5b31f42466ed21b740e1e69a14784f79f2815d019faaa8b411f9a30562ea1 600 main/binary-arm64/Packages
d8ccc972408816d791130076a859249b822c19183b746137ee61d765134ef59ab9e72ce43c9755c11c8540dfb55f7d573796036137f4f8296f35d8cafb79b3b6 454 main/binary-arm64/Packages.gz

Related

Can I make a CMake target dependent upon a target in another CMake project?

I have two separate projects, but one of them must now incorporate aspects of the other, including the generation of some code, which done by a Python script which is called by CMake.
Here is my project structure:
repo/
├── project_top/
│ ├── stuff_and_things.cpp
│ └── CMakeLists.txt
│
└── submods/
└── project_bottom/
├── CMakeLists.txt
└── tools/
├── build_scripts
│ └── cmake_bits.cmake
└── generator
└── gen_code.py
In repo/submods/project_bottom/tools/build_scripts/cmake_bits.cmake there is a macro set_up_additional_targets(), which includes a custom target which runs repo/submods/project_bottom/tools/generator/gen_code.py in that directory. This is based on project_bottom being its own project.
add_custom_target(gen_code
COMMAND echo "Generating code"
COMMAND python3 gen_code.py args
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/generator
)
Now, I need to make a new target in project_top dependent upon the gen_code target in project_bottom. How do I do this? The gen_code target needs to be run as part of the project_top build, but within the context of project_bottom, because for that target, ${CMAKE_CURRENT_SOURCE_DIR} needs to be repo/submods/project_bottom, not repo/project_top.

cc_import for debug and release versions?

My toolset:
Windows 10 x64 (1909)
Bazel 3.1.0
Visual Studio 2019 (16.6)
Powershell
I need to use a prebuild third-party C++ DLL. The third-party lib looks like this:
<directory> third-party-lib
├── <directory> bin
| ├── <file> third_party_lib.dll
| └── <file> third_party_libd.dll
├── <directory> lib
| ├── <file> third_party_lib.lib
| └── <file> third_party_libd.lib
└── <directory> includes
└── <file> third_party_lib.h
So there are two versions a release and a debug version. Filenames ending with "d" indicate the debug version.
To consume this library I am using a cc_import target:
cc_import(
name = "third-party-lib",
interface_library = "lib/third_party_lib.lib",
shared_library = "bin/third_party_lib.dll",
)
My build target depends on the third-party-lib. Building in release (opt) mode works without any problems:
bazel build //:MyBuildTarget
But if I try to do a debug build I run into linker problems:
bazel build --compilation_mode=dbg //:MyBuildTarget
Is there any possibility to specify debug and release DLLs in cc_import rule? Or is there any other rule that can I use for this propose?
You can use select() to switch between library variants:
cc_import(
name = "third-party-lib",
interface_library = "lib/third_party_lib.lib",
shared_library = select({
":debug_build": "third_party_libd.dll",
"//conditions:default": "third_party_lib.dll",
}),
)
config_setting(
name = "debug_build",
values = {
"compilation_mode": "dbg",
},
)

How to copy a whole directory recursively with an npm script on Windows 10 Powershell?

How to copy a whole directory recursively with an npm script on Windows 10 Powershell?
Right now I have the following tree:
test
├───1
│ package.json
│
└───2
└───src
│ asd.txt
│
└───asd
asd - Copy (2).txt
asd - Copy.txt
asd.txt
What I want is a script that when run in dir 1 it goes to dir 2 and copies the whole dir src recursively from there to dir 1. So in the end I would have a similar src in 1 as there is in 2.
When I cd to the directory 1 and run npm run build:ui which is defined in package.json as
"scripts": {
"build:ui": "cd ..\\2 && copy src ..\\1"
}
it starts doing kind of what I want but not quite; it copies stuff from directory 2 to 1. The problem is it doesn't copy the whole directory with all of its subdirectories and all the possible contents, instead it just copies the files from directly inside 2/src/. In other words, here's what the tree looks like after the operation:
test
├───1
│ asd.txt
│ package.json
│
└───2
└───src
│ asd.txt
│
└───asd
asd - Copy (2).txt
asd - Copy.txt
asd.txt
So only the file asd.txt got copied.
Other configurations I have tried without success include:
"scripts": {
"build:ui": "cd ..\\2 && copy -r src ..\\1"
}
"scripts": {
"build:ui": "cd ..\\2 && Copy-Item -Recursive src ..\\1"
}
"scripts": {
"build:ui": "cd ..\\2 && cp -r src ..\\1"
}
...none of which are even valid.
Consider utilizing the xcopy command instead of copy as it better suits your requirement.
Redefine your build:ui script in the scripts section of your package.json file as follows:
Scripts section of package.json:
"scripts": {
"build:ui": "xcopy /e/h/y/q \"../2/src\" \"./src\\\" > nul 2>&1"
}
Running:
When you cd to the directory named 1, (i.e. the directory that contains the package.json with the aforementioned build:ui script defined in it), and then run:
npm run build:ui
it will produce the resultant directory structure:
test
├── 1
│   ├── package.json
│   └── src
│   ├── asd
│   │   ├── asd - Copy (2).txt
│   │   ├── asd - Copy.txt
│   │   └── asd.txt
│   └── asd.txt
└── 2
└── src
├── asd
│   ├── asd - Copy (2).txt
│   ├── asd - Copy.txt
│   └── asd.txt
└── asd.txt
As you can see, the src folder inside folder 2, and all of it's contents, has been copied to folder 1.
Explanation:
The following provides a detailed breakdown of the aforementioned xcopy command:
Options:
/e - Copy folders and subfolders, including empty folders.
/h - Copy hidden and system files and folders.
/y - Suppress prompt to confirm overwriting a file.
/q - Do not display file names while copying.
Notes:
Each pathname has been encased in JSON escaped double quotes, i.e. \"...\"
The ./src\\ part has a trailing backslash (\), which has been JSON escaped (\\), to inform xcopy that the destination is a directory. This also ensures the src directory is created if it doesn't already exist.
The > nul 2>&1 part suppresses the confirmation log that states how many files were copied.
Related information:
It's worth noting that on Windows npm utilizes cmd.exe as the default shell for running npm scripts - regardless of the CLI tool you're using, e.g. PowerShell. You can verify this by utilizing the npm-config command to check the script-shell setting. For instance run the following command:
npm config get script-shell
Edit:
If you want your resultant directory structure to be like this:
test
├── 1
│   ├── asd
│   │   ├── asd - Copy (2).txt
│   │   ├── asd - Copy.txt
│   │   └── asd.txt
│   ├── asd.txt
│   └── package.json
└── 2
└── src
├── asd
│   ├── asd - Copy (2).txt
│   ├── asd - Copy.txt
│   └── asd.txt
└── asd.txt
This time the contents of the src folder inside the folder named 2 has been copied to folder 1 - but not the actual containing src folder itself.
Then you need to define your npm script as follows:
"scripts": {
"build:ui": "xcopy /e/h/y/q \"../2/src\" \".\" > nul 2>&1"
}
Note: the destination path has been changed from \"./src\\\" to \".\".
For something like this, I might use an approach similar to the below.
Modify your NPM script (build:ui) to call a Powershell script(build.ui.ps1) that is located in the same dir as the package.json file.
"scripts": {
"build:ui": "#powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./build.ui.ps1"
},
Create the aforementioned Powershell script with the following contents.
param(
$srcParentDir = '2',
$srcDir = 'src',
$srcDestDir = '1'
)
Set-Location (get-item $PSScriptRoot).parent.FullName
Copy-Item -Path "$srcParentDir\$srcDir" -Destination $srcDestDir -Recurse
Run the npm script
npm run build:ui

Installing cmake components into different directory

Let's say I have some component install rules for some executables:
install(TARGETS foo1 DESTINATION bin COMPONENT foo-utils)
install(TARGETS foo2 DESTINATION bin COMPONENT foo-utils)
install(TARGETS foo3 DESTINATION bin COMPONENT foo-utils)
Now, I have my own executable, and I want its install rule to also install all the foo-utils install rules - but instead of bin, I want them to go somewhere else.
add_executable(special ...)
# more options
add_dependencies(special foo1 foo2 foo3)
install(TARGETS special DESTINATION package/bin COMPONENT special)
add_custom_target(package-special
DEPENDS special
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=special -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=foo-utils -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)
This works great, except building package-special produces:
$ tree install
install
├── bin
│   ├── foo1
│   ├── foo2
│   └── foo3
└── package
└── bin
└── special
How do I get it to produce:
$ tree install
install
└── package
└── bin
├── foo1
├── foo2
├── foo3
└── special
I will have multiple different specials that depend on the foo-utils, and I would like each package-special to install the foo-utils into a different directory. The foo-utils are also in a separate project from the specials, so I cannot install(TARGETS ...) the foo-utils.
cmake_install.cmake uses a default install prefix if one doesn't already exist.
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
As such, you can specify a value prior to calling the script for your foo-utils installation command.
add_custom_target(package-special
DEPENDS special
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=special
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=foo-utils
-DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}/package/bin" # <-- here
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
)

NSIS - check if process exists (nsProcess not working)

For my NSIS uninstaller, I want to check if a process is running. FindProcDLL is not working under Windows 7 x64, so I tried nsProcess.
I've downloaded the version 1.6 from the website: http://nsis.sourceforge.net/NsProcess_plugin
If I start the nsProcessTest.nsi in the Example folder, I get the following errors:
Section: "Find process" ->(FindProcess)
!insertmacro: nsProcess::FindProcess
Invalid command: nsProcess::_FindProcess
Error in macro nsProcess::FindProcess on macroline 1
Error in script "C:\Users\Sebastian\Desktop\nsProcess_1_6\Example\nsProcessTest.nsi" on line 14 -- aborting creation process
This is line 14 of the example script:
${nsProcess::FindProcess} "Calc.exe" $R0
Do somebody know what is wrong? How can I check if a process is running with NSIS?
NSIS does not find the plug-in, so make sure you copied its files to the correct folder.
NSIS 2.x:
NSIS/
├── Include/
│ └── nsProcess.nsh
└── Plugins/
└── nsProcess.dll
NSIS 3.x:
NSIS/
├── Include/
│ └── nsProcess.nsh
└── Plugins/
├── x86-ansi/
│ └── nsProcess.dll
└── x86-unicode/
└── nsProcess.dll
The file inside Plugins\x86-unicode is nsProcessW.dll renamed to nsProcess.dll (blame the author for making it overly complicated!)
More generally, refer to How can I install a plugin? on the NSIS Wiki.