Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 100174 - addition of linux-old symlink to the processing of the symlink use flag
Summary: addition of linux-old symlink to the processing of the symlink use flag
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-24 18:33 UTC by Kevin Williams
Modified: 2005-09-02 13:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Symlink use flag code update (kernel-2.symlink-use-update.txt,1.28 KB, text/plain)
2005-07-25 14:36 UTC, Kevin Williams
Details
Symlink use flag code update (kernel-2.symlink-use-update.txt,1.28 KB, text/plain)
2005-07-25 14:37 UTC, Kevin Williams
Details
The diff file (kernel-2.symlink-use-update.txt,5.37 KB, text/plain)
2005-07-27 02:47 UTC, Kevin Williams
Details
the symlink use flag update (kernel-2-symlink-use-20050727.txt,2.39 KB, text/plain)
2005-07-27 16:11 UTC, Kevin Williams
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Williams 2005-07-24 18:33:55 UTC
The following is no big enhancement just a small change to make life easier when
maintaining a system after a kernel upgraade in portage while having the
"symlink" flag set on the kernel sources. Just adds a usr/src/linux-old symlink
along with the usr/src/linux symlink already added by the eclass. Submitted to
be included in the kernel-2.eclass review and update. Tested with upgrading
between linux-2.6.12-gentoo-r4 and linux-2.6.12-gentoo-r6. 

 

Reproducible: Always
Steps to Reproduce:
# File: /usr/portage/kernel-2.eclass
# Starting line: 530
# Submitter: Kevin williams (llslim) <llslym@yahoo.com>
# Type: enhancement
#
# Description.
#   Trivial upgrade to the symlink use flag functionality. 
#   When the "symlink" use flag is set, we  Create an additional symlink 
#  (linux-old) 
#   to the /usr/src/ directory for the purpose of locating last workinng kernel.
 
postinst_sources() {
	local MAKELINK=0
        local MAKE_OLDLINK=0
         
        # current and working Kernel tree.
         local K_DIR

	# if we have USE=symlink, then force K_SYMLINK=1
	use symlink && K_SYMLINK=1

	# if we are to forcably create the symlink for the new kernel tree, 
	# then first we need to delete the symlinks for the current andd backup
        # kernel trees if they exsist.  
	if [[ -n ${K_SYMLINK} ]]; then

	  if [[ -h ${ROOT}usr/src/linux ]]; then
	    # remove the backup kernel symlink, only when upgrading kernel
	    # emerging the same kernel version only removes the symlink 
	    # for current kernel tree. 
	    K_DIR=$(readlink ${ROOT}usr/src/linux)
	    [[ "${K_DIR}" != "linux-${KV_FULL}" ]] && MAKE_OLDLINK=1
	    [[ -h ${ROOT}usr/src/linux-old ]] && [[ ${MAKE_OLDLINK} == 1 ]] && 
	      rm ${ROOT}usr/src/linux-old
		  
	    # remove the link for current kernel tree
	    rm ${ROOT}usr/src/linux
          fi 
	  MAKELINK=1
        fi

	# enabling making a new current link if it doesn't already exsist.
	[[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
	
	# create the symlinks for the current and backup kernel trees.
	if [[ ${MAKELINK} == 1 ]]; then
		cd ${ROOT}usr/src
		ln -sf linux-${KV_FULL} linux
		[[ ${MAKE_OLDLINK} == 1 ]] && ln -sf ${K_DIR} linux-old 
		cd ${OLDPWD}
	fi
#===============================end of snippet=================================#
Actual Results:  
in test case with kernels linux-2.6.12-gentoo-r4 and linux-2.6.12-gentoo-r6
these symlinks were created/updated

/usr/src/linux -> /usr/src/linux-2.6.12-gentoo-r6
/usr/src/linux-old -> /usr/src/linux-2.6.12-gentoo-r4

Expected Results:  
see actual results

plse let me know. if you think this is worth adding to the kernel-2 eclass for
the general population of gentoo users
Comment 1 Henrik Brix Andersen 2005-07-25 01:06:02 UTC
Perhaps it should be /usr/src/linux.old to follow the naming scheme of the
kernel files in /boot?
Comment 2 Kevin Williams 2005-07-25 14:36:29 UTC
Created attachment 64307 [details]
Symlink use flag code update

Here is the symlink use flag code with previous kernel symlink in the form of
linux.old.

this file is a snippet. Is that the right form, or what format should it be in?
Comment 3 Kevin Williams 2005-07-25 14:37:27 UTC
Created attachment 64308 [details]
Symlink use flag code update

Here is the symlink use flag code with previous kernel symlink in the form of
linux.old.

this file is a snippet. Is that the right form, or what format should it be in?
Comment 4 Henrik Brix Andersen 2005-07-26 01:08:34 UTC
A unified diff (diff -up) is the preferred way of submitting patches.
Comment 5 Kevin Williams 2005-07-27 02:47:43 UTC
Created attachment 64422 [details]
The diff file

Here is the diff file for patch
Comment 6 Henrik Brix Andersen 2005-07-27 02:52:53 UTC
That patch can not be accepted - did you even look at your diff output before
uploading? Your patch removes important sections of the kernel-2.eclass which
was recently added.

Please bring your local version up-to-date and rediff.
Comment 7 Kevin Williams 2005-07-27 16:11:01 UTC
Created attachment 64463 [details]
the symlink use flag update

Sorry about that. Forgot there was an baselayout updated after i did work on
kernel-2, and did the diff while dead tired. Anyway, here is the patch updated
checkedagainst a sync this morning. Tested it as well. Works well on my
machine.
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2005-08-27 17:27:45 UTC
I just talked with John about this, we aren't sure how useful it would be (by
default, the /usr/src/linux symlink is used in every ebuild that looks at or
uses kernel stuff, which is part of the Gentoo reasoning behind it and why it is
important).

We won't be including this right now, but thanks for the contribution.
Comment 9 Kevin Williams 2005-09-02 13:25:28 UTC
That's understandable, it wasn't any major critical upddate. Having a symlink to
the previous working kernel treedoes have it advantages when a person needs to
revert back to previious kernel during the transition period of upgradinng the
kernel version of a system to add new features. I figured one moree symlink
wouldn't put to much strain on the ebuild. Then write the script that put the
symlink to good use in one you have to run manually called "update-kern". Oh
well, I will find a work aroun. Thank you for the consideration.