使用例如构建源代码后的清理策略。 git
我(主要)使用 git 从源代码下载和编译各种项目,将源代码保存在 /usr/local/src
中,并将二进制文件安装在 /usr/local/bin
中代码>.
遵循构建过程,通常使用 ./configure &&制作&& make install
后,我留下了很多垃圾,最终成为我本地 git 存储库中的“新”文件。
据我了解, make clean
、 make distclean
以及可能还有 (?) ./configure clean
都是可以考虑的程序,以便丢弃大多数剩余文件。但在特定情况下(参见下面的示例),我不知道该怎么做才能“保持干净”,就像我在安装之前一样......
最近的一个例子 – 安装 jscoverage (通过 git svn )来自 http://svn.siliconforks.com/jscoverage/trunk jscoverage:
这个项目的构建说明提示我使用 ./bootstrap.sh &&制作&&进行安装
。在这种情况下,编译和安装完成后,我尝试了所有上述清理命令(随机),但未能摆脱所有内容。
总结一下我的问题:是否有任何我还没有掌握的全能、卓越的清洁策略?在使用 git 等 VCS 时,在典型的工作流程中,您如何解决此清理问题:1.) 下载 – 2.) 构建 – 3.) 从上游存储库提取更新 – 4.) 再次构建 – 等等?
I (mostly) use git to download and compile various projects from their source code, keeping my source in /usr/local/src
and installing the binaries in /usr/local/bin
.
Following the building procedure, usually with ./configure && make && make install
, I'm left with a lot of cruft that ends up as 'new' files in my local git repository.
To my understanding, make clean
, make distclean
and possibly also (?) ./configure clean
are thinkable procedures in order to trash most leftover files. But in specific scenarios (see example below) I'm left clueless what thing to do in order to "stay clean", such as I was prior to the installation...
A recent example – installing jscoverage (via git svn) from http://svn.siliconforks.com/jscoverage/trunk jscoverage:
The building instructions for this project prompted me to use ./bootstrap.sh && make && make install
. In this case, after compiling and installing was finished, I tried all of the aforementioned cleanup commands (by random), but didn't manage to get rid of everything.
To wrap my question up: Is there any all-mighty, superior cleaning strategy that I haven't grasped? How do you approach this cleanup issue when using a VCS such as git, in a typical workflow where you 1.) download – 2.) build – 3.) pull updates from upstream repository – 4.) build once again – and so forth?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还有 git clean(“从工作树中删除未跟踪的文件”)。这是一个简单的命令,命令行选项相对较少。请参阅 git-clean 手册页。
There is also
git clean
("Remove untracked files from the working tree"). It's a simple command with relatively few command line options. See the git-clean man page.对于自动工具项目(即大多数使用
./configure && make && make install
的项目),make distclean
将使您进入原始发行版 tarball 的状态。他们不会删除自动生成的所有内容,因为这会为最终用户带来对其他工具的依赖。许多软件包将提供一个
make Maintenanceer-clean
,它会删除尽可能多的内容,但仍会保留足够的内容来构建项目(如果您有正确的开发人员工具)。这仍然不会删除像Makefile.in
这样的文件,它是生成Makefile
所需要的。这里的想法是./configure && make
应该仍然足以构建所有内容(前提是安装了所有依赖项)。也就是说,我认为您可能在这里问了错误的问题。如果我不打算保留任何源代码,我会在安装后删除源目录。如果我计划提取更新并重建,我什至不会费心使用
make clean
:像make
这样的工具的全部要点是它们仅重建更改的内容项目的某些部分和强迫性清洁会破坏这一点。当我开发自己的项目时,我将所有自动生成的文件标记为被 VCS 忽略,因此它不会一直显示。例如,SVN 具有 svn:ignore 属性,mercurial 具有 .hgignore 文件,git 具有 .gitignore 文件。
For an autotooled project (i.e., most of the ones that use
./configure && make && make install
),make distclean
will get you to the state of a pristine distribution tarball. They won't remove everything autogenerated because that would introduce dependencies on additional tools for the end user.Many packages will provide a
make maintainer-clean
that removes as much as possible, but will still keep around enough to build the project (if you have the correct developer tools). This still won't remove files likeMakefile.in
, which is needed to makeMakefile
. The idea here is that./configure && make
should still be enough to build everything (provided all of the dependencies are installed).That said, I think you're potentially asking the wrong question here. If I'm not going to keep the source around for anything, I'd just delete the source directory after installing. If I'm planning on pulling updates and rebuilding, I'd not even bother with a
make clean
: the whole point of tools likemake
is that they rebuild only the changed parts of a project and obsessive cleaning defeats that.When I develop my own projects, I mark any autogenerated file as ignored by the VCS, so it doesn't show up all the time. SVN has the
svn:ignore
property, mercurial has the.hgignore
file and git has the.gitignore
file, for example.