What is the purpose of the BUILD.tools file in a pants repo? - pants

When installing pants into a new repo, it seems you need to copy BUILD.tools from the pants distribution into the root directory of the repo.
What is this file used for?
Do I need to edit this file?
Do I need to update this file when I upgrade the version of pants?

This file is used for tools that Pants itself uses. For example, it includes jmake, which Pants uses to build Java files and coberatura, which Pants uses for text coverage reporting.
You might want to edit this file if you want to use a different version of one of these tools (you'll also sometimes need to edit your pants.ini to reflect the new version).
Sometimes Pants itself will add a new tool, or update a version. In this case, when you upgrade pants you'll want to update your BUILD.tools file as well.

Related

how to use git with a package I am distributing

I have been using git for some time now and I feel I have a good handle on it.
I did however, build my first small program as a distribution (something with ./configure make and make install) and I want to put it up on github but I am not sure how to exactly go about tracking it.
Should I, for instance, initialize git but only track the source code file, manpage, and readme (since the other files generated by autoconf and automake seem a bit superfluous)
Or should I make an entirely different directory and put the source files in there and then manually rebuild everything for version 0.2 when it is time?
Or do something else entirely?
I have tried searching but I cannot come up with any search terms that give me the kind of results I am looking for.
for instance initialize git but only track the source code file, manpage, and readme (since the other files generated by autoconf and automake seem a bit superfluous)
Yes: anything used to build needs to be tracked.
Anything being the result of the build does not need to be tracked.
should I make an entirely different directory
No: in version control, you could make a new tag to mark each version, and release branches from those tags to isolate patches which could be specific to the implementation details of a fixed release.
But you don't create folders (that was the subversion way)
should I make an entirely different directory for sources
Yes, you can (if you have a large set of files for sources)
But see also "Makefiles with source files in different directories"; you don't have just one Makefile.
The traditional way is to have a Makefile in each of the subdirectories (part1, part2, etc.) allowing you to build them independently.
Further, have a Makefile in the root directory of the project which builds everything.
And don't forget to put your object files in a separate folder (not tracked) as well.
See also this question as a concrete example.

How to write Git hash to (node's) package.json?

is there a way to automatically update version number of a package.json (https://npmjs.org/doc/json.html) with the HEAD hash of git? I would like to have something like version: 1.0.0+rev82e4b91cfe42cd86e9453b4987b9cc446566de6 inside the project's package.json file. Eveything before the plus is set manually and the hash is updated everytime I commit something.
Is this possible? I couldn't find anything on this topic :-/
It appears that this can be done directly without a plugin. npm version $(git describe) will take the value from git describe and update the value of the version in package.json.
(I'm currently using npm version 3.10.)
Part of that can be solved with git-describe and there's actually a grunt plug-in that wraps that for you (https://github.com/mikaelkaron/grunt-git-describe/).
The second part you'd have to do manually (right now), but I actually have a similar problem at the moment, so I can try to hack up a grunt plug-in for you (and myself).
Full disclosure, I'm the author of grunt-git-describe above.
git rev-parse HEAD will write out the last commit to the current head branch which you could then append to a version number in your package whenever you run your build.
There are a number of git rev-xxx commands that might be useful for any additional stuff you might want to record.
Automatically at what point? Possibilities are:
Update the version field every time you run a build from a machine environment
Update the version field every time you run any build.
Update the version field in a git hook to keep in sync. Personally, I'd be nervous about a hook that performs a change when something changes. This strategy is highest risk, highest reward.
If you go with the first or second approach, it depends of course on what build tool you use. If you use grunt, see about a grunt plugin. I can't find any grunt plugins that do what you're asking for, but you can create one fairly easily.
http://gruntjs.com/plugins
If you do end up creating one, let me know as I am also in need of a similar process :)
In my case, I am using SVN, but want the same pattern. I want to put the SVN revision number as my build number.
My recommendation is to leave the build number blank in the file that is checked in and have your build environment do a git clone for a new build and update the build number. Then built packages always have something about them indicating the git commit they came from.
I think that for development, you don't really need it because you can always ask git which version you have checked out. There is a grunt-git plugin which you could maybe use to figure out the version in dev. (maybe git show?)

how to create a debian package which updates only required files while updating the package

After few weeks of struggle i am able to create a medium native package debian package which works well in installation and removing of the package.
As http://www.quietsche-entchen.de/cgi-bin/wiki.cgi/-wiki/CreatingDebianPackages
Debian wiki
http://wiki.debian.org/HowToPackageForDebian http://www.debian.org/doc/manuals/maint-guide/ these are the quite good material for beginners,
I have basic problem, in updating the package all the files data.tar.gz are updated by default.
I want only few files to get updated in the data.tar.gz based on a key variable stored in all the files.
After the unpacking that is executing preinst script, all the files in data.tar.gz are already updated..
my idea was to take back up of the files intially before upgrading the package, and check key variable in files.. if the key variable is greater than the current variable replace it..
which means i am writing a simple backup script.. and executing in the postinst file..
i donot think this is good idea.. and more over limitations in dash script make it a very tough job..
What are you trying to accomplish here? During the reinstallation (or upgrading) of a Debian package, replacement of all of the non-conffiles with the latest version is exactly what's supposed to happen. If the file hasn't changed since the last installed version of the package then there's no harm in updating it anyway, and if is has changed, it's supposed to be updated.
If you have specific files which might be modified by the user and should be preserved across upgrades, make then conf files. The package system will prompt the user and ask them if they want to keep the package maintainer's version or the locally modified version.
(But if you're going to make every file a conf file, then you're probably doing something wrong.)
To make a file a conffile, list it in debian/conffiles. But if the file is going to be installed under /etc then you don't need to do this because dh_installdeb will do it for you.
EDIT following additional information in comment:
Suppose you have files test1.sh and test2.sh (among others) in your package. In the Debian world, they are either conffiles are intended to be modified by the end user, or they're not.
conffiles should be relatively few in number and as short as possible, to minimize the burden of having to reconcile changes made by the package maintainer with conflicting changes made by the end user.
If there are things mixed into the code that the end user is likely to want to tune, try to factor them out into a configuration file. If you put that file in /etc, you don't even have to manually designate it as a conffile.
If the end user needs to make a change to a non-conffile, they should use the dpkg-divert protocol to (1) move the original file aside, and (2) edit a copy. Diverted files are respected by package upgrades. The end user who uses dpkg-divert should be aware that things might break after upgrades as a result, because the package maintainer hasn't foreseen that these files would be modified by end users and the locally modified version might be incompatible with a newly upgraded version of a different file. dpkg-divert should be used carefully and sparingly.

TortoiseSVN : Good 'patch file' viewer?

The default patch file viewer is messy (ie. no side by side diff view etc). I tried setting the path of beyondCompare exe in "Settings->Unified Diff Viewer->custom", but beyond compare also behaves same as default diff tool.
Is there a way to atleast allow side by side diff in patch files ? If so, what is the method ?
My aim is to allow emailing of changes so that they can be reviewed before I commit them :)
Mishal
I've never found any, but the solution that I usually use is to simply apply the patch file to a pristine checkout of the tree, and then do a "regular" diff (my preferred tool is diffuse) to review the changes in context.
The problem with "raw" patch files is that they only provide a few lines of context before and after the change, which often isn't enough.
If you don't like the patch, simply revert the changes and don't commit!
Beyond Compare 4 allows you to view patch files created by SVN. The top window in Beyond Compare is a tree structure, allowing you to navigate folders and files by name. Revision numbers are present in the left and right diff windows.
Create the patch
svn diff -r 5922:6116 > CodeReview.patch
Open the patch in Beyond Compare 4
SVN 1.7 I think was released since this answer was posted, and I landed here because I wanted to show my newly created patch file with syntax coloring, a la view unified diff in TortoiseSvn.
It turns out that Notepad++ automatically syntax colors my file correctly if I give it the filetype of "patch"!
Patches have been around a long time but SVN is now supporting them more fully.
See for example the documentation;
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html
For how to create a patch file, see this nice document that describes various methods including mine, WinMerge;
http://docs.moodle.org/dev/How_to_create_a_patch#Creating_a_patch_using_WinMerge
If you have access to a Mac OS X machine, PatchViewer sounds like it might do what you're looking for:
http://appledeveloper.com.au/products/patchviewer/
(Disclaimer: I am the author of PatchViewer.)
You can view a diff file (a patch generated by diff tool) using Kompare from KDE environment. I used it before on Linux, but today I found how to install it on Windows. Here is an installation instruction from a blog "Kompare - the only valuable diff for M$Windows":
Go to gnuwin32 diffutils, download and install.
Download kdewin installer and launch it.
After installing kde4win - start kompare and in "Diff" section show him where your diff.exe (from gnuwin32 diffutils) is located.
Restart Kompare and it's ready to use!
You can also add an association with .diff file format and now you can view any diff files. For me it works great.
I like to use KDiff3, it's packed with functions, very user friendly and available for all popular platforms. It can also integrate with TortoiseSVN.
GitExtensions, my favorite Git GUI, also has an option to "View patch file":

A visual patch tool for Linux

I've got a file and a patch for it. I'd like to visually apply the patch, t.i. see how the changes proposed by the patch look in context, make some corrections, and save the resulting file.
What tool can do that?
Neither of the visual diff tools (i.e. meld, diffuse, diffmerge) do what I want: they don't work with patches, they merely merge whole files.
I really like Kompare. It is just a (very nice) graphical interface for diff.
http://www.caffeinated.me.uk/kompare/
sudo apt-get install kompare
Creating and applying patches
Kompare is able to create a patch file
which lists only the differences
between two compared text files A and
B. Further, Kompare can apply a patch
file which was created this way to an
original file A and, in this manner,
recompute the contents of the
corresponding file B. This is a
comfortable utility for passing a
corrected version of a file to a
friend who already has an older
version of the same file, because only
the (relatively small) patch file has
to be delivered and the receiver can
generate the corrected file by
applying the patch to the original
file.
The patches created and applied by
Kompare are compatible to patch files
generated or applied by the command
line interface diff utility, because
Kompare is in fact merely a graphical
front end to diff and the patches are
created and applied by patch, which
gets called by Kompare.
See use vimdiff with a diff file.
gvim original.file +'vert diffpa the.patch'
This will open GVim and split the window, with the original on the left and the patch applied on the right. You can then add, remove, or change hunks, and save the changes. (Well, if you want to create a new.patch you'll have to run diff again, but that's not difficult.)
You may use the emacs ediff mode.
It lets you see and validate each chunk interactively.
For what it's worth, I have this handy script in my ~/bin directory:
#!/bin/bash
if [ "$1" == "--text" ] ; then shift; fi
if diff --brief $1 $2 ; then
exit 0
else
emacs -fn 8x13bold --eval '(ediff-files "'$1'" "'$2'")'
fi
Another option: if you use Eclipse, you can generate and apply patches visually.
The idea with visual diff tools is that you can:
make a backup copy of the patched file (or a new pristine checkout of the whole tree)
apply the patch
use the visual diff tool to review the changes in context
make any desired change to the patched file within the visual diff tool.
Some tools, such as meld or diffuse will automatically diff against the previous committed version of the files.
The key insight is that you CAN apply the patch, they discard everything you don't like as long as you have a backup copy, or if you are working on a clean checkout.
If you feel more comfortable with reading and modifying unified diffs, and just want to have more context for the diff, emacs has a fairly unique feature, which is next-error-follow-mode while viewing a diff file (diff major mode). That shows the context of a diff line in the target file.
On platforms where Kompare (a fairly nice piece of software if KDE is your cup of tea), I agree that Eclipse is a great option.
I have consistently been a reluctant Eclipse user AND I am consistently impressed by how well the tools work (once the platform finally starts up).
On Fedora, I've got just about every front end installed for each of the main version control engines (SVN - also serving my Windows machines, Mercurial, git, etc.);
Meld is quite nice (no patch interface though).
Submerge works well also.
But since Eclipse does know how to apply patches and Working Copy project created itself once I figured out to create the project in the folder containing my working copy, it may become my favorite SVN front end.
I normally use GitExtensions (.NET and Mono) which also supports applying patches interactively. I hope you are already familiar with git.
Edit: Everything mentioned below this line doesn't seem to be available directly in KDiff3. And as I mentioned before: I haven't tried it yet.
GitExtension normally uses KDiff3 as diff tool, which is able to view patches.
http://kdiff3.sourceforge.net/doc/kpart.html
Using it for patches it has only a two window view, (edit) and doesn't support merging :( but it also supports 3 way diff on complete folders etc.
Actually I never tryed it with patches.
Does xxdiff do what you are looking for?
I'd use meld.
Create two copies of the files, one without and another with the patch. Use meld to compare them, and you can see exactly what the patch is changing and make changes as necessary.
Seriously, why is this so hard?

Resources