Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
abuild
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
25
Issues
25
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
abuild
Commits
3ac1b129
Commit
3ac1b129
authored
Jan 08, 2013
by
Carlo Landmeter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
abuild: add git/svn snapshot hook
ref
#1537
parent
a00d100c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
abuild.in
abuild.in
+57
-0
No files found.
abuild.in
View file @
3ac1b129
...
...
@@ -1651,6 +1651,62 @@ all() {
fi
}
# This abuild hook will checkout an svn or git repository by specifying
# $svnurl or $giturl in APKBUILD. You can checkout a specific branch in
# git by adding -b $branch in $giturl. $reporev will select the correct
# commit, revision or tag for you. If you specify $disturl your distfile
# will automatically be uploaded with rsync to the url provided.
# Base version defaults to 0 except if specified by $basever.
snapshot
()
{
# check if we setup vars correctly
[
-z
"
$disturl
"
]
&&
warning
"Missing disturl in APKBUILD, auto uploading disabled."
[
-z
"
$svnurl
"
]
&&
[
-z
"
$giturl
"
]
&&
die
"Missding repository url in APKBUILD!"
[
-n
"
$svnurl
"
]
&&
[
-n
"
$giturl
"
]
&&
die
"You can only use a single repository!"
local
_date
=
$(
date
+%Y%m%d
)
local
_format
=
"tar.gz"
# remove any repositories left in srcdir
abuild clean
mkdir
-p
"
$srcdir
"
&&
cd
"
$srcdir
"
# clone git repo and archive
if
[
-n
"
$giturl
"
]
;
then
local
_version
=
${
verbase
:-
0
}
_git
${
_date
}
command
-v
git
>
/dev/null
||
\
die
"Missing git! Install git to support git clone."
[
-z
"
$reporev
"
]
&&
local
_rev
=
"HEAD"
&&
local
_depth
=
"--depth=1"
msg
"Creating git snapshot:
$pkgname
-
$_version
"
git clone
$_depth
--bare
$giturl
$pkgname
-
$_version
||
return
1
git
--git-dir
$pkgname
-
$_version
archive
\
--format
=
$_format
\
-o
$pkgname
-
$_version
.
$_format
\
--prefix
=
$pkgname
-
$_version
/
$_rev
\
||
return
1
fi
# export svn repo and archive
if
[
-n
"
$svnurl
"
]
;
then
local
_version
=
${
verbase
:-
0
}
_svn
${
_date
}
command
-v
svn
>
/dev/null
||
\
die
"Missing svn! Install subverion to support svn export."
[
-n
"
$reporev
"
]
&&
local
_rev
=
"-r
$reporev
"
msg
"Creating svn snapshot:
$pkgname
-
$_version
"
svn
export
$_rev
$svnurl
$pkgname
-
$_version
||
return
1
tar
zcf
$pkgname
-
$_version
.
$_format
$pkgname
-
$_version
||
return
1
fi
# upload to defined distfiles url
if
[
-n
"
$disturl
"
]
;
then
command
-v
rsync
>
/dev/null
||
\
die
"Missing rsync! Install rsync to enable automatic uploads."
msg
"Uploading to
$disturl
"
rsync
--progress
-La
$pkgname
-
$_version
.
$_format
\
$disturl
||
return
1
cd
"
$startdir
"
# set the pkgver to current date and update checksum
sed
-i
-e
"s/^pkgver=.*/pkgver=
${
_version
}
/"
\
APKBUILD
||
return
1
abuild checksum
fi
}
usage
()
{
echo
"
$program
$abuild_ver
"
echo
"usage:
$program
[options] [-i PKG] [-P REPODEST] [-p PKGDEST]"
...
...
@@ -1692,6 +1748,7 @@ usage() {
echo
" up2date Compare target and sources dates"
echo
" installdeps Install packages listed in makedepends and depends"
echo
" uninstalldeps Uninstall packages listed in makedepends and depends"
echo
" snapshot Create a
\$
giturl or
\$
svnurl snapshot and upload to
\$
disturl"
echo
""
exit
0
}
...
...
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