Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
matrix-stickers
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
matrix-stickers
Validations
53149a63
Valider
53149a63
rédigé
2 years ago
par
Elliu
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
WIP: WIP
parent
f9bdcb08
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
stpkg
+34
-25
34 ajouts, 25 suppressions
stpkg
avec
34 ajouts
et
25 suppressions
stpkg
+
34
−
25
Voir le fichier @
53149a63
...
@@ -775,10 +775,14 @@ __pack() {
...
@@ -775,10 +775,14 @@ __pack() {
# Check packs
# Check packs
local
DEST_FOLDER
=
"
$STPKG_BASE
/packs/
$PACK_NAME
"
local
DEST_FOLDER
=
"
$STPKG_BASE
/packs/
$PACK_NAME
"
[
-d
"
$DEST_FOLDER
"
]
\
[
-d
"
$DEST_FOLDER
"
]
\
&&
{
{
warn
"Delete old folder content for pack
$PACK_NAME
"
;
rm
"
$DEST_FOLDER
"
/
*
;
}
\
&&
{
warn
"Old folder for pack
$PACK_NAME
exists, using checksums to reupload necessary stickers"
;
}
\
||
die
"Failed to remove old folder pack content"
;
}
\
||
{
{
info
"Create folder for pack
$PACK_NAME
"
;
mkdir
"
$DEST_FOLDER
"
;
}
\
||
{
{
info
"Create folder for pack
$PACK_NAME
"
;
mkdir
"
$DEST_FOLDER
"
;
}
\
||
die
"Failed to create destination folder for pack '
$PACK_NAME
'"
;
}
||
die
"Failed to create destination folder for pack '
$PACK_NAME
'"
;
}
#[ -d "$DEST_FOLDER" ] \
# && { { warn "Delete old folder content for pack $PACK_NAME" ; rm "$DEST_FOLDER"/*; } \
# || die "Failed to remove old folder pack content"; } \
# || { { info "Create folder for pack $PACK_NAME" ; mkdir "$DEST_FOLDER"; } \
# || die "Failed to create destination folder for pack '$PACK_NAME'"; }
local
DEST_INDEX
=
"
$DEST_FOLDER
/
$PACK_NAME
.json"
local
DEST_INDEX
=
"
$DEST_FOLDER
/
$PACK_NAME
.json"
touch
$DEST_INDEX
touch
$DEST_INDEX
[
!
-f
$DEST_INDEX
]
&&
die
"Failed to create the index file '
$DEST_INDEX
'"
[
!
-f
$DEST_INDEX
]
&&
die
"Failed to create the index file '
$DEST_INDEX
'"
...
@@ -792,42 +796,46 @@ __pack() {
...
@@ -792,42 +796,46 @@ __pack() {
local
FIRST_IN_ARRAY
=
""
local
FIRST_IN_ARRAY
=
""
# Check checksums
# Check checksums
local
SUM_FILE
=
".
$
{
PACK_NAME
}
.checksums"
local
SUM_FILE
=
"
$DEST_FOLDER
/
.
$PACK_NAME
.checksums"
if
[
!
-f
"
$SUM_FILE
"
]
;
then
if
[
!
-f
"
$SUM_FILE
"
]
;
then
touch
$SUM_FILE
touch
$SUM_FILE
fi
fi
local
-a
newFiles
local
-A
hashes unchangedFiles updatedFiles deletedFiles skipFiles
local
-A
hashes unchangedFiles updatedFiles deletedFiles
local
TEMP_CHECK
=
`
mktemp
--suffix
=
.stpkg
`
local
TEMP_CHECK
=
`
mktemp
--suffix
=
.stpkg
`
md5sum
-c
$SUM_FILE
&>/dev/null
>
$TEMP_CHECK
md5sum
-c
$SUM_FILE
&>/dev/null
>
$TEMP_CHECK
while
read
-r
_hash _file
;
do
while
read
-r
_hash _file
;
do
hashes[
"
$_file
"
]=
"
$_hash
"
hashes[
"
$_file
"
]=
"
$_hash
"
done
<
$SUM_FILE
done
<
$SUM_FILE
newFiles
=(
*
)
for
i
in
"
`
cat
$TEMP_CHECK
|
grep
": OK$"
|
sed
"s/: OK
$/
/g"
`
"
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': OK$'
|
sed
's/\(.*\): OK/\1/'
`
;
do
unchangedFiles[
"
$i
"
]=(
"
${
hashes
[
"
$i
"
]
}
"
)
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
unchangedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unset
hashes[
"
$i
"
]
unset
hashes[
"
$i
"
]
newFiles
=
"
${
newFiles
[@]/
$i
}
"
skipFiles[
$i
]=
"
"
done
done
for
i
in
"
`
cat
$TEMP_CHECK
|
grep
": FAILED$"
|
sed
"s/: FAILED
$/
/g"
`
"
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED$'
|
sed
's/\(.*\): FAILED/\1/'
`
;
do
updatedFiles[
"
$i
"
]=(
"
${
hashes
[
"
$i
"
]
}
"
)
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
updatedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unset
hashes[
"
$i
"
]
unset
hashes[
"
$i
"
]
newFiles
=
"
${
newFiles
[@]/
$i
}
"
skipFiles[
$i
]=
"
"
done
done
for
i
in
"
`
cat
$TEMP_CHECK
|
grep
": FAILED open or read$"
|
sed
"s/: FAILED open or read
$/
/g"
`
"
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED open or read$'
|
sed
's/\(.*\): FAILED open or read/\1/'
`
;
do
deletedFiles[
"
$i
"
]=(
"
${
hashes
[
"
$i
"
]
}
"
)
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
deletedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unset
hashes[
"
$i
"
]
unset
hashes[
"
$i
"
]
newFiles
=
"
${
newFiles
[@]/
$i
}
"
skipFiles[
$i
]=
"
"
done
done
for
FILE
in
"
${
!newFiles[@]
}
"
;
do
for
FILE
in
*
;
do
# Add a ',' only if it's not the first in the array
# Add a ',' only if it's not the first in the array
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
if
[[
$(
md5sum
$FILE
)
=
$(
cat
$SUM_FILE
|
grep
)
]]
;
then
if
[[
-v
skipFiles[
$FILE
]
]]
;
then continue
;
fi
else
md5sum
$FILE
>>
$SUM_FILE
echo
"Processing new file
$FILE
"
if
[[
"
`
md5sum
$FILE
|
sed
-e
's/\([0-9a-f]\{32\}\) .*$/\1/'
`
"
=
"
`
cat
$SUM_FILE
|
grep
"
$FILE
"
|
sed
-e
's/\([0-9a-f]\{32\}\) .*$/\1/'
`
"
]]
;
then
die
"New file is replacing existing file, that should not be happening"
fi
fi
local
ST_JSON
=
""
local
ST_JSON
=
""
...
@@ -836,10 +844,10 @@ __pack() {
...
@@ -836,10 +844,10 @@ __pack() {
# For the report
# For the report
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
local
FIRST_IN_ARRAY
=
","
FIRST_IN_ARRAY
=
","
echo
-e
"
$ST_JSON
"
| jq
-r
'[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
echo
-e
"
$ST_JSON
"
| jq
-r
'[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
# TODO: add hashes
md5sum
$FILE
>>
$SUM_FILE
progress_reset
progress_reset
done
| column
-t
done
| column
-t
...
@@ -847,7 +855,7 @@ __pack() {
...
@@ -847,7 +855,7 @@ __pack() {
for
FILE
in
"
${
!unchangedFiles[@]
}
"
;
do
for
FILE
in
"
${
!unchangedFiles[@]
}
"
;
do
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
local
FIRST_IN_ARRAY
=
","
FIRST_IN_ARRAY
=
","
#echo -e "$ST_JSON" | jq -r '[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
#echo -e "$ST_JSON" | jq -r '[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
echo
"
$FILE
unchanged"
echo
"
$FILE
unchanged"
done
| column
-t
done
| column
-t
...
@@ -855,14 +863,14 @@ __pack() {
...
@@ -855,14 +863,14 @@ __pack() {
for
FILE
in
"
${
!updatedFiles[@]
}
"
;
do
for
FILE
in
"
${
!updatedFiles[@]
}
"
;
do
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
local
FIRST_IN_ARRAY
=
","
FIRST_IN_ARRAY
=
","
echo
"
$FILE
updated"
echo
"
$FILE
updated"
done
| column
-t
done
| column
-t
for
FILE
in
"
${
!deletedFiles[@]
}
"
;
do
for
FILE
in
"
${
!deletedFiles[@]
}
"
;
do
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$DEST_INDEX
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
[
"x
$FIRST_IN_ARRAY
"
=
"x"
]
&&
echo
-e
"StickerName MXC Type Width Height"
local
FIRST_IN_ARRAY
=
","
FIRST_IN_ARRAY
=
","
#echo -e "$ST_JSON" | jq -r '[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
#echo -e "$ST_JSON" | jq -r '[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
echo
"
$FILE
deleted, but kept in the pack"
echo
"
$FILE
deleted, but kept in the pack"
done
| column
-t
done
| column
-t
...
@@ -878,9 +886,10 @@ __pack() {
...
@@ -878,9 +886,10 @@ __pack() {
#montage "$DEST_FOLDER/*.{png,gif}" -background none "$DEST_FOLDER/preview.png"
#montage "$DEST_FOLDER/*.{png,gif}" -background none "$DEST_FOLDER/preview.png"
#echo -ne "# $PACK_NAME\n" > "$DEST_FOLDER/README.md"
#echo -ne "# $PACK_NAME\n" > "$DEST_FOLDER/README.md"
echo
-ne
"#
$PACK_NAME
\n
(no preview)"
>
"
$DEST_FOLDER
/README.md"
echo
-ne
"#
$PACK_NAME
\n
(no preview)"
>
"
$DEST_FOLDER
/README.md"
find
$DEST_FOLDER
-type
f
\(
!
-name
"preview.png"
-and
!
-name
"
$PACK_NAME
.json"
\)
-exec
rm
{}
\;
find
$DEST_FOLDER
-type
f
\(
!
-name
"preview.png"
-and
!
-name
"
$PACK_NAME
.json"
-and
!
-name
'.*.checksums'
\)
-exec
rm
{}
\;
echo
-n
"]}"
>>
$DEST_INDEX
echo
-n
"]}"
>>
$DEST_INDEX
cat
$DEST_INDEX
cat
$DEST_INDEX
| jq | sponge
$DEST_INDEX
cat
$DEST_INDEX
| jq | sponge
$DEST_INDEX
info
"Pack created, you can now commit it and create a MR to share it with other users"
info
"Pack created, you can now commit it and create a MR to share it with other users"
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter