Skip to contentSkip to conversation

small mtd-utils fixes

PATCH In review Brian Norris 5 participants 29 messages Nov 16, 2011 – Dec 7, 2011 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

cover small mtd-utils fixes

Hi,

These two fixes are somewhat trivial, although the second one fixes a kind of regression that occurred since the last release.

Speaking of releases: when will we make a new release? After kernel 3.2 is final? Or perhaps a pre-3.2 and post-3.2 release? There are a lot of important fixes in git right now, and I'd like to incorporate them officially.

Also, note that the following commit was intended to be paired with the commits in the "brian" branch:

commit bf01f2960ba82468b1b25f00e044fd0c3ee0770a
nandwrite: consolidate buffer usage

While it is functionally harmless, it does include an unnecessary memcpy(). In fact, the patch really is useful only when paired with the rest of the 'brian' branch, which is intended for kernels supporting ioctl(MEMWRITE) - i.e., kernel version >= 3.2.

So I recommend that the next release either includes the 'brian' branch or does not include commit bf01f2. Mike Frysinger and I discussed this issue on the ML earlier and didn't really come up with a solution that avoids the overhead both with and without MEMWRITE. I figure pre-3.2 kernel users will just have to put up with it eventually.

Thanks,
Brian

Brian Norris (2):
mtd-utils: add jffs2reader to .gitignore
mtdinfo: provide info when used without arguments

 .gitignore          |    1 +
 ubi-utils/mtdinfo.c |   14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/2 mtd-utils: add jffs2reader to .gitignore

---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
index 3a56d0d..d4771fb 100644
@@ -30,6 +30,7 @@
 /ftl_check
 /ftl_format
 /jffs2dump
+/jffs2reader
 /mkfs.jffs2
 /mtd_debug
 /nanddump
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/2 mtdinfo: provide info when used without arguments

In reply to Brian Norris

If the user specifies neither a MTD argument nor the `-a' flag, we print a cryptic message; i.e.,

    # mtdinfo
    libmtd: error!: cannot get information about "(null)"
            error 14 (Bad address)
    mtdinfo: error!: cannot get information about MTD device "(null)"
             error 14 (Bad address)

This is a regression; previously, mtdinfo would give some short info about number of devices, etc. when used without arguments. To fix this, we revert commit d53c03b0989f8354a7e4dbb947a150fc7fe3f6d1 and call print_general_info() when no device is specified.

---
 ubi-utils/mtdinfo.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
ubi-utils/mtdinfo.c +10 -4
index d919673..ead4bce 100644
@@ -340,7 +340,8 @@ static int print_dev_info(libmtd_t libmtd, const struct mtd_info *mtd_info, int
 	return 0;
 }
 
-static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info)
+static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info,
+			      int all)
 {
 	int i, err, first = 1;
 	struct mtd_dev_info mtd;
@@ -367,9 +368,14 @@ static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info)
 		}
 	}
 	printf("\n");
-	printf("Sysfs interface supported:      %s\n\n",
+	printf("Sysfs interface supported:      %s\n",
 	       mtd_info->sysfs_supported ? "yes" : "no");
 
+	if (!all)
+		return 0;
+
+	printf("\n");
+
 	for (i = mtd_info->lowest_mtd_num;
 	     i <= mtd_info->highest_mtd_num; i++) {
 		err = print_dev_info(libmtd, mtd_info, i);
@@ -404,7 +410,7 @@ int main(int argc, char * const argv[])
 		return sys_errmsg("cannot get MTD information");
 	}
 
-	if (!args.all) {
+	if (!args.all && args.node) {
 		int mtdn;
 
 		/*
@@ -416,7 +422,7 @@ int main(int argc, char * const argv[])
 			goto out_libmtd;
 		err = print_dev_info(libmtd, &mtd_info, mtdn);
 	} else
-		err = print_general_info(libmtd, &mtd_info);
+		err = print_general_info(libmtd, &mtd_info, args.all);
 	if (err)
 		goto out_libmtd;
 
Signature · 1 line
1.7.5.4
#5 lore raw
In reply to Brian Norris
Quoted 4 lines · Brian Norris

Speaking of releases: when will we make a new release? After kernel 3.2 is final? Or perhaps a pre-3.2 and post-3.2 release? There are a lot of important fixes in git right now, and I'd like to incorporate them officially.

We can release it as soon as someone ask. Should I do this now?

Quoted 11 lines

Also, note that the following commit was intended to be paired with the commits in the "brian" branch:

commit bf01f2960ba82468b1b25f00e044fd0c3ee0770a
nandwrite: consolidate buffer usage

While it is functionally harmless, it does include an unnecessary memcpy(). In fact, the patch really is useful only when paired with the rest of the 'brian' branch, which is intended for kernels supporting ioctl(MEMWRITE) - i.e., kernel version >= 3.2.

Quoted 5 lines

So I recommend that the next release either includes the 'brian' branch or does not include commit bf01f2. Mike Frysinger and I discussed this issue on the ML earlier and didn't really come up with a solution that avoids the overhead both with and without MEMWRITE. I figure pre-3.2 kernel users will just have to put up with it eventually.

Could you please refresh my memory and remind me about the brian branch? Why we have it and what prevents us from merging it to the master branch? There were some kernel changes which I was not sure about? But now they are in Linus' tree so we can merge that branch and make a release, right?

Artem.

#28 lore raw
In reply to Brian Norris
Quoted 4 lines · Brian Norris

Hi,

These two fixes are somewhat trivial, although the second one fixes a kind of regression that occurred since the last release.

Pushed both, thanks!

Artem.

#6 lore raw
In reply to Artem Bityutskiy
Quoted 1 line · Artem Bityutskiy

We can release it as soon as someone ask. Should I do this now?

I suppose I'm asking, so yes :)

Quoted 5 lines

Could you please refresh my memory and remind me about the brian branch? Why we have it and what prevents us from merging it to the master branch? There were some kernel changes which I was not sure about? But now they are in Linus' tree so we can merge that branch and make a release, right?

Your exact quote: "And last but not least, I think we should not push your changes to the master branch of mtd-utils _befor_ the corresponding kernel-space changes have reached Linuses tree (e.g., dwmw2 might dislike something)."

So I suppose it was just waiting until the kernel changes passed dwmw2. Now's a good time to merge 'brian' and release, I guess.

Thanks,
Brian

#7 lore raw
Quoted 4 lines · Brian Norris
Quoted 1 line · Artem Bityutskiy

We can release it as soon as someone ask. Should I do this now?

I suppose I'm asking, so yes :)

Done: mtd-utils-1.4.7
The tarball is at the usual place as well.

Artem.

#8 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Artem" == Artem Bityutskiy <[email protected]> writes:

Quoted 4 lines · Brian Norris
Quoted 4 lines · Artem Bityutskiy
Quoted 1 line

We can release it as soon as someone ask. Should I do this now?

I suppose I'm asking, so yes :)

Artem> Done: mtd-utils-1.4.7
Artem> The tarball is at the usual place as well.

Thanks, I've updated the package in buildroot. One minor nit, you forgot to update the version in the Makefile.

Signature · 1 line
Bye, Peter Korsgaard
#9 lore raw
Quoted 2 lines · Peter Korsgaard

Thanks, I've updated the package in buildroot. One minor nit, you forgot to update the version in the Makefile.

I was just about to comment on the Makefile version as well; I forgot about that...any chance we can fix this on the official release? It's kind of important that I can tell which version my users are using, now that we've fixed a lot of annoying bugs/"features". If not, I may just modify it in my own releases.

Brian

#10 lore raw
Quoted 9 lines · Brian Norris
Quoted 2 lines · Peter Korsgaard

Thanks, I've updated the package in buildroot. One minor nit, you forgot to update the version in the Makefile.

I was just about to comment on the Makefile version as well; I forgot about that...any chance we can fix this on the official release? It's kind of important that I can tell which version my users are using, now that we've fixed a lot of annoying bugs/"features". If not, I may just modify it in my own releases.

My apologies. I've released 1.4.8 and changed the Makefile this time. Uploaded the tarball as well.

Artem.

#11 lore raw
Quoted 5 lines · Artem Bityutskiy
Quoted 4 lines · Brian Norris
Quoted 2 lines · Peter Korsgaard

Thanks, I've updated the package in buildroot. One minor nit, you forgot to update the version in the Makefile.

Quoted 8 lines
Quoted 5 lines

I was just about to comment on the Makefile version as well; I forgot about that...any chance we can fix this on the official release? It's kind of important that I can tell which version my users are using, now that we've fixed a lot of annoying bugs/"features". If not, I may just modify it in my own releases.

My apologies. I've released 1.4.8 and changed the Makefile this time. Uploaded the tarball as well.

how are you making the releases ? seems like this keeps coming up, so maybe we should have a make dist that takes care of this stuff automatically to avoid future mistakes ...
-mike

#12 lore raw
Quoted 12 lines · Mike Frysinger
Quoted 11 lines · Artem Bityutskiy
Quoted 9 lines · Brian Norris
Quoted 2 lines · Peter Korsgaard

Thanks, I've updated the package in buildroot. One minor nit, you forgot to update the version in the Makefile.

I was just about to comment on the Makefile version as well; I forgot about that...any chance we can fix this on the official release? It's kind of important that I can tell which version my users are using, now that we've fixed a lot of annoying bugs/"features". If not, I may just modify it in my own releases.

Quoted 6 lines
Quoted 2 lines

My apologies. I've released 1.4.8 and changed the Makefile this time. Uploaded the tarball as well.

how are you making the releases ? seems like this keeps coming up, so maybe we should have a make dist that takes care of this stuff automatically to avoid future mistakes ...

You are right. I've just created a simple shell script which should do cut a new release properly.

#!/bin/sh -uef

# A small helper script to release mtd-utils. Takes the new version

# as a parameter.
fatal() {
	printf "%s\n" "$1" >&2
	exit 1
}

[ $# -eq 1 ] || fatal "Please, specify the new version" new_ver="$1"

# Change the version in the Makefile
tmpfile="$(mktemp)"
sed -e "s/^VERSION = [[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/VERSION = $new_ver/" \
Makefile > "$tmpfile"
mv "$tmpfile" Makefile

# And commit the change
git commit -s -m "Release mtd-utils-$new_ver" Makefile

# Create new tag
git tag "v$new_ver"

# Prepare the tarball

git archive --format=tar --prefix="mtd-utils-$new_ver/" "v$new_ver" | \
	bzip2 > "mtd-utils-$new_ver.tar.bz2"

# Upload the tarball
scp "mtd-utils-$new_ver.tar.bz2" casper.infradead.org:/var/ftp/pub/mtd-utils/

#13 lore raw
Quoted 7 lines · Artem Bityutskiy
Quoted 3 lines · Mike Frysinger

how are you making the releases ?  seems like this keeps coming up, so maybe we should have a make dist that takes care of this stuff automatically to avoid future mistakes ...

You are right. I've just created a simple shell script which should do cut a new release properly.

could you add it to the git repo ? be easier to send fixes/tweaks :). -mike

#15 lore raw
In reply to Artem Bityutskiy
Quoted 3 lines · Artem Bityutskiy

# Prepare the tarball

git archive --format=tar --prefix="mtd-utils-$new_ver/" "v$new_ver" | \
        bzip2 > "mtd-utils-$new_ver.tar.bz2"

gpg --detach-sign -a "mtd-utils-$new_ver.tar.bz2"

Quoted 2 lines

# Upload the tarball
scp "mtd-utils-$new_ver.tar.bz2" casper.infradead.org:/var/ftp/pub/mtd-utils/

mtd-utils-$new_ver.tar.bz2{.asc,}

Signature · 1 line
dwmw2
#16 lore raw
Quoted 11 lines · David Woodhouse
Quoted 3 lines · Artem Bityutskiy

# Prepare the tarball

git archive --format=tar --prefix="mtd-utils-$new_ver/" "v$new_ver" | \
        bzip2 > "mtd-utils-$new_ver.tar.bz2"

gpg --detach-sign -a "mtd-utils-$new_ver.tar.bz2"

Quoted 2 lines

# Upload the tarball
scp "mtd-utils-$new_ver.tar.bz2" casper.infradead.org:/var/ftp/pub/mtd-utils/

mtd-utils-$new_ver.tar.bz2{.asc,}

OK, I've updated the script:

1. Added some sanity checks
2. Sign tags
3. Sign the tarball
4. Instead of uploading, print the instructions how to do this

#!/bin/sh -uef

# A small helper script to release mtd-utils. Takes the new version

# as a parameter.
fatal() {
	printf "Error: %s\n" "$1" >&2
	exit 1
}

usage() {
cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver> - mtd utils version to create in X.Y.Z format
<outdir> - the output directory where to store the tarball with the
gpg signature
EOF
exit 0
}

[ $# -eq 0 ] && usage
[ $# -eq 2 ] || fatal "Insufficient or too many argumetns"

new_ver="$1"; shift
outdir="$1"; shift

release_name="mtd-utils-$new_ver"
tag_name="v$new_ver"

# Make sure the input is sane and the makefile contains sensible version echo "$new_ver" | egrep -q -x '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' ||
fatal "please, provide new version in X.Y.Z format"

egrep -q -x 'VERSION = [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' Makefile ||
fatal "Makefile does not contain \"Version = X.Y.Z\" line"

# Make sure the git index is up-to-date
[ -z "$(git status --porcelain)" ] || fatal "Git index is not up-to-date"

# Make sure the tag does not exist
[ -z "$(git tag -l "$tag_name")" ] || fatal "Tag $tag_name already exists"

# Change the version in the Makefile
tmpfile="$(mktemp)"
sed -e "s/^VERSION = [[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/VERSION = $new_ver/" \
Makefile > "$tmpfile"
mv "$tmpfile" Makefile

# And commit the change
git commit -s -m "Release $release_name" Makefile

# Create new signed tag
git tag -m "$release_name" -s "$tag_name"

# Prepare signed tarball

git archive --format=tar --prefix="$release_name/" "$tag_name" | \
	bzip2 > "$outdir/$release_name.tar.bz2"

gpg --detach-sign -a "$outdir/$release_name.tar.bz2" > "$outdir/$release_name.tar.bz2.asc"

echo "Created $outdir/$release_name.tar.bz2"
echo "Please, verify, then push the tag and upload the tarball and the signature"
echo "You can use these commands:"
echo "git push $tag_name"
echo "scp $outdir/$release_name.tar.bz2 $outdir/$release_name.tar.bz2.asc casper.infradead.org:/var/ftp/pub/mtd-utils"

#14 lore raw
In reply to Mike Frysinger
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · Artem Bityutskiy
Quoted 3 lines · Mike Frysinger

how are you making the releases ? seems like this keeps coming up, so maybe we should have a make dist that takes care of this stuff automatically to avoid future mistakes ...

You are right. I've just created a simple shell script which should do cut a new release properly.

could you add it to the git repo ? be easier to send fixes/tweaks :).

Yeah, I'll do this when everyone is OK with the initial version.

Artem.

#17 lore raw
In reply to Artem Bityutskiy
Quoted 10 lines · Artem Bityutskiy

usage() {
       cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver>  - mtd utils version to create in X.Y.Z format <outdir>   - the output directory where to store the tarball with the gpg signature
EOF
       exit 0
}

i'd have outdir be optional and default to $PWD

prob want to update .gitignore to ignore "mtd-utils-*.tar*"

Quoted 5 lines

# Change the version in the Makefile
tmpfile="$(mktemp)"
sed -e "s/^VERSION = [[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/VERSION = $new_ver/" \
       Makefile > "$tmpfile"
mv "$tmpfile" Makefile

use sed -i and you won't need the $tmpfile at all

Quoted 1 line

gpg --detach-sign -a "$outdir/$release_name.tar.bz2" > "$outdir/$release_name.tar.bz2.asc"

by using --detach-sign, you don't want the output redirection. so delete the "> .......".

Quoted 5 lines

echo "Created $outdir/$release_name.tar.bz2"
echo "Please, verify, then push the tag and upload the tarball and the signature"
echo "You can use these commands:"
echo "git push $tag_name"
echo "scp $outdir/$release_name.tar.bz2 $outdir/$release_name.tar.bz2.asc casper.infradead.org:/var/ftp/pub/mtd-utils"

if you really like, you could make this a single cat like in the usage() -mike

#18 lore raw
Quoted 12 lines · Mike Frysinger
Quoted 10 lines · Artem Bityutskiy

usage() {
cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver> - mtd utils version to create in X.Y.Z format
<outdir> - the output directory where to store the tarball with the
gpg signature
EOF
exit 0
}

Quoted 3 lines

i'd have outdir be optional and default to $PWD

prob want to update .gitignore to ignore "mtd-utils-*.tar*"

Yeah, but this would require me to add options handling using getopt, because optional parameters have to have an option. I just do not feel it is necessary right now. This can be done at any point if someone needs.

Quoted 8 lines
Quoted 6 lines

# Change the version in the Makefile
tmpfile="$(mktemp)"
sed -e "s/^VERSION = [[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/VERSION = $new_ver/" \
Makefile > "$tmpfile"
mv "$tmpfile" Makefile

use sed -i and you won't need the $tmpfile at all

Good point, thanks, I'll do this.

Quoted 5 lines
Quoted 2 lines

gpg --detach-sign -a "$outdir/$release_name.tar.bz2" > "$outdir/$release_name.tar.bz2.asc"

by using --detach-sign, you don't want the output redirection. so delete the "> .......".

OK, I'll actually test this and fix.

Quoted 7 lines
Quoted 5 lines

echo "Created $outdir/$release_name.tar.bz2"
echo "Please, verify, then push the tag and upload the tarball and the signature"
echo "You can use these commands:"
echo "git push $tag_name"
echo "scp $outdir/$release_name.tar.bz2 $outdir/$release_name.tar.bz2.asc casper.infradead.org:/var/ftp/pub/mtd-utils"

if you really like, you could make this a single cat like in the usage()

Will do.

But now I have to go sleep, will send an updated patch in near future. Thank you for suggestions.

Artem.

#19 lore raw
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Mike Frysinger
Quoted 10 lines · Artem Bityutskiy

usage() {
       cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver>  - mtd utils version to create in X.Y.Z format <outdir>   - the output directory where to store the tarball with the gpg signature
EOF
       exit 0
}

Quoted 6 lines
Quoted 1 line

i'd have outdir be optional and default to $PWD

Yeah, but this would require me to add options handling using getopt, because optional parameters have to have an option. I just do not feel it is necessary right now. This can be done at any point if someone needs.

i don't think so

case $# in
0) usage ;;
1|2) ;;
*) fatal "Insufficient or too many argumetns" ;;
esac

new_ver="$1"; shift
outdir="${1:-.}"; shift
-mike

#20 lore raw
In reply to Mike Frysinger
Quoted 23 lines · Mike Frysinger
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Mike Frysinger
Quoted 10 lines · Artem Bityutskiy

usage() {
cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver> - mtd utils version to create in X.Y.Z format
<outdir> - the output directory where to store the tarball with the
gpg signature
EOF
exit 0
}

Quoted 6 lines
Quoted 1 line

i'd have outdir be optional and default to $PWD

Yeah, but this would require me to add options handling using getopt, because optional parameters have to have an option. I just do not feel it is necessary right now. This can be done at any point if someone needs.

i don't think so

Quoted 8 lines

case $# in
0) usage ;;
1|2) ;;
*) fatal "Insufficient or too many argumetns" ;;
esac

new_ver="$1"; shift
outdir="${1:-.}"; shift

I did not mean it is technincally impossible, I meant that it is just normal Unix rule which I want to stick with, at least in simple cases:

1. Non-mandatory arguments come with options like -x <blah>
2. Mandatory arguments come come without options.

utility < -x blah and other optional stuff> <arg1> <other mandatory args>

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#25 lore raw
In reply to Mike Frysinger

Hi, updated the script as you suggested. Did not do the "outdir should be optional" part because it is not needed now - we can do this later if we want.

#!/bin/sh -uef

# A small helper script to release mtd-utils. Takes the new version

# as a parameter.
fatal() {
	printf "Error: %s\n" "$1" >&2
	exit 1
}

usage() {
cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver> - mtd utils version to create in X.Y.Z format
<outdir> - the output directory where to store the tarball with the
gpg signature
EOF
exit 0
}

[ $# -eq 0 ] && usage
[ $# -eq 2 ] || fatal "Insufficient or too many argumetns"

new_ver="$1"; shift
outdir="$1"; shift

release_name="mtd-utils-$new_ver"
tag_name="v$new_ver"

# Make sure the input is sane and the makefile contains sensible version echo "$new_ver" | egrep -q -x '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' ||
fatal "please, provide new version in X.Y.Z format"

egrep -q -x 'VERSION = [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' Makefile ||
fatal "Makefile does not contain \"Version = X.Y.Z\" line"

# Make sure the git index is up-to-date
[ -z "$(git status --porcelain)" ] || fatal "Git index is not up-to-date"

# Make sure the tag does not exist
[ -z "$(git tag -l "$tag_name")" ] || fatal "Tag $tag_name already exists"

# Change the version in the Makefile
sed -i -e "s/^VERSION = [[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/VERSION = $new_ver/" Makefile

# And commit the change
git commit -s -m "Release $release_name" Makefile

# Create new signed tag
echo "Signing tag $tag_name"
git tag -m "$release_name" -s "$tag_name"

# Prepare signed tarball

git archive --format=tar --prefix="$release_name/" "$tag_name" | \
	bzip2 > "$outdir/$release_name.tar.bz2"

echo "Signing the tarball"
gpg -o "$outdir/$release_name.tar.bz2.asc" --detach-sign -a "$outdir/$release_name.tar.bz2"

cat <<EOF
Created $outdir/$release_name.tar.bz2
Please, verify, then push the tag and upload the tarball and the signature
You can use these commands:
git push origin $tag_name
scp $outdir/$release_name.tar.bz2 $outdir/$release_name.tar.bz2.asc casper.infradead.org:/var/ftp/pub/mtd-utils EOF

#27 lore raw
In reply to Mike Frysinger
Quoted 4 lines · Mike Frysinger
Quoted 1 line · Artem Bityutskiy

[ $# -eq 2 ] || fatal "Insufficient or too many argumetns"

typo: arguments

Oh, yes, will also fix.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#21 lore raw
In reply to Artem Bityutskiy
Quoted 33 lines · Artem Bityutskiy
Quoted 23 lines · Mike Frysinger
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Mike Frysinger
Quoted 10 lines · Artem Bityutskiy

usage() {
       cat <<EOF
Usage: ${0##*/} <new_ver> <outdir>

<new_ver>  - mtd utils version to create in X.Y.Z format <outdir>   - the output directory where to store the tarball with the gpg signature
EOF
       exit 0
}

Quoted 6 lines
Quoted 1 line

i'd have outdir be optional and default to $PWD

Yeah, but this would require me to add options handling using getopt, because optional parameters have to have an option. I just do not feel it is necessary right now. This can be done at any point if someone needs.

i don't think so

Quoted 8 lines

case $# in
  0) usage ;;
  1|2) ;;
  *) fatal "Insufficient or too many argumetns" ;; esac

new_ver="$1"; shift
outdir="${1:-.}"; shift

Quoted 8 lines

I did not mean it is technincally impossible, I meant that it is just normal Unix rule which I want to stick with, at least in simple cases:

1. Non-mandatory arguments come with options like -x <blah>
2. Mandatory arguments come come without options.

utility < -x blah and other optional stuff> <arg1> <other mandatory args>

sure, but we're not taking about options here, we're talking about required arguments:
./make-release.sh <version> [output_dir]

if we were to make it into:
./make-release.sh [-o output_dir] <version>

then i'd understand the getopt desire
-mike

#22 lore raw
Quoted 3 lines · Mike Frysinger

sure, but we're not taking about options here, we're talking about required arguments:
./make-release.sh <version> [output_dir]

Yes, but my point was that this way is not very normal and not "standard" for Unix, at least by my perception of "standard".

Quoted 4 lines

if we were to make it into:
./make-release.sh [-o output_dir] <version>

then i'd understand the getopt desire

This is something standard - options are optional and go first, then mandatory stuff without options.

Signature · 2 lines
Best Regards,
Artem Bityutskiy
#23 lore raw
Quoted 7 lines · Artem Bityutskiy
Quoted 3 lines · Mike Frysinger

sure, but we're not taking about options here, we're talking about required arguments:
./make-release.sh <version> [output_dir]

Yes, but my point was that this way is not very normal and not "standard" for Unix, at least by my perception of "standard".

for tools installed into $PATH and expected a little "higher" terms of quality, then sure, it's not standard. for tiny scripts in repo dirs that serve specific functions, i think it's fairly common.

i think it should be the way i suggested, but i won't fight over it too much ... i'm not the one making releases after all. -mike

#24 lore raw
Quoted 2 lines · Mike Frysinger

i think it should be the way i suggested, but i won't fight over it too much ... i'm not the one making releases after all.

I've added the script to the mtd-utils.git repo. Thanks for review. I nevertheless did not change that parameter thing - we can do it when / if we actually need this.

Artem.

Signature · 2 lines
Best Regards,
Artem Bityutskiy