user1427180
user1427180

Reputation: 133

FreeScale LTIB source control with patch files using "diff" & "patch" commands by excluding binaries and object files

I was wondering if there is any way to generate the the patch file for Free scale "LTIB" using "diff" command (by excluding binary files,object files and other temporary files that were generated while compiling (with out "./ltib clean/"distclean")) and reapply them with "patch" command.

I can generate the patch file, which by default includes all temporary files.

I appreciate your help in advance..

Upvotes: 0

Views: 754

Answers (1)

Ned Konz
Ned Konz

Reputation: 21

It depends on what patch you're trying to make. There are several kinds of things you might want to change in an LTIB environment, with different strategies:

  • files in $LTIB_DIR/merge: these can be handled with regular version control techniques
  • configuration, etc. in $LTIB_DIR/config (and $LTIB_DIR/.config and $LTIB_DIR/.ltibrc): these can also be handled with regular version control techniques
  • modifications to packages (under $LTIB_DIR/rpm/BUILD): LTIB itself can prepare a patch file for you and edit the active .spec file (which lives under $LTIB_DIR/dist or $LTIB_DIR/config/platform); to do this you can make the patch using ltib:

    cd $LTIB_DIR
    ./ltib -p packagename -m patchmerge
    

If you look at the code for patchmerge in the ltib script itself, you will see that it does roughly this:

mv $LTIB_DIR/rpm/BUILD/packagename $LTIB_DIR/rpm/BUILD/packagename.modified
cd $LTIB_DIR/rpm/BUILD/packagename.modified
make distclean
cd -
rpmbuild -bp ... # go through the original prep stage
diff --exclude CVS --exclude .git -uNr $LTIB_DIR/rpm/BUILD/packagename $LTIB_DIR/rpm/BUILD/packagename.modified > patchfile

then adds patchfile to the spec and tells you about it.

I don't know which distclean you're trying to avoid (global or package), but if you are OK with doing a "make distclean" in the package directory (as opposed to doing ./ltib -m distclean, which will remove your rootfs), then this may be OK for you.

Otherwise, you can use diff (or git diff) to make your own patch file.

You can make an exclude file for diff similar to .gitignore and give it to diff to be more selective about what ends up in your patch (read the diff manpage):

cd $LTIB_DIR
vi diffignore # add file patterns to this file
mv $LTIB_DIR/rpm/BUILD/packagename $LTIB_DIR/rpm/BUILD/packagename.modified
./ltib -p packagename -m prep
diff --exclude CVS --exclude .git -X diffignore -uNr $LTIB_DIR/rpm/BUILD/packagename $LTIB_DIR/rpm/BUILD/packagename.modified > patchfile

Upvotes: 1

Related Questions