GithubHelp home page GithubHelp logo

Comments (7)

guysoft avatar guysoft commented on June 26, 2024

The relative path becomes a problem if you are using docker build environment. Or multiple CustomPiOS source trees.

I am not sure how to solve this without placing custompios in the execution PATH variable. So this was the compromise at the time.

What exactly are you proposing with relative paths? Relative to the working directory or the distro you are building?

from custompios.

umlaeute avatar umlaeute commented on June 26, 2024

i think that relative paths to the distro is what I mean.

e.g.

$ .
├── LICENSE
├── README.md
├── mydistro
│   └── src
│       ├── build_dist
│       ├── config
│       └── custompios_path
└── src
    ├── build
    ├── build_custom_os
    ├── build_docker
    ├── common.sh
    ├── config
    ├── config_sanity
    ├── custompios
    ├── make_custom_pi_os
    └── update-custompios-paths

$ cat mydistro/src/custompios_path
../../src

this obviously assumes that it actually makes sense to use a relative path, because the mydistro directory and the CustomPiOS/src folder are guaranteed to have a fixed relative path (e.g. because both are tracked in the same git repository). this is my current mode of operation (but I'm sure others do it differently).

it probably makes sense to have src/update-custompios-paths generate absolute paths, but allow relative paths.
right now it fails with:

python3: can't open file '<<CUSTOMPIOS_SRCDIR>>/mydistro/src/workspace/mount/../../src/execution_order.py': [Errno 2] No such file or directory

from custompios.

umlaeute avatar umlaeute commented on June 26, 2024

sidenote: my current workaround to this problem is to exclude the mydist/src/custompios_path from my repository, and instead have a wrapper-script that first creates this file (with the absolute path) and then call mydistro's build_dist.

so the priority of this issue is pretty low for me.

from custompios.

umlaeute avatar umlaeute commented on June 26, 2024

i guess this might work:

diff --git a/src/dist_generators/dist_example/src/build_dist b/src/dist_generators/dist_example/src/build_dist
index e3d3cb8..14799a7 100755
--- a/src/dist_generators/dist_example/src/build_dist
+++ b/src/dist_generators/dist_example/src/build_dist
@@ -5,4 +5,6 @@ export DIST_PATH=${DIR}
 export CUSTOM_PI_OS_PATH=$(<${DIR}/custompios_path)
 export PATH=$PATH:$CUSTOM_PI_OS_PATH
 
+CUSTOM_PI_OS_PATH="$( cd "$(DIR}" && cd "${CUSTOM_PI_OS_PATH}" && pwd )"
+
 ${CUSTOM_PI_OS_PATH}/build_custom_os $@

afaict, the custompios_path file is only read once (in the distro's build_dist script) so it could be expanded to an absolute path right there.

this still doesn't handle the expansion in Vagrantfile though (I'm afraid my ruby-knowledge is nil)

from custompios.

umlaeute avatar umlaeute commented on June 26, 2024

i guess that's the change required for the Vagrantfile:

diff --git a/src/dist_generators/dist_example/src/vagrant/Vagrantfile b/src/dist_generators/dist_example/src/vagrant/Vagrantfile
index 4484441..f6bfa37 100644
--- a/src/dist_generators/dist_example/src/vagrant/Vagrantfile
+++ b/src/dist_generators/dist_example/src/vagrant/Vagrantfile
@@ -2,7 +2,7 @@ vagrant_root = File.dirname(__FILE__)
 Vagrant.configure("2") do |o|
     o.vm.box = "debian/buster64"
     o.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
-    o.vm.synced_folder File.read("../custompios_path").gsub("\n",""), "/CustomPiOS", create:true, type: "nfs"
+    o.vm.synced_folder File.expand_path(File.read("../custompios_path").gsub("\n", ""), ".."), "/CustomPiOS", create:true, type: "nfs"
     o.vm.synced_folder "../", "/distro", create:true, type: "nfs"
     o.vm.network :private_network, ip: "192.168.55.55"
     o.vm.provision :shell, :path => "setup.sh", args: ENV['SHELL_ARGS']

note that i haven't actually tested this with Vagrant (just with a small, standalone ruby script)

from custompios.

guysoft avatar guysoft commented on June 26, 2024

Its part of .gitignore on my distros:
eg:
https://github.com/guysoft/OctoPi/blob/devel/.gitignore#L2

I initially didn't add git files in to the template folder of a new distro. But since 2013 when it started git has become the only version control out there. Though there are a few that use mercurial (though I rarely see .hgignore). So perhaps it might make sense to add now a default .gitignore.

ATM the vagrant is falling out of support no one is actually using it. And I have no time to test it.

from custompios.

umlaeute avatar umlaeute commented on June 26, 2024

I initially didn't add git files in to the template folder of a new distro.

oops: with b10ed77 i have introduced a default .gitignore file (and continued to work on that with 25bff8b).

so probably, you could just keep it and add more files?

and what do you think of #206 (comment)?

one potential drawback i see is, that if the path in custompios_path does not exist (regardless of absolute or relative), the CUSTOM_PI_OS_PATH will then hold the same value as DIR.
this might give confusing error messages.
using realpath instead of the cd ... && pwd magic would fix this, but i guess it is not very portable (e.g. wouldn't run on macOS)

from custompios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.