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
9da6db01
Valider
9da6db01
rédigé
2 years ago
par
Elliu
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Properly delete deleted stickers
parent
dbed17a1
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
+22
-32
22 ajouts, 32 suppressions
stpkg
avec
22 ajouts
et
32 suppressions
stpkg
+
22
−
32
Voir le fichier @
9da6db01
...
@@ -757,7 +757,7 @@ __pack() {
...
@@ -757,7 +757,7 @@ __pack() {
if
[
!
-f
"
$SUM_FILE
"
]
;
then
if
[
!
-f
"
$SUM_FILE
"
]
;
then
touch
$SUM_FILE
touch
$SUM_FILE
fi
fi
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
...
@@ -766,32 +766,25 @@ __pack() {
...
@@ -766,32 +766,25 @@ __pack() {
for
i
in
`
cat
$TEMP_CHECK
|
grep
': OK$'
|
sed
's/\(.*\): OK/\1/'
`
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': OK$'
|
sed
's/\(.*\): OK/\1/'
`
;
do
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
echo
"
$FILE
is OK"
if
[
"x
$STPKG_REUPLOAD_SAME_FILE
"
=
"xyes"
]
;
then
if
[
"x
$STPKG_REUPLOAD_SAME_FILE
"
=
"xyes"
]
;
then
echo
"
$FILE
is updated"
updatedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
updatedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
else
else
echo
"
$FILE
is unchanged"
unchangedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unchangedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
fi
fi
echo
"unset
$FILE
"
unset
hashes[
"
$i
"
]
skipFiles[
$i
]=
""
done
done
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED$'
|
sed
's/\(.*\): FAILED/\1/'
`
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED$'
|
sed
's/\(.*\): FAILED/\1/'
`
;
do
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
updatedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
updatedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unset
hashes[
"
$i
"
]
skipFiles[
$i
]=
""
done
done
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED open or read$'
|
sed
's/\(.*\): FAILED open or read/\1/'
`
;
do
for
i
in
`
cat
$TEMP_CHECK
|
grep
': FAILED open or read$'
|
sed
's/\(.*\): FAILED open or read/\1/'
`
;
do
if
[
"x
$i
"
=
"x"
]
;
then continue
;
fi
if
[
"x
$i
"
=
=
"x"
]
;
then continue
;
fi
deletedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
deletedFiles[
"
$i
"
]=
"
${
hashes
[
"
$i
"
]
}
"
unset
hashes[
"
$i
"
]
echo
"add
$i
to deleted"
skipFiles[
$i
]=
""
done
done
local
ST_JSON
=
""
local
ST_JSON
=
""
echo
"----- Pack -----"
{
for
FILE
in
*
;
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
"
>>
$TEMP_JSON
echo
-n
"
$FIRST_IN_ARRAY
"
>>
$TEMP_JSON
...
@@ -801,18 +794,12 @@ __pack() {
...
@@ -801,18 +794,12 @@ __pack() {
if
[[
-v
unchangedFiles[
$FILE
]
]]
;
then
if
[[
-v
unchangedFiles[
$FILE
]
]]
;
then
STICKER_STATUS
=
"Unchanged"
STICKER_STATUS
=
"Unchanged"
ST_JSON
=
`
jq
".stickers[] | select(.body ==
\"
$STICKER_NAME
\"
)"
<
"
$DEST_INDEX
"
`
ST_JSON
=
`
jq
".stickers[] | select(.body ==
\"
$STICKER_NAME
\"
)"
<
"
$DEST_INDEX
"
`
elif
[[
-v
deletedFiles[
$FILE
]
]]
;
then
STICKER_STATUS
=
"Deleted"
ST_JSON
=
`
jq
".stickers[] | select(.body ==
\"
$STICKER_NAME
\"
)"
<
"
$DEST_INDEX
"
`
#TODO: remove from checksum?
else
else
if
[[
-v
updatedFiles[
$FILE
]
]]
;
then
if
[[
-v
updatedFiles[
$FILE
]
]]
;
then
STICKER_STATUS
=
"Updated"
STICKER_STATUS
=
"
`
__yellow Updated
`
"
#TODO: deleted old checksum
sed
-i
"/[0-9a-f]
\{
32
\}
$FILE
/d"
$SUM_FILE
sed
-i
"/[0-9a-f]
\{
32
\}
$FILE
/d"
$SUM_FILE
else
else
STICKER_STATUS
=
"New"
STICKER_STATUS
=
"
`
__green
New
`
"
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
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"
die
"New file is replacing existing file, that should not be happening"
fi
fi
...
@@ -829,24 +816,27 @@ __pack() {
...
@@ -829,24 +816,27 @@ __pack() {
FIRST_IN_ARRAY
=
","
FIRST_IN_ARRAY
=
","
local
report
=
"
`
echo
-ne
"
$ST_JSON
"
| jq
-r
'[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
`
$STICKER_STATUS
"
local
report
=
"
`
echo
-ne
"
$ST_JSON
"
| jq
-r
'[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
`
$STICKER_STATUS
"
echo
"
$report
"
echo
"
$report
"
done
for
i
in
"
${
!deletedFiles[@]
}
"
;
do
local
STICKER_NAME
=
$(
file_get_name
"
$i
"
)
ST_JSON
=
`
jq
".stickers[] | select(.body ==
\"
$STICKER_NAME
\"
)"
<
"
$DEST_INDEX
"
`
sed
-i
"/[0-9a-f]
\{
32
\}
$i
/d"
$SUM_FILE
local
report
=
"
`
echo
-ne
"
$ST_JSON
"
| jq
-r
'[.body, .url, .info.mimetype, .info.w, .info.h]|join(" ")'
`
`
__red Deleted
`
"
echo
"
$report
"
done
}
| column
-t
echo
"----------------"
done
| column
-t
# Update the sum file:
# Keep deleted but kept
# Remove deleted and deleted
# Update updated
# Keep unchanged
# Add new
# Create the preview
#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
(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"
-and
!
-name
'.*.checksums'
\)
-exec
rm
{}
\;
find
$DEST_FOLDER
-type
f
\(
!
-name
"preview.png"
-and
!
-name
"
$PACK_NAME
.json"
-and
!
-name
'.*.checksums'
\)
-exec
rm
{}
\;
echo
-n
"]}"
>>
$TEMP_JSON
echo
-n
"]}"
>>
$TEMP_JSON
cat
$TEMP_JSON
| jq
>
$DEST_INDEX
cat
$TEMP_JSON
| jq
>
$DEST_INDEX
echo
$TEMP_JSON
# Sort checksums to get better diffs
cat
$SUM_FILE
|
sort
| sponge
$SUM_FILE
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