Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Adélie Linux
abuild
Commits
630ec726
Commit
630ec726
authored
Nov 29, 2012
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
abuild: use sha256 and sha512 sums instead of md5
ref #1484
parent
30afd296
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
19 deletions
+57
-19
abuild.in
abuild.in
+57
-19
No files found.
abuild.in
View file @
630ec726
...
@@ -217,31 +217,30 @@ sanitycheck() {
...
@@ -217,31 +217,30 @@ sanitycheck() {
default_sanitycheck
default_sanitycheck
}
}
md5check
()
{
sumcheck
()
{
local
algo
=
"
$1
"
sums
=
"
$2
"
local
dummy f endreturnval originalparams origin file
local
dummy f endreturnval originalparams origin file
if
[
-z
"
$source
"
]
&&
[
-z
"
$md5sums
"
]
;
then
return
0
# get number of checksums
fi
set
--
$sums
if
[
-z
"
$md5sums
"
]
;
then
local
numsums
=
$((
$#
/
2
))
die
"Use 'abuild checksum' to generate/update the checksum(s)"
fi
set
--
$source
if
[
"
$(
echo
$source
|
wc
-l
)
"
-ne
"
$(
echo
$md5sums
|
wc
-l
)
"
]
;
then
if
[
$#
-ne
$numsums
]
;
then
die
"Number of
md5sums does not correspond to number of sources
"
die
"Number of
${
algo
}
sums(
$numsums
) does not correspond to number of sources(
$#)
"
fi
fi
fetch
||
return
1
fetch
||
return
1
msg
"Checking
md5
sums..."
msg
"Checking
${
algo
}
sums..."
cd
"
$srcdir
"
||
return
1
cd
"
$srcdir
"
||
return
1
IFS
=
$'
\n
'
IFS
=
$'
\n
'
endreturnval
=
0
endreturnval
=
0
originalparams
=
$@
for
src
in
$sums
;
do
set
--
$source
for
src
in
$md5sums
;
do
origin
=
$1
;
shift
origin
=
$1
;
shift
echo
"
$src
"
|
md5
sum
-c
echo
"
$src
"
|
${
algo
}
sum
-c
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
endreturnval
=
1
endreturnval
=
1
is_remote
$origin
||
continue
is_remote
$origin
||
continue
echo
"Because the remote file above failed the
md5
sum check it will be deleted."
echo
"Because the remote file above failed the
${
algo
}
sum check it will be deleted."
echo
"Rebuilding will cause it to re-download which in some cases may fix the problem."
echo
"Rebuilding will cause it to re-download which in some cases may fix the problem."
file
=
`
echo
"
$src
"
|
sed
's/.*[ \t\n]\(.*\)/\1/'
`
file
=
`
echo
"
$src
"
|
sed
's/.*[ \t\n]\(.*\)/\1/'
`
echo
"Deleting:
$file
"
echo
"Deleting:
$file
"
...
@@ -249,10 +248,33 @@ md5check() {
...
@@ -249,10 +248,33 @@ md5check() {
fi
fi
done
done
unset
IFS
unset
IFS
set
--
$originalparams
return
$endreturnval
return
$endreturnval
}
}
# for compatibility
md5check
()
{
warning
"'md5check' is deprecated. Use 'verify' instead"
sumcheck md5
"
$md5sums
"
}
# verify checksums
verify
()
{
local
verified
=
false
algo
=
for
algo
in
md5 sha1 sha256 sha512
;
do
local
sums
=
eval
sums
=
\"\$
${
algo
}
sums
\"
if
[
-z
"
$sums
"
]
||
[
-z
"
$source
"
]
;
then
continue
fi
sumcheck
"
$algo
"
"
$sums
"
||
return
1
verified
=
true
done
if
[
-n
"
$source
"
]
&&
!
$verified
;
then
die
"Use 'abuild checksum' to generate/update the checksum(s)"
fi
return
0
}
# verify upstream sources
# verify upstream sources
sourcecheck
()
{
sourcecheck
()
{
local
uri
local
uri
...
@@ -1475,15 +1497,31 @@ builddeps() {
...
@@ -1475,15 +1497,31 @@ builddeps() {
# replace the md5sums in the APKBUILD
# replace the md5sums in the APKBUILD
checksum
()
{
checksum
()
{
local
s files
local
s files
[
-z
"
$source
"
]
&&
[
-n
"
${
md5sums
}${
sha256sums
}${
sha512sums
}
"
]
\
&&
msg
"Removing checksums from APKBUILD"
sed
-i
-e
'/^md5sums="/,/"\$/d; /^md5sums=''/,/''\$/d'
"
$APKBUILD
"
sed
-i
-e
'/^sha512sums="/,/"\$/d; /^sha512sums=''/,/''\$/d'
"
$APKBUILD
"
sed
-i
-e
'/^sha256sums="/,/"\$/d; /^sha256sums=''/,/''\$/d'
"
$APKBUILD
"
[
-z
"
$source
"
]
&&
return
0
[
-z
"
$source
"
]
&&
return
0
fetch
fetch
msg
"Updating the md5sums in APKBUILD..."
for
s
in
$source
;
do
for
s
in
$source
;
do
files
=
"
$files
${
s
##*/
}
"
files
=
"
$files
${
s
##*/
}
"
done
done
# for compatibility/backporting reasons we still add md5sum
msg
"Updating the md5sums in APKBUILD..."
md5sums
=
"
$(
cd
"
$srcdir
"
&&
md5sum
$files
)
"
||
die
"md5sum failed"
md5sums
=
"
$(
cd
"
$srcdir
"
&&
md5sum
$files
)
"
||
die
"md5sum failed"
sed
-i
-e
'/^md5sums="/,/"\$/d; /^md5sums=''/,/''\$/d'
"
$APKBUILD
"
echo
"md5sums=
\"
$md5sums
\"
"
>>
"
$APKBUILD
"
echo
"md5sums=
\"
$md5sums
\"
"
>>
"
$APKBUILD
"
msg
"Updating the sha256sums in APKBUILD..."
sha256sums
=
"
$(
cd
"
$srcdir
"
&&
sha256sum
$files
)
"
\
||
die
"sha256sum failed"
echo
"sha256sums=
\"
$sha256sums
\"
"
>>
"
$APKBUILD
"
msg
"Updating the sha512sums in APKBUILD..."
sha512sums
=
"
$(
cd
"
$srcdir
"
&&
sha512sum
$files
)
"
\
||
die
"sha512sum failed"
echo
"sha512sums=
\"
$sha512sums
\"
"
>>
"
$APKBUILD
"
}
}
stripbin
()
{
stripbin
()
{
...
@@ -1633,7 +1671,7 @@ usage() {
...
@@ -1633,7 +1671,7 @@ usage() {
echo
" checksum Generate checksum to be included in APKBUILD"
echo
" checksum Generate checksum to be included in APKBUILD"
echo
" fetch Fetch sources to
\$
SRCDEST and verify checksums"
echo
" fetch Fetch sources to
\$
SRCDEST and verify checksums"
echo
" sanitycheck Basic sanity check of APKBUILD"
echo
" sanitycheck Basic sanity check of APKBUILD"
echo
"
md5check Check md5
sums"
echo
"
verify Verify check
sums"
echo
" unpack Unpack sources to
\$
srcdir"
echo
" unpack Unpack sources to
\$
srcdir"
echo
" build Compile and install package into
\$
pkgdir"
echo
" build Compile and install package into
\$
pkgdir"
echo
" listpkg List target packages"
echo
" listpkg List target packages"
...
...
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