Re: packages (retry)

Erich Titl <[email protected]>
Newsgroups gmane.linux.leaf.devel
Message-ID <[email protected]>
Hi KP

Am 06.06.2015 um 01:34 schrieb kp kirchdoerfer:
> Hi Erich;
>
> ...sorry for being late.
>
> Am Dienstag, 2. Juni 2015, 10:44:39 schrieb Erich Titl:I found
>> Hi KP
>>
>> I am somewhat online again and I would like to get the upgrade thing
>> running (again). Looking at the packages repo I only see 5_0 and 5_1.
>
> I haven't changed anything since your tests. Looking at git commit logs it
> should be 5.1.4.
>
> Could you try to cleanup the packages repo before 5.2? Or even add some notes
> (e.g. the wiki) how to deal with the repository so it could be used to update
> from via a command line tool?
> As-Is is a bit confusing (yes I know it is mainly for testing now).
>
....

I found some time to write a small script to build a branch for the 
upgrade process, first and foremost a few lines

- Why did I chose a separate branch for the release.

I chose a branch because to me it looked like the most comprehensive way 
to have the web presentation I needed and to _lock_ a specific state of 
the files to a release, e.g. x.y.z will remain x.y.z unless someone 
makes modifications in this branch.

If ayone with more knowledge of sourceforge's web interface has a better 
aproach, please go for it.

Now to my script

I placed it in the tools directory and tried to push it, but it appears 
that sourceforge has problems with ssh access right now. This is the 
second time in a shotr timeframe that sourceforge is not performing. It 
just drives me nuts, as I have restricted internet access and no time to 
waste on stuff like that.

mega@leafbuilder:~/leaf/devel/packages$ git pull --rebase
ssh: connect to host git.code.sf.net port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
mega@leafbuilder:~/leaf/devel/packages$ ssh git.code.sf.net
ssh: connect to host git.code.sf.net port 22: Connection refused
mega@leafbuilder:~/leaf/devel/packages$

usage is tools/build_upgrade <version> <master_dir>

It will build branch <version> from the files in <master_dir> and 
finally commit the changes. It checks for a number of things and tries 
to abort cleanly if they are missing.

Known caveats:

- It only handles i386 architecture right now.
- It does not handle the firmware directory, this can be added with 
small effort once a reasonable master_dir is available. I would like to 
reach an agreement that firmware is architecture independent and should 
not be in the architecture path.

I cannot test it, as my leaf box has no internet access right now and 
probably not for a while.

I am attaching one version of build_upgrade, as there is no sourceforge 
access, maybe you have more luck.

cheers

Erich

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/


_______________________________________________
leaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-devel
build_upgrade (text/plain, 5.3 KB)
#!/bin/sh
#
# Copyleft 2015 Erich Titl ([email protected])
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.

################################################################################

program=`basename $0`

usage () {
	echo usage: $program release_name master_dir
	echo
}

cleanup_failure() {
	echo cleaning up...
	git checkout master
	git branch -d $1
	git reset --hard
	rm -rf i386 rpi X86_64
	rm -f version
	exit 255
}

bailout_missing() {
	echo there are at least $missing objects missing in the master path  && \
	echo you will need to add these objects before $program can succeed && \
	echo some log output before this message should be more specific && \
	echo && exit 255
}

# run it
clear
echo running $program with parameters $*
echo

[ $# -lt 2 ] && usage && exit 255

################################################################################
# check for the existence of master_dir
# and set MASTER to that path
[ ! -d $2 ] && echo cannot find master directory $2 && usage && exit 255

NEW_BRANCH=$1
MASTER=$2

################################################################################
# check for the existence of kernel, initmod and modules files in master_dir
# this is only done for i386 architecture right now, needs to be extended
missing=0
ARCH=i386

for subarch in i486 geode i686
do
	current=$MASTER/$ARCH/linux*$subarch
	[ ! -f $current ] && \
		echo there is no kernel file for $subarch in directory $MASTER available... && \
		missing=$((missing + 1)) 
	current=$MASTER/$ARCH/initmod*$subarch.lrp
	[ ! -f $current ] && \
		echo there is no initmod file for $subarch in directory $MASTER available... && \
		missing=$((missing + 1)) 
	current=$MASTER/$ARCH/modules-$subarch.sqfs
	[ ! -f $current ] && \
		echo missing $current && \
		echo there is no modules repository for $subarch in directory $MASTER available... && \
		missing=$((missing + 1)) 
done

################################################################################

[ $missing -ne 0 ] && bailout_missing

################################################################################

echo I checked as far as I could, now starting to build the upgrade branch 

################################################################################
# first make a suitable branch and switch to it
git checkout -b $NEW_BRANCH
[ $? -ne 0 ] && echo problem building new branch $NEW_BRANCH && exit 255

################################################################################
# now we are in a new branch
# remove everything except the master directory 
# this very program and the tools directory

for i in `ls`
do
	case $i in 
		$MASTER | $program | tools)
				echo skip $i it is in the delete_mask
				;;
		*)		echo delete $i
				rm -rf $i
				;;
	esac
done

# move all the directories in the master dir up one level
# then remove the master
################################################################################
for i in i386 rpi X86_64
do
	mv $MASTER/$i .
	[ $? -ne 0 ] && echo moving of the directories in $MASTER failed && cleanup_failure $NEW_BRANCH
	git add $i
done

# also remove the master directory in the current branch
################################################################################
rmdir $MASTER
[ $? -ne 0 ] && echo removing $MASTER failed && cleanup_failure $NEW_BRANCH

# we need to get rid of the overspecified information within the directories
# so we remove all version specific info from the kernel filenames
################################################################################
for subarch in i486 geode i686
do
	current=$ARCH/linux*$subarch
	mv $current $ARCH/linux-$subarch
	[ $? -ne 0 ] && echo renaming $current failed && cleanup_failure $NEW_BRANCH
	git add $ARCH/linux-$subarch
done

# register the new version in the version file of the new branch
################################################################################
echo $NEW_BRANCH > version
git add version

# give the user a chance to read the messages on the screen 
################################################################################

echo
echo
echo "If you continue here the changes made by $program will be committed" 
echo "to branch $NEW_BRANCH".
echo -n "Do you wish to continue? Y/N (N) " 
read ans 

case $ans in 
	Y | Yes | y | yes)
		echo proceeding to commit
		;;
	*) 
		echo "discarding all changes made by $(program)"
		cleanup_failure $NEW_BRANCH
esac

# now commit the changes 
################################################################################
#git commit -a --dry-run -m "$program built branch $NEW_BRANCH from $MASTER" --short
git commit -a -m "$program built branch $NEW_BRANCH from $MASTER" 
[ $? -ne 0 ] && echo committing $NEW_BRANCH failed && cleanup_failure $NEW_BRANCH
git checkout master

clear
echo
echo $program committed changes in $NEW_BRANCH
echo $program successfully terminated

exit 0
smime.p7s (application/pkcs7-signature, 1.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.