I want to restructure my folder hierarchy in a bzr branch. As part of that I want to move my lib folder down to a new sub folder (lib/x86), that is, all subfolders of lib should then be located under lib/x86. A simple bzr mv lib lib/x86 doesn't work, neither does moving the lib folder to a new name and then trying to move that to the subfolder.
What's the command to accomplish that?
The solution is to use a wildcard. Assuming you have renamed your lib folder to lib-old you can then move its content like so:
bzr mv lib-old/* lib/x86
The lib-old folder still exists after that, but that is a simple remove op. I had previously added the new path to bzr, so that might be necessary too.
You can, in 3 steps:
bzr mv lib lib-tmp
bzr mkdir lib
bzr mv lib-tmp lib/x86
I guess you missed the 2nd step. Btw, bzr mkdir lib is equivalent to:
mkdir lib
bzr add lib
Related
I'm trying to use the NPM copyfiles package, which I used many times. But I'm trying to copy the content of a dist folder in a destination folder without creating a dist but I can't find the correct way of doing it. I basically just want the content of the dist (not the folder in itself).
So what I have is
-- dist
|
-- bundles
-- lib
package.json
I want this result
-- destination
|
-- bundles
-- lib
package.json
but I always get the dist in the destination which is unwanted
-- destination
|
-- dist
|
-- bundles
-- lib
package.json
I tried
cross-env copyfiles dist/**/*.* ../dest
I also tried with the --up 1
cross-env copyfiles --up 1 dist/**/*.* ../dest
The only thing that works is with the -f (flatten) flag but I lose the folder structure.
cross-env -f copyfiles dist/**/*.* ../dest
Am I missing something or is it just not possible?
Firstly, given the examples shown in your question there is no need to use copyfiles with the additional package cross-env. The package copyfiles will work cross platforms.
cross-env is used for setting and using environment variables, e.g. NODE_ENV=production.
Using the --up 1 argument, (or its shorthand equivalent -u 1), with copyfiles is the correct way to omit the dist directory. So just use the following instead:
copyfiles --up 1 dist/**/*.* ../dest
I.e. remove the initial cross-env part to resolve the issue.
Got this working with ncp npm package.
ncp ./dist/ dest --filter **/*.*
I want to copy a folder "obj_files" in my source dir to its output dir with the following code:
ADD_EXECUTABLE(projExec ${files_proj})
add_custom_command(TARGET projExec POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/obj_files $<TARGET_FILE_DIR:projExec>)
but it doesn't work. The "CMakeLists.txt" with above commands lies in a subdirectory to another project, hence the output dir is a subdir to that project's output dir. Is this something to consider when attempting to do what I am trying to? Anyways, the problem is that the directory simply is nowhere to be found in the output dirs of the projects. No error messages when configurating/generating, the folder simply isn't copied.
I need to find a way to link additional names to an installed executable, after installing it.
The below example is close, except for two problems. One, the linking is done after every target, not just the install. Two, the links are created in the build directory, not in the install directory (I can probably add the paths necessary to do that, but it would then error out if done before the install.)
cmake_minimum_required(VERSION 2.8.4)
add_executable(gr gr.c)
install(TARGETS gr DESTINATION bin)
add_custom_command(
TARGET gr
POST_BUILD
COMMAND ln;-f;gr;grm
COMMAND ln;-f;gr;grs
COMMAND ln;-f;gr;grh
)
What's simple, clean way to do what I want?
In case it's not clear, the Makefile equivalent is:
gr: gr.c
cc -o gr gr.c
install:
install gr ${BINDIR}
ln -f ${BINDIR}/gr ${BINDIR}/grm
ln -f ${BINDIR}/gr ${BINDIR}/grs
ln -f ${BINDIR}/gr ${BINDIR}/grh
What I have done in similar situations is use the custom command similar to what you have done, but add an additional install command to install the links in the final bin directory alongside the target. So after your add_custom_command:
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/grm
${CMAKE_CURRENT_BINARY_DIR}/grs
${CMAKE_CURRENT_BINARY_DIR}/grh
DESTINATION bin
)
Of course, this will probably only do what you expect if you change your links to symbolic links (ln -s).
I have a folder that I'd like to delete that is located in httpdocs:
The folder is named: /content/
/var/www/vhosts/webiste/httpdocs/
If i use the CD command to access /httpdocs/ and I'm in that folder, can is use the command:
-rf /content/
Or do I need to use the full directory
e.g -rf /var/www/vhosts/webiste/content/
I just wanted to clarify in case this would delete every folder on the server called content.
Don't use /content.. it's an absolute path.
use just rm -rf content when the content folder is inside /var/www/vhosts/webiste/httpdocs/ and your current working directory is /var/www/vhosts/webiste/httpdocs/
is there a way to set a output-directory for making kernel-modules inside my makefile?
I want to keep my source-direcory clean from the build-files.
KBUILD_OUTPUT and O= did not work for me and were failing to find the kernel headers when building externally.
My solution is to symlink the source files into the bin directory, and dynamically generate a new MakeFile in the bin directory. This allows all build files to be cleaned up easily since the dynamic Makefile can always just be recreated.
INCLUDE=include
SOURCE=src
TARGET=mymodule
OUTPUT=bin
EXPORT=package
SOURCES=$(wildcard $(SOURCE)/*.c)
# Depends on bin/include bin/*.c and bin/Makefile
all: $(OUTPUT)/$(INCLUDE) $(subst $(SOURCE),$(OUTPUT),$(SOURCES)) $(OUTPUT)/Makefile
make -C /lib/modules/$(shell uname -r)/build M=$(PWD)/$(OUTPUT) modules
# Create a symlink from src to bin
$(OUTPUT)/%: $(SOURCE)/%
ln -s ../$< $#
# Generate a Makefile with the needed obj-m and mymodule-objs set
$(OUTPUT)/Makefile:
echo "obj-m += $(TARGET).o\n$(TARGET)-objs := $(subst $(TARGET).o,, $(subst .c,.o,$(subst $(SOURCE)/,,$(SOURCES))))" > $#
clean:
rm -rf $(OUTPUT)
mkdir $(OUTPUT)
If you are building inside the kernel tree you can use the O variable:
make O=/path/to/mydir
If you are compiling outside the kernel tree (module, or any other kind of program) you need to change your Makefile to output in a different directory. Here a little example of a Makefile rule which output in the MY_DIR directory:
$(MY_DIR)/test: test.c
gcc -o $# $<
and then write:
$ make MY_DIR=/path/to/build/directory
The same here, but I used a workaround that worked for me:
Create a sub-directory with/for every arch name (e.g. "debug_64").
Under "debug_64": create symbolic link of all .c and .h files. Keeping the same structure.
Copy the makefile to "debug_64" and set the right flags for 64 Debug build, e.g.
ccflags-y := -DCRONO_DEBUG_ENABLED
ccflags-y += -I$(src)/../../../lib/include
KBUILD_AFLAGS += -march=x86_64
Remember to set the relative directories paths to one level down, e.g. ../inc will be ../../inc.
Repeat the same for every arch/profile.
Now we have one source code, different folders, and different make files.
By the way, creating profiles inside make files for kernel module build is not an easy job, so, I preferred to create a copy of makefile for every arch.