Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
b01adf63
Commit
b01adf63
authored
Mar 13, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpmbph: rewrite branch functions
parent
ce0688f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
25 deletions
+50
-25
rpmbph
bin/rpmbph
+9
-14
branch
share/eterbuild/functions/branch
+41
-11
No files found.
bin/rpmbph
View file @
b01adf63
...
@@ -107,18 +107,23 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
...
@@ -107,18 +107,23 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
set_specdir
$SPEC
set_specdir
$SPEC
docmd
cd
$SPECDIR
||
fatal
docmd
cd
$SPECDIR
||
fatal
# set USEBRANCH
set_usebranch
# spec name for branch
# spec name for branch
BPSPEC
=
$SPEC
.
$USEBRANCH
BPSPEC
=
$SPEC
.
$USEBRANCH
set_currentbranch
#[ -f "$BPSPEC" ] && fatal "File $BPSPEC is already exists, check it and remove"
#[ -f "$BPSPEC" ] && fatal "File $BPSPEC is already exists, check it and remove"
cp
-f
$SPEC
$BPSPEC
||
fatal
"Can't copy to
$BPSPEC
"
cp
-f
$SPEC
$BPSPEC
||
fatal
"Can't copy to
$BPSPEC
"
# set USEBRANCH CURBRANCH
# checkout to $USERBRANCH
checkout_bpbranch
# backport spec
# backport spec
docmd
$ETERBUILDBIN
/rpmbps
-b
$BINARYREPO
$BPSPEC
||
fatal
docmd
$ETERBUILDBIN
/rpmbps
-b
$BINARYREPO
$BPSPEC
||
fatal
# checkout to $USEBRANCH
checkout_bpbranch
# TODO: check result message for merge?
# TODO: check result message for merge?
# Use heads/ against warning: refname 'branch-name' is ambiguous
# Use heads/ against warning: refname 'branch-name' is ambiguous
docmd git merge
--no-ff
heads/
$CURBRANCH
docmd git merge
--no-ff
heads/
$CURBRANCH
...
@@ -141,16 +146,6 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
...
@@ -141,16 +146,6 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
docmd
$BUILDCOMMAND
-b
$BINARYREPO
$LISTRPMARGS
$LISTNAMES
docmd
$BUILDCOMMAND
-b
$BINARYREPO
$LISTRPMARGS
$LISTNAMES
RET
=
$?
RET
=
$?
for
SPEC
in
$LISTNAMES
;
do
set_specdir
$SPEC
docmd
cd
$SPECDIR
||
fatal
# return to CURBRANCH
checkout_original_branch
||
RET
=
$?
cd
-
>
/dev/null
done
exit
$RET
exit
$RET
fi
fi
...
...
share/eterbuild/functions/branch
View file @
b01adf63
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# Public domain
# used: BINARYREPO MDISTR
BPSPEC
# used: BINARYREPO MDISTR
# set: USEBRANCH
CUR
BRANCH
# set: USEBRANCH
OLD
BRANCH
checkout_bp
branch
()
set_use
branch
()
{
{
#local OLDBRANCH
#[ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo"
#[ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo"
USEBRANCH
=
$BINARYREPO
USEBRANCH
=
$BINARYREPO
...
@@ -20,22 +21,35 @@ checkout_bpbranch()
...
@@ -20,22 +21,35 @@ checkout_bpbranch()
USEBRANCH
=
$OLDBRANCH
USEBRANCH
=
$OLDBRANCH
fi
fi
fi
fi
}
CURBRANCH
=
$(
cat
$(
get_root_git_dir
)
/.git/.rpmbph.current 2>/dev/null
)
# used: USEBRANCH OLDBRANCH BPSPEC
if
[
-n
"
$CURBRANCH
"
]
;
then
# set: CURBRANCH
set_currentbranch
()
{
CURBRANCH
=
$(
get_current_branch
)
local
cb
cb
=
$(
cat
$(
get_root_git_dir
)
/.git/.rpmbph.current 2>/dev/null
)
if
[
-n
"
$cb
"
]
;
then
echog
"Autorestore from broken build..."
echog
"Autorestore from broken build..."
docmd git checkout
$CURBRANCH
docmd git checkout
$cb
||
fatal
CURBRANCH
=
$cb
rm
-fv
$(
get_root_git_dir
)
/.git/.rpmbph.current
rm
-fv
$(
get_root_git_dir
)
/.git/.rpmbph.current
#rm -fv $BPSPEC $BPSPEC.*
#rm -fv $BPSPEC $BPSPEC.*
rm
-fv
$BPSPEC
.
*
[
-n
"
$BPSPEC
"
]
&&
rm
-fv
$BPSPEC
.
*
fi
fi
CURBRANCH
=
$(
get_current_branch
)
# TODO: move to a separate function
if
[
"
$CURBRANCH
"
=
"
$USEBRANCH
"
]
||
[
"
$CURBRANCH
"
=
"
$OLDBRANCH
"
]
;
then
if
[
"
$CURBRANCH
"
=
"
$USEBRANCH
"
]
||
[
"
$CURBRANCH
"
=
"
$OLDBRANCH
"
]
;
then
fatal
"You are already in backported branch
$CURBRANCH
. Run rpmbph in sisyphus or master branch only."
fatal
"You are already in backported branch
$CURBRANCH
. Run rpmbph in sisyphus or master branch only."
fi
fi
}
# used: USEBRANCH
checkout_bpbranch
()
{
# TODO
[
-n
"
$CURBRANCH
"
]
||
fatal
"use assert in checkout_bpbranch"
echo
"
$CURBRANCH
"
>
$(
get_root_git_dir
)
/.git/.rpmbph.current
echo
"
$CURBRANCH
"
>
$(
get_root_git_dir
)
/.git/.rpmbph.current
...
@@ -47,10 +61,26 @@ checkout_bpbranch()
...
@@ -47,10 +61,26 @@ checkout_bpbranch()
fi
fi
}
}
# used: USEBRNACH
# set: CURBRANCH
checkout_usebranch
()
{
CURBRANCH
=
$(
get_current_branch
)
if
[
"
$USEBRANCH
"
=
"
$CURBRANCH
"
]
;
then
# let's think we called from rpmbph
return
fi
checkout_bpbranch
}
checkout_original_branch
()
checkout_original_branch
()
{
{
local
CURBRANCH
local
CURBRANCH
CURBRANCH
=
$(
cat
$(
get_root_git_dir
)
/.git/.rpmbph.current
)
CURBRANCH
=
$(
cat
$(
get_root_git_dir
)
/.git/.rpmbph.current 2>/dev/null
)
[
-z
"
$CURBRANCH
"
]
&&
return
rm
-f
$(
get_root_git_dir
)
/.git/.rpmbph.current
rm
-f
$(
get_root_git_dir
)
/.git/.rpmbph.current
docmd git checkout
$CURBRANCH
docmd git checkout
$CURBRANCH
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment