Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
FHS location for development files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Mar 01, 2018 5:48 pm    Post subject: FHS location for development files Reply with quote

Everything in the File Hierarchy Standard seems to be for files that have already been distributed. Where do you store files on projects under active development but not released?

I've been using /home/{developer name} but that's a little messy and a mistake in where one is can wipe out non-related files. I've thought of /home/{project name}, making the project name an actual user and logging in with the project name, but that seems to be a perversion of the user system. One feature of this is that the password can be shared if there is more than one developer. Another is that a mistake in a command or script (think rm -r *) can only destroy files owned by the project. Users can su into the project and su - brings them right into the project directory. Downside is leaving all those users around as projects and polluting /etc/group.

I just thought of another scheme. If /mnt/projects is mounted on a central drive partition, /home/{project-name} can be a symlink to a sub-directory on /mnt/projects. This avoids having multiple different copies. Every time you log in, from whatever workstation, you get the same files. Haven't thought that through.

What are your thoughts and practices?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Thu Mar 01, 2018 7:46 pm    Post subject: Reply with quote

Tony0945,

Use a version control system of your choosing.
Check things in, check things out.

The repo can even be on a remote system.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Mar 01, 2018 11:37 pm    Post subject: Reply with quote

Ah, but where do I check them into? A year or two ago, I struggled to make a git repo. With a lot of help here I managed. I've since converted it to rsync which is much simplere.

Last real VCS I used was ClearCase. Probably before a few forum members were born.
Back to top
View user's profile Send private message
miket
Guru
Guru


Joined: 28 Apr 2007
Posts: 488
Location: Gainesville, FL, USA

PostPosted: Sat Mar 03, 2018 4:44 am    Post subject: Reply with quote

When you wrote about how you "struggled to make a git repo" and then talked about rsync, I can only conclude that you're talking about having made changes to how you deal with the Portage tree. In general, a typical Gentoo user who uses git only to fetch the tip of the ebuild repository is taking advantage of pretty much only one git feature: cryptographically signed commits. This is a protection against having bad actors insert malicious changes into the ebuilds before they reach you, but it's a long way from using the full power of git.

ClearCase is a traditional client/server version-control system. That means that any changes you make have to be committed to the server ir order to take effect. The development cycle includes the steps of pulling the most recent version from the repository on the server and then committing any of your changes back to that same server-side repository. Subversion and CVS work that same way. You would work on your projects under whatever directory you'd choose under your own home directory but that directory tree would reflect the layout of the project in the repostory on the server. All the project history resides on the server. If you ask for something like a log of a diff, the ClearCase client has to request that data from the server. The big downside is that even if all you want to track is a private little project, in order to have it under version control with ClearCase you must set up (or have an administrator set up) the repository on the server.

Git is an example of a newer kind of version-control system: a distributed version-control system. Every checkout contains (within a hidden directory) the complete project history. It is possible to use it without setting up a central repository. If you have a really small personal project (or say a tree you want to keep in version control--like your /etc directory), you can skip any kind of central repository. If you like, you can set up a centralized repository somewhere on your network or use a hosting service like GitHub, but you don't have to. If you do have such a central git repostory for your project, using git will feel rather like using ClearCase because you're still pushing changes to the server, but the git difference is that whole repository history is local to your checkout.


Let me reiterate an important point: regardless of the type of VCS, one principle is that development happens in a directory under your home directory. True, is is fairly common for the root directory of a project to have a fixed name, but this directory does not have to be a direct child of $HOME. So, say you're starting a C project called fastchomp, a PHP project called webwand, and a Go project called golly. The three project directories could just as well be arranged under your home directory like this:
Code:

  $HOME/
         fastchomp/
         php/
                webwand/
         go/
                src/
                       golly/
If all three of these projects are personal projects you're not planning to share, using ClearCase is going to seem like a lot of overkill. On the other hand, setting up repositories with git is extremely straightforward:
Code:
mkdir ~/fastchomp
cd ~/fastchomp
git init
mkdir -p ~/php/webwand
cd ~/php/webwand
git init
mkdir -p ~/go/src/golly
cd ~/go/src/golly
git init


So now when you work on one of those projects, you switch to the directory, make your changes, and commit them. Commits you make with git are to the local repository: if the project has a central master repository set up, a separate push step is necessary. (It is possible to push multiple commits at once, though.)

When would you choose to use a central master repository with git? If the project has more than one or two developers or you're happier having a central master backup, you might want to set up a private git server for your project. If you'd like to make your project available to a wider audience, you would do well to use a hosting service like GitHub for that central repository.


Before I go, let me point out the power of cloning. The usual case is to make a new checkout of some existing project, as in
Code:
git clone git://anongit.gentoo.org/proj/baselayout.git
but the argument to the clone command could be one of several other types so as to identify a "non-traditional" transport, such as ssh or a filesystem path:
Code:
git clone /home/otherdev/go/gobsmack
git clone ssh://guest@othermachine/home/otherdev/php/phrenology
Since every checkout contains all the history information, any checkout could potientally be the source of a clone operation.

Things get better with the pull command. Once your checkout is set up, obtaining future work that others made is a simple matter of pulling new changes with git pull. The checkout metadata records the source path, so now the client reuses that method and path to retrieve updates.

Pulling can be a two-way street. In a small project with two developers who coordinate their work, each developer is free to pull changes from the other's repository--without making recorse to a central server at all.


NeddySeagoon advised you to use whatever VCS you choose. I would say, though, that life is much happer not using client/server systems like Subversion or CVS but rather a distributed one like git, Mercurial, Bazaar, or Monotone. Mercurial is my favorite because of its simpler (and to my mind, more sensible) commands, but git is faster, supports more transports and has more support behind it. I'd advise Mercurial for personal projects and git for things you want to share.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Mar 04, 2018 4:21 am    Post subject: Reply with quote

Thank you for your long and detailed reply.
Miket wrote:

When you wrote about how you "struggled to make a git repo" and then talked about rsync, I can only conclude that you're talking about having made changes to how you deal with the Portage tree.
No, that was my own local overlay located on a central server. It's so much easier now. No git commands, just scp to the overlay source than "layman -S". Similarly just scp the tarball to my apache serverver on that machine and "service apache2 restart".

A more complex scheme as you describe would be necessary if my server were on the internet, but it's just on the local LAN with one developer, me. The only work to coordinate (and it can be error-prone) is between workstations on my LAN. That's why I'm toying with having the files on a partition on the server's second drive and mounting the drive with samba on whatever workstation I'm on. Works good for playing video, but might not for compiling and linking and testing. I could do the same and rsync. Sure everyone uses git and you point out it's advantages over rsync, but rsyn cis quick, one command. I build 32bit portage packages on my Phenom II and rsync them to my k6 machines so that portage on that machine can install them with "emerge --usepkgonly". The poor machine struggles to do that. In both cases no security necessary except keeping strangers off the LAN.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Mar 04, 2018 2:24 pm    Post subject: Reply with quote

Tony0945 wrote:
Ah, but where do I check them into? A year or two ago, I struggled to make a git repo. With a lot of help here I managed. I've since converted it to rsync which is much simplere.

Last real VCS I used was ClearCase. Probably before a few forum members were born.
With Git, if your use case will tolerate open source, then it's simple as can be: take a look at GitHub or GitLab. You can have a repository set up in single-digit minutes.

If you use case requires privacy, you can pay one of the above a very reasonable fee for a single developer private host, or you can set up a simple local Git host with Gitolite (in Portage: dev-vcs/gitolite). It'll probably take you more than singlet-digit minutes, but minutes is still probably accurate. I followed the install guide from the Gitolite home page with no trouble at all.

And, of course, you can ask questions here if you run into snags. :) All the major VCS systems are in Portage, so it's relatively easy to check them out, too.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Mar 04, 2018 4:40 pm    Post subject: Reply with quote

Thank you, both of you offering good information, but both are missing my main question "What is your working area on your local machine?" i.e. when you do your git-clone, where in the file hierarchy are they? Maine are in /home/tony/projects/{projectname}/{projectname-version} where they can be conveniently be tarred up and moved to the distfile server. So the actual source directly is usually home/tony/projects/{projectname}/{projectname-version}/src which is way too deep. The xterm prompt covers half the line. yes, I could change the prompt and then forget where I am amongst all the open terminals and accidentally delete something or many somethings. and I have.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Mar 04, 2018 4:44 pm    Post subject: Reply with quote

Well that's easy. ~/Projects/ProjectName. But you can (and should) use any hierarchy you like within your home directory. It doesn't need to be standardized. You don't create a ProjectVersion sub-structure because version control handles that without additional subdirectory depth. If you want more details, let me know.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Mar 04, 2018 7:47 pm    Post subject: Reply with quote

Tony0945 wrote:
...accidentally delete something or many somethings. and I have.
Version control, properly used, protects you from this as well.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Sun Mar 04, 2018 10:24 pm    Post subject: Reply with quote

Regarding prompt depth, I like using a prompt that expresses $HOME as ~, so instead of /home/hu/projects, I just get ~/projects in my prompt. When I go outside home, it switches to a more verbose path (though even there, I usually let it trim some context and keep the full path in my statusline).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum