Skip to content

Commit 6bb2f50

Browse files
author
Cruz Monrreal
authored
Merge pull request #7713 from geky/littlefs-v1.6
LittleFS: Update to version 1.6
2 parents b01d0ab + 783bc84 commit 6bb2f50

File tree

17 files changed

+330
-562
lines changed

17 files changed

+330
-562
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ matrix:
200200
- fusermount --version
201201
before_script:
202202
# Setup and patch littlefs-fuse
203-
- git clone https://github.com/geky/littlefs-fuse littlefs_fuse
203+
- git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
204204
- git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
205205
- echo '*' > littlefs_fuse/.mbedignore
206206
- rm -rf littlefs_fuse/littlefs/*
@@ -238,7 +238,7 @@ matrix:
238238
- make clean size
239239
CC='arm-none-eabi-gcc -mthumb'
240240
OBJ="$(ls lfs*.o | tr '\n' ' ')"
241-
CFLAGS+="-DLFS_NO{ASSERT,DEBUG,WARN,ERROR}"
241+
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
242242
| tee sizes
243243
after_success:
244244
# update status if we succeeded, compare with master if possible

features/filesystem/littlefs/LICENSE.md

Lines changed: 0 additions & 165 deletions
This file was deleted.

features/filesystem/littlefs/LittleFileSystem.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
#include "filesystem/mbed_filesystem.h"
1717
#include "LittleFileSystem.h"
1818
#include "errno.h"
19-
extern "C" {
2019
#include "lfs.h"
2120
#include "lfs_util.h"
22-
}
2321

2422

2523
////// Conversion functions //////

features/filesystem/littlefs/LittleFileSystem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include "FileSystem.h"
2020
#include "BlockDevice.h"
2121
#include "PlatformMutex.h"
22-
extern "C" {
2322
#include "lfs.h"
24-
}
2523

2624

2725
/**

features/filesystem/littlefs/littlefs/.travis.yml

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ script:
2727
# compile and find the code size with the smallest configuration
2828
- make clean size
2929
OBJ="$(ls lfs*.o | tr '\n' ' ')"
30-
CFLAGS+="-DLFS_NO{ASSERT,DEBUG,WARN,ERROR}"
30+
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
3131
| tee sizes
3232

3333
# update status if we succeeded, compare with master if possible
3434
- |
3535
if [ "$TRAVIS_TEST_RESULT" -eq 0 ]
3636
then
3737
CURR=$(tail -n1 sizes | awk '{print $1}')
38-
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
38+
PREV=$(curl -u $GEKY_BOT_STATUSES https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
3939
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
4040
| .statuses[] | select(.context == \"$STAGE/$NAME\").description
4141
| capture(\"code size is (?<size>[0-9]+)\").size" \
@@ -134,52 +134,44 @@ jobs:
134134
- STAGE=deploy
135135
- NAME=deploy
136136
script:
137-
# Update tag for version defined in lfs.h
137+
# Find version defined in lfs.h
138138
- LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
139139
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
140140
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
141-
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
142-
- echo "littlefs version $LFS_VERSION"
141+
# Grab latests patch from repo tags, default to 0
142+
- LFS_VERSION_PATCH=$(curl -f -u "$GEKY_BOT_RELEASES"
143+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs
144+
| jq 'map(.ref | match(
145+
"refs/tags/v'"$LFS_VERSION_MAJOR"'\\.'"$LFS_VERSION_MINOR"'\\.(.*)$")
146+
.captures[].string | tonumber + 1) | max // 0')
147+
# We have our new version
148+
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR.$LFS_VERSION_PATCH"
149+
- echo "VERSION $LFS_VERSION"
143150
- |
144-
curl -u $GEKY_BOT_RELEASES -X POST \
145-
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
146-
-d "{
147-
\"ref\": \"refs/tags/$LFS_VERSION\",
148-
\"sha\": \"$TRAVIS_COMMIT\"
149-
}"
150-
- |
151-
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
152-
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
153-
-d "{
154-
\"sha\": \"$TRAVIS_COMMIT\"
155-
}"
156-
# Create release notes from commits
157-
- LFS_PREV_VERSION="v$LFS_VERSION_MAJOR.$(($LFS_VERSION_MINOR-1))"
158-
- |
159-
if [ $(git tag -l "$LFS_PREV_VERSION") ]
151+
# Check that we're the most recent commit
152+
CURRENT_COMMIT=$(curl -f -u "$GEKY_BOT_RELEASES" \
153+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/commits/master \
154+
| jq -re '.sha')
155+
if [ "$TRAVIS_COMMIT" == "$CURRENT_COMMIT" ]
160156
then
161-
curl -u $GEKY_BOT_RELEASES -X POST \
157+
# Build release notes
158+
PREV=$(git tag --sort=-v:refname -l "v*" | head -1)
159+
if [ ! -z "$PREV" ]
160+
then
161+
echo "PREV $PREV"
162+
CHANGES=$'### Changes\n\n'$( \
163+
git log --oneline $PREV.. --grep='^Merge' --invert-grep)
164+
printf "CHANGES\n%s\n\n" "$CHANGES"
165+
fi
166+
# Create the release
167+
curl -f -u "$GEKY_BOT_RELEASES" -X POST \
162168
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
163169
-d "{
164170
\"tag_name\": \"$LFS_VERSION\",
165-
\"name\": \"$LFS_VERSION\"
171+
\"target_commitish\": \"$TRAVIS_COMMIT\",
172+
\"name\": \"${LFS_VERSION%.0}\",
173+
\"body\": $(jq -sR '.' <<< "$CHANGES")
166174
}"
167-
RELEASE=$(
168-
curl -f https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
169-
)
170-
CHANGES=$(
171-
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
172-
)
173-
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
174-
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/$(
175-
jq -r '.id' <<< "$RELEASE"
176-
) \
177-
-d "$(
178-
jq -s '{
179-
"body": ((.[0] // "" | sub("(?<=\n)#+ Changes.*"; ""; "mi"))
180-
+ "### Changes\n\n" + .[1])
181-
}' <(jq '.body' <<< "$RELEASE") <(jq -sR '.' <<< "$CHANGES")
182-
)"
183175
fi
184176
185177
# Manage statuses
@@ -220,4 +212,4 @@ after_success:
220212
stages:
221213
- name: test
222214
- name: deploy
223-
if: branch = master
215+
if: branch = master AND type = push

0 commit comments

Comments
 (0)