Opened 16 years ago
Closed 15 years ago
#2860 closed bug (fixed)
script doesn't recognize svn revision
Reported by: | Adek336 | Owned by: | bonefish |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Build System | Version: | R1/pre-alpha1 |
Keywords: | Cc: | planche2k@… | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
Because of the fact the svn hangs in Haiku (#2840), I used Debian to svn checkout the sources and Haiku to copy them to a BFS partition and to jam them. Unfortunately
AddSymlinkToContainerCopyFilesScript <HaikuImage>beos/system/add-ons/kernel/drivers/dev/net/syskonnect AddSymlinkToContainerCopyFilesScript <HaikuImage>beos/system/add-ons/kernel/drivers/dev/net/usb_ecm CopySetHaikuRevision1 generated/objects/haiku/x86/release/system/kernel/revisioned/kernel_x86 Usage: set_haiku_revision <file> <revision> Finds the haiku revision section in ELF object file <file> and replaces the writes the number given by <revision> into the first 32 bits of the section. revision=`(LC_ALL=C LANG=C svn info . 2> /dev/null || (cd . && LC_ALL=C LANG=C git svn info) 2> /dev/null || (git log --max-count=1 --grep="git-svn-id:" 2> /dev/null | grep git-svn-id: | cut -d '@' -f 2 | awk '{printf "Revision: " $1}') 2> /dev/null || echo Revision: 0) | grep Revision | awk '{printf $2}'` generated/objects/haiku_host/x86/release/tools/copyattr --data generated/objects/haiku/x86/release/system/kernel/kernel_x86 generated/objects/haiku/x86/release/system/kernel/revisioned/kernel_x86 && generated/objects/haiku_host/x86/release/tools/set_haiku_revision generated/objects/haiku/x86/release/system/kernel/revisioned/kernel_x86 ${revision} ...failed CopySetHaikuRevision1 generated/objects/haiku/x86/release/system/kernel/revisioned/kernel_x86 ... ...removing generated/objects/haiku/x86/release/system/kernel/revisioned/kernel_x86 ...skipped <HaikuImage>haiku.image-copy-files-dummy-beos/system for lack of <revisioned>kernel_x86...
I believe it is a problem with build/jam/FileRules
revision=`(LC_ALL=C LANG=C svn info $(HAIKU_TOP) 2> /dev/null || (cd $(HAIKU_TOP) && LC_ALL=C LANG=C git svn info) 2> /dev/null || (git log --max-count=1 --grep="git-svn-id:" 2> /dev/null | grep git-svn-id: | cut -d '@' -f 2 | awk '{printf "Revision: " $1}') 2> /dev/null || echo Revision: 0) | grep Revision | awk '{printf $2}'`
This is related to the fact that svn cannot find out the revision number
/haiku-dane/haiku> svn info svn: This client is too old to work with working copy '.'; please get a newer Subversion client
the script then tries to ask git for the revision number. And git fails as I don't use nor have it
/haiku-dane/haiku> git sh: git: command not found
but the script doesn't then fall back to revision=0; scenario:
/haiku-dane/haiku> no_such_command sh: no_such_command: command not found /haiku-dane/haiku> ((no_such_command) 2> /dev/null ) /haiku-dane/haiku> echo $? 127 /haiku-dane/haiku> ((no_such_command | awk '{printf "Revision: " $1}') 2> /dev/null ) /haiku-dane/haiku> echo $? 0
Expected behaviour: it should fail on getting the revision from both svn and git and fall back to revision=0.
As a note, I was able to do so (check out on Debian, build on Haiku, with svn versions incompatible) just about 2 weeks ago.
Attachments (1)
Change History (10)
comment:1 by , 16 years ago
Cc: | added |
---|
comment:2 by , 16 years ago
follow-ups: 4 5 comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in hrev28226.
comment:4 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Unfortunately this fix broke the original git svn info
code path by not extracting the correct piece of information like from svn info
. Patch coming up shortly.
by , 16 years ago
Attachment: | 0001-Fix-extracting-revision-number-with-git-svn.patch added |
---|
Proposed patch
comment:5 by , 16 years ago
When git-svn was in fact usable, the whole svn info
-like output was stored in $revision
. The final if
doesn't check for a sane numeric value, and no revision information was displayed in AboutSystem.
The attached patch reunifies svn and git-svn to share the postprocessing (grep
, awk
).
If both fail, $revision
should be empty, triggering Ingo's if
and my pure git fallback. Failing that as well, $revision
should be empty once again and thus set to 0
, still fixing #2860.
follow-up: 8 comment:7 by , 16 years ago
Rene or Ryan, aren't you both using git? Can either of you please have a look?
comment:8 by , 15 years ago
Cc: | removed |
---|
@Axel: Since the original hrev26977 patch was mine, you could trust me that the Git part is okay! ;) What I do not have a setup for, is a build without git.
The ticket reporter or anyone else with a non-svn, non-git setup should have a look.
Or commit it after reviewing that it doesn't affect regular svn users, and let people reopen later if necessary - the current svn state is a regression.
comment:9 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Applied in hrev31333, thanks!
My git patch was a quick addition to get the revision number displayed. A better solution might be to split up the command, e.g. (pseudocode)
That would avoid that use of
awk
to put it into theRevision: nnnnn
format to later extract it again.