how to configure cygwin Local Package Directory - windows

I have to change my cygwin Local Package Directory, which happen to be earlier as C:\Users\username\Downloads.
Folders like http%3a%2f%2fcygwin.mirror.constant.com%2f are all in place in my new directory for Local Package Directory.
How to do that? (I cannot find, where cygwin stores the config.)
Running setup from new location tries to install all over again instead from continue using earlier packages from the internet.

The information is on /etc/setup/setup.rc
$ head setup.rc
last-cache
e:\downloads\cygwin_cache
last-mirror
http://mirrors.kernel.org/sourceware/cygwin/
net-method
Direct
last-action
Download,Install
mirrors-lst
....
Please note that setup just propose the settings based on last run but you can always change typing new values.

Related

How do I add a new dotfile with Dotbot?

I'm trying to version my dotfiles on Linux via Dotbot, using init-dotfiles as initial setup. It worked great, but how do I add a new file to my .dotfiles repository?
In my case, I created a .bash_aliases file in my home folder.
It wouldn't make sense to run the init-dotfiles script and go through he whole setup process every time I create a new dotfile.
You could still run the script in verbose/preview mode, just to see the commands it runs
./init_dotfiles.sh verbose-config preview
Then you will be able to deduce the git command to run in order to add your new file (and future new files) to the dotfile repository.
That's correct, you shouldn't run the init-dotfiles script again.
To add a new dotfile, at a high level, you'll need to:
move the dotfile from the original location (e.g. ~/.bash_aliases) to the dotfiles repository (e.g. ~/.dotfiles/bash_aliases)
update your install.conf.yaml to specify how to symlink the file
add both the new dotfile (bash_aliases) and your install.conf.yaml to a new git commit

Why do I not have a .hgrc file?

I'm trying to insert the mercurial_keyring file with my username and password in the .hgrc file but it doesn't exist in my user directory on windows. I have tortoise hg installed and even checked if it was installed properly on the command prompt yet I still don't have the .hgrc folder.
Can anyone tell me what might be the reason to it?
Thanks
Because it's %USERPROFILE%\mercurial.ini
Mercurial reads configuration data from several files, if they exist.
These files do not exist by default and you will have to create the
appropriate configuration files yourself:
Local configuration is put into the per-repository /.hg/hgrc
file.
Global configuration like the username setting is typically put into:
%USERPROFILE%\mercurial.ini (on Windows)
The .hgrc files are not created automatically when you install Mercurial or TortoiseHg.
You will need to manually create it at the location you need whether that is within the repository's .hg folder or your own C:\Users\username\ folder.
You will probably need to use the command line to create the file as it's not usually possible to create filenames that start with . in Windows Explorer.
https://www.selenic.com/mercurial/hgrc.5.html

Using and running Tortoise svnsync in Windows via command line

I have a local repository and I have just signed up to unfuddle and want to sync my local repository to the new one I have created on there.
I was told to run the following command:
svnsync init --username USERNAME http://username.unfuddle.com/svn/username-rep http://SOURCE_REPO_URL
Firstly, I assume I can remove the username stuff if the source repository doesn't require authentication?
Secondly, when I run that command my system doesn't recognize it. I assumed svnsync needed to be added somewhere in Windows so that it could be run via it's name only (think the correct term is an environment variable)?, but not only do I not know how to do that I don't know what program to add...... I cannot find any svnsync.exe or anything locate din my TortoiseSVN folder.
What do I need to do here?
When you install TortoiseSVN you are given the option to install the Subversion binaries as well:
Once you do that, you will see svnsync.exe in the installation folder:
As long as you have C:\Program Files\TortoiseSVN\bin in your PATH variable, you will be able to call svnsync.exe from the command-line:
(You can view your PATH variable thus (on Windows 7): Start -> right-click Computer -> Properties -> Advanced system settings -> Environment variables.... DO NOT overwrite whatever is there - simply append the path to TortoiseSVN if it isn't already there. More info here.)
Hope this helps.

How to link a CKAN installation in Vagrant to a cloned repo in the host OS?

I'm using the chef-ckan cookbooks from Vitor Baptista to setup a CKAN installation for Vagrant.
Everything is working fine, but I can't find the way to make CKAN load the source code from my host OS (in this case the cloned directory in OSX).
Currently our CKAN code (the repo code) in the host OS is shared with Vagrant as /vagrant. The problem is that the CKAN virtual environment is reading the source from ~/pyenv/src/ckan which doesn't include our commits.
How could we link both directories?
UPDATE 1:
Looks like vm.shared_folder won't do the trick, since it maps host folders to vm folders. I'm also looking at the cookbooks/ckan/recipes and found a SOURCE_DIR constant, but doesn't solve the issue.
USER = node[:user]
HOME = "/home/#{USER}"
ENV['VIRTUAL_ENV'] = "#{HOME}/pyenv"
ENV['PATH'] = "#{ENV['VIRTUAL_ENV']}/bin:#{ENV['PATH']}"
SOURCE_DIR = "#{ENV['VIRTUAL_ENV']}/src/ckan"
UPDATE 2:
Just found out this line in the recipe https://github.com/vitorbaptista/chef-ckan/blob/master/cookbooks/ckan/recipes/default.rb#L29 which perhaps we could link to the vm.shared_folder so the CKAN installation reads the source from our host OS.
Still not working. Just wondering if vagrant reload is not enough, and I should do a vagrant destroy; vagrant up
(I've just added this to chef-ckan's repository, so it's easier to simply update it. Here I'm just explaining the fix.)
The problem is that I've used pip install --editable to both clone CKAN's repository and install it. To do what you want, you'll need to break these two steps apart.
Before the # Install CKAN Package step, add:
git SOURCE_DIR do
user USER
group USER
repository "git://github.com/okfn/ckan.git"
reference "master"
enable_submodules true
end
And then edit the installation to be:
python_pip SOURCE_DIR do
...
end
Then you can change SOURCE_DIR for whatever you like (i.e. /vagrant/ckan), and it should work. It just can't be a subdirectory whose parent wasn't created yet. For example, if SOURCE_DIR is "/vagrant/src/ckan", "/vagrant/src" have to exist already.
By default, the git chef's recipe updates the cloned repository whenever it's run. If you want to change that, check its documentation at http://docs.opscode.com/resource_git.html.
Cheers!
I finally got it, by sharing my CKAN fork directoy with the VM (in this case the parent directoy since the Vagrantfile is inside the chef-ckan submodule):
config.vm.share_folder "ckan", "/vagrant", ".."
Reference: https://github.com/wilhelmbot/chef-ckan/commit/3cacc6969e8e257862cbc13f32a4d9f271850f27
and changing the CKAN recipes to use the shared folder as the SOURCE DIRECTORY (as Vitor pointed out) https://github.com/wilhelmbot/chef-ckan/commit/cc338f6946efc3968c3b8bded6df00010e9e4732
NOTE:
I couldn't make the git reference attribute to work, that's why I didn't use the full solution proposed by Vitor.
I was getting STDOUT: STDERR: fatal: Could not parse object 'e0648dbf...'

How do I set up Mercurial and hgweb on IIS?

I've been looking all over for decent instructions on how to get hgweb working on IIS but I haven't found much of worth.
There's this "step by step" on the Mercurial wiki, but it's not very good.
There's also this and this, but again, I can't find good steps to lead up to where those get started.
I just had to install a fresh Mercurial instance yesterday, here's updated instructions for 1.7:
Install Mercurial (these instructions were tested with 1.7)
Install Python (for Mercurial 1.7, you must use the x86 version of Python 2.6.6)
You will need to download the hgweb.cgi file from the Mercurial source. You can download the source by running: hg clone https://www.mercurial-scm.org/repo/hg/
Create a folder that will be your web application folder. You will need to copy three things into this folder:
The hgweb.cgi file
The contents of the Library.zip from your "C:\Program Files\Mercurial" folder
The Templates folder from your "C:\Program Files\Mercurial"
You will need to make sure you have Python set up in IIS.
Enable CGI via the following: Control Panel -> Turn Windows Features On or Off -> Roles -> Web Server (IIS) -> Add Role Services -> Check CGI
Create a new Web Site in IIS and make sure the physical path is the folder you created above
In the Handler Mappings for the new website, select "Add Script Map". Enter *.cgi for the request path, c:\Python26\python.exe -u "%s" for the Executable, and Python for the Name.
You will also need to create a file named "hgweb.config" with contents similar to below. The path within the file needs to be the location on your drive where you want to store the Mercurial repositories:
[collections]
c:\Mercurial\repos = c:\Mercurial\repos
Edit the hgweb.cgi file and change the line where it sets the path to your hgweb.config to something like the following (wherever the hgweb.config file is):
config = "C:\Mercurial\hgweb.config"
Now, open a browser and navigate to http://localhost/mercurial/hgweb.cgi (or whatever is the appropriate URL path you set up in IIS) and you should see the Mercurial Repositories page.
Also, check out Jeremy Skinners blog post . It's a little outdated, but has some extra nice steps like setting up URL re-writing for cleaner URL's.
It seems since Mercurial 1.5.2 was released, these tutorials don't work exactly right. For one thing, hgwebdir.cgi has been removed, and is now replaced with hgweb.cgi.
The instructions that worked best for me is at eworldui.net:
http://www.eworldui.net/blog/post/2010/04/08/Setting-up-Mercurial-server-in-IIS7-using-a-ISAPI-module.aspx
Those instructions are meant for IIS 7 or greater. If you're setting this up on IIS 6, I wrote up similar instructions geared toward Win2k3 and IIS 6.0:
http://partialclass.blogspot.com/2010/05/setting-up-mercurial-server-on-win2k3.html
UPDATE: Shortly after getting this working I learned that BitBucket changed their pricing scheme to offer free, unlimited, private hosting: https://bitbucket.org/. I would've opted for that in a heartbeat when I was originally working on this project.
Below are what I did after doing a fair amount of research for geting hgwebdir.cgi setup on IIS6 . It is based on the following sites:
http://python.markrowsoft.com/iiswse.asp
http://www.jeremyskinner.co.uk/mercurial-on-iis7/
You'll need to install the following on the server:
Mercurial (I used version 1.5)
Python 2.6. The version of Python depends on the version of Mercurial installed.
Mercurial 1.5 uses Python 2.6. Install x86 even if you are running x64.
The steps for me were:
Create a directory for the website. I used c:\inetpub\wwwroot\hg.
In IIS, right click on the folder for hg, select properties, select the Home Directory tab.
Click on the Create application button. Set the execute permissions to "scripts".
Still in the Home Directory tab, click on the Configuration button. In the "Application Configuration" popup, click the Add button to add an application extension. The Executable is c:\Python26\python.exe -u "%s" "%s". The extension is .cgi. Set the "verbs" to "limit to: GET,HEAD,POST". Check both Script engine and Verify that file exists.
In the Directory Security tab, click on the Edit button in the Authentication and access control section. Uncheck all authentication methods, and check the "Basic authenication" method. Set the Default domain if you like to your Active Directory domain.
In IIS, click on the Web Service Extensions folder on the left panel. Click on "Add a new Web service extension" link. Extension name should be Python, the required file is c:\Python26\python.exe -u "%s" "%s". Make sure the new extension is "Allowed".
Now is a good time to test that Python is working. Create a file in your new Hg folder called test.cgi. Paste the following python code:
print 'Status: 200 OK'
print 'Content-type: text/html'
print
print '<html><head>'
print ''
print '<h1>It works!</h1>'
print ''
print ''
Open the browser to your site, for instance, http://localhost/hg/test.cgi
You should see "It works!" in the browser.
Next let's get the hgwebdir working.
Delete test.cgi
clone the hg repo to a new directory: https://www.mercurial-scm.org/repo/hg/
copy hgwebdir.cgi to your web directory: c:\inetpub\wwwroot\hg\ from the cloned hg repo
Edit the file and change
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)
to
application = hgwebdir('c:\inetpub\wwwroot\hg\hgweb.config')
wsgicgi.launch(application)
Unzip the Library.zip file in the Mercurial directory, c:\Program Files\Mercurial\, to your web directory, c:\inetpub\wwwroot\hg\
Copy the templates directory from c:\Program Files\Mercurial\templates\ to c:\inetpub\wwwroot\hg\templates\
Create a file called hgweb.config in your web directory.
Now is a good time to test it out. Go to the following URL in the browser, http://localhost/hg/hgwebdir.cgi
Edit hgweb.config, and paste the following:
[collections]
\\server\share$\Hg\ = \\server\share$\Hg\
[web]
allow_push = *
push_ssl = false
These are all my preferences, for instance we have our repos in subdirectories at \\server\share$\Hg. The web app will run under the permissions of the logged in user via the browser, so they'll need read/write permissions to the share.
The last step is to allow for long connections which can happen when you first clone a repo. Run the following command to increase the timeout to 50 minutes:
cd \inetpub\AdminScripts\
cscript adsutil.vbs GET /W3SVC/CGITimeout
cscript adsutil.vbs SET /W3SVC/CGITimeout 3000
Use mercurial to clone the mercurial repository:
hg clone https://www.mercurial-scm.org/repo/hg/
you will find hgwebdir.cgi at the top level. It should install
like any other cgi script.
I've been fighting with this setup for mercurial 1.7.2 for the past week or so, I had to do things slightly differently than the above articles do in order to get it working.
Posting here because google kept bringing me back here....
Full instructions posted here
I followed a combination of these instructions and these (in the source)
The main differences are that I had to do the "pure python" install of mercurial otherwise it would complain about missing dlls, and I found it was important to use the "python installers" for pywin and isapi-wsgi. (maybe this is obvious to experienced python developers, but I'm a python newbie so it was news to me)
Hope this helps somebody and I'm not just making stuff up (I might be, like i said, python newbie)
The hg red book contains some much better general instructions than I've seen in other places. They are not IIS specific, but they are quite good:
http://hgbook.red-bean.com/read/collaborating-with-other-people.html#sec:collab:cgi
I was running into a "...can not load module..." type error and after some reading, the key for me was to ignore the Library.zip file in the Mercurial folder, and instead use the one from C:\Program Files (x86)\TortoiseHg folder.
That tip I found as #6 in this guide:
http://www.endswithsaurus.com/2010/05/setting-up-and-configuring-mercurial-in.html
Hope this helps someone...
I know this is an old question, but I really struggled getting Hg installed on Server 2019 and IIS 10.
Here is what I did to get it working:
Install Python 2.7 which in my case was python-2.7.18.amd64.msi. I will assume it's installed in C:\Python27. Make sure python is added to your path and that pip is installed.
Install Mercurial as a module using pip at the command line:
pip install mercurial
Under Default Web Site add a new application called hg and point it to the directory you want to use to use.
Configure Python as CGI handler in IIS 10.0 for this new website (or the entire web server if you wish). You can do this manually or create/add the follwing to your web.config file:
<system.webServer>
<handlers accessPolicy="Read, Script">
<add name="Python 2.7" path="*.cgi" verb="*" modules="CgiModule" scriptProcessor="C:\Python27\python.exe -u "%s"" resourceType="File" />
</handlers>
</system.webServer>
In the 'hg' application folder create a hgweb.cgi that looks similar to the following:
#!/usr/bin/env python3
#
# An example hgweb CGI script, edit as necessary
# See also https://mercurial-scm.org/wiki/PublishingRepositories
# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "hgweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
# import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()
from mercurial import demandimport
demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)
In the 'hg' application folder create the hgweb.config file and point it at your repos like the following:
[collections]
C:\Web\www\hg\repos\ = C:\Web\www\hg\repos\
Navigate to http://localhost/hg/hgweb.cgi and enjoy!
You can try HgLab. This isn't exactly hgwebdir; rather it is a purely managed Mercurial implementation with push and pull server and repository browser.

Resources