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
You need to sign in or sign up before continuing.
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
Show 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
set_specdir
$SPEC
docmd
cd
$SPECDIR
||
fatal
# set USEBRANCH
set_usebranch
# spec name for branch
BPSPEC
=
$SPEC
.
$USEBRANCH
set_currentbranch
#[ -f "$BPSPEC" ] && fatal "File $BPSPEC is already exists, check it and remove"
cp
-f
$SPEC
$BPSPEC
||
fatal
"Can't copy to
$BPSPEC
"
# set USEBRANCH CURBRANCH
# checkout to $USERBRANCH
checkout_bpbranch
# backport spec
docmd
$ETERBUILDBIN
/rpmbps
-b
$BINARYREPO
$BPSPEC
||
fatal
# checkout to $USEBRANCH
checkout_bpbranch
# TODO: check result message for merge?
# Use heads/ against warning: refname 'branch-name' is ambiguous
docmd git merge
--no-ff
heads/
$CURBRANCH
...
...
@@ -142,16 +147,6 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
docmd
$BUILDCOMMAND
-b
$BINARYREPO
$LISTRPMARGS
$LISTNAMES
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
fi
...
...
share/eterbuild/functions/branch
View file @
b01adf63
...
...
@@ -3,10 +3,11 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# used: BINARYREPO MDISTR
BPSPEC
# set: USEBRANCH
CUR
BRANCH
checkout_bp
branch
()
# used: BINARYREPO MDISTR
# set: USEBRANCH
OLD
BRANCH
set_use
branch
()
{
#local OLDBRANCH
#[ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo"
USEBRANCH
=
$BINARYREPO
...
...
@@ -20,22 +21,35 @@ checkout_bpbranch()
USEBRANCH
=
$OLDBRANCH
fi
fi
}
CURBRANCH
=
$(
cat
$(
get_root_git_dir
)
/.git/.rpmbph.current 2>/dev/null
)
if
[
-n
"
$CURBRANCH
"
]
;
then
# used: USEBRANCH OLDBRANCH BPSPEC
# 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..."
docmd git checkout
$CURBRANCH
docmd git checkout
$cb
||
fatal
CURBRANCH
=
$cb
rm
-fv
$(
get_root_git_dir
)
/.git/.rpmbph.current
#rm -fv $BPSPEC $BPSPEC.*
rm
-fv
$BPSPEC
.
*
[
-n
"
$BPSPEC
"
]
&&
rm
-fv
$BPSPEC
.
*
fi
CURBRANCH
=
$(
get_current_branch
)
# TODO: move to a separate function
if
[
"
$CURBRANCH
"
=
"
$USEBRANCH
"
]
||
[
"
$CURBRANCH
"
=
"
$OLDBRANCH
"
]
;
then
fatal
"You are already in backported branch
$CURBRANCH
. Run rpmbph in sisyphus or master branch only."
fi
}
# used: USEBRANCH
checkout_bpbranch
()
{
# TODO
[
-n
"
$CURBRANCH
"
]
||
fatal
"use assert in checkout_bpbranch"
echo
"
$CURBRANCH
"
>
$(
get_root_git_dir
)
/.git/.rpmbph.current
...
...
@@ -47,10 +61,26 @@ checkout_bpbranch()
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
()
{
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
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