diff -Nru mktorrent-1.0/debian/changelog mktorrent-1.1/debian/changelog --- mktorrent-1.0/debian/changelog 2018-02-05 16:51:07.000000000 +0000 +++ mktorrent-1.1/debian/changelog 2018-08-22 12:06:55.000000000 +0000 @@ -1,8 +1,23 @@ -mktorrent (1.0-4build1) bionic; urgency=high +mktorrent (1.1-1) unstable; urgency=medium - * No change rebuild against openssl1.1. + * New upstream version. + Closes: #852159, closes: #699485, closes: #765935. + * Set myself (Paride Legovini) as maintainer (Closes: #903256) + * Improved description (Closes: #699488). Thanks: Ivan Shmakov. + * Bump Standards-Version to 4.2.0. Changes: + - Priority: extra replaced by Priority: optional + * d/copyright converted to the DEP5 machine-readable format + * Bump compat level to 11 (no changes needed) + * Hardened build (hardening=+all) + * Mark package as Multi-Arch: foreign + * The sf.net project is gone, mktorrent is now hosted on GitHub. + - d/control: use the GitHub project page as Homepage + - d/watch: retrieve the upstream versions from GitHub (mode=git) + * d/control: added the Vcs- fields, packaging hosted on salsa + * Add d/gbp.conf (DEP14) + * gbp.conf: pristine-tar{,-commit} = True - -- Dimitri John Ledkov Mon, 05 Feb 2018 16:51:07 +0000 + -- Paride Legovini Wed, 22 Aug 2018 12:06:55 +0000 mktorrent (1.0-4) unstable; urgency=low @@ -29,4 +44,3 @@ * Initial release (Closes: #542839). -- Nico Golde Tue, 25 Aug 2009 22:43:14 +0200 - diff -Nru mktorrent-1.0/debian/compat mktorrent-1.1/debian/compat --- mktorrent-1.0/debian/compat 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/compat 2018-08-22 12:06:55.000000000 +0000 @@ -1 +1 @@ -7 +11 diff -Nru mktorrent-1.0/debian/control mktorrent-1.1/debian/control --- mktorrent-1.0/debian/control 2018-02-05 16:51:07.000000000 +0000 +++ mktorrent-1.1/debian/control 2018-08-22 12:06:55.000000000 +0000 @@ -1,22 +1,28 @@ Source: mktorrent Section: net -Priority: extra -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Nico Golde -Build-Depends: debhelper (>= 7.0.8), libssl-dev -Standards-Version: 3.9.3 -Homepage: http://mktorrent.sourceforge.net/ +Priority: optional +Maintainer: Paride Legovini +Build-Depends: debhelper (>= 11~), libssl-dev +Standards-Version: 4.2.0 +Homepage: https://github.com/Rudde/mktorrent +Vcs-Git: https://salsa.debian.org/debian/mktorrent.git +Vcs-Browser: https://salsa.debian.org/debian/mktorrent Package: mktorrent Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: foreign Description: simple command line utility to create BitTorrent metainfo files mktorrent is a text-based utility to create BitTorrent metainfo files - used by trackers and torrent clients. It can create metainfo files for single - files or complete directories in a fast way. + used by trackers and torrent clients. It can create metainfo files for + single files or complete directories in a fast way. . - It also supports: - - multiple trackers - - embedding custom comments into torrent files - - disallowing DHT and Peer Exchange - - multi-threaded hashing + It supports: + - multiple trackers, + - embedding custom comments into torrent files, + - multi-threaded hashing. + . + It also supports setting the "private" flag, which advises the BitTorrent + agents to refrain from using alternative peer discovery mechanisms, + such as Distributed Hash Table (DHT), Local Peer Discovery (LPD), + or Peer Exchange. diff -Nru mktorrent-1.0/debian/copyright mktorrent-1.1/debian/copyright --- mktorrent-1.0/debian/copyright 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/copyright 2018-08-22 12:06:55.000000000 +0000 @@ -1,37 +1,61 @@ -This package was debianized by Nico Golde on -Tue, 25 Aug 2009 22:43:14 +0200. - -It was downloaded from http://mktorrent.sourceforge.net/ - -Upstream Author: - Emil Renner Berthing +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: mktorrent +Upstream-Contact: Kai Nilsen +Source: https://github.com/Rudde/mktorrent +Comment: + Emil Renner Berthing, the upstream author, transferred the maintainership of + mktorrent to Kai Nilsen (Rudde) on May 26, 2016. See upstream commit 887351f: + https://github.com/Rudde/mktorrent/commit/887351ffda449e4dee2f. +Files: * Copyright: + 2009-2017, Emil Renner Berthing +License: GPL-2+ with OpenSSL exception - Copyright (C) 2007-2009 Emil Renner Berthing - -License: - - This package 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. - - This package 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. - - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1301, USA. - - In addition: - Permission is granted to link the code in this release with the - OpenSSL project's 'OpenSSL' library and to distribute the linked - executables. Works derived from mktorrent may, at their authors' - discretion, keep or delete this exception. - -The Debian packaging is Copyright (C) 2009, Nico Golde -and is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. +Files: debian/* +Copyright: + 2009-2018, Nico Golde + 2018, Paride Legovini +License: GPL-2+ + +License: GPL-2+ with OpenSSL exception + This package 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. + . + This package 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. + . + You should have received a copy of the GNU General Public License along + with this package; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + . + In addition: + Permission is granted to link the code in this release with the + OpenSSL project's 'OpenSSL' library and to distribute the linked + executables. Works derived from mktorrent may, at their authors' + discretion, keep or delete this exception. + . + On Debian systems, the full text of the GNU General Public License + version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. + +License: GPL-2+ + 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. + . + 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. + . + You should have received a copy of the GNU General Public License along + with this package; if not, write to the Free Software Foundation, Inc., + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + . + On Debian systems, the full text of the GNU General Public License + version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. diff -Nru mktorrent-1.0/debian/dirs mktorrent-1.1/debian/dirs --- mktorrent-1.0/debian/dirs 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/dirs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/bin diff -Nru mktorrent-1.0/debian/docs mktorrent-1.1/debian/docs --- mktorrent-1.0/debian/docs 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -README diff -Nru mktorrent-1.0/debian/gbp.conf mktorrent-1.1/debian/gbp.conf --- mktorrent-1.0/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ mktorrent-1.1/debian/gbp.conf 2018-08-22 12:06:55.000000000 +0000 @@ -0,0 +1,6 @@ +[DEFAULT] +debian-branch = debian/sid +upstream-branch = +upstream-tag = v%(version)s +pristine-tar = True +pristine-tar-commit = True diff -Nru mktorrent-1.0/debian/mktorrent.1 mktorrent-1.1/debian/mktorrent.1 --- mktorrent-1.0/debian/mktorrent.1 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/mktorrent.1 2018-08-22 12:06:55.000000000 +0000 @@ -48,14 +48,14 @@ \fB\-w\fR [,]* .IP add web seed URLs, additional \fB\-w\fR add more URLs -.SH "COPYRIGH" +.SH "COPYRIGHT" .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. .SH "AUTHORS" -Emil Renner Berthing +Emil Renner Berthing .PP This manpage was written for the Debian GNU/Linux distribution by Nico Golde .SH "BUGS" diff -Nru mktorrent-1.0/debian/README.Debian mktorrent-1.1/debian/README.Debian --- mktorrent-1.0/debian/README.Debian 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/README.Debian 2018-08-22 12:06:55.000000000 +0000 @@ -1,6 +1,7 @@ mktorrent for Debian -------------------- -No explicit support for multibyte characters or UTF-8. Reads and writes file names and comments exactly as reported by the OS. +No explicit support for multibyte characters or UTF-8. Reads and writes +file names and comments exactly as reported by the OS. -- Nico Golde Tue, 25 Aug 2009 22:43:14 +0200 diff -Nru mktorrent-1.0/debian/rules mktorrent-1.1/debian/rules --- mktorrent-1.0/debian/rules 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/rules 2018-08-22 12:06:55.000000000 +0000 @@ -1,4 +1,19 @@ #!/usr/bin/make -f +# https://wiki.debian.org/HardeningWalkthrough +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# Build and installation options +export USE_PTHREADS = 1 +export PREFIX = /usr +export USE_OPENSSL = 1 +export USE_LARGE_FILES = 1 +export USE_LONG_OPTIONS = 1 + %: - DESTDIR=$(CURDIR)/debian/mktorrent PREFIX=/usr USE_PTHREADS=1 USE_OPENSSL=1 USE_LARGE_FILES=1 USE_LONG_OPTIONS=1 dh $@ + dh $@ + +override_dh_auto_build: + # The Makefile supports CFLAGS, but not CPPFLAGS, let's append them. + # https://wiki.debian.org/HardeningWalkthrough#Handwritten_Makefiles + CFLAGS="$$CFLAGS $$CPPFLAGS" dh_auto_build diff -Nru mktorrent-1.0/debian/watch mktorrent-1.1/debian/watch --- mktorrent-1.0/debian/watch 2012-06-17 12:15:09.000000000 +0000 +++ mktorrent-1.1/debian/watch 2018-08-22 12:06:55.000000000 +0000 @@ -1,2 +1,2 @@ -version=3 -http://sf.net/mktorrent/mktorrent-(.+)\.tar\.gz debian uupdate +version=4 +opts="mode=git" https://github.com/Rudde/mktorrent.git refs/tags/v([\d\.]+) diff -Nru mktorrent-1.0/.gitignore mktorrent-1.1/.gitignore --- mktorrent-1.0/.gitignore 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/.gitignore 2017-01-11 21:13:16.000000000 +0000 @@ -6,3 +6,4 @@ *~ mktorrent prefix +*.torrent diff -Nru mktorrent-1.0/hash.c mktorrent-1.1/hash.c --- mktorrent-1.0/hash.c 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/hash.c 2017-01-11 21:13:16.000000000 +0000 @@ -41,6 +41,12 @@ #define O_BINARY 0 #endif +#if defined _LARGEFILE_SOURCE && defined O_LARGEFILE +#define OPENFLAGS (O_RDONLY | O_BINARY | O_LARGEFILE) +#else +#define OPENFLAGS (O_RDONLY | O_BINARY) +#endif + /* * go through the files in file_list, split their contents into pieces * of size piece_length and create the hash string, which is the @@ -82,11 +88,7 @@ for (f = m->file_list; f; f = f->next) { /* open the current file for reading */ -#if defined _LARGEFILE_SOURCE && defined O_LARGEFILE - if ((fd = open(f->path, O_RDONLY | O_BINARY | O_LARGEFILE)) == -1) { -#else - if ((fd = open(f->path, O_RDONLY | O_BINARY)) == -1) { -#endif + if ((fd = open(f->path, OPENFLAGS)) == -1) { fprintf(stderr, "Error opening '%s' for reading: %s\n", f->path, strerror(errno)); exit(EXIT_FAILURE); diff -Nru mktorrent-1.0/hash_pthreads.c mktorrent-1.1/hash_pthreads.c --- mktorrent-1.0/hash_pthreads.c 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/hash_pthreads.c 2017-01-11 21:13:16.000000000 +0000 @@ -46,6 +46,12 @@ #define O_BINARY 0 #endif +#if defined _LARGEFILE_SOURCE && defined O_LARGEFILE +#define OPENFLAGS (O_RDONLY | O_BINARY | O_LARGEFILE) +#else +#define OPENFLAGS (O_RDONLY | O_BINARY) +#endif + struct piece_s; typedef struct piece_s piece_t; struct piece_s { @@ -204,14 +210,13 @@ static void read_files(metafile_t *m, queue_t *q, unsigned char *pos) { - int fd; /* file descriptor */ - flist_t *f; /* pointer to a place in the file - list */ - ssize_t r = 0; /* number of bytes read from - file(s) into the read buffer */ + int fd; /* file descriptor */ + flist_t *f; /* pointer to a place in the file list */ + ssize_t r = 0; /* number of bytes read from file(s) + into the read buffer */ #ifndef NO_HASH_CHECK - off_t counter = 0; /* number of bytes hashed - should match size when done */ + off_t counter = 0; /* number of bytes hashed + should match size when done */ #endif piece_t *p = get_free(q, m->piece_length); @@ -219,11 +224,7 @@ for (f = m->file_list; f; f = f->next) { /* open the current file for reading */ -#if defined _LARGEFILE_SOURCE && defined O_LARGEFILE - if ((fd = open(f->path, O_RDONLY | O_BINARY | O_LARGEFILE)) == -1) { -#else - if ((fd = open(f->path, O_RDONLY | O_BINARY)) == -1) { -#endif + if ((fd = open(f->path, OPENFLAGS)) == -1) { fprintf(stderr, "Error opening '%s' for reading: %s\n", f->path, strerror(errno)); exit(EXIT_FAILURE); @@ -301,8 +302,10 @@ workers = malloc(m->threads * sizeof(pthread_t)); hash_string = malloc(m->pieces * SHA_DIGEST_LENGTH); - if (workers == NULL || hash_string == NULL) - return NULL; + if (workers == NULL || hash_string == NULL) { + fprintf(stderr, "Out of memory.\n"); + exit(EXIT_FAILURE); + } q.pieces = m->pieces; q.buffers_max = 3*m->threads; diff -Nru mktorrent-1.0/init.c mktorrent-1.1/init.c --- mktorrent-1.0/init.c 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/init.c 2017-01-11 21:13:16.000000000 +0000 @@ -23,7 +23,7 @@ #include /* strerror() */ #include /* printf() etc. */ #include /* the stat structure */ -#include /* getopt(), getcwd() */ +#include /* getopt(), getcwd(), sysconf() */ #include /* strcmp(), strlen(), strncpy() */ #ifdef USE_LONG_OPTIONS #include /* getopt_long() */ @@ -289,9 +289,10 @@ "-o, --output= : set the path and filename of the created file\n" " default is .torrent\n" "-p, --private : set the private flag\n" + "-s, --source= : add source string embedded in infohash\n" #ifdef USE_PTHREADS "-t, --threads= : use threads for calculating hashes\n" - " default is 2\n" + " default is the number of CPU cores\n" #endif "-v, --verbose : be verbose\n" "-w, --web-seed=[,]* : add web seed URLs\n" @@ -310,16 +311,17 @@ "-o : set the path and filename of the created file\n" " default is .torrent\n" "-p : set the private flag\n" + "-s : add source string embedded in infohash\n" #ifdef USE_PTHREADS "-t : use threads for calculating hashes\n" - " default is 2\n" + " default is the number of CPU cores\n" #endif "-v : be verbose\n" "-w [,]* : add web seed URLs\n" " additional -w adds more URLs\n" #endif "\nPlease send bug reports, patches, feature requests, praise and\n" - "general gossip about the program to: esmil@users.sourceforge.net\n"); + "general gossip about the program to: mktorrent@rudde.org\n"); } /* @@ -368,8 +370,15 @@ printf(" Torrent name: %s\n" " Metafile: %s\n" " Piece length: %u\n" +#ifdef USE_PTHREADS + " Threads: %u\n" +#endif " Be verbose: yes\n", - m->torrent_name, m->metainfo_file_path, m->piece_length); + m->torrent_name, m->metainfo_file_path, m->piece_length +#ifdef USE_PTHREADS + ,m->threads +#endif + ); printf(" Write date: "); if (m->no_creation_date) @@ -379,6 +388,10 @@ print_web_seed_list(m->web_seed_list); + /* Print source string only if set */ + if (m->source) + printf("\n Source: %s\n\n", m->source); + printf(" Comment: "); if (m->comment == NULL) printf("none\n\n"); @@ -407,6 +420,7 @@ {"name", 1, NULL, 'n'}, {"output", 1, NULL, 'o'}, {"private", 0, NULL, 'p'}, + {"source", 1, NULL, 's'}, #ifdef USE_PTHREADS {"threads", 1, NULL, 't'}, #endif @@ -418,9 +432,9 @@ /* now parse the command line options given */ #ifdef USE_PTHREADS -#define OPT_STRING "a:c:dhl:n:o:pt:vw:" +#define OPT_STRING "a:c:dhl:n:o:ps:t:vw:" #else -#define OPT_STRING "a:c:dhl:n:o:pvw:" +#define OPT_STRING "a:c:dhl:n:o:ps:vw:" #endif #ifdef USE_LONG_OPTIONS while ((c = getopt_long(argc, argv, OPT_STRING, @@ -467,6 +481,9 @@ case 'p': m->private = 1; break; + case 's': + m->source = optarg; + break; #ifdef USE_PTHREADS case 't': m->threads = atoi(optarg); @@ -503,14 +520,8 @@ } m->piece_length = 1 << m->piece_length; - /* user must specify at least one announce URL as it wouldn't make - * any sense to have a default for this */ - if (m->announce_list == NULL) { - fprintf(stderr, "Must specify an announce URL. " - "Use -h for help.\n"); - exit(EXIT_FAILURE); - } - announce_last->next = NULL; + if (announce_last != NULL) + announce_last->next = NULL; /* ..and a file or directory from which to create the torrent */ if (optind >= argc) { @@ -521,10 +532,18 @@ #ifdef USE_PTHREADS /* check the number of threads */ - if (m->threads < 1 || m->threads > 20) { - fprintf(stderr, "The number of threads must be a number" - "between 1 and 20\n"); - exit(EXIT_FAILURE); + if (m->threads) { + if (m->threads > 20) { + fprintf(stderr, "The number of threads is limited to " + "at most 20\n"); + exit(EXIT_FAILURE); + } + } else { +#ifdef _SC_NPROCESSORS_ONLN + m->threads = sysconf(_SC_NPROCESSORS_ONLN); + if (m->threads == -1) +#endif + m->threads = 2; /* some sane default */ } #endif diff -Nru mktorrent-1.0/main.c mktorrent-1.1/main.c --- mktorrent-1.0/main.c 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/main.c 2017-01-11 21:13:16.000000000 +0000 @@ -27,7 +27,7 @@ #ifdef ALLINONE #include -#include /* access(), read(), close(), getcwd() */ +#include /* access(), read(), close(), getcwd(), sysconf() */ #ifdef USE_LONG_OPTIONS #include /* getopt_long() */ #endif @@ -39,7 +39,6 @@ #include #endif #ifdef USE_PTHREADS -#include /* alloca() */ #include /* pthread functions and data structures */ #endif @@ -145,9 +144,10 @@ 0, /* target_is_directory */ 0, /* no_creation_date */ 0, /* private */ + NULL, /* source string */ 0, /* verbose */ #ifdef USE_PTHREADS - 2, /* threads */ + 0, /* threads, initialised by init() */ #endif /* information calculated by read_dir() */ diff -Nru mktorrent-1.0/Makefile mktorrent-1.1/Makefile --- mktorrent-1.0/Makefile 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/Makefile 2017-01-11 21:13:16.000000000 +0000 @@ -63,7 +63,7 @@ #-------------Nothing interesting below this line----------------------------- program = mktorrent -version = 1.0 +version = 1.1 HEADERS = mktorrent.h SRCS = ftw.c init.c sha1.c hash.c output.c main.c diff -Nru mktorrent-1.0/mktorrent.h mktorrent-1.1/mktorrent.h --- mktorrent-1.0/mktorrent.h 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/mktorrent.h 2017-01-11 21:13:16.000000000 +0000 @@ -45,6 +45,7 @@ int target_is_directory; /* target is a directory */ int no_creation_date; /* don't write the creation date */ int private; /* set the private flag */ + char *source; /* set source for private trackers */ int verbose; /* be verbose */ #ifdef USE_PTHREADS unsigned int threads; /* number of threads used for hashing */ diff -Nru mktorrent-1.0/output.c mktorrent-1.1/output.c --- mktorrent-1.0/output.c 2009-08-25 18:53:22.000000000 +0000 +++ mktorrent-1.1/output.c 2017-01-11 21:13:16.000000000 +0000 @@ -119,15 +119,20 @@ printf("Writing metainfo file... "); fflush(stdout); - /* every metainfo file is one big dictonary - and the first entry is the announce URL */ - fprintf(f, "d8:announce%lu:%s", - (unsigned long)strlen(m->announce_list->l->s), - m->announce_list->l->s); - /* write the announce-list entry if we have - more than one announce URL */ - if (m->announce_list->next || m->announce_list->l->next) - write_announce_list(f, m->announce_list); + /* every metainfo file is one big dictonary */ + fprintf(f, "d"); + + if (m->announce_list != NULL) { + /* write the announce URL */ + fprintf(f, "8:announce%lu:%s", + (unsigned long)strlen(m->announce_list->l->s), + m->announce_list->l->s); + /* write the announce-list entry if we have + more than one announce URL */ + if (m->announce_list->next || m->announce_list->l->next) + write_announce_list(f, m->announce_list); + } + /* add the comment if one is specified */ if (m->comment != NULL) fprintf(f, "7:comment%lu:%s", @@ -161,6 +166,9 @@ if (m->private) fprintf(f, "7:privatei1e"); + if (m->source) + fprintf(f, "6:source%lu:%s", (unsigned long)strlen(m->source), m->source); + /* end the info section */ fprintf(f, "e");